aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/cpu-hotplug.txt27
-rw-r--r--Documentation/feature-removal-schedule.txt9
-rw-r--r--Documentation/filesystems/tmpfs.txt21
-rw-r--r--Documentation/filesystems/v9fs.txt16
-rw-r--r--Documentation/fujitsu/frv/kernel-ABI.txt234
-rw-r--r--Documentation/hwmon/w83627hf4
-rw-r--r--Documentation/kernel-parameters.txt5
-rw-r--r--Documentation/kprobes.txt81
-rw-r--r--Documentation/mips/AU1xxx_IDE.README6
-rw-r--r--Documentation/scsi/ChangeLog.megaraid_sas23
-rw-r--r--Documentation/sysctl/kernel.txt10
-rw-r--r--MAINTAINERS18
-rw-r--r--Makefile9
-rw-r--r--arch/arm/common/rtctime.c16
-rw-r--r--arch/arm/kernel/calls.S2
-rw-r--r--arch/arm/kernel/entry-armv.S2
-rw-r--r--arch/arm/kernel/setup.c5
-rw-r--r--arch/arm/kernel/smp.c1
-rw-r--r--arch/arm/kernel/sys_oabi-compat.c30
-rw-r--r--arch/arm/kernel/traps.c8
-rw-r--r--arch/arm/mach-at91rm9200/devices.c4
-rw-r--r--arch/arm/mach-at91rm9200/gpio.c17
-rw-r--r--arch/arm/mach-integrator/platsmp.c21
-rw-r--r--arch/arm/mach-iop3xx/iop321-setup.c1
-rw-r--r--arch/arm/mach-iop3xx/iop331-setup.c1
-rw-r--r--arch/arm/mach-ixp4xx/common.c20
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-power.c3
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c13
-rw-r--r--arch/arm/mach-realview/platsmp.c21
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c29
-rw-r--r--arch/arm/mach-s3c2410/s3c2400.h31
-rw-r--r--arch/arm/mach-versatile/pci.c93
-rw-r--r--arch/arm/mm/abort-ev6.S2
-rw-r--r--arch/arm/plat-omap/pm.c1
-rw-r--r--arch/arm/tools/mach-types35
-rw-r--r--arch/frv/Kconfig4
-rw-r--r--arch/frv/Makefile2
-rw-r--r--arch/frv/kernel/break.S77
-rw-r--r--arch/frv/kernel/entry-table.S39
-rw-r--r--arch/frv/kernel/entry.S91
-rw-r--r--arch/frv/kernel/head.S3
-rw-r--r--arch/frv/kernel/irq.c41
-rw-r--r--arch/frv/mm/kmap.c9
-rw-r--r--arch/h8300/Kconfig4
-rw-r--r--arch/h8300/Kconfig.cpu2
-rw-r--r--arch/h8300/Kconfig.debug2
-rw-r--r--arch/h8300/defconfig2
-rw-r--r--arch/i386/boot/.gitignore3
-rw-r--r--arch/i386/boot/tools/.gitignore1
-rw-r--r--arch/i386/kernel/.gitignore1
-rw-r--r--arch/i386/kernel/cpu/transmeta.c1
-rw-r--r--arch/i386/kernel/head.S4
-rw-r--r--arch/i386/kernel/mpparse.c2
-rw-r--r--arch/i386/kernel/smpboot.c4
-rw-r--r--arch/i386/kernel/syscall_table.S2
-rw-r--r--arch/i386/kernel/timers/timer_tsc.c5
-rw-r--r--arch/i386/kernel/vsyscall-sysenter.S15
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c2
-rw-r--r--arch/i386/oprofile/backtrace.c19
-rw-r--r--arch/ia64/kernel/acpi.c53
-rw-r--r--arch/ia64/kernel/entry.S4
-rw-r--r--arch/ia64/kernel/ia64_ksyms.c15
-rw-r--r--arch/ia64/kernel/setup.c4
-rw-r--r--arch/ia64/kernel/smpboot.c5
-rw-r--r--arch/ia64/kernel/time.c39
-rw-r--r--arch/ia64/kernel/traps.c8
-rw-r--r--arch/ia64/sn/kernel/io_init.c97
-rw-r--r--arch/ia64/sn/kernel/setup.c4
-rw-r--r--arch/ia64/sn/kernel/sn2/prominfo_proc.c25
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c35
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_proc_fs.c22
-rw-r--r--arch/ia64/sn/kernel/sn2/timer.c19
-rw-r--r--arch/ia64/sn/kernel/sn2/timer_interrupt.c7
-rw-r--r--arch/ia64/sn/kernel/tiocx.c4
-rw-r--r--arch/ia64/sn/kernel/xpc_channel.c8
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c20
-rw-r--r--arch/ia64/sn/pci/pci_dma.c16
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_ate.c29
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_dma.c14
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_provider.c9
-rw-r--r--arch/m32r/kernel/sys_m32r.c61
-rw-r--r--arch/m68k/Kconfig4
-rw-r--r--arch/m68k/fpsp040/bindec.S5
-rw-r--r--arch/m68k/fpsp040/binstr.S5
-rw-r--r--arch/m68k/fpsp040/bugfix.S5
-rw-r--r--arch/m68k/fpsp040/decbin.S5
-rw-r--r--arch/m68k/fpsp040/do_func.S5
-rw-r--r--arch/m68k/fpsp040/fpsp.h5
-rw-r--r--arch/m68k/fpsp040/gen_except.S5
-rw-r--r--arch/m68k/fpsp040/get_op.S5
-rw-r--r--arch/m68k/fpsp040/kernel_ex.S5
-rw-r--r--arch/m68k/fpsp040/res_func.S5
-rw-r--r--arch/m68k/fpsp040/round.S5
-rw-r--r--arch/m68k/fpsp040/sacos.S5
-rw-r--r--arch/m68k/fpsp040/sasin.S5
-rw-r--r--arch/m68k/fpsp040/satan.S5
-rw-r--r--arch/m68k/fpsp040/satanh.S5
-rw-r--r--arch/m68k/fpsp040/scale.S5
-rw-r--r--arch/m68k/fpsp040/scosh.S5
-rw-r--r--arch/m68k/fpsp040/setox.S5
-rw-r--r--arch/m68k/fpsp040/sgetem.S5
-rw-r--r--arch/m68k/fpsp040/sint.S5
-rw-r--r--arch/m68k/fpsp040/skeleton.S5
-rw-r--r--arch/m68k/fpsp040/slog2.S5
-rw-r--r--arch/m68k/fpsp040/slogn.S5
-rw-r--r--arch/m68k/fpsp040/smovecr.S5
-rw-r--r--arch/m68k/fpsp040/srem_mod.S5
-rw-r--r--arch/m68k/fpsp040/ssin.S5
-rw-r--r--arch/m68k/fpsp040/ssinh.S5
-rw-r--r--arch/m68k/fpsp040/stan.S5
-rw-r--r--arch/m68k/fpsp040/stanh.S5
-rw-r--r--arch/m68k/fpsp040/sto_res.S5
-rw-r--r--arch/m68k/fpsp040/stwotox.S5
-rw-r--r--arch/m68k/fpsp040/tbldo.S5
-rw-r--r--arch/m68k/fpsp040/util.S5
-rw-r--r--arch/m68k/fpsp040/x_bsun.S5
-rw-r--r--arch/m68k/fpsp040/x_fline.S5
-rw-r--r--arch/m68k/fpsp040/x_operr.S5
-rw-r--r--arch/m68k/fpsp040/x_ovfl.S5
-rw-r--r--arch/m68k/fpsp040/x_snan.S5
-rw-r--r--arch/m68k/fpsp040/x_store.S5
-rw-r--r--arch/m68k/fpsp040/x_unfl.S5
-rw-r--r--arch/m68k/fpsp040/x_unimp.S5
-rw-r--r--arch/m68k/fpsp040/x_unsupp.S5
-rw-r--r--arch/m68k/kernel/process.c3
-rw-r--r--arch/m68knommu/Kconfig4
-rw-r--r--arch/mips/Makefile1
-rw-r--r--arch/mips/configs/ip27_defconfig13
-rw-r--r--arch/mips/kernel/binfmt_elfn32.c5
-rw-r--r--arch/mips/kernel/binfmt_elfo32.c5
-rw-r--r--arch/mips/kernel/linux32.c22
-rw-r--r--arch/mips/kernel/process.c158
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S4
-rw-r--r--arch/mips/kernel/signal-common.h2
-rw-r--r--arch/mips/kernel/signal32.c76
-rw-r--r--arch/mips/kernel/signal_n32.c35
-rw-r--r--arch/mips/kernel/smp.c20
-rw-r--r--arch/mips/kernel/smp_mt.c34
-rw-r--r--arch/mips/kernel/traps.c4
-rw-r--r--arch/mips/mm/c-r4k.c104
-rw-r--r--arch/mips/mm/c-tx39.c70
-rw-r--r--arch/mips/mm/cex-sb1.S2
-rw-r--r--arch/mips/pmc-sierra/yosemite/smp.c2
-rw-r--r--arch/mips/sibyte/Kconfig4
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c5
-rw-r--r--arch/parisc/Kconfig5
-rw-r--r--arch/parisc/kernel/syscall_table.S6
-rw-r--r--arch/powerpc/Makefile2
-rw-r--r--arch/powerpc/configs/g5_defconfig174
-rw-r--r--arch/powerpc/configs/ppc64_defconfig173
-rw-r--r--arch/powerpc/configs/pseries_defconfig127
-rw-r--r--arch/powerpc/kernel/crash.c4
-rw-r--r--arch/powerpc/kernel/head_32.S1
-rw-r--r--arch/powerpc/kernel/head_64.S111
-rw-r--r--arch/powerpc/kernel/lparcfg.c6
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c10
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c16
-rw-r--r--arch/powerpc/kernel/process.c32
-rw-r--r--arch/powerpc/kernel/prom_init.c38
-rw-r--r--arch/powerpc/kernel/setup_64.c4
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c4
-rw-r--r--arch/powerpc/kernel/time.c282
-rw-r--r--arch/powerpc/mm/hash_native_64.c7
-rw-r--r--arch/powerpc/mm/hash_utils_64.c3
-rw-r--r--arch/powerpc/oprofile/Kconfig1
-rw-r--r--arch/powerpc/platforms/iseries/lpevents.c2
-rw-r--r--arch/powerpc/platforms/iseries/setup.c1
-rw-r--r--arch/powerpc/platforms/maple/pci.c4
-rw-r--r--arch/powerpc/platforms/powermac/feature.c10
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig7
-rw-r--r--arch/powerpc/platforms/pseries/smp.c2
-rw-r--r--arch/powerpc/sysdev/mpic.c9
-rw-r--r--arch/ppc/kernel/head.S1
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c8
-rw-r--r--arch/ppc/xmon/adb.c212
-rw-r--r--arch/ppc/xmon/start.c184
-rw-r--r--arch/ppc/xmon/xmon.c108
-rw-r--r--arch/s390/Kconfig4
-rw-r--r--arch/s390/defconfig9
-rw-r--r--arch/s390/kernel/compat_linux.c20
-rw-r--r--arch/s390/kernel/compat_signal.c3
-rw-r--r--arch/s390/kernel/compat_wrapper.S13
-rw-r--r--arch/s390/kernel/machine_kexec.c5
-rw-r--r--arch/s390/kernel/process.c4
-rw-r--r--arch/s390/kernel/setup.c2
-rw-r--r--arch/s390/kernel/smp.c73
-rw-r--r--arch/s390/kernel/syscalls.S3
-rw-r--r--arch/s390/lib/delay.c2
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sparc/kernel/systbls.S2
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c21
-rw-r--r--arch/sparc64/kernel/systbls.S4
-rw-r--r--arch/v850/Kconfig4
-rw-r--r--arch/x86_64/defconfig40
-rw-r--r--arch/x86_64/ia32/ia32entry.S2
-rw-r--r--arch/x86_64/ia32/sys_ia32.c22
-rw-r--r--arch/x86_64/kernel/apic.c3
-rw-r--r--arch/x86_64/kernel/entry.S1
-rw-r--r--arch/x86_64/kernel/head.S7
-rw-r--r--arch/x86_64/kernel/io_apic.c16
-rw-r--r--arch/x86_64/kernel/mpparse.c4
-rw-r--r--arch/x86_64/kernel/nmi.c19
-rw-r--r--arch/x86_64/kernel/pci-gart.c6
-rw-r--r--arch/x86_64/kernel/time.c15
-rw-r--r--arch/x86_64/kernel/traps.c18
-rw-r--r--arch/x86_64/mm/k8topology.c2
-rw-r--r--arch/x86_64/mm/numa.c2
-rw-r--r--arch/x86_64/mm/srat.c5
-rw-r--r--drivers/acpi/resources/rscalc.c6
-rw-r--r--drivers/block/pktcdvd.c139
-rw-r--r--drivers/bluetooth/bt3c_cs.c17
-rw-r--r--drivers/char/agp/Kconfig55
-rw-r--r--drivers/char/agp/amd64-agp.c6
-rw-r--r--drivers/char/agp/sworks-agp.c4
-rw-r--r--drivers/char/drm/drm_pciids.h1
-rw-r--r--drivers/char/drm/i915_irq.c5
-rw-r--r--drivers/char/drm/r300_cmdbuf.c48
-rw-r--r--drivers/char/drm/r300_reg.h3
-rw-r--r--drivers/char/drm/radeon_drv.h3
-rw-r--r--drivers/char/esp.c22
-rw-r--r--drivers/char/hpet.c22
-rw-r--r--drivers/char/hvc_console.c8
-rw-r--r--drivers/char/sysrq.c2
-rw-r--r--drivers/char/tipar.c15
-rw-r--r--drivers/char/tpm/tpm_infineon.c48
-rw-r--r--drivers/char/tty_io.c37
-rw-r--r--drivers/char/watchdog/pcwd.c450
-rw-r--r--drivers/char/watchdog/sa1100_wdt.c12
-rw-r--r--drivers/cpufreq/cpufreq.c110
-rw-r--r--drivers/crypto/padlock-aes.c8
-rw-r--r--drivers/fc4/fc.c2
-rw-r--r--drivers/hwmon/it87.c3
-rw-r--r--drivers/hwmon/vt8231.c8
-rw-r--r--drivers/hwmon/w83781d.c43
-rw-r--r--drivers/i2c/busses/i2c-isa.c12
-rw-r--r--drivers/ide/ide-taskfile.c3
-rw-r--r--drivers/ide/pci/sgiioc4.c5
-rw-r--r--drivers/ieee1394/sbp2.c10
-rw-r--r--drivers/infiniband/core/mad.c10
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cmd.c38
-rw-r--r--drivers/infiniband/hw/mthca/mthca_dev.h4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c28
-rw-r--r--drivers/input/keyboard/Makefile1
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/ixp4xx-beeper.c1
-rw-r--r--drivers/input/mouse/logips2pp.c1
-rw-r--r--drivers/input/mouse/trackpoint.c20
-rw-r--r--drivers/input/mouse/trackpoint.h4
-rw-r--r--drivers/input/serio/Makefile1
-rw-r--r--drivers/input/touchscreen/ads7846.c147
-rw-r--r--drivers/isdn/i4l/isdn_tty.c4
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c1
-rw-r--r--drivers/message/fusion/mptbase.c115
-rw-r--r--drivers/message/fusion/mptbase.h2
-rw-r--r--drivers/message/fusion/mptctl.c241
-rw-r--r--drivers/message/fusion/mptctl.h4
-rw-r--r--drivers/message/fusion/mptscsih.c2
-rw-r--r--drivers/mmc/mmci.c7
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c14
-rw-r--r--drivers/net/Kconfig5
-rw-r--r--drivers/net/appletalk/cops.h2
-rw-r--r--drivers/net/bonding/bond_main.c1
-rw-r--r--drivers/net/irda/irda-usb.c90
-rw-r--r--drivers/net/irda/irda-usb.h7
-rw-r--r--drivers/net/sis190.c4
-rw-r--r--drivers/net/skge.c10
-rw-r--r--drivers/net/sky2.c31
-rw-r--r--drivers/net/tokenring/smctr.h2
-rw-r--r--drivers/net/wireless/Kconfig2
-rw-r--r--drivers/net/wireless/atmel.c98
-rw-r--r--drivers/net/wireless/ipw2200.c6
-rw-r--r--drivers/net/wireless/orinoco_cs.c1
-rw-r--r--drivers/net/wireless/wavelan_cs.c16
-rw-r--r--drivers/parisc/ccio-dma.c160
-rw-r--r--drivers/parisc/sba_iommu.c125
-rw-r--r--drivers/s390/block/Kconfig14
-rw-r--r--drivers/s390/block/Makefile2
-rw-r--r--drivers/s390/block/dasd.c97
-rw-r--r--drivers/s390/block/dasd_3990_erp.c3
-rw-r--r--drivers/s390/block/dasd_eckd.h1
-rw-r--r--drivers/s390/block/dasd_eer.c1090
-rw-r--r--drivers/s390/block/dasd_int.h38
-rw-r--r--drivers/s390/char/sclp.c13
-rw-r--r--drivers/s390/cio/chsc.c10
-rw-r--r--drivers/s390/cio/device.c2
-rw-r--r--drivers/s390/cio/device_pgid.c2
-rw-r--r--drivers/s390/cio/device_status.c1
-rw-r--r--drivers/s390/cio/qdio.c13
-rw-r--r--drivers/s390/net/lcs.c31
-rw-r--r--drivers/s390/net/lcs.h2
-rw-r--r--drivers/s390/net/qeth.h112
-rw-r--r--drivers/s390/net/qeth_eddp.c11
-rw-r--r--drivers/s390/net/qeth_main.c17
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c76
-rw-r--r--drivers/s390/scsi/zfcp_def.h13
-rw-r--r--drivers/s390/scsi/zfcp_erp.c82
-rw-r--r--drivers/s390/scsi/zfcp_ext.h5
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c80
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c15
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_adapter.c4
-rw-r--r--drivers/scsi/3w-9xxx.c7
-rw-r--r--drivers/scsi/aacraid/aachba.c217
-rw-r--r--drivers/scsi/aacraid/aacraid.h18
-rw-r--r--drivers/scsi/aacraid/commctrl.c22
-rw-r--r--drivers/scsi/aacraid/comminit.c12
-rw-r--r--drivers/scsi/aacraid/commsup.c50
-rw-r--r--drivers/scsi/aacraid/dpcsup.c2
-rw-r--r--drivers/scsi/aacraid/linit.c50
-rw-r--r--drivers/scsi/esp.c4
-rw-r--r--drivers/scsi/gdth.c2
-rw-r--r--drivers/scsi/ipr.c49
-rw-r--r--drivers/scsi/ipr.h5
-rw-r--r--drivers/scsi/iscsi_tcp.c78
-rw-r--r--drivers/scsi/iscsi_tcp.h4
-rw-r--r--drivers/scsi/libata-core.c22
-rw-r--r--drivers/scsi/megaraid.c2
-rw-r--r--drivers/scsi/megaraid.h2
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c101
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.h53
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c276
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h44
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h27
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c108
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c43
-rw-r--r--drivers/scsi/qla2xxx/qla_rscn.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_sup.c963
-rw-r--r--drivers/scsi/sata_mv.c1
-rw-r--r--drivers/scsi/sata_qstor.c2
-rw-r--r--drivers/scsi/sata_vsc.c30
-rw-r--r--drivers/scsi/scsi_lib.c59
-rw-r--r--drivers/scsi/scsi_scan.c26
-rw-r--r--drivers/scsi/scsi_sysfs.c9
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c260
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c2
-rw-r--r--drivers/serial/8250.c2
-rw-r--r--drivers/serial/Kconfig4
-rw-r--r--drivers/serial/ioc4_serial.c14
-rw-r--r--drivers/spi/spi.c5
-rw-r--r--drivers/usb/host/pci-quirks.c16
-rw-r--r--drivers/usb/host/sl811_cs.c4
-rw-r--r--drivers/usb/input/hid-core.c50
-rw-r--r--drivers/usb/misc/Kconfig2
-rw-r--r--drivers/usb/misc/ldusb.c57
-rw-r--r--drivers/usb/serial/pl2303.c5
-rw-r--r--drivers/usb/serial/pl2303.h4
-rw-r--r--drivers/usb/storage/unusual_devs.h52
-rw-r--r--drivers/video/Kconfig5
-rw-r--r--drivers/video/aty/radeon_pm.c19
-rw-r--r--drivers/video/fbmem.c2
-rw-r--r--drivers/video/gbefb.c2
-rw-r--r--drivers/video/neofb.c17
-rw-r--r--drivers/video/nvidia/nvidia.c2
-rw-r--r--drivers/video/s3c2410fb.c1
-rw-r--r--fs/9p/v9fs.c2
-rw-r--r--fs/cifs/cifssmb.c7
-rw-r--r--fs/cifs/connect.c8
-rw-r--r--fs/cifs/file.c14
-rw-r--r--fs/compat.c37
-rw-r--r--fs/exec.c2
-rw-r--r--fs/ext2/xattr.c6
-rw-r--r--fs/fuse/dev.c6
-rw-r--r--fs/fuse/file.c11
-rw-r--r--fs/jbd/checkpoint.c418
-rw-r--r--fs/jbd/commit.c3
-rw-r--r--fs/lockd/clntlock.c27
-rw-r--r--fs/lockd/svc4proc.c2
-rw-r--r--fs/lockd/svcproc.c2
-rw-r--r--fs/ocfs2/dlm/dlmcommon.h4
-rw-r--r--fs/ocfs2/dlm/dlmconvert.c12
-rw-r--r--fs/ocfs2/dlm/dlmlock.c25
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c7
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c42
-rw-r--r--fs/ocfs2/journal.c7
-rw-r--r--fs/ocfs2/journal.h2
-rw-r--r--fs/proc/inode.c4
-rw-r--r--fs/proc/root.c17
-rw-r--r--fs/reiserfs/super.c2
-rw-r--r--fs/reiserfs/xattr_acl.c3
-rw-r--r--fs/select.c32
-rw-r--r--fs/stat.c22
-rw-r--r--fs/super.c15
-rw-r--r--include/asm-alpha/mman.h6
-rw-r--r--include/asm-arm/arch-at91rm9200/gpio.h1
-rw-r--r--include/asm-arm/arch-ixp4xx/nas100d.h4
-rw-r--r--include/asm-arm/arch-s3c2410/h1940-latch.h64
-rw-r--r--include/asm-arm/mman.h29
-rw-r--r--include/asm-arm/smp.h5
-rw-r--r--include/asm-arm/unistd.h6
-rw-r--r--include/asm-arm26/mman.h29
-rw-r--r--include/asm-cris/mman.h29
-rw-r--r--include/asm-frv/atomic.h6
-rw-r--r--include/asm-frv/cacheflush.h12
-rw-r--r--include/asm-frv/io.h1
-rw-r--r--include/asm-frv/mman.h29
-rw-r--r--include/asm-frv/spr-regs.h1
-rw-r--r--include/asm-frv/system.h88
-rw-r--r--include/asm-frv/uaccess.h3
-rw-r--r--include/asm-frv/unistd.h28
-rw-r--r--include/asm-generic/mman.h42
-rw-r--r--include/asm-h8300/mman.h29
-rw-r--r--include/asm-i386/mman.h29
-rw-r--r--include/asm-i386/thread_info.h4
-rw-r--r--include/asm-i386/topology.h2
-rw-r--r--include/asm-i386/unistd.h2
-rw-r--r--include/asm-ia64/acpi.h2
-rw-r--r--include/asm-ia64/machvec_sn2.h7
-rw-r--r--include/asm-ia64/mman.h29
-rw-r--r--include/asm-ia64/sn/arch.h2
-rw-r--r--include/asm-ia64/sn/bte.h6
-rw-r--r--include/asm-ia64/sn/pcibr_provider.h14
-rw-r--r--include/asm-ia64/sn/sn_feature_sets.h3
-rw-r--r--include/asm-ia64/sn/xpc.h31
-rw-r--r--include/asm-ia64/timex.h2
-rw-r--r--include/asm-m32r/mman.h31
-rw-r--r--include/asm-m32r/system.h2
-rw-r--r--include/asm-m68k/irq.h2
-rw-r--r--include/asm-m68k/mman.h29
-rw-r--r--include/asm-m68k/raw_io.h1
-rw-r--r--include/asm-mips/cpu.h6
-rw-r--r--include/asm-mips/gcc/sgidefs.h17
-rw-r--r--include/asm-mips/mach-generic/timex.h11
-rw-r--r--include/asm-mips/mach-rm200/timex.h13
-rw-r--r--include/asm-mips/mman.h20
-rw-r--r--include/asm-mips/r4kcache.h74
-rw-r--r--include/asm-mips/uaccess.h9
-rw-r--r--include/asm-mips/unistd.h10
-rw-r--r--include/asm-parisc/mman.h6
-rw-r--r--include/asm-powerpc/cputable.h9
-rw-r--r--include/asm-powerpc/mman.h30
-rw-r--r--include/asm-powerpc/mmu.h1
-rw-r--r--include/asm-powerpc/pgalloc.h2
-rw-r--r--include/asm-powerpc/reg.h33
-rw-r--r--include/asm-powerpc/thread_info.h4
-rw-r--r--include/asm-ppc/machdep.h13
-rw-r--r--include/asm-s390/bitops.h4
-rw-r--r--include/asm-s390/dasd.h13
-rw-r--r--include/asm-s390/mman.h29
-rw-r--r--include/asm-s390/setup.h10
-rw-r--r--include/asm-s390/smp.h3
-rw-r--r--include/asm-s390/unistd.h7
-rw-r--r--include/asm-sh/mman.h29
-rw-r--r--include/asm-sparc/mman.h29
-rw-r--r--include/asm-sparc/unistd.h2
-rw-r--r--include/asm-sparc64/mman.h29
-rw-r--r--include/asm-sparc64/unistd.h2
-rw-r--r--include/asm-v850/mman.h28
-rw-r--r--include/asm-x86_64/hpet.h2
-rw-r--r--include/asm-x86_64/ia32_unistd.h2
-rw-r--r--include/asm-x86_64/mman.h28
-rw-r--r--include/asm-x86_64/proto.h1
-rw-r--r--include/asm-xtensa/mman.h20
-rw-r--r--include/linux/acpi.h3
-rw-r--r--include/linux/compat.h20
-rw-r--r--include/linux/cpumask.h2
-rw-r--r--include/linux/jbd.h8
-rw-r--r--include/linux/kbd_kern.h4
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/kexec.h1
-rw-r--r--include/linux/kobject.h6
-rw-r--r--include/linux/ktime.h10
-rw-r--r--include/linux/libata.h16
-rw-r--r--include/linux/lockd/lockd.h6
-rw-r--r--include/linux/mm.h6
-rw-r--r--include/linux/mmc/mmc.h2
-rw-r--r--include/linux/netfilter.h21
-rw-r--r--include/linux/netfilter_ipv4.h2
-rw-r--r--include/linux/netlink.h3
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/ptrace.h1
-rw-r--r--include/linux/sched.h5
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--include/linux/sysctl.h1
-rw-r--r--include/linux/time.h25
-rw-r--r--include/linux/timex.h3
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/tty_flip.h4
-rw-r--r--include/net/bluetooth/rfcomm.h2
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/irda/irda.h6
-rw-r--r--include/net/irda/irlap.h3
-rw-r--r--include/net/xfrm.h1
-rw-r--r--include/scsi/iscsi_if.h3
-rw-r--r--include/scsi/scsi.h2
-rw-r--r--include/scsi/scsi_transport_iscsi.h34
-rw-r--r--include/video/neomagic.h1
-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/auditsc.c6
-rw-r--r--kernel/cpuset.c35
-rw-r--r--kernel/exit.c3
-rw-r--r--kernel/fork.c9
-rw-r--r--kernel/hrtimer.c13
-rw-r--r--kernel/panic.c1
-rw-r--r--kernel/power/snapshot.c4
-rw-r--r--kernel/power/swsusp.c4
-rw-r--r--kernel/ptrace.c28
-rw-r--r--kernel/sched.c152
-rw-r--r--kernel/sys_ni.c2
-rw-r--r--kernel/sysctl.c20
-rw-r--r--kernel/timer.c39
-rw-r--r--lib/iomap_copy.c2
-rw-r--r--lib/kobject_uevent.c4
-rw-r--r--lib/radix-tree.c10
-rw-r--r--mm/hugetlb.c4
-rw-r--r--mm/madvise.c21
-rw-r--r--mm/memory.c10
-rw-r--r--mm/mempolicy.c22
-rw-r--r--mm/nommu.c2
-rw-r--r--mm/oom_kill.c123
-rw-r--r--mm/page_alloc.c46
-rw-r--r--mm/shmem.c81
-rw-r--r--mm/slab.c10
-rw-r--r--mm/swap.c2
-rw-r--r--mm/vmscan.c106
-rw-r--r--net/802/p8023.c2
-rw-r--r--net/atm/signaling.c3
-rw-r--r--net/bluetooth/hci_sock.c10
-rw-r--r--net/bluetooth/rfcomm/core.c13
-rw-r--r--net/bridge/br_if.c94
-rw-r--r--net/bridge/br_input.c19
-rw-r--r--net/bridge/br_netfilter.c57
-rw-r--r--net/bridge/br_private.h6
-rw-r--r--net/bridge/br_stp_bpdu.c30
-rw-r--r--net/bridge/br_stp_if.c4
-rw-r--r--net/bridge/br_sysfs_if.c50
-rw-r--r--net/core/datagram.c81
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/core/skbuff.c10
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv4/fib_semantics.c2
-rw-r--r--net/ipv4/icmp.c2
-rw-r--r--net/ipv4/ip_gre.c3
-rw-r--r--net/ipv4/ip_output.c16
-rw-r--r--net/ipv4/ipip.c3
-rw-r--r--net/ipv4/netfilter.c41
-rw-r--r--net/ipv4/netfilter/ip_nat_core.c18
-rw-r--r--net/ipv4/netfilter/ip_nat_standalone.c22
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c5
-rw-r--r--net/ipv4/tcp_input.c3
-rw-r--r--net/ipv4/xfrm4_output.c13
-rw-r--r--net/ipv6/icmp.c6
-rw-r--r--net/ipv6/ip6_tunnel.c2
-rw-r--r--net/ipv6/netfilter/ip6t_REJECT.c2
-rw-r--r--net/ipv6/raw.c5
-rw-r--r--net/irda/irda_device.c4
-rw-r--r--net/irda/irnet/irnet_irda.c2
-rw-r--r--net/netfilter/Kconfig10
-rw-r--r--net/netfilter/nf_conntrack_core.c5
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c4
-rw-r--r--net/netfilter/nf_conntrack_proto_udp.c4
-rw-r--r--net/netlink/af_netlink.c7
-rw-r--r--net/netlink/genetlink.c11
-rw-r--r--net/xfrm/xfrm_policy.c6
-rw-r--r--sound/core/control_compat.c16
563 files changed, 7796 insertions, 6846 deletions
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index 08c5d04f3086..57a09f99ecb0 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -11,6 +11,8 @@
11 Joel Schopp <jschopp@austin.ibm.com> 11 Joel Schopp <jschopp@austin.ibm.com>
12 ia64/x86_64: 12 ia64/x86_64:
13 Ashok Raj <ashok.raj@intel.com> 13 Ashok Raj <ashok.raj@intel.com>
14 s390:
15 Heiko Carstens <heiko.carstens@de.ibm.com>
14 16
15Authors: Ashok Raj <ashok.raj@intel.com> 17Authors: Ashok Raj <ashok.raj@intel.com>
16Lots of feedback: Nathan Lynch <nathanl@austin.ibm.com>, 18Lots of feedback: Nathan Lynch <nathanl@austin.ibm.com>,
@@ -44,9 +46,28 @@ maxcpus=n Restrict boot time cpus to n. Say if you have 4 cpus, using
44 maxcpus=2 will only boot 2. You can choose to bring the 46 maxcpus=2 will only boot 2. You can choose to bring the
45 other cpus later online, read FAQ's for more info. 47 other cpus later online, read FAQ's for more info.
46 48
47additional_cpus=n [x86_64 only] use this to limit hotpluggable cpus. 49additional_cpus*=n Use this to limit hotpluggable cpus. This option sets
48 This option sets 50 cpu_possible_map = cpu_present_map + additional_cpus
49 cpu_possible_map = cpu_present_map + additional_cpus 51
52(*) Option valid only for following architectures
53- x86_64, ia64, s390
54
55ia64 and x86_64 use the number of disabled local apics in ACPI tables MADT
56to determine the number of potentially hot-pluggable cpus. The implementation
57should only rely on this to count the #of cpus, but *MUST* not rely on the
58apicid values in those tables for disabled apics. In the event BIOS doesnt
59mark such hot-pluggable cpus as disabled entries, one could use this
60parameter "additional_cpus=x" to represent those cpus in the cpu_possible_map.
61
62s390 uses the number of cpus it detects at IPL time to also the number of bits
63in cpu_possible_map. If it is desired to add additional cpus at a later time
64the number should be specified using this option or the possible_cpus option.
65
66possible_cpus=n [s390 only] use this to set hotpluggable cpus.
67 This option sets possible_cpus bits in
68 cpu_possible_map. Thus keeping the numbers of bits set
69 constant even if the machine gets rebooted.
70 This option overrides additional_cpus.
50 71
51CPU maps and such 72CPU maps and such
52----------------- 73-----------------
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index b730d765b525..be5ae600f533 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -171,3 +171,12 @@ Why: 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 171 probing is also known to cause trouble in at least one case (see
172 bug #5889.) 172 bug #5889.)
173Who: Jean Delvare <khali@linux-fr.org> 173Who: Jean Delvare <khali@linux-fr.org>
174
175---------------------------
176
177What: mount/umount uevents
178When: February 2007
179Why: These events are not correct, and do not properly let userspace know
180 when a file system has been mounted or unmounted. Userspace should
181 poll the /proc/mounts file instead to detect this properly.
182Who: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt
index dbe4d87d2615..8a155418c705 100644
--- a/Documentation/filesystems/tmpfs.txt
+++ b/Documentation/filesystems/tmpfs.txt
@@ -79,15 +79,18 @@ that instance in a system with many cpus making intensive use of it.
79 79
80 80
81tmpfs has a mount option to set the NUMA memory allocation policy for 81tmpfs has a mount option to set the NUMA memory allocation policy for
82all files in that instance: 82all files in that instance (if CONFIG_NUMA is enabled) - which can be
83mpol=interleave prefers to allocate memory from each node in turn 83adjusted on the fly via 'mount -o remount ...'
84mpol=default prefers to allocate memory from the local node
85mpol=bind prefers to allocate from mpol_nodelist
86mpol=preferred prefers to allocate from first node in mpol_nodelist
87 84
88The following mount option is used in conjunction with mpol=interleave, 85mpol=default prefers to allocate memory from the local node
89mpol=bind or mpol=preferred: 86mpol=prefer:Node prefers to allocate memory from the given Node
90mpol_nodelist: nodelist suitable for parsing with nodelist_parse. 87mpol=bind:NodeList allocates memory only from nodes in NodeList
88mpol=interleave prefers to allocate from each node in turn
89mpol=interleave:NodeList allocates from each node of NodeList in turn
90
91NodeList format is a comma-separated list of decimal numbers and ranges,
92a range being two hyphen-separated decimal numbers, the smallest and
93largest node numbers in the range. For example, mpol=bind:0-3,5,7,9-15
91 94
92 95
93To specify the initial root directory you can use the following mount 96To specify the initial root directory you can use the following mount
@@ -109,4 +112,4 @@ RAM/SWAP in 10240 inodes and it is only accessible by root.
109Author: 112Author:
110 Christoph Rohland <cr@sap.com>, 1.12.01 113 Christoph Rohland <cr@sap.com>, 1.12.01
111Updated: 114Updated:
112 Hugh Dickins <hugh@veritas.com>, 13 March 2005 115 Hugh Dickins <hugh@veritas.com>, 19 February 2006
diff --git a/Documentation/filesystems/v9fs.txt b/Documentation/filesystems/v9fs.txt
index 4e92feb6b507..24c7a9c41f0d 100644
--- a/Documentation/filesystems/v9fs.txt
+++ b/Documentation/filesystems/v9fs.txt
@@ -57,8 +57,6 @@ OPTIONS
57 57
58 port=n port to connect to on the remote server 58 port=n port to connect to on the remote server
59 59
60 timeout=n request timeouts (in ms) (default 60000ms)
61
62 noextend force legacy mode (no 9P2000.u semantics) 60 noextend force legacy mode (no 9P2000.u semantics)
63 61
64 uid attempt to mount as a particular uid 62 uid attempt to mount as a particular uid
@@ -74,10 +72,16 @@ OPTIONS
74RESOURCES 72RESOURCES
75========= 73=========
76 74
77The Linux version of the 9P server, along with some client-side utilities 75The Linux version of the 9P server is now maintained under the npfs project
78can be found at http://v9fs.sf.net (along with a CVS repository of the 76on sourceforge (http://sourceforge.net/projects/npfs).
79development branch of this module). There are user and developer mailing 77
80lists here, as well as a bug-tracker. 78There are user and developer mailing lists available through the v9fs project
79on sourceforge (http://sourceforge.net/projects/v9fs).
80
81News and other information is maintained on SWiK (http://swik.net/v9fs).
82
83Bug reports may be issued through the kernel.org bugzilla
84(http://bugzilla.kernel.org)
81 85
82For more information on the Plan 9 Operating System check out 86For more information on the Plan 9 Operating System check out
83http://plan9.bell-labs.com/plan9 87http://plan9.bell-labs.com/plan9
diff --git a/Documentation/fujitsu/frv/kernel-ABI.txt b/Documentation/fujitsu/frv/kernel-ABI.txt
new file mode 100644
index 000000000000..0ed9b0a779bc
--- /dev/null
+++ b/Documentation/fujitsu/frv/kernel-ABI.txt
@@ -0,0 +1,234 @@
1 =================================
2 INTERNAL KERNEL ABI FOR FR-V ARCH
3 =================================
4
5The internal FRV kernel ABI is not quite the same as the userspace ABI. A number of the registers
6are used for special purposed, and the ABI is not consistent between modules vs core, and MMU vs
7no-MMU.
8
9This partly stems from the fact that FRV CPUs do not have a separate supervisor stack pointer, and
10most of them do not have any scratch registers, thus requiring at least one general purpose
11register to be clobbered in such an event. Also, within the kernel core, it is possible to simply
12jump or call directly between functions using a relative offset. This cannot be extended to modules
13for the displacement is likely to be too far. Thus in modules the address of a function to call
14must be calculated in a register and then used, requiring two extra instructions.
15
16This document has the following sections:
17
18 (*) System call register ABI
19 (*) CPU operating modes
20 (*) Internal kernel-mode register ABI
21 (*) Internal debug-mode register ABI
22 (*) Virtual interrupt handling
23
24
25========================
26SYSTEM CALL REGISTER ABI
27========================
28
29When a system call is made, the following registers are effective:
30
31 REGISTERS CALL RETURN
32 =============== ======================= =======================
33 GR7 System call number Preserved
34 GR8 Syscall arg #1 Return value
35 GR9-GR13 Syscall arg #2-6 Preserved
36
37
38===================
39CPU OPERATING MODES
40===================
41
42The FR-V CPU has three basic operating modes. In order of increasing capability:
43
44 (1) User mode.
45
46 Basic userspace running mode.
47
48 (2) Kernel mode.
49
50 Normal kernel mode. There are many additional control registers available that may be
51 accessed in this mode, in addition to all the stuff available to user mode. This has two
52 submodes:
53
54 (a) Exceptions enabled (PSR.T == 1).
55
56 Exceptions will invoke the appropriate normal kernel mode handler. On entry to the
57 handler, the PSR.T bit will be cleared.
58
59 (b) Exceptions disabled (PSR.T == 0).
60
61 No exceptions or interrupts may happen. Any mandatory exceptions will cause the CPU to
62 halt unless the CPU is told to jump into debug mode instead.
63
64 (3) Debug mode.
65
66 No exceptions may happen in this mode. Memory protection and management exceptions will be
67 flagged for later consideration, but the exception handler won't be invoked. Debugging traps
68 such as hardware breakpoints and watchpoints will be ignored. This mode is entered only by
69 debugging events obtained from the other two modes.
70
71 All kernel mode registers may be accessed, plus a few extra debugging specific registers.
72
73
74=================================
75INTERNAL KERNEL-MODE REGISTER ABI
76=================================
77
78There are a number of permanent register assignments that are set up by entry.S in the exception
79prologue. Note that there is a complete set of exception prologues for each of user->kernel
80transition and kernel->kernel transition. There are also user->debug and kernel->debug mode
81transition prologues.
82
83
84 REGISTER FLAVOUR USE
85 =============== ======= ====================================================
86 GR1 Supervisor stack pointer
87 GR15 Current thread info pointer
88 GR16 GP-Rel base register for small data
89 GR28 Current exception frame pointer (__frame)
90 GR29 Current task pointer (current)
91 GR30 Destroyed by kernel mode entry
92 GR31 NOMMU Destroyed by debug mode entry
93 GR31 MMU Destroyed by TLB miss kernel mode entry
94 CCR.ICC2 Virtual interrupt disablement tracking
95 CCCR.CC3 Cleared by exception prologue (atomic op emulation)
96 SCR0 MMU See mmu-layout.txt.
97 SCR1 MMU See mmu-layout.txt.
98 SCR2 MMU Save for EAR0 (destroyed by icache insns in debug mode)
99 SCR3 MMU Save for GR31 during debug exceptions
100 DAMR/IAMR NOMMU Fixed memory protection layout.
101 DAMR/IAMR MMU See mmu-layout.txt.
102
103
104Certain registers are also used or modified across function calls:
105
106 REGISTER CALL RETURN
107 =============== =============================== ===============================
108 GR0 Fixed Zero -
109 GR2 Function call frame pointer
110 GR3 Special Preserved
111 GR3-GR7 - Clobbered
112 GR8 Function call arg #1 Return value (or clobbered)
113 GR9 Function call arg #2 Return value MSW (or clobbered)
114 GR10-GR13 Function call arg #3-#6 Clobbered
115 GR14 - Clobbered
116 GR15-GR16 Special Preserved
117 GR17-GR27 - Preserved
118 GR28-GR31 Special Only accessed explicitly
119 LR Return address after CALL Clobbered
120 CCR/CCCR - Mostly Clobbered
121
122
123================================
124INTERNAL DEBUG-MODE REGISTER ABI
125================================
126
127This is the same as the kernel-mode register ABI for functions calls. The difference is that in
128debug-mode there's a different stack and a different exception frame. Almost all the global
129registers from kernel-mode (including the stack pointer) may be changed.
130
131 REGISTER FLAVOUR USE
132 =============== ======= ====================================================
133 GR1 Debug stack pointer
134 GR16 GP-Rel base register for small data
135 GR31 Current debug exception frame pointer (__debug_frame)
136 SCR3 MMU Saved value of GR31
137
138
139Note that debug mode is able to interfere with the kernel's emulated atomic ops, so it must be
140exceedingly careful not to do any that would interact with the main kernel in this regard. Hence
141the debug mode code (gdbstub) is almost completely self-contained. The only external code used is
142the sprintf family of functions.
143
144Futhermore, break.S is so complicated because single-step mode does not switch off on entry to an
145exception. That means unless manually disabled, single-stepping will blithely go on stepping into
146things like interrupts. See gdbstub.txt for more information.
147
148
149==========================
150VIRTUAL INTERRUPT HANDLING
151==========================
152
153Because accesses to the PSR is so slow, and to disable interrupts we have to access it twice (once
154to read and once to write), we don't actually disable interrupts at all if we don't have to. What
155we do instead is use the ICC2 condition code flags to note virtual disablement, such that if we
156then do take an interrupt, we note the flag, really disable interrupts, set another flag and resume
157execution at the point the interrupt happened. Setting condition flags as a side effect of an
158arithmetic or logical instruction is really fast. This use of the ICC2 only occurs within the
159kernel - it does not affect userspace.
160
161The flags we use are:
162
163 (*) CCR.ICC2.Z [Zero flag]
164
165 Set to virtually disable interrupts, clear when interrupts are virtually enabled. Can be
166 modified by logical instructions without affecting the Carry flag.
167
168 (*) CCR.ICC2.C [Carry flag]
169
170 Clear to indicate hardware interrupts are really disabled, set otherwise.
171
172
173What happens is this:
174
175 (1) Normal kernel-mode operation.
176
177 ICC2.Z is 0, ICC2.C is 1.
178
179 (2) An interrupt occurs. The exception prologue examines ICC2.Z and determines that nothing needs
180 doing. This is done simply with an unlikely BEQ instruction.
181
182 (3) The interrupts are disabled (local_irq_disable)
183
184 ICC2.Z is set to 1.
185
186 (4) If interrupts were then re-enabled (local_irq_enable):
187
188 ICC2.Z would be set to 0.
189
190 A TIHI #2 instruction (trap #2 if condition HI - Z==0 && C==0) would be used to trap if
191 interrupts were now virtually enabled, but physically disabled - which they're not, so the
192 trap isn't taken. The kernel would then be back to state (1).
193
194 (5) An interrupt occurs. The exception prologue examines ICC2.Z and determines that the interrupt
195 shouldn't actually have happened. It jumps aside, and there disabled interrupts by setting
196 PSR.PIL to 14 and then it clears ICC2.C.
197
198 (6) If interrupts were then saved and disabled again (local_irq_save):
199
200 ICC2.Z would be shifted into the save variable and masked off (giving a 1).
201
202 ICC2.Z would then be set to 1 (thus unchanged), and ICC2.C would be unaffected (ie: 0).
203
204 (7) If interrupts were then restored from state (6) (local_irq_restore):
205
206 ICC2.Z would be set to indicate the result of XOR'ing the saved value (ie: 1) with 1, which
207 gives a result of 0 - thus leaving ICC2.Z set.
208
209 ICC2.C would remain unaffected (ie: 0).
210
211 A TIHI #2 instruction would be used to again assay the current state, but this would do
212 nothing as Z==1.
213
214 (8) If interrupts were then enabled (local_irq_enable):
215
216 ICC2.Z would be cleared. ICC2.C would be left unaffected. Both flags would now be 0.
217
218 A TIHI #2 instruction again issued to assay the current state would then trap as both Z==0
219 [interrupts virtually enabled] and C==0 [interrupts really disabled] would then be true.
220
221 (9) The trap #2 handler would simply enable hardware interrupts (set PSR.PIL to 0), set ICC2.C to
222 1 and return.
223
224(10) Immediately upon returning, the pending interrupt would be taken.
225
226(11) The interrupt handler would take the path of actually processing the interrupt (ICC2.Z is
227 clear, BEQ fails as per step (2)).
228
229(12) The interrupt handler would then set ICC2.C to 1 since hardware interrupts are definitely
230 enabled - or else the kernel wouldn't be here.
231
232(13) On return from the interrupt handler, things would be back to state (1).
233
234This trap (#2) is only available in kernel mode. In user mode it will result in SIGILL.
diff --git a/Documentation/hwmon/w83627hf b/Documentation/hwmon/w83627hf
index 5d23776e9907..bbeaba680443 100644
--- a/Documentation/hwmon/w83627hf
+++ b/Documentation/hwmon/w83627hf
@@ -36,6 +36,10 @@ Module Parameters
36 (default is 1) 36 (default is 1)
37 Use 'init=0' to bypass initializing the chip. 37 Use 'init=0' to bypass initializing the chip.
38 Try this if your computer crashes when you load the module. 38 Try this if your computer crashes when you load the module.
39* reset: int
40 (default is 0)
41 The driver used to reset the chip on load, but does no more. Use
42 'reset=1' to restore the old behavior. Report if you need to do this.
39 43
40Description 44Description
41----------- 45-----------
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 84370363da80..b874771385cd 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1133,6 +1133,8 @@ running once the system is up.
1133 Mechanism 1. 1133 Mechanism 1.
1134 conf2 [IA-32] Force use of PCI Configuration 1134 conf2 [IA-32] Force use of PCI Configuration
1135 Mechanism 2. 1135 Mechanism 2.
1136 nommconf [IA-32,X86_64] Disable use of MMCONFIG for PCI
1137 Configuration
1136 nosort [IA-32] Don't sort PCI devices according to 1138 nosort [IA-32] Don't sort PCI devices according to
1137 order given by the PCI BIOS. This sorting is 1139 order given by the PCI BIOS. This sorting is
1138 done to get a device order compatible with 1140 done to get a device order compatible with
@@ -1636,6 +1638,9 @@ running once the system is up.
1636 Format: 1638 Format:
1637 <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]] 1639 <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
1638 1640
1641 norandmaps Don't use address space randomization
1642 Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space
1643
1639 1644
1640______________________________________________________________________ 1645______________________________________________________________________
1641Changelog: 1646Changelog:
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
index 0ea5a0c6e827..2c3b1eae4280 100644
--- a/Documentation/kprobes.txt
+++ b/Documentation/kprobes.txt
@@ -136,17 +136,20 @@ Kprobes, jprobes, and return probes are implemented on the following
136architectures: 136architectures:
137 137
138- i386 138- i386
139- x86_64 (AMD-64, E64MT) 139- x86_64 (AMD-64, EM64T)
140- ppc64 140- ppc64
141- ia64 (Support for probes on certain instruction types is still in progress.) 141- ia64 (Does not support probes on instruction slot1.)
142- sparc64 (Return probes not yet implemented.) 142- sparc64 (Return probes not yet implemented.)
143 143
1443. Configuring Kprobes 1443. Configuring Kprobes
145 145
146When configuring the kernel using make menuconfig/xconfig/oldconfig, 146When configuring the kernel using make menuconfig/xconfig/oldconfig,
147ensure that CONFIG_KPROBES is set to "y". Under "Kernel hacking", 147ensure that CONFIG_KPROBES is set to "y". Under "Instrumentation
148look for "Kprobes". You may have to enable "Kernel debugging" 148Support", look for "Kprobes".
149(CONFIG_DEBUG_KERNEL) before you can enable Kprobes. 149
150So that you can load and unload Kprobes-based instrumentation modules,
151make sure "Loadable module support" (CONFIG_MODULES) and "Module
152unloading" (CONFIG_MODULE_UNLOAD) are set to "y".
150 153
151You may also want to ensure that CONFIG_KALLSYMS and perhaps even 154You may also want to ensure that CONFIG_KALLSYMS and perhaps even
152CONFIG_KALLSYMS_ALL are set to "y", since kallsyms_lookup_name() 155CONFIG_KALLSYMS_ALL are set to "y", since kallsyms_lookup_name()
@@ -262,18 +265,18 @@ at any time after the probe has been registered.
262 265
2635. Kprobes Features and Limitations 2665. Kprobes Features and Limitations
264 267
265As of Linux v2.6.12, Kprobes allows multiple probes at the same 268Kprobes allows multiple probes at the same address. Currently,
266address. Currently, however, there cannot be multiple jprobes on 269however, there cannot be multiple jprobes on the same function at
267the same function at the same time. 270the same time.
268 271
269In general, you can install a probe anywhere in the kernel. 272In general, you can install a probe anywhere in the kernel.
270In particular, you can probe interrupt handlers. Known exceptions 273In particular, you can probe interrupt handlers. Known exceptions
271are discussed in this section. 274are discussed in this section.
272 275
273For obvious reasons, it's a bad idea to install a probe in 276The register_*probe functions will return -EINVAL if you attempt
274the code that implements Kprobes (mostly kernel/kprobes.c and 277to install a probe in the code that implements Kprobes (mostly
275arch/*/kernel/kprobes.c). A patch in the v2.6.13 timeframe instructs 278kernel/kprobes.c and arch/*/kernel/kprobes.c, but also functions such
276Kprobes to reject such requests. 279as do_page_fault and notifier_call_chain).
277 280
278If you install a probe in an inline-able function, Kprobes makes 281If you install a probe in an inline-able function, Kprobes makes
279no attempt to chase down all inline instances of the function and 282no attempt to chase down all inline instances of the function and
@@ -290,18 +293,14 @@ from the accidental ones. Don't drink and probe.
290 293
291Kprobes makes no attempt to prevent probe handlers from stepping on 294Kprobes makes no attempt to prevent probe handlers from stepping on
292each other -- e.g., probing printk() and then calling printk() from a 295each other -- e.g., probing printk() and then calling printk() from a
293probe handler. As of Linux v2.6.12, if a probe handler hits a probe, 296probe handler. If a probe handler hits a probe, that second probe's
294that second probe's handlers won't be run in that instance. 297handlers won't be run in that instance, and the kprobe.nmissed member
295 298of the second probe will be incremented.
296In Linux v2.6.12 and previous versions, Kprobes' data structures are 299
297protected by a single lock that is held during probe registration and 300As of Linux v2.6.15-rc1, multiple handlers (or multiple instances of
298unregistration and while handlers are run. Thus, no two handlers 301the same handler) may run concurrently on different CPUs.
299can run simultaneously. To improve scalability on SMP systems, 302
300this restriction will probably be removed soon, in which case 303Kprobes does not use mutexes or allocate memory except during
301multiple handlers (or multiple instances of the same handler) may
302run concurrently on different CPUs. Code your handlers accordingly.
303
304Kprobes does not use semaphores or allocate memory except during
305registration and unregistration. 304registration and unregistration.
306 305
307Probe handlers are run with preemption disabled. Depending on the 306Probe handlers are run with preemption disabled. Depending on the
@@ -316,11 +315,18 @@ address instead of the real return address for kretprobed functions.
316(As far as we can tell, __builtin_return_address() is used only 315(As far as we can tell, __builtin_return_address() is used only
317for instrumentation and error reporting.) 316for instrumentation and error reporting.)
318 317
319If the number of times a function is called does not match the 318If the number of times a function is called does not match the number
320number of times it returns, registering a return probe on that 319of times it returns, registering a return probe on that function may
321function may produce undesirable results. We have the do_exit() 320produce undesirable results. We have the do_exit() case covered.
322and do_execve() cases covered. do_fork() is not an issue. We're 321do_execve() and do_fork() are not an issue. We're unaware of other
323unaware of other specific cases where this could be a problem. 322specific cases where this could be a problem.
323
324If, upon entry to or exit from a function, the CPU is running on
325a stack other than that of the current task, registering a return
326probe on that function may produce undesirable results. For this
327reason, Kprobes doesn't support return probes (or kprobes or jprobes)
328on the x86_64 version of __switch_to(); the registration functions
329return -EINVAL.
324 330
3256. Probe Overhead 3316. Probe Overhead
326 332
@@ -347,14 +353,12 @@ k = 0.77 usec; j = 1.31; r = 1.26; kr = 1.45; jr = 1.99
347 353
3487. TODO 3547. TODO
349 355
350a. SystemTap (http://sourceware.org/systemtap): Work in progress 356a. SystemTap (http://sourceware.org/systemtap): Provides a simplified
351to provide a simplified programming interface for probe-based 357programming interface for probe-based instrumentation. Try it out.
352instrumentation. 358b. Kernel return probes for sparc64.
353b. Improved SMP scalability: Currently, work is in progress to handle 359c. Support for other architectures.
354multiple kprobes in parallel. 360d. User-space probes.
355c. Kernel return probes for sparc64. 361e. Watchpoint probes (which fire on data references).
356d. Support for other architectures.
357e. User-space probes.
358 362
3598. Kprobes Example 3638. Kprobes Example
360 364
@@ -411,8 +415,7 @@ int init_module(void)
411 printk("Couldn't find %s to plant kprobe\n", "do_fork"); 415 printk("Couldn't find %s to plant kprobe\n", "do_fork");
412 return -1; 416 return -1;
413 } 417 }
414 ret = register_kprobe(&kp); 418 if ((ret = register_kprobe(&kp) < 0)) {
415 if (ret < 0) {
416 printk("register_kprobe failed, returned %d\n", ret); 419 printk("register_kprobe failed, returned %d\n", ret);
417 return -1; 420 return -1;
418 } 421 }
diff --git a/Documentation/mips/AU1xxx_IDE.README b/Documentation/mips/AU1xxx_IDE.README
index a7e4c4ea3560..afb31c141d9d 100644
--- a/Documentation/mips/AU1xxx_IDE.README
+++ b/Documentation/mips/AU1xxx_IDE.README
@@ -95,11 +95,13 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
95CONFIG_IDEDMA_PCI_AUTO=y 95CONFIG_IDEDMA_PCI_AUTO=y
96CONFIG_BLK_DEV_IDE_AU1XXX=y 96CONFIG_BLK_DEV_IDE_AU1XXX=y
97CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y 97CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y
98CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON=y
99CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128 98CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
100CONFIG_BLK_DEV_IDEDMA=y 99CONFIG_BLK_DEV_IDEDMA=y
101CONFIG_IDEDMA_AUTO=y 100CONFIG_IDEDMA_AUTO=y
102 101
102Also define 'IDE_AU1XXX_BURSTMODE' in 'drivers/ide/mips/au1xxx-ide.c' to enable
103the burst support on DBDMA controller.
104
103If the used system need the USB support enable the following kernel configs for 105If the used system need the USB support enable the following kernel configs for
104high IDE to USB throughput. 106high IDE to USB throughput.
105 107
@@ -115,6 +117,8 @@ CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
115CONFIG_BLK_DEV_IDEDMA=y 117CONFIG_BLK_DEV_IDEDMA=y
116CONFIG_IDEDMA_AUTO=y 118CONFIG_IDEDMA_AUTO=y
117 119
120Also undefine 'IDE_AU1XXX_BURSTMODE' in 'drivers/ide/mips/au1xxx-ide.c' to
121disable the burst support on DBDMA controller.
118 122
119ADD NEW HARD DISC TO WHITE OR BLACK LIST 123ADD NEW HARD DISC TO WHITE OR BLACK LIST
120---------------------------------------- 124----------------------------------------
diff --git a/Documentation/scsi/ChangeLog.megaraid_sas b/Documentation/scsi/ChangeLog.megaraid_sas
index f8c16cbf56ba..2dafa63bd370 100644
--- a/Documentation/scsi/ChangeLog.megaraid_sas
+++ b/Documentation/scsi/ChangeLog.megaraid_sas
@@ -1,3 +1,26 @@
11 Release Date : Wed Feb 03 14:31:44 PST 2006 - Sumant Patro <Sumant.Patro@lsil.com>
22 Current Version : 00.00.02.04
33 Older Version : 00.00.02.04
4
5i. Support for 1078 type (ppc IOP) controller, device id : 0x60 added.
6 During initialization, depending on the device id, the template members
7 are initialized with function pointers specific to the ppc or
8 xscale controllers.
9
10 -Sumant Patro <Sumant.Patro@lsil.com>
11
121 Release Date : Fri Feb 03 14:16:25 PST 2006 - Sumant Patro
13 <Sumant.Patro@lsil.com>
142 Current Version : 00.00.02.04
153 Older Version : 00.00.02.02
16i. Register 16 byte CDB capability with scsi midlayer
17
18 "Ths patch properly registers the 16 byte command length capability of the
19 megaraid_sas controlled hardware with the scsi midlayer. All megaraid_sas
20 hardware supports 16 byte CDB's."
21
22 -Joshua Giles <joshua_giles@dell.com>
23
11 Release Date : Mon Jan 23 14:09:01 PST 2006 - Sumant Patro <Sumant.Patro@lsil.com> 241 Release Date : Mon Jan 23 14:09:01 PST 2006 - Sumant Patro <Sumant.Patro@lsil.com>
22 Current Version : 00.00.02.02 252 Current Version : 00.00.02.02
33 Older Version : 00.00.02.01 263 Older Version : 00.00.02.01
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index 9f11d36a8c10..b0c7ab93dcb9 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -16,6 +16,7 @@ before actually making adjustments.
16 16
17Currently, these files might (depending on your configuration) 17Currently, these files might (depending on your configuration)
18show up in /proc/sys/kernel: 18show up in /proc/sys/kernel:
19- acpi_video_flags
19- acct 20- acct
20- core_pattern 21- core_pattern
21- core_uses_pid 22- core_uses_pid
@@ -57,6 +58,15 @@ show up in /proc/sys/kernel:
57 58
58============================================================== 59==============================================================
59 60
61acpi_video_flags:
62
63flags
64
65See Doc*/kernel/power/video.txt, it allows mode of video boot to be
66set during run time.
67
68==============================================================
69
60acct: 70acct:
61 71
62highwater lowwater frequency 72highwater lowwater frequency
diff --git a/MAINTAINERS b/MAINTAINERS
index b22db521cec1..9c592aa0280c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2232,7 +2232,23 @@ P: Martin Schwidefsky
2232M: schwidefsky@de.ibm.com 2232M: schwidefsky@de.ibm.com
2233M: linux390@de.ibm.com 2233M: linux390@de.ibm.com
2234L: linux-390@vm.marist.edu 2234L: linux-390@vm.marist.edu
2235W: http://oss.software.ibm.com/developerworks/opensource/linux390 2235W: http://www.ibm.com/developerworks/linux/linux390/
2236S: Supported
2237
2238S390 NETWORK DRIVERS
2239P: Frank Pavlic
2240M: fpavlic@de.ibm.com
2241M: linux390@de.ibm.com
2242L: linux-390@vm.marist.edu
2243W: http://www.ibm.com/developerworks/linux/linux390/
2244S: Supported
2245
2246S390 ZFCP DRIVER
2247P: Andreas Herrmann
2248M: aherrman@de.ibm.com
2249M: linux390@de.ibm.com
2250L: linux-390@vm.marist.edu
2251W: http://www.ibm.com/developerworks/linux/linux390/
2236S: Supported 2252S: Supported
2237 2253
2238SAA7146 VIDEO4LINUX-2 DRIVER 2254SAA7146 VIDEO4LINUX-2 DRIVER
diff --git a/Makefile b/Makefile
index a1158d1c051e..77a448c8e776 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 16 3SUBLEVEL = 16
4EXTRAVERSION =-rc2 4EXTRAVERSION =-rc4
5NAME=Sliding Snow Leopard 5NAME=Sliding Snow Leopard
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -106,13 +106,12 @@ KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
106$(if $(KBUILD_OUTPUT),, \ 106$(if $(KBUILD_OUTPUT),, \
107 $(error output directory "$(saved-output)" does not exist)) 107 $(error output directory "$(saved-output)" does not exist))
108 108
109.PHONY: $(MAKECMDGOALS) cdbuilddir 109.PHONY: $(MAKECMDGOALS)
110$(MAKECMDGOALS) _all: cdbuilddir
111 110
112cdbuilddir: 111$(filter-out _all,$(MAKECMDGOALS)) _all:
113 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ 112 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
114 KBUILD_SRC=$(CURDIR) \ 113 KBUILD_SRC=$(CURDIR) \
115 KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $(MAKECMDGOALS) 114 KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $@
116 115
117# Leave processing to above invocation of make 116# Leave processing to above invocation of make
118skip-makefile := 1 117skip-makefile := 1
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c
index 48b1e19b131f..e851d86c212c 100644
--- a/arch/arm/common/rtctime.c
+++ b/arch/arm/common/rtctime.c
@@ -128,19 +128,27 @@ EXPORT_SYMBOL(rtc_tm_to_time);
128/* 128/*
129 * Calculate the next alarm time given the requested alarm time mask 129 * Calculate the next alarm time given the requested alarm time mask
130 * and the current time. 130 * and the current time.
131 *
132 * FIXME: for now, we just copy the alarm time because we're lazy (and
133 * is therefore buggy - setting a 10am alarm at 8pm will not result in
134 * the alarm triggering.)
135 */ 131 */
136void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc_time *alrm) 132void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc_time *alrm)
137{ 133{
134 unsigned long next_time;
135 unsigned long now_time;
136
138 next->tm_year = now->tm_year; 137 next->tm_year = now->tm_year;
139 next->tm_mon = now->tm_mon; 138 next->tm_mon = now->tm_mon;
140 next->tm_mday = now->tm_mday; 139 next->tm_mday = now->tm_mday;
141 next->tm_hour = alrm->tm_hour; 140 next->tm_hour = alrm->tm_hour;
142 next->tm_min = alrm->tm_min; 141 next->tm_min = alrm->tm_min;
143 next->tm_sec = alrm->tm_sec; 142 next->tm_sec = alrm->tm_sec;
143
144 rtc_tm_to_time(now, &now_time);
145 rtc_tm_to_time(next, &next_time);
146
147 if (next_time < now_time) {
148 /* Advance one day */
149 next_time += 60 * 60 * 24;
150 rtc_time_to_tm(next_time, next);
151 }
144} 152}
145 153
146static inline int rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm) 154static inline int rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm)
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 8c3035d5ffc9..3173924a9b60 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -111,7 +111,7 @@
111 CALL(sys_statfs) 111 CALL(sys_statfs)
112/* 100 */ CALL(sys_fstatfs) 112/* 100 */ CALL(sys_fstatfs)
113 CALL(sys_ni_syscall) 113 CALL(sys_ni_syscall)
114 CALL(OBSOLETE(sys_socketcall)) 114 CALL(OBSOLETE(ABI(sys_socketcall, sys_oabi_socketcall)))
115 CALL(sys_syslog) 115 CALL(sys_syslog)
116 CALL(sys_setitimer) 116 CALL(sys_setitimer)
117/* 105 */ CALL(sys_getitimer) 117/* 105 */ CALL(sys_getitimer)
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 964cd717506b..ec48d70c6d8b 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -566,7 +566,7 @@ ENTRY(__switch_to)
566 ldr r6, [r2, #TI_CPU_DOMAIN]! 566 ldr r6, [r2, #TI_CPU_DOMAIN]!
567#endif 567#endif
568#if __LINUX_ARM_ARCH__ >= 6 568#if __LINUX_ARM_ARCH__ >= 6
569#ifdef CONFIG_CPU_MPCORE 569#ifdef CONFIG_CPU_32v6K
570 clrex 570 clrex
571#else 571#else
572 strex r5, r4, [ip] @ Clear exclusive monitor 572 strex r5, r4, [ip] @ Clear exclusive monitor
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index c45d10d07bde..68273b4dc882 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -23,6 +23,7 @@
23#include <linux/root_dev.h> 23#include <linux/root_dev.h>
24#include <linux/cpu.h> 24#include <linux/cpu.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/smp.h>
26 27
27#include <asm/cpu.h> 28#include <asm/cpu.h>
28#include <asm/elf.h> 29#include <asm/elf.h>
@@ -771,6 +772,10 @@ void __init setup_arch(char **cmdline_p)
771 paging_init(&meminfo, mdesc); 772 paging_init(&meminfo, mdesc);
772 request_standard_resources(&meminfo, mdesc); 773 request_standard_resources(&meminfo, mdesc);
773 774
775#ifdef CONFIG_SMP
776 smp_init_cpus();
777#endif
778
774 cpu_init(); 779 cpu_init();
775 780
776 /* 781 /*
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 7338948bd7d3..02aa300c4633 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -338,7 +338,6 @@ void __init smp_prepare_boot_cpu(void)
338 338
339 per_cpu(cpu_data, cpu).idle = current; 339 per_cpu(cpu_data, cpu).idle = current;
340 340
341 cpu_set(cpu, cpu_possible_map);
342 cpu_set(cpu, cpu_present_map); 341 cpu_set(cpu, cpu_present_map);
343 cpu_set(cpu, cpu_online_map); 342 cpu_set(cpu, cpu_online_map);
344} 343}
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index 9d4b76409c64..8e2f9bc3368b 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -64,6 +64,7 @@
64 * sys_connect: 64 * sys_connect:
65 * sys_sendmsg: 65 * sys_sendmsg:
66 * sys_sendto: 66 * sys_sendto:
67 * sys_socketcall:
67 * 68 *
68 * struct sockaddr_un loses its padding with EABI. Since the size of the 69 * 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 * structure is used as a validation test in unix_mkname(), we need to
@@ -78,6 +79,7 @@
78#include <linux/eventpoll.h> 79#include <linux/eventpoll.h>
79#include <linux/sem.h> 80#include <linux/sem.h>
80#include <linux/socket.h> 81#include <linux/socket.h>
82#include <linux/net.h>
81#include <asm/ipc.h> 83#include <asm/ipc.h>
82#include <asm/uaccess.h> 84#include <asm/uaccess.h>
83 85
@@ -408,3 +410,31 @@ asmlinkage long sys_oabi_sendmsg(int fd, struct msghdr __user *msg, unsigned fla
408 return sys_sendmsg(fd, msg, flags); 410 return sys_sendmsg(fd, msg, flags);
409} 411}
410 412
413asmlinkage long sys_oabi_socketcall(int call, unsigned long __user *args)
414{
415 unsigned long r = -EFAULT, a[6];
416
417 switch (call) {
418 case SYS_BIND:
419 if (copy_from_user(a, args, 3 * sizeof(long)) == 0)
420 r = sys_oabi_bind(a[0], (struct sockaddr __user *)a[1], a[2]);
421 break;
422 case SYS_CONNECT:
423 if (copy_from_user(a, args, 3 * sizeof(long)) == 0)
424 r = sys_oabi_connect(a[0], (struct sockaddr __user *)a[1], a[2]);
425 break;
426 case SYS_SENDTO:
427 if (copy_from_user(a, args, 6 * sizeof(long)) == 0)
428 r = sys_oabi_sendto(a[0], (void __user *)a[1], a[2], a[3],
429 (struct sockaddr __user *)a[4], a[5]);
430 break;
431 case SYS_SENDMSG:
432 if (copy_from_user(a, args, 3 * sizeof(long)) == 0)
433 r = sys_oabi_sendmsg(a[0], (struct msghdr __user *)a[1], a[2]);
434 break;
435 default:
436 r = sys_socketcall(call, args);
437 }
438
439 return r;
440}
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 10235b01582e..03924bcc6129 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -19,6 +19,7 @@
19#include <linux/personality.h> 19#include <linux/personality.h>
20#include <linux/ptrace.h> 20#include <linux/ptrace.h>
21#include <linux/kallsyms.h> 21#include <linux/kallsyms.h>
22#include <linux/delay.h>
22#include <linux/init.h> 23#include <linux/init.h>
23 24
24#include <asm/atomic.h> 25#include <asm/atomic.h>
@@ -231,6 +232,13 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
231 __die(str, err, thread, regs); 232 __die(str, err, thread, regs);
232 bust_spinlocks(0); 233 bust_spinlocks(0);
233 spin_unlock_irq(&die_lock); 234 spin_unlock_irq(&die_lock);
235
236 if (panic_on_oops) {
237 printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n");
238 ssleep(5);
239 panic("Fatal exception");
240 }
241
234 do_exit(SIGSEGV); 242 do_exit(SIGSEGV);
235} 243}
236 244
diff --git a/arch/arm/mach-at91rm9200/devices.c b/arch/arm/mach-at91rm9200/devices.c
index 8df3e5245651..57eedd5beaf6 100644
--- a/arch/arm/mach-at91rm9200/devices.c
+++ b/arch/arm/mach-at91rm9200/devices.c
@@ -100,8 +100,10 @@ void __init at91_add_device_udc(struct at91_udc_data *data)
100 at91_set_gpio_input(data->vbus_pin, 0); 100 at91_set_gpio_input(data->vbus_pin, 0);
101 at91_set_deglitch(data->vbus_pin, 1); 101 at91_set_deglitch(data->vbus_pin, 1);
102 } 102 }
103 if (data->pullup_pin) 103 if (data->pullup_pin) {
104 at91_set_gpio_output(data->pullup_pin, 0); 104 at91_set_gpio_output(data->pullup_pin, 0);
105 at91_set_multi_drive(data->pullup_pin, 1);
106 }
105 107
106 udc_data = *data; 108 udc_data = *data;
107 platform_device_register(&at91rm9200_udc_device); 109 platform_device_register(&at91rm9200_udc_device);
diff --git a/arch/arm/mach-at91rm9200/gpio.c b/arch/arm/mach-at91rm9200/gpio.c
index 2fd2ef583e4d..a9f718bf8ba8 100644
--- a/arch/arm/mach-at91rm9200/gpio.c
+++ b/arch/arm/mach-at91rm9200/gpio.c
@@ -159,6 +159,23 @@ int __init_or_module at91_set_deglitch(unsigned pin, int is_on)
159} 159}
160EXPORT_SYMBOL(at91_set_deglitch); 160EXPORT_SYMBOL(at91_set_deglitch);
161 161
162/*
163 * enable/disable the multi-driver; This is only valid for output and
164 * allows the output pin to run as an open collector output.
165 */
166int __init_or_module at91_set_multi_drive(unsigned pin, int is_on)
167{
168 void __iomem *pio = pin_to_controller(pin);
169 unsigned mask = pin_to_mask(pin);
170
171 if (!pio)
172 return -EINVAL;
173
174 __raw_writel(mask, pio + (is_on ? PIO_MDER : PIO_MDDR));
175 return 0;
176}
177EXPORT_SYMBOL(at91_set_multi_drive);
178
162/*--------------------------------------------------------------------------*/ 179/*--------------------------------------------------------------------------*/
163 180
164 181
diff --git a/arch/arm/mach-integrator/platsmp.c b/arch/arm/mach-integrator/platsmp.c
index ea10bd8c972c..1bc8534ef0c6 100644
--- a/arch/arm/mach-integrator/platsmp.c
+++ b/arch/arm/mach-integrator/platsmp.c
@@ -140,6 +140,18 @@ static void __init poke_milo(void)
140 mb(); 140 mb();
141} 141}
142 142
143/*
144 * Initialise the CPU possible map early - this describes the CPUs
145 * which may be present or become present in the system.
146 */
147void __init smp_init_cpus(void)
148{
149 unsigned int i, ncores = get_core_count();
150
151 for (i = 0; i < ncores; i++)
152 cpu_set(i, cpu_possible_map);
153}
154
143void __init smp_prepare_cpus(unsigned int max_cpus) 155void __init smp_prepare_cpus(unsigned int max_cpus)
144{ 156{
145 unsigned int ncores = get_core_count(); 157 unsigned int ncores = get_core_count();
@@ -176,14 +188,11 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
176 max_cpus = ncores; 188 max_cpus = ncores;
177 189
178 /* 190 /*
179 * Initialise the possible/present maps. 191 * Initialise the present map, which describes the set of CPUs
180 * cpu_possible_map describes the set of CPUs which may be present 192 * actually populated at the present time.
181 * cpu_present_map describes the set of CPUs populated
182 */ 193 */
183 for (i = 0; i < max_cpus; i++) { 194 for (i = 0; i < max_cpus; i++)
184 cpu_set(i, cpu_possible_map);
185 cpu_set(i, cpu_present_map); 195 cpu_set(i, cpu_present_map);
186 }
187 196
188 /* 197 /*
189 * Do we need any more CPUs? If so, then let them know where 198 * Do we need any more CPUs? If so, then let them know where
diff --git a/arch/arm/mach-iop3xx/iop321-setup.c b/arch/arm/mach-iop3xx/iop321-setup.c
index e4f4c52d93d4..0ebbcb20c6ae 100644
--- a/arch/arm/mach-iop3xx/iop321-setup.c
+++ b/arch/arm/mach-iop3xx/iop321-setup.c
@@ -13,7 +13,6 @@
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/config.h> 15#include <linux/config.h>
16#include <linux/init.h>
17#include <linux/major.h> 16#include <linux/major.h>
18#include <linux/fs.h> 17#include <linux/fs.h>
19#include <linux/platform_device.h> 18#include <linux/platform_device.h>
diff --git a/arch/arm/mach-iop3xx/iop331-setup.c b/arch/arm/mach-iop3xx/iop331-setup.c
index 63585485123e..2d6abe5be14d 100644
--- a/arch/arm/mach-iop3xx/iop331-setup.c
+++ b/arch/arm/mach-iop3xx/iop331-setup.c
@@ -12,7 +12,6 @@
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/config.h> 14#include <linux/config.h>
15#include <linux/init.h>
16#include <linux/major.h> 15#include <linux/major.h>
17#include <linux/fs.h> 16#include <linux/fs.h>
18#include <linux/platform_device.h> 17#include <linux/platform_device.h>
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 4bdc9d4526cd..fbadf3021b9e 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -111,24 +111,30 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type)
111 if (line < 0) 111 if (line < 0)
112 return -EINVAL; 112 return -EINVAL;
113 113
114 if (type & IRQT_BOTHEDGE) { 114 switch (type){
115 case IRQT_BOTHEDGE:
115 int_style = IXP4XX_GPIO_STYLE_TRANSITIONAL; 116 int_style = IXP4XX_GPIO_STYLE_TRANSITIONAL;
116 irq_type = IXP4XX_IRQ_EDGE; 117 irq_type = IXP4XX_IRQ_EDGE;
117 } else if (type & IRQT_RISING) { 118 break;
119 case IRQT_RISING:
118 int_style = IXP4XX_GPIO_STYLE_RISING_EDGE; 120 int_style = IXP4XX_GPIO_STYLE_RISING_EDGE;
119 irq_type = IXP4XX_IRQ_EDGE; 121 irq_type = IXP4XX_IRQ_EDGE;
120 } else if (type & IRQT_FALLING) { 122 break;
123 case IRQT_FALLING:
121 int_style = IXP4XX_GPIO_STYLE_FALLING_EDGE; 124 int_style = IXP4XX_GPIO_STYLE_FALLING_EDGE;
122 irq_type = IXP4XX_IRQ_EDGE; 125 irq_type = IXP4XX_IRQ_EDGE;
123 } else if (type & IRQT_HIGH) { 126 break;
127 case IRQT_HIGH:
124 int_style = IXP4XX_GPIO_STYLE_ACTIVE_HIGH; 128 int_style = IXP4XX_GPIO_STYLE_ACTIVE_HIGH;
125 irq_type = IXP4XX_IRQ_LEVEL; 129 irq_type = IXP4XX_IRQ_LEVEL;
126 } else if (type & IRQT_LOW) { 130 break;
131 case IRQT_LOW:
127 int_style = IXP4XX_GPIO_STYLE_ACTIVE_LOW; 132 int_style = IXP4XX_GPIO_STYLE_ACTIVE_LOW;
128 irq_type = IXP4XX_IRQ_LEVEL; 133 irq_type = IXP4XX_IRQ_LEVEL;
129 } else 134 break;
135 default:
130 return -EINVAL; 136 return -EINVAL;
131 137 }
132 ixp4xx_config_irq(irq, irq_type); 138 ixp4xx_config_irq(irq, irq_type);
133 139
134 if (line >= 8) { /* pins 8-15 */ 140 if (line >= 8) { /* pins 8-15 */
diff --git a/arch/arm/mach-ixp4xx/nslu2-power.c b/arch/arm/mach-ixp4xx/nslu2-power.c
index b0ad9e901f6e..d80c362bc539 100644
--- a/arch/arm/mach-ixp4xx/nslu2-power.c
+++ b/arch/arm/mach-ixp4xx/nslu2-power.c
@@ -77,6 +77,9 @@ static int __init nslu2_power_init(void)
77 77
78static void __exit nslu2_power_exit(void) 78static void __exit nslu2_power_exit(void)
79{ 79{
80 if (!(machine_is_nslu2()))
81 return;
82
80 free_irq(NSLU2_RB_IRQ, NULL); 83 free_irq(NSLU2_RB_IRQ, NULL);
81 free_irq(NSLU2_PB_IRQ, NULL); 84 free_irq(NSLU2_PB_IRQ, NULL);
82} 85}
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index da9340a53434..55411f21d838 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -27,8 +27,6 @@ static struct flash_platform_data nslu2_flash_data = {
27}; 27};
28 28
29static struct resource nslu2_flash_resource = { 29static struct resource nslu2_flash_resource = {
30 .start = NSLU2_FLASH_BASE,
31 .end = NSLU2_FLASH_BASE + NSLU2_FLASH_SIZE,
32 .flags = IORESOURCE_MEM, 30 .flags = IORESOURCE_MEM,
33}; 31};
34 32
@@ -52,6 +50,12 @@ static struct platform_device nslu2_i2c_controller = {
52 .num_resources = 0, 50 .num_resources = 0,
53}; 51};
54 52
53static struct platform_device nslu2_beeper = {
54 .name = "ixp4xx-beeper",
55 .id = NSLU2_GPIO_BUZZ,
56 .num_resources = 0,
57};
58
55static struct resource nslu2_uart_resources[] = { 59static struct resource nslu2_uart_resources[] = {
56 { 60 {
57 .start = IXP4XX_UART1_BASE_PHYS, 61 .start = IXP4XX_UART1_BASE_PHYS,
@@ -99,6 +103,7 @@ static struct platform_device *nslu2_devices[] __initdata = {
99 &nslu2_i2c_controller, 103 &nslu2_i2c_controller,
100 &nslu2_flash, 104 &nslu2_flash,
101 &nslu2_uart, 105 &nslu2_uart,
106 &nslu2_beeper,
102}; 107};
103 108
104static void nslu2_power_off(void) 109static void nslu2_power_off(void)
@@ -116,6 +121,10 @@ static void __init nslu2_init(void)
116{ 121{
117 ixp4xx_sys_init(); 122 ixp4xx_sys_init();
118 123
124 nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
125 nslu2_flash_resource.end =
126 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
127
119 pm_power_off = nslu2_power_off; 128 pm_power_off = nslu2_power_off;
120 129
121 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); 130 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index a8fbd76d8be5..b8484e15dacb 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -143,6 +143,18 @@ static void __init poke_milo(void)
143 mb(); 143 mb();
144} 144}
145 145
146/*
147 * Initialise the CPU possible map early - this describes the CPUs
148 * which may be present or become present in the system.
149 */
150void __init smp_init_cpus(void)
151{
152 unsigned int i, ncores = get_core_count();
153
154 for (i = 0; i < ncores; i++)
155 cpu_set(i, cpu_possible_map);
156}
157
146void __init smp_prepare_cpus(unsigned int max_cpus) 158void __init smp_prepare_cpus(unsigned int max_cpus)
147{ 159{
148 unsigned int ncores = get_core_count(); 160 unsigned int ncores = get_core_count();
@@ -179,14 +191,11 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
179 local_timer_setup(cpu); 191 local_timer_setup(cpu);
180 192
181 /* 193 /*
182 * Initialise the possible/present maps. 194 * Initialise the present map, which describes the set of CPUs
183 * cpu_possible_map describes the set of CPUs which may be present 195 * actually populated at the present time.
184 * cpu_present_map describes the set of CPUs populated
185 */ 196 */
186 for (i = 0; i < max_cpus; i++) { 197 for (i = 0; i < max_cpus; i++)
187 cpu_set(i, cpu_possible_map);
188 cpu_set(i, cpu_present_map); 198 cpu_set(i, cpu_present_map);
189 }
190 199
191 /* 200 /*
192 * Do we need any more CPUs? If so, then let them know where 201 * Do we need any more CPUs? If so, then let them know where
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 1c316f14ed94..646a3a5d33a5 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -46,10 +46,11 @@
46#include <asm/irq.h> 46#include <asm/irq.h>
47#include <asm/mach-types.h> 47#include <asm/mach-types.h>
48 48
49//#include <asm/debug-ll.h> 49
50#include <asm/arch/regs-serial.h> 50#include <asm/arch/regs-serial.h>
51#include <asm/arch/regs-lcd.h> 51#include <asm/arch/regs-lcd.h>
52 52
53#include <asm/arch/h1940-latch.h>
53#include <asm/arch/fb.h> 54#include <asm/arch/fb.h>
54 55
55#include <linux/serial_core.h> 56#include <linux/serial_core.h>
@@ -59,7 +60,12 @@
59#include "cpu.h" 60#include "cpu.h"
60 61
61static struct map_desc h1940_iodesc[] __initdata = { 62static struct map_desc h1940_iodesc[] __initdata = {
62 /* nothing here yet */ 63 [0] = {
64 .virtual = (unsigned long)H1940_LATCH,
65 .pfn = __phys_to_pfn(H1940_PA_LATCH),
66 .length = SZ_16K,
67 .type = MT_DEVICE
68 },
63}; 69};
64 70
65#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK 71#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
@@ -92,6 +98,25 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] = {
92 } 98 }
93}; 99};
94 100
101/* Board control latch control */
102
103static unsigned int latch_state = H1940_LATCH_DEFAULT;
104
105void h1940_latch_control(unsigned int clear, unsigned int set)
106{
107 unsigned long flags;
108
109 local_irq_save(flags);
110
111 latch_state &= ~clear;
112 latch_state |= set;
113
114 __raw_writel(latch_state, H1940_LATCH);
115
116 local_irq_restore(flags);
117}
118
119EXPORT_SYMBOL_GPL(h1940_latch_control);
95 120
96 121
97/** 122/**
diff --git a/arch/arm/mach-s3c2410/s3c2400.h b/arch/arm/mach-s3c2410/s3c2400.h
new file mode 100644
index 000000000000..8b2394e1ed40
--- /dev/null
+++ b/arch/arm/mach-s3c2410/s3c2400.h
@@ -0,0 +1,31 @@
1/* arch/arm/mach-s3c2410/s3c2400.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C2400 cpu support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * Modifications:
13 * 09-Fev-2006 LCVR First version, based on s3c2410.h
14*/
15
16#ifdef CONFIG_CPU_S3C2400
17
18extern int s3c2400_init(void);
19
20extern void s3c2400_map_io(struct map_desc *mach_desc, int size);
21
22extern void s3c2400_init_uarts(struct s3c2410_uartcfg *cfg, int no);
23
24extern void s3c2400_init_clocks(int xtal);
25
26#else
27#define s3c2400_init_clocks NULL
28#define s3c2400_init_uarts NULL
29#define s3c2400_map_io NULL
30#define s3c2400_init NULL
31#endif
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index b80d57d51699..722fbabc9cfb 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -240,6 +240,14 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys)
240 int i; 240 int i;
241 int myslot = -1; 241 int myslot = -1;
242 unsigned long val; 242 unsigned long val;
243 void __iomem *local_pci_cfg_base;
244
245 val = __raw_readl(SYS_PCICTL);
246 if (!(val & 1)) {
247 printk("Not plugged into PCI backplane!\n");
248 ret = -EIO;
249 goto out;
250 }
243 251
244 if (nr == 0) { 252 if (nr == 0) {
245 sys->mem_offset = 0; 253 sys->mem_offset = 0;
@@ -253,48 +261,45 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys)
253 goto out; 261 goto out;
254 } 262 }
255 263
256 __raw_writel(VERSATILE_PCI_MEM_BASE0 >> 28,PCI_IMAP0);
257 __raw_writel(VERSATILE_PCI_MEM_BASE1 >> 28,PCI_IMAP1);
258 __raw_writel(VERSATILE_PCI_MEM_BASE2 >> 28,PCI_IMAP2);
259
260 __raw_writel(1, SYS_PCICTL);
261
262 val = __raw_readl(SYS_PCICTL);
263 if (!(val & 1)) {
264 printk("Not plugged into PCI backplane!\n");
265 ret = -EIO;
266 goto out;
267 }
268
269 /* 264 /*
270 * We need to discover the PCI core first to configure itself 265 * We need to discover the PCI core first to configure itself
271 * before the main PCI probing is performed 266 * before the main PCI probing is performed
272 */ 267 */
273 for (i=0; i<32; i++) { 268 for (i=0; i<32; i++)
274 if ((__raw_readl(VERSATILE_PCI_VIRT_BASE+(i<<11)+DEVICE_ID_OFFSET) == VP_PCI_DEVICE_ID) && 269 if ((__raw_readl(VERSATILE_PCI_VIRT_BASE+(i<<11)+DEVICE_ID_OFFSET) == VP_PCI_DEVICE_ID) &&
275 (__raw_readl(VERSATILE_PCI_VIRT_BASE+(i<<11)+CLASS_ID_OFFSET) == VP_PCI_CLASS_ID)) { 270 (__raw_readl(VERSATILE_PCI_VIRT_BASE+(i<<11)+CLASS_ID_OFFSET) == VP_PCI_CLASS_ID)) {
276 myslot = i; 271 myslot = i;
277
278 __raw_writel(myslot, PCI_SELFID);
279 val = __raw_readl(VERSATILE_PCI_CFG_VIRT_BASE+(myslot<<11)+CSR_OFFSET);
280 val |= (1<<2);
281 __raw_writel(val, VERSATILE_PCI_CFG_VIRT_BASE+(myslot<<11)+CSR_OFFSET);
282 break; 272 break;
283 } 273 }
284 }
285 274
286 if (myslot == -1) { 275 if (myslot == -1) {
287 printk("Cannot find PCI core!\n"); 276 printk("Cannot find PCI core!\n");
288 ret = -EIO; 277 ret = -EIO;
289 } else { 278 goto out;
290 printk("PCI core found (slot %d)\n",myslot);
291 /* Do not to map Versatile FPGA PCI device
292 into memory space as we are short of
293 mappable memory */
294 pci_slot_ignore |= (1 << myslot);
295 ret = 1;
296 } 279 }
297 280
281 printk("PCI core found (slot %d)\n",myslot);
282
283 __raw_writel(myslot, PCI_SELFID);
284 local_pci_cfg_base = (void *) VERSATILE_PCI_CFG_VIRT_BASE + (myslot << 11);
285
286 val = __raw_readl(local_pci_cfg_base + CSR_OFFSET);
287 val |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE;
288 __raw_writel(val, local_pci_cfg_base + CSR_OFFSET);
289
290 /*
291 * Configure the PCI inbound memory windows to be 1:1 mapped to SDRAM
292 */
293 __raw_writel(PHYS_OFFSET, local_pci_cfg_base + PCI_BASE_ADDRESS_0);
294 __raw_writel(PHYS_OFFSET, local_pci_cfg_base + PCI_BASE_ADDRESS_1);
295 __raw_writel(PHYS_OFFSET, local_pci_cfg_base + PCI_BASE_ADDRESS_2);
296
297 /*
298 * Do not to map Versatile FPGA PCI device into memory space
299 */
300 pci_slot_ignore |= (1 << myslot);
301 ret = 1;
302
298 out: 303 out:
299 return ret; 304 return ret;
300} 305}
@@ -305,18 +310,18 @@ struct pci_bus *pci_versatile_scan_bus(int nr, struct pci_sys_data *sys)
305 return pci_scan_bus(sys->busnr, &pci_versatile_ops, sys); 310 return pci_scan_bus(sys->busnr, &pci_versatile_ops, sys);
306} 311}
307 312
308/*
309 * V3_LB_BASE? - local bus address
310 * V3_LB_MAP? - pci bus address
311 */
312void __init pci_versatile_preinit(void) 313void __init pci_versatile_preinit(void)
313{ 314{
314} 315 __raw_writel(VERSATILE_PCI_MEM_BASE0 >> 28, PCI_IMAP0);
316 __raw_writel(VERSATILE_PCI_MEM_BASE1 >> 28, PCI_IMAP1);
317 __raw_writel(VERSATILE_PCI_MEM_BASE2 >> 28, PCI_IMAP2);
315 318
316void __init pci_versatile_postinit(void) 319 __raw_writel(PHYS_OFFSET >> 28, PCI_SMAP0);
317{ 320 __raw_writel(PHYS_OFFSET >> 28, PCI_SMAP1);
318} 321 __raw_writel(PHYS_OFFSET >> 28, PCI_SMAP2);
319 322
323 __raw_writel(1, SYS_PCICTL);
324}
320 325
321/* 326/*
322 * map the specified device/slot/pin to an IRQ. Different backplanes may need to modify this. 327 * map the specified device/slot/pin to an IRQ. Different backplanes may need to modify this.
@@ -326,16 +331,15 @@ static int __init versatile_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
326 int irq; 331 int irq;
327 int devslot = PCI_SLOT(dev->devfn); 332 int devslot = PCI_SLOT(dev->devfn);
328 333
329 /* slot, pin, irq 334 /* slot, pin, irq
330 24 1 27 335 * 24 1 27
331 25 1 28 untested 336 * 25 1 28
332 26 1 29 337 * 26 1 29
333 27 1 30 untested 338 * 27 1 30
334 */ 339 */
335 340 irq = 27 + ((slot + pin - 1) & 3);
336 irq = 27 + ((slot + pin + 2) % 3); /* Fudged */
337 341
338 printk("map irq: slot %d, pin %d, devslot %d, irq: %d\n",slot,pin,devslot,irq); 342 printk("PCI map irq: slot %d, pin %d, devslot %d, irq: %d\n",slot,pin,devslot,irq);
339 343
340 return irq; 344 return irq;
341} 345}
@@ -347,7 +351,6 @@ static struct hw_pci versatile_pci __initdata = {
347 .setup = pci_versatile_setup, 351 .setup = pci_versatile_setup,
348 .scan = pci_versatile_scan_bus, 352 .scan = pci_versatile_scan_bus,
349 .preinit = pci_versatile_preinit, 353 .preinit = pci_versatile_preinit,
350 .postinit = pci_versatile_postinit,
351}; 354};
352 355
353static int __init versatile_pci_init(void) 356static int __init versatile_pci_init(void)
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S
index dbd346033122..8a7f65ba14b7 100644
--- a/arch/arm/mm/abort-ev6.S
+++ b/arch/arm/mm/abort-ev6.S
@@ -20,7 +20,7 @@
20 */ 20 */
21 .align 5 21 .align 5
22ENTRY(v6_early_abort) 22ENTRY(v6_early_abort)
23#ifdef CONFIG_CPU_MPCORE 23#ifdef CONFIG_CPU_32v6K
24 clrex 24 clrex
25#else 25#else
26 strex r0, r1, [sp] @ Clear the exclusive monitor 26 strex r0, r1, [sp] @ Clear the exclusive monitor
diff --git a/arch/arm/plat-omap/pm.c b/arch/arm/plat-omap/pm.c
index 1a24e2c10714..093efd786f21 100644
--- a/arch/arm/plat-omap/pm.c
+++ b/arch/arm/plat-omap/pm.c
@@ -38,7 +38,6 @@
38#include <linux/pm.h> 38#include <linux/pm.h>
39#include <linux/sched.h> 39#include <linux/sched.h>
40#include <linux/proc_fs.h> 40#include <linux/proc_fs.h>
41#include <linux/pm.h>
42#include <linux/interrupt.h> 41#include <linux/interrupt.h>
43 42
44#include <asm/io.h> 43#include <asm/io.h>
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index d0f9bb5e9023..8ab5300dcb94 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Mon Jan 9 12:56:42 2006 15# Last update: Mon Feb 20 10:18:02 2006
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -904,7 +904,7 @@ wg302v2 MACH_WG302V2 WG302V2 890
904eb42x MACH_EB42X EB42X 891 904eb42x MACH_EB42X EB42X 891
905iq331es MACH_IQ331ES IQ331ES 892 905iq331es MACH_IQ331ES IQ331ES 892
906cosydsp MACH_COSYDSP COSYDSP 893 906cosydsp MACH_COSYDSP COSYDSP 893
907uplat7d MACH_UPLAT7D UPLAT7D 894 907uplat7d_proto MACH_UPLAT7D UPLAT7D 894
908ptdavinci MACH_PTDAVINCI PTDAVINCI 895 908ptdavinci MACH_PTDAVINCI PTDAVINCI 895
909mbus MACH_MBUS MBUS 896 909mbus MACH_MBUS MBUS 896
910nadia2vb MACH_NADIA2VB NADIA2VB 897 910nadia2vb MACH_NADIA2VB NADIA2VB 897
@@ -938,3 +938,34 @@ auckland MACH_AUCKLAND AUCKLAND 924
938ak3220m MACH_AK3320M AK3320M 925 938ak3220m MACH_AK3320M AK3320M 925
939duramax MACH_DURAMAX DURAMAX 926 939duramax MACH_DURAMAX DURAMAX 926
940n35 MACH_N35 N35 927 940n35 MACH_N35 N35 927
941pronghorn MACH_PRONGHORN PRONGHORN 928
942fundy MACH_FUNDY FUNDY 929
943logicpd_pxa270 MACH_LOGICPD_PXA270 LOGICPD_PXA270 930
944cpu777 MACH_CPU777 CPU777 931
945simicon9201 MACH_SIMICON9201 SIMICON9201 932
946leap2_hpm MACH_LEAP2_HPM LEAP2_HPM 933
947cm922txa10 MACH_CM922TXA10 CM922TXA10 934
948sandgate MACH_PXA PXA 935
949sandgate2 MACH_SANDGATE2 SANDGATE2 936
950sandgate2g MACH_SANDGATE2G SANDGATE2G 937
951sandgate2p MACH_SANDGATE2P SANDGATE2P 938
952fred_jack MACH_FRED_JACK FRED_JACK 939
953ttg_color1 MACH_TTG_COLOR1 TTG_COLOR1 940
954nxeb500hmi MACH_NXEB500HMI NXEB500HMI 941
955netdcu8 MACH_NETDCU8 NETDCU8 942
956ml675050_cpu_boa MACH_ML675050_CPU_BOA ML675050_CPU_BOA 943
957ng_fvx538 MACH_NG_FVX538 NG_FVX538 944
958ng_fvs338 MACH_NG_FVS338 NG_FVS338 945
959pnx4103 MACH_PNX4103 PNX4103 946
960hesdb MACH_HESDB HESDB 947
961xsilo MACH_XSILO XSILO 948
962espresso MACH_ESPRESSO ESPRESSO 949
963emlc MACH_EMLC EMLC 950
964sisteron MACH_SISTERON SISTERON 951
965rx1950 MACH_RX1950 RX1950 952
966tsc_venus MACH_TSC_VENUS TSC_VENUS 953
967ds101j MACH_DS101J DS101J 954
968mxc300_30ads MACH_MXC30030ADS MXC30030ADS 955
969fujitsu_wimaxsoc MACH_FUJITSU_WIMAXSOC FUJITSU_WIMAXSOC 956
970dualpcmodem MACH_DUALPCMODEM DUALPCMODEM 957
971gesbc9312 MACH_GESBC9312 GESBC9312 958
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 60a617aff8ba..e08383712370 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -25,6 +25,10 @@ config GENERIC_HARDIRQS
25 bool 25 bool
26 default n 26 default n
27 27
28config TIME_LOW_RES
29 bool
30 default y
31
28mainmenu "Fujitsu FR-V Kernel Configuration" 32mainmenu "Fujitsu FR-V Kernel Configuration"
29 33
30source "init/Kconfig" 34source "init/Kconfig"
diff --git a/arch/frv/Makefile b/arch/frv/Makefile
index 90c0fb8d9dc3..d163747d17c0 100644
--- a/arch/frv/Makefile
+++ b/arch/frv/Makefile
@@ -81,7 +81,7 @@ endif
81# - reserve CC3 for use with atomic ops 81# - reserve CC3 for use with atomic ops
82# - all the extra registers are dealt with only at context switch time 82# - all the extra registers are dealt with only at context switch time
83CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media 83CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media
84CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 84CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2
85AFLAGS += -mno-fdpic 85AFLAGS += -mno-fdpic
86ASFLAGS += -mno-fdpic 86ASFLAGS += -mno-fdpic
87 87
diff --git a/arch/frv/kernel/break.S b/arch/frv/kernel/break.S
index 33233dc23e29..687c48d62dde 100644
--- a/arch/frv/kernel/break.S
+++ b/arch/frv/kernel/break.S
@@ -200,12 +200,20 @@ __break_step:
200 movsg bpcsr,gr2 200 movsg bpcsr,gr2
201 sethi.p %hi(__entry_kernel_external_interrupt),gr3 201 sethi.p %hi(__entry_kernel_external_interrupt),gr3
202 setlo %lo(__entry_kernel_external_interrupt),gr3 202 setlo %lo(__entry_kernel_external_interrupt),gr3
203 subcc gr2,gr3,gr0,icc0 203 subcc.p gr2,gr3,gr0,icc0
204 sethi %hi(__entry_uspace_external_interrupt),gr3
205 setlo.p %lo(__entry_uspace_external_interrupt),gr3
204 beq icc0,#2,__break_step_kernel_external_interrupt 206 beq icc0,#2,__break_step_kernel_external_interrupt
205 sethi.p %hi(__entry_uspace_external_interrupt),gr3 207 subcc.p gr2,gr3,gr0,icc0
206 setlo %lo(__entry_uspace_external_interrupt),gr3 208 sethi %hi(__entry_kernel_external_interrupt_virtually_disabled),gr3
207 subcc gr2,gr3,gr0,icc0 209 setlo.p %lo(__entry_kernel_external_interrupt_virtually_disabled),gr3
208 beq icc0,#2,__break_step_uspace_external_interrupt 210 beq icc0,#2,__break_step_uspace_external_interrupt
211 subcc.p gr2,gr3,gr0,icc0
212 sethi %hi(__entry_kernel_external_interrupt_virtual_reenable),gr3
213 setlo.p %lo(__entry_kernel_external_interrupt_virtual_reenable),gr3
214 beq icc0,#2,__break_step_kernel_external_interrupt_virtually_disabled
215 subcc gr2,gr3,gr0,icc0
216 beq icc0,#2,__break_step_kernel_external_interrupt_virtual_reenable
209 217
210 LEDS 0x2007,gr2 218 LEDS 0x2007,gr2
211 219
@@ -254,6 +262,9 @@ __break_step_kernel_softprog_interrupt:
254# step through an external interrupt from kernel mode 262# step through an external interrupt from kernel mode
255 .globl __break_step_kernel_external_interrupt 263 .globl __break_step_kernel_external_interrupt
256__break_step_kernel_external_interrupt: 264__break_step_kernel_external_interrupt:
265 # deal with virtual interrupt disablement
266 beq icc2,#0,__break_step_kernel_external_interrupt_virtually_disabled
267
257 sethi.p %hi(__entry_kernel_external_interrupt_reentry),gr3 268 sethi.p %hi(__entry_kernel_external_interrupt_reentry),gr3
258 setlo %lo(__entry_kernel_external_interrupt_reentry),gr3 269 setlo %lo(__entry_kernel_external_interrupt_reentry),gr3
259 270
@@ -294,6 +305,64 @@ __break_return_as_kernel_prologue:
294#endif 305#endif
295 rett #1 306 rett #1
296 307
308# we single-stepped into an interrupt handler whilst interrupts were merely virtually disabled
309# need to really disable interrupts, set flag, fix up and return
310__break_step_kernel_external_interrupt_virtually_disabled:
311 movsg psr,gr2
312 andi gr2,#~PSR_PIL,gr2
313 ori gr2,#PSR_PIL_14,gr2 /* debugging interrupts only */
314 movgs gr2,psr
315
316 ldi @(gr31,#REG_CCR),gr3
317 movgs gr3,ccr
318 subcc.p gr0,gr0,gr0,icc2 /* leave Z set, clear C */
319
320 # exceptions must've been enabled and we must've been in supervisor mode
321 setlos BPSR_BET|BPSR_BS,gr3
322 movgs gr3,bpsr
323
324 # return to where the interrupt happened
325 movsg pcsr,gr2
326 movgs gr2,bpcsr
327
328 lddi.p @(gr31,#REG_GR(2)),gr2
329
330 xor gr31,gr31,gr31
331 movgs gr0,brr
332#ifdef CONFIG_MMU
333 movsg scr3,gr31
334#endif
335 rett #1
336
337# we stepped through into the virtual interrupt reenablement trap
338#
339# we also want to single step anyway, but after fixing up so that we get an event on the
340# instruction after the broken-into exception returns
341 .globl __break_step_kernel_external_interrupt_virtual_reenable
342__break_step_kernel_external_interrupt_virtual_reenable:
343 movsg psr,gr2
344 andi gr2,#~PSR_PIL,gr2
345 movgs gr2,psr
346
347 ldi @(gr31,#REG_CCR),gr3
348 movgs gr3,ccr
349 subicc gr0,#1,gr0,icc2 /* clear Z, set C */
350
351 # save the adjusted ICC2
352 movsg ccr,gr3
353 sti gr3,@(gr31,#REG_CCR)
354
355 # exceptions must've been enabled and we must've been in supervisor mode
356 setlos BPSR_BET|BPSR_BS,gr3
357 movgs gr3,bpsr
358
359 # return to where the trap happened
360 movsg pcsr,gr2
361 movgs gr2,bpcsr
362
363 # and then process the single step
364 bra __break_continue
365
297# step through an internal exception from uspace mode 366# step through an internal exception from uspace mode
298 .globl __break_step_uspace_softprog_interrupt 367 .globl __break_step_uspace_softprog_interrupt
299__break_step_uspace_softprog_interrupt: 368__break_step_uspace_softprog_interrupt:
diff --git a/arch/frv/kernel/entry-table.S b/arch/frv/kernel/entry-table.S
index 9b9243e2103c..81568acea9cd 100644
--- a/arch/frv/kernel/entry-table.S
+++ b/arch/frv/kernel/entry-table.S
@@ -116,6 +116,8 @@ __break_kerneltrap_fixup_table:
116 .long __break_step_uspace_external_interrupt 116 .long __break_step_uspace_external_interrupt
117 .section .trap.kernel 117 .section .trap.kernel
118 .org \tbr_tt 118 .org \tbr_tt
119 # deal with virtual interrupt disablement
120 beq icc2,#0,__entry_kernel_external_interrupt_virtually_disabled
119 bra __entry_kernel_external_interrupt 121 bra __entry_kernel_external_interrupt
120 .section .trap.fixup.kernel 122 .section .trap.fixup.kernel
121 .org \tbr_tt >> 2 123 .org \tbr_tt >> 2
@@ -259,25 +261,52 @@ __trap_fixup_kernel_data_tlb_miss:
259 .org TBR_TT_TRAP0 261 .org TBR_TT_TRAP0
260 .rept 127 262 .rept 127
261 bra __entry_uspace_softprog_interrupt 263 bra __entry_uspace_softprog_interrupt
262 bra __break_step_uspace_softprog_interrupt 264 .long 0,0,0
263 .long 0,0
264 .endr 265 .endr
265 .org TBR_TT_BREAK 266 .org TBR_TT_BREAK
266 bra __entry_break 267 bra __entry_break
267 .long 0,0,0 268 .long 0,0,0
268 269
270 .section .trap.fixup.user
271 .org TBR_TT_TRAP0 >> 2
272 .rept 127
273 .long __break_step_uspace_softprog_interrupt
274 .endr
275 .org TBR_TT_BREAK >> 2
276 .long 0
277
269 # miscellaneous kernel mode entry points 278 # miscellaneous kernel mode entry points
270 .section .trap.kernel 279 .section .trap.kernel
271 .org TBR_TT_TRAP0 280 .org TBR_TT_TRAP0
272 .rept 127
273 bra __entry_kernel_softprog_interrupt 281 bra __entry_kernel_softprog_interrupt
274 bra __break_step_kernel_softprog_interrupt 282 .org TBR_TT_TRAP1
275 .long 0,0 283 bra __entry_kernel_softprog_interrupt
284
285 # trap #2 in kernel - reenable interrupts
286 .org TBR_TT_TRAP2
287 bra __entry_kernel_external_interrupt_virtual_reenable
288
289 # miscellaneous kernel traps
290 .org TBR_TT_TRAP3
291 .rept 124
292 bra __entry_kernel_softprog_interrupt
293 .long 0,0,0
276 .endr 294 .endr
277 .org TBR_TT_BREAK 295 .org TBR_TT_BREAK
278 bra __entry_break 296 bra __entry_break
279 .long 0,0,0 297 .long 0,0,0
280 298
299 .section .trap.fixup.kernel
300 .org TBR_TT_TRAP0 >> 2
301 .long __break_step_kernel_softprog_interrupt
302 .long __break_step_kernel_softprog_interrupt
303 .long __break_step_kernel_external_interrupt_virtual_reenable
304 .rept 124
305 .long __break_step_kernel_softprog_interrupt
306 .endr
307 .org TBR_TT_BREAK >> 2
308 .long 0
309
281 # miscellaneous debug mode entry points 310 # miscellaneous debug mode entry points
282 .section .trap.break 311 .section .trap.break
283 .org TBR_TT_BREAK 312 .org TBR_TT_BREAK
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index 5f6548388b74..1d21c8d34d8a 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -141,7 +141,10 @@ __entry_uspace_external_interrupt_reentry:
141 141
142 movsg gner0,gr4 142 movsg gner0,gr4
143 movsg gner1,gr5 143 movsg gner1,gr5
144 stdi gr4,@(gr28,#REG_GNER0) 144 stdi.p gr4,@(gr28,#REG_GNER0)
145
146 # interrupts start off fully disabled in the interrupt handler
147 subcc gr0,gr0,gr0,icc2 /* set Z and clear C */
145 148
146 # set up kernel global registers 149 # set up kernel global registers
147 sethi.p %hi(__kernel_current_task),gr5 150 sethi.p %hi(__kernel_current_task),gr5
@@ -193,9 +196,8 @@ __entry_uspace_external_interrupt_reentry:
193 .type __entry_kernel_external_interrupt,@function 196 .type __entry_kernel_external_interrupt,@function
194__entry_kernel_external_interrupt: 197__entry_kernel_external_interrupt:
195 LEDS 0x6210 198 LEDS 0x6210
196 199// sub sp,gr15,gr31
197 sub sp,gr15,gr31 200// LEDS32
198 LEDS32
199 201
200 # set up the stack pointer 202 # set up the stack pointer
201 or.p sp,gr0,gr30 203 or.p sp,gr0,gr30
@@ -231,7 +233,10 @@ __entry_kernel_external_interrupt_reentry:
231 stdi gr24,@(gr28,#REG_GR(24)) 233 stdi gr24,@(gr28,#REG_GR(24))
232 stdi gr26,@(gr28,#REG_GR(26)) 234 stdi gr26,@(gr28,#REG_GR(26))
233 sti gr29,@(gr28,#REG_GR(29)) 235 sti gr29,@(gr28,#REG_GR(29))
234 stdi gr30,@(gr28,#REG_GR(30)) 236 stdi.p gr30,@(gr28,#REG_GR(30))
237
238 # note virtual interrupts will be fully enabled upon return
239 subicc gr0,#1,gr0,icc2 /* clear Z, set C */
235 240
236 movsg tbr ,gr20 241 movsg tbr ,gr20
237 movsg psr ,gr22 242 movsg psr ,gr22
@@ -267,7 +272,10 @@ __entry_kernel_external_interrupt_reentry:
267 272
268 movsg gner0,gr4 273 movsg gner0,gr4
269 movsg gner1,gr5 274 movsg gner1,gr5
270 stdi gr4,@(gr28,#REG_GNER0) 275 stdi.p gr4,@(gr28,#REG_GNER0)
276
277 # interrupts start off fully disabled in the interrupt handler
278 subcc gr0,gr0,gr0,icc2 /* set Z and clear C */
271 279
272 # set the return address 280 # set the return address
273 sethi.p %hi(__entry_return_from_kernel_interrupt),gr4 281 sethi.p %hi(__entry_return_from_kernel_interrupt),gr4
@@ -291,6 +299,45 @@ __entry_kernel_external_interrupt_reentry:
291 299
292 .size __entry_kernel_external_interrupt,.-__entry_kernel_external_interrupt 300 .size __entry_kernel_external_interrupt,.-__entry_kernel_external_interrupt
293 301
302###############################################################################
303#
304# deal with interrupts that were actually virtually disabled
305# - we need to really disable them, flag the fact and return immediately
306# - if you change this, you must alter break.S also
307#
308###############################################################################
309 .balign L1_CACHE_BYTES
310 .globl __entry_kernel_external_interrupt_virtually_disabled
311 .type __entry_kernel_external_interrupt_virtually_disabled,@function
312__entry_kernel_external_interrupt_virtually_disabled:
313 movsg psr,gr30
314 andi gr30,#~PSR_PIL,gr30
315 ori gr30,#PSR_PIL_14,gr30 ; debugging interrupts only
316 movgs gr30,psr
317 subcc gr0,gr0,gr0,icc2 ; leave Z set, clear C
318 rett #0
319
320 .size __entry_kernel_external_interrupt_virtually_disabled,.-__entry_kernel_external_interrupt_virtually_disabled
321
322###############################################################################
323#
324# deal with re-enablement of interrupts that were pending when virtually re-enabled
325# - set ICC2.C, re-enable the real interrupts and return
326# - we can clear ICC2.Z because we shouldn't be here if it's not 0 [due to TIHI]
327# - if you change this, you must alter break.S also
328#
329###############################################################################
330 .balign L1_CACHE_BYTES
331 .globl __entry_kernel_external_interrupt_virtual_reenable
332 .type __entry_kernel_external_interrupt_virtual_reenable,@function
333__entry_kernel_external_interrupt_virtual_reenable:
334 movsg psr,gr30
335 andi gr30,#~PSR_PIL,gr30 ; re-enable interrupts
336 movgs gr30,psr
337 subicc gr0,#1,gr0,icc2 ; clear Z, set C
338 rett #0
339
340 .size __entry_kernel_external_interrupt_virtual_reenable,.-__entry_kernel_external_interrupt_virtual_reenable
294 341
295############################################################################### 342###############################################################################
296# 343#
@@ -335,6 +382,7 @@ __entry_uspace_softprog_interrupt_reentry:
335 382
336 sethi.p %hi(__entry_return_from_user_exception),gr23 383 sethi.p %hi(__entry_return_from_user_exception),gr23
337 setlo %lo(__entry_return_from_user_exception),gr23 384 setlo %lo(__entry_return_from_user_exception),gr23
385
338 bra __entry_common 386 bra __entry_common
339 387
340 .size __entry_uspace_softprog_interrupt,.-__entry_uspace_softprog_interrupt 388 .size __entry_uspace_softprog_interrupt,.-__entry_uspace_softprog_interrupt
@@ -495,7 +543,10 @@ __entry_common:
495 543
496 movsg gner0,gr4 544 movsg gner0,gr4
497 movsg gner1,gr5 545 movsg gner1,gr5
498 stdi gr4,@(gr28,#REG_GNER0) 546 stdi.p gr4,@(gr28,#REG_GNER0)
547
548 # set up virtual interrupt disablement
549 subicc gr0,#1,gr0,icc2 /* clear Z flag, set C flag */
499 550
500 # set up kernel global registers 551 # set up kernel global registers
501 sethi.p %hi(__kernel_current_task),gr5 552 sethi.p %hi(__kernel_current_task),gr5
@@ -1418,11 +1469,27 @@ sys_call_table:
1418 .long sys_add_key 1469 .long sys_add_key
1419 .long sys_request_key 1470 .long sys_request_key
1420 .long sys_keyctl 1471 .long sys_keyctl
1421 .long sys_ni_syscall // sys_vperfctr_open 1472 .long sys_ioprio_set
1422 .long sys_ni_syscall // sys_vperfctr_control /* 290 */ 1473 .long sys_ioprio_get /* 290 */
1423 .long sys_ni_syscall // sys_vperfctr_unlink 1474 .long sys_inotify_init
1424 .long sys_ni_syscall // sys_vperfctr_iresume 1475 .long sys_inotify_add_watch
1425 .long sys_ni_syscall // sys_vperfctr_read 1476 .long sys_inotify_rm_watch
1477 .long sys_migrate_pages
1478 .long sys_openat /* 295 */
1479 .long sys_mkdirat
1480 .long sys_mknodat
1481 .long sys_fchownat
1482 .long sys_futimesat
1483 .long sys_newfstatat /* 300 */
1484 .long sys_unlinkat
1485 .long sys_renameat
1486 .long sys_linkat
1487 .long sys_symlinkat
1488 .long sys_readlinkat /* 305 */
1489 .long sys_fchmodat
1490 .long sys_faccessat
1491 .long sys_pselect6
1492 .long sys_ppoll
1426 1493
1427 1494
1428syscall_table_size = (. - sys_call_table) 1495syscall_table_size = (. - sys_call_table)
diff --git a/arch/frv/kernel/head.S b/arch/frv/kernel/head.S
index c73b4fe9f6ca..29a5265489b7 100644
--- a/arch/frv/kernel/head.S
+++ b/arch/frv/kernel/head.S
@@ -513,6 +513,9 @@ __head_mmu_enabled:
513 movgs gr0,ccr 513 movgs gr0,ccr
514 movgs gr0,cccr 514 movgs gr0,cccr
515 515
516 # initialise the virtual interrupt handling
517 subcc gr0,gr0,gr0,icc2 /* set Z, clear C */
518
516#ifdef CONFIG_MMU 519#ifdef CONFIG_MMU
517 movgs gr3,scr2 520 movgs gr3,scr2
518 movgs gr3,scr3 521 movgs gr3,scr3
diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c
index 59580c59c62c..27ab4c30aac6 100644
--- a/arch/frv/kernel/irq.c
+++ b/arch/frv/kernel/irq.c
@@ -287,18 +287,11 @@ asmlinkage void do_IRQ(void)
287 struct irq_source *source; 287 struct irq_source *source;
288 int level, cpu; 288 int level, cpu;
289 289
290 irq_enter();
291
290 level = (__frame->tbr >> 4) & 0xf; 292 level = (__frame->tbr >> 4) & 0xf;
291 cpu = smp_processor_id(); 293 cpu = smp_processor_id();
292 294
293#if 0
294 {
295 static u32 irqcount;
296 *(volatile u32 *) 0xe1200004 = ~((irqcount++ << 8) | level);
297 *(volatile u16 *) 0xffc00100 = (u16) ~0x9999;
298 mb();
299 }
300#endif
301
302 if ((unsigned long) __frame - (unsigned long) (current + 1) < 512) 295 if ((unsigned long) __frame - (unsigned long) (current + 1) < 512)
303 BUG(); 296 BUG();
304 297
@@ -308,40 +301,12 @@ asmlinkage void do_IRQ(void)
308 301
309 kstat_this_cpu.irqs[level]++; 302 kstat_this_cpu.irqs[level]++;
310 303
311 irq_enter();
312
313 for (source = frv_irq_levels[level].sources; source; source = source->next) 304 for (source = frv_irq_levels[level].sources; source; source = source->next)
314 source->doirq(source); 305 source->doirq(source);
315 306
316 irq_exit();
317
318 __clr_MASK(level); 307 __clr_MASK(level);
319 308
320 /* only process softirqs if we didn't interrupt another interrupt handler */ 309 irq_exit();
321 if ((__frame->psr & PSR_PIL) == PSR_PIL_0)
322 if (local_softirq_pending())
323 do_softirq();
324
325#ifdef CONFIG_PREEMPT
326 local_irq_disable();
327 while (--current->preempt_count == 0) {
328 if (!(__frame->psr & PSR_S) ||
329 current->need_resched == 0 ||
330 in_interrupt())
331 break;
332 current->preempt_count++;
333 local_irq_enable();
334 preempt_schedule();
335 local_irq_disable();
336 }
337#endif
338
339#if 0
340 {
341 *(volatile u16 *) 0xffc00100 = (u16) ~0x6666;
342 mb();
343 }
344#endif
345 310
346} /* end do_IRQ() */ 311} /* end do_IRQ() */
347 312
diff --git a/arch/frv/mm/kmap.c b/arch/frv/mm/kmap.c
index 539f45e6d15e..c54f18e65ea6 100644
--- a/arch/frv/mm/kmap.c
+++ b/arch/frv/mm/kmap.c
@@ -44,15 +44,6 @@ void iounmap(void *addr)
44} 44}
45 45
46/* 46/*
47 * __iounmap unmaps nearly everything, so be careful
48 * it doesn't free currently pointer/page tables anymore but it
49 * wans't used anyway and might be added later.
50 */
51void __iounmap(void *addr, unsigned long size)
52{
53}
54
55/*
56 * Set new cache mode for some kernel address space. 47 * Set new cache mode for some kernel address space.
57 * The caller must push data for that range itself, if such data may already 48 * The caller must push data for that range itself, if such data may already
58 * be in the cache. 49 * be in the cache.
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 80940d712acf..98308b018a35 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -33,6 +33,10 @@ config GENERIC_CALIBRATE_DELAY
33 bool 33 bool
34 default y 34 default y
35 35
36config TIME_LOW_RES
37 bool
38 default y
39
36config ISA 40config ISA
37 bool 41 bool
38 default y 42 default y
diff --git a/arch/h8300/Kconfig.cpu b/arch/h8300/Kconfig.cpu
index a380167a13cf..582797db9603 100644
--- a/arch/h8300/Kconfig.cpu
+++ b/arch/h8300/Kconfig.cpu
@@ -169,7 +169,7 @@ endif
169 169
170config CPU_H8300H 170config CPU_H8300H
171 bool 171 bool
172 depends on (H8002 || H83007 || H83048 || H83068) 172 depends on (H83002 || H83007 || H83048 || H83068)
173 default y 173 default y
174 174
175config CPU_H8S 175config CPU_H8S
diff --git a/arch/h8300/Kconfig.debug b/arch/h8300/Kconfig.debug
index 55034d08abff..e0e9bcb015a9 100644
--- a/arch/h8300/Kconfig.debug
+++ b/arch/h8300/Kconfig.debug
@@ -34,7 +34,7 @@ config GDB_DEBUG
34 help 34 help
35 gdb stub exception support 35 gdb stub exception support
36 36
37config CONFIG_SH_STANDARD_BIOS 37config SH_STANDARD_BIOS
38 bool "Use gdb protocol serial console" 38 bool "Use gdb protocol serial console"
39 depends on (!H8300H_SIM && !H8S_SIM) 39 depends on (!H8300H_SIM && !H8S_SIM)
40 help 40 help
diff --git a/arch/h8300/defconfig b/arch/h8300/defconfig
index 9d9b491cfc2c..8f1ec3297150 100644
--- a/arch/h8300/defconfig
+++ b/arch/h8300/defconfig
@@ -328,7 +328,7 @@ CONFIG_FULLDEBUG=y
328CONFIG_NO_KERNEL_MSG=y 328CONFIG_NO_KERNEL_MSG=y
329# CONFIG_SYSCALL_PRINT is not set 329# CONFIG_SYSCALL_PRINT is not set
330# CONFIG_GDB_DEBUG is not set 330# CONFIG_GDB_DEBUG is not set
331# CONFIG_CONFIG_SH_STANDARD_BIOS is not set 331# CONFIG_SH_STANDARD_BIOS is not set
332# CONFIG_DEFAULT_CMDLINE is not set 332# CONFIG_DEFAULT_CMDLINE is not set
333# CONFIG_BLKDEV_RESERVE is not set 333# CONFIG_BLKDEV_RESERVE is not set
334 334
diff --git a/arch/i386/boot/.gitignore b/arch/i386/boot/.gitignore
new file mode 100644
index 000000000000..495f20c085de
--- /dev/null
+++ b/arch/i386/boot/.gitignore
@@ -0,0 +1,3 @@
1bootsect
2bzImage
3setup
diff --git a/arch/i386/boot/tools/.gitignore b/arch/i386/boot/tools/.gitignore
new file mode 100644
index 000000000000..378eac25d311
--- /dev/null
+++ b/arch/i386/boot/tools/.gitignore
@@ -0,0 +1 @@
build
diff --git a/arch/i386/kernel/.gitignore b/arch/i386/kernel/.gitignore
new file mode 100644
index 000000000000..40836ad9079c
--- /dev/null
+++ b/arch/i386/kernel/.gitignore
@@ -0,0 +1 @@
vsyscall.lds
diff --git a/arch/i386/kernel/cpu/transmeta.c b/arch/i386/kernel/cpu/transmeta.c
index bdbeb77f4e22..7214c9b577ab 100644
--- a/arch/i386/kernel/cpu/transmeta.c
+++ b/arch/i386/kernel/cpu/transmeta.c
@@ -1,4 +1,5 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
2#include <linux/mm.h>
2#include <linux/init.h> 3#include <linux/init.h>
3#include <asm/processor.h> 4#include <asm/processor.h>
4#include <asm/msr.h> 5#include <asm/msr.h>
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index 5884469f6bfe..2bee6499edd9 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -398,7 +398,11 @@ ignore_int:
398 pushl 32(%esp) 398 pushl 32(%esp)
399 pushl 40(%esp) 399 pushl 40(%esp)
400 pushl $int_msg 400 pushl $int_msg
401#ifdef CONFIG_EARLY_PRINTK
402 call early_printk
403#else
401 call printk 404 call printk
405#endif
402 addl $(5*4),%esp 406 addl $(5*4),%esp
403 popl %ds 407 popl %ds
404 popl %es 408 popl %es
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index 0102f3d50e57..e7609abf3796 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -710,7 +710,7 @@ void __init get_smp_config (void)
710 * Read the physical hardware table. Anything here will 710 * Read the physical hardware table. Anything here will
711 * override the defaults. 711 * override the defaults.
712 */ 712 */
713 if (!smp_read_mpc((void *)mpf->mpf_physptr)) { 713 if (!smp_read_mpc(phys_to_virt(mpf->mpf_physptr))) {
714 smp_found_config = 0; 714 smp_found_config = 0;
715 printk(KERN_ERR "BIOS bug, MP table errors detected!...\n"); 715 printk(KERN_ERR "BIOS bug, MP table errors detected!...\n");
716 printk(KERN_ERR "... disabling SMP support. (tell your hw vendor)\n"); 716 printk(KERN_ERR "... disabling SMP support. (tell your hw vendor)\n");
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 5a8b3fb6d27b..ac687d00a1ce 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -299,7 +299,7 @@ ENTRY(sys_call_table)
299 .long sys_mknodat 299 .long sys_mknodat
300 .long sys_fchownat 300 .long sys_fchownat
301 .long sys_futimesat 301 .long sys_futimesat
302 .long sys_newfstatat /* 300 */ 302 .long sys_fstatat64 /* 300 */
303 .long sys_unlinkat 303 .long sys_unlinkat
304 .long sys_renameat 304 .long sys_renameat
305 .long sys_linkat 305 .long sys_linkat
diff --git a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c
index 7c86e3c5f1c1..a7f5a2aceba2 100644
--- a/arch/i386/kernel/timers/timer_tsc.c
+++ b/arch/i386/kernel/timers/timer_tsc.c
@@ -282,6 +282,10 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
282 if (val != CPUFREQ_RESUMECHANGE) 282 if (val != CPUFREQ_RESUMECHANGE)
283 write_seqlock_irq(&xtime_lock); 283 write_seqlock_irq(&xtime_lock);
284 if (!ref_freq) { 284 if (!ref_freq) {
285 if (!freq->old){
286 ref_freq = freq->new;
287 goto end;
288 }
285 ref_freq = freq->old; 289 ref_freq = freq->old;
286 loops_per_jiffy_ref = cpu_data[freq->cpu].loops_per_jiffy; 290 loops_per_jiffy_ref = cpu_data[freq->cpu].loops_per_jiffy;
287#ifndef CONFIG_SMP 291#ifndef CONFIG_SMP
@@ -307,6 +311,7 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
307#endif 311#endif
308 } 312 }
309 313
314end:
310 if (val != CPUFREQ_RESUMECHANGE) 315 if (val != CPUFREQ_RESUMECHANGE)
311 write_sequnlock_irq(&xtime_lock); 316 write_sequnlock_irq(&xtime_lock);
312 317
diff --git a/arch/i386/kernel/vsyscall-sysenter.S b/arch/i386/kernel/vsyscall-sysenter.S
index 4daefb2ec1b2..76b728159403 100644
--- a/arch/i386/kernel/vsyscall-sysenter.S
+++ b/arch/i386/kernel/vsyscall-sysenter.S
@@ -7,6 +7,21 @@
7 * for details. 7 * for details.
8 */ 8 */
9 9
10/*
11 * The caller puts arg2 in %ecx, which gets pushed. The kernel will use
12 * %ecx itself for arg2. The pushing is because the sysexit instruction
13 * (found in entry.S) requires that we clobber %ecx with the desired %esp.
14 * User code might expect that %ecx is unclobbered though, as it would be
15 * for returning via the iret instruction, so we must push and pop.
16 *
17 * The caller puts arg3 in %edx, which the sysexit instruction requires
18 * for %eip. Thus, exactly as for arg2, we must push and pop.
19 *
20 * Arg6 is different. The caller puts arg6 in %ebp. Since the sysenter
21 * instruction clobbers %esp, the user's %esp won't even survive entry
22 * into the kernel. We store %esp in %ebp. Code in entry.S must fetch
23 * arg6 from the stack.
24 */
10 .text 25 .text
11 .globl __kernel_vsyscall 26 .globl __kernel_vsyscall
12 .type __kernel_vsyscall,@function 27 .type __kernel_vsyscall,@function
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/i386/oprofile/backtrace.c b/arch/i386/oprofile/backtrace.c
index acc18138fb22..c049ce414f01 100644
--- a/arch/i386/oprofile/backtrace.c
+++ b/arch/i386/oprofile/backtrace.c
@@ -20,7 +20,20 @@ struct frame_head {
20} __attribute__((packed)); 20} __attribute__((packed));
21 21
22static struct frame_head * 22static struct frame_head *
23dump_backtrace(struct frame_head * head) 23dump_kernel_backtrace(struct frame_head * head)
24{
25 oprofile_add_trace(head->ret);
26
27 /* frame pointers should strictly progress back up the stack
28 * (towards higher addresses) */
29 if (head >= head->ebp)
30 return NULL;
31
32 return head->ebp;
33}
34
35static struct frame_head *
36dump_user_backtrace(struct frame_head * head)
24{ 37{
25 struct frame_head bufhead[2]; 38 struct frame_head bufhead[2];
26 39
@@ -105,10 +118,10 @@ x86_backtrace(struct pt_regs * const regs, unsigned int depth)
105 118
106 if (!user_mode_vm(regs)) { 119 if (!user_mode_vm(regs)) {
107 while (depth-- && valid_kernel_stack(head, regs)) 120 while (depth-- && valid_kernel_stack(head, regs))
108 head = dump_backtrace(head); 121 head = dump_kernel_backtrace(head);
109 return; 122 return;
110 } 123 }
111 124
112 while (depth-- && head) 125 while (depth-- && head)
113 head = dump_backtrace(head); 126 head = dump_user_backtrace(head);
114} 127}
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index d2702c419cf8..ecd44bdc8394 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -761,6 +761,59 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
761 return (0); 761 return (0);
762} 762}
763 763
764int additional_cpus __initdata = -1;
765
766static __init int setup_additional_cpus(char *s)
767{
768 if (s)
769 additional_cpus = simple_strtol(s, NULL, 0);
770
771 return 0;
772}
773
774early_param("additional_cpus", setup_additional_cpus);
775
776/*
777 * cpu_possible_map should be static, it cannot change as cpu's
778 * are onlined, or offlined. The reason is per-cpu data-structures
779 * are allocated by some modules at init time, and dont expect to
780 * do this dynamically on cpu arrival/departure.
781 * cpu_present_map on the other hand can change dynamically.
782 * In case when cpu_hotplug is not compiled, then we resort to current
783 * behaviour, which is cpu_possible == cpu_present.
784 * - Ashok Raj
785 *
786 * Three ways to find out the number of additional hotplug CPUs:
787 * - If the BIOS specified disabled CPUs in ACPI/mptables use that.
788 * - The user can overwrite it with additional_cpus=NUM
789 * - Otherwise don't reserve additional CPUs.
790 */
791__init void prefill_possible_map(void)
792{
793 int i;
794 int possible, disabled_cpus;
795
796 disabled_cpus = total_cpus - available_cpus;
797
798 if (additional_cpus == -1) {
799 if (disabled_cpus > 0)
800 additional_cpus = disabled_cpus;
801 else
802 additional_cpus = 0;
803 }
804
805 possible = available_cpus + additional_cpus;
806
807 if (possible > NR_CPUS)
808 possible = NR_CPUS;
809
810 printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n",
811 possible, max((possible - available_cpus), 0));
812
813 for (i = 0; i < possible; i++)
814 cpu_set(i, cpu_possible_map);
815}
816
764int acpi_map_lsapic(acpi_handle handle, int *pcpu) 817int acpi_map_lsapic(acpi_handle handle, int *pcpu)
765{ 818{
766 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 819 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 27b222c277e4..930fdfca6ddb 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -569,7 +569,9 @@ GLOBAL_ENTRY(ia64_trace_syscall)
569.mem.offset 0,0; st8.spill [r2]=r8 // store return value in slot for r8 569.mem.offset 0,0; st8.spill [r2]=r8 // store return value in slot for r8
570.mem.offset 8,0; st8.spill [r3]=r10 // clear error indication in slot for r10 570.mem.offset 8,0; st8.spill [r3]=r10 // clear error indication in slot for r10
571 br.call.sptk.many rp=syscall_trace_leave // give parent a chance to catch return value 571 br.call.sptk.many rp=syscall_trace_leave // give parent a chance to catch return value
572.ret3: br.cond.sptk .work_pending_syscall_end 572.ret3:
573(pUStk) cmp.eq.unc p6,p0=r0,r0 // p6 <- pUStk
574 br.cond.sptk .work_pending_syscall_end
573 575
574strace_error: 576strace_error:
575 ld8 r3=[r2] // load pt_regs.r8 577 ld8 r3=[r2] // load pt_regs.r8
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c
index e72de580ebbf..bbcfd08378a6 100644
--- a/arch/ia64/kernel/ia64_ksyms.c
+++ b/arch/ia64/kernel/ia64_ksyms.c
@@ -10,23 +10,8 @@
10 10
11#include <linux/string.h> 11#include <linux/string.h>
12EXPORT_SYMBOL(memset); 12EXPORT_SYMBOL(memset);
13EXPORT_SYMBOL(memchr);
14EXPORT_SYMBOL(memcmp);
15EXPORT_SYMBOL(memcpy); 13EXPORT_SYMBOL(memcpy);
16EXPORT_SYMBOL(memmove);
17EXPORT_SYMBOL(memscan);
18EXPORT_SYMBOL(strcat);
19EXPORT_SYMBOL(strchr);
20EXPORT_SYMBOL(strcmp);
21EXPORT_SYMBOL(strcpy);
22EXPORT_SYMBOL(strlen); 14EXPORT_SYMBOL(strlen);
23EXPORT_SYMBOL(strncat);
24EXPORT_SYMBOL(strncmp);
25EXPORT_SYMBOL(strncpy);
26EXPORT_SYMBOL(strnlen);
27EXPORT_SYMBOL(strrchr);
28EXPORT_SYMBOL(strstr);
29EXPORT_SYMBOL(strpbrk);
30 15
31#include <asm/checksum.h> 16#include <asm/checksum.h>
32EXPORT_SYMBOL(ip_fast_csum); /* hand-coded assembly */ 17EXPORT_SYMBOL(ip_fast_csum); /* hand-coded assembly */
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 35f7835294a3..3258e09278d0 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -430,6 +430,7 @@ setup_arch (char **cmdline_p)
430 if (early_console_setup(*cmdline_p) == 0) 430 if (early_console_setup(*cmdline_p) == 0)
431 mark_bsp_online(); 431 mark_bsp_online();
432 432
433 parse_early_param();
433#ifdef CONFIG_ACPI 434#ifdef CONFIG_ACPI
434 /* Initialize the ACPI boot-time table parser */ 435 /* Initialize the ACPI boot-time table parser */
435 acpi_table_init(); 436 acpi_table_init();
@@ -688,6 +689,9 @@ void
688setup_per_cpu_areas (void) 689setup_per_cpu_areas (void)
689{ 690{
690 /* start_kernel() requires this... */ 691 /* start_kernel() requires this... */
692#ifdef CONFIG_ACPI_HOTPLUG_CPU
693 prefill_possible_map();
694#endif
691} 695}
692 696
693/* 697/*
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 8f44e7d2df66..b681ef34a86e 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -129,7 +129,7 @@ DEFINE_PER_CPU(int, cpu_state);
129/* Bitmasks of currently online, and possible CPUs */ 129/* Bitmasks of currently online, and possible CPUs */
130cpumask_t cpu_online_map; 130cpumask_t cpu_online_map;
131EXPORT_SYMBOL(cpu_online_map); 131EXPORT_SYMBOL(cpu_online_map);
132cpumask_t cpu_possible_map; 132cpumask_t cpu_possible_map = CPU_MASK_NONE;
133EXPORT_SYMBOL(cpu_possible_map); 133EXPORT_SYMBOL(cpu_possible_map);
134 134
135cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned; 135cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned;
@@ -506,9 +506,6 @@ smp_build_cpu_map (void)
506 506
507 for (cpu = 0; cpu < NR_CPUS; cpu++) { 507 for (cpu = 0; cpu < NR_CPUS; cpu++) {
508 ia64_cpu_to_sapicid[cpu] = -1; 508 ia64_cpu_to_sapicid[cpu] = -1;
509#ifdef CONFIG_HOTPLUG_CPU
510 cpu_set(cpu, cpu_possible_map);
511#endif
512 } 509 }
513 510
514 ia64_cpu_to_sapicid[0] = boot_cpu_id; 511 ia64_cpu_to_sapicid[0] = boot_cpu_id;
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index a094ec49ccfa..307d01e15b2e 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -250,32 +250,27 @@ time_init (void)
250 set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); 250 set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
251} 251}
252 252
253#define SMALLUSECS 100 253/*
254 254 * Generic udelay assumes that if preemption is allowed and the thread
255void 255 * migrates to another CPU, that the ITC values are synchronized across
256udelay (unsigned long usecs) 256 * all CPUs.
257 */
258static void
259ia64_itc_udelay (unsigned long usecs)
257{ 260{
258 unsigned long start; 261 unsigned long start = ia64_get_itc();
259 unsigned long cycles; 262 unsigned long end = start + usecs*local_cpu_data->cyc_per_usec;
260 unsigned long smallusecs;
261 263
262 /* 264 while (time_before(ia64_get_itc(), end))
263 * Execute the non-preemptible delay loop (because the ITC might 265 cpu_relax();
264 * not be synchronized between CPUS) in relatively short time 266}
265 * chunks, allowing preemption between the chunks.
266 */
267 while (usecs > 0) {
268 smallusecs = (usecs > SMALLUSECS) ? SMALLUSECS : usecs;
269 preempt_disable();
270 cycles = smallusecs*local_cpu_data->cyc_per_usec;
271 start = ia64_get_itc();
272 267
273 while (ia64_get_itc() - start < cycles) 268void (*ia64_udelay)(unsigned long usecs) = &ia64_itc_udelay;
274 cpu_relax();
275 269
276 preempt_enable(); 270void
277 usecs -= smallusecs; 271udelay (unsigned long usecs)
278 } 272{
273 (*ia64_udelay)(usecs);
279} 274}
280EXPORT_SYMBOL(udelay); 275EXPORT_SYMBOL(udelay);
281 276
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index 55391901b013..dabd6c32641e 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> /* for EXPORT_SYMBOL */ 16#include <linux/module.h> /* for EXPORT_SYMBOL */
17#include <linux/hardirq.h> 17#include <linux/hardirq.h>
18#include <linux/kprobes.h> 18#include <linux/kprobes.h>
19#include <linux/delay.h> /* for ssleep() */
19 20
20#include <asm/fpswa.h> 21#include <asm/fpswa.h>
21#include <asm/ia32.h> 22#include <asm/ia32.h>
@@ -116,6 +117,13 @@ die (const char *str, struct pt_regs *regs, long err)
116 bust_spinlocks(0); 117 bust_spinlocks(0);
117 die.lock_owner = -1; 118 die.lock_owner = -1;
118 spin_unlock_irq(&die.lock); 119 spin_unlock_irq(&die.lock);
120
121 if (panic_on_oops) {
122 printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n");
123 ssleep(5);
124 panic("Fatal exception");
125 }
126
119 do_exit(SIGSEGV); 127 do_exit(SIGSEGV);
120} 128}
121 129
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 3437c2390429..3edef0d32f86 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -23,6 +23,10 @@
23#include "xtalk/hubdev.h" 23#include "xtalk/hubdev.h"
24#include "xtalk/xwidgetdev.h" 24#include "xtalk/xwidgetdev.h"
25 25
26
27extern void sn_init_cpei_timer(void);
28extern void register_sn_procfs(void);
29
26static struct list_head sn_sysdata_list; 30static struct list_head sn_sysdata_list;
27 31
28/* sysdata list struct */ 32/* sysdata list struct */
@@ -40,12 +44,12 @@ struct brick {
40 struct slab_info slab_info[MAX_SLABS + 1]; 44 struct slab_info slab_info[MAX_SLABS + 1];
41}; 45};
42 46
43int sn_ioif_inited = 0; /* SN I/O infrastructure initialized? */ 47int sn_ioif_inited; /* SN I/O infrastructure initialized? */
44 48
45struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */ 49struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */
46 50
47static int max_segment_number = 0; /* Default highest segment number */ 51static int max_segment_number; /* Default highest segment number */
48static int max_pcibus_number = 255; /* Default highest pci bus number */ 52static int max_pcibus_number = 255; /* Default highest pci bus number */
49 53
50/* 54/*
51 * Hooks and struct for unsupported pci providers 55 * Hooks and struct for unsupported pci providers
@@ -84,7 +88,6 @@ static inline u64
84sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num, 88sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
85 u64 address) 89 u64 address)
86{ 90{
87
88 struct ia64_sal_retval ret_stuff; 91 struct ia64_sal_retval ret_stuff;
89 ret_stuff.status = 0; 92 ret_stuff.status = 0;
90 ret_stuff.v0 = 0; 93 ret_stuff.v0 = 0;
@@ -94,7 +97,6 @@ sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
94 (u64) nasid, (u64) widget_num, 97 (u64) nasid, (u64) widget_num,
95 (u64) device_num, (u64) address, 0, 0, 0); 98 (u64) device_num, (u64) address, 0, 0, 0);
96 return ret_stuff.status; 99 return ret_stuff.status;
97
98} 100}
99 101
100/* 102/*
@@ -102,7 +104,6 @@ sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
102 */ 104 */
103static inline u64 sal_get_hubdev_info(u64 handle, u64 address) 105static inline u64 sal_get_hubdev_info(u64 handle, u64 address)
104{ 106{
105
106 struct ia64_sal_retval ret_stuff; 107 struct ia64_sal_retval ret_stuff;
107 ret_stuff.status = 0; 108 ret_stuff.status = 0;
108 ret_stuff.v0 = 0; 109 ret_stuff.v0 = 0;
@@ -118,7 +119,6 @@ static inline u64 sal_get_hubdev_info(u64 handle, u64 address)
118 */ 119 */
119static inline u64 sal_get_pcibus_info(u64 segment, u64 busnum, u64 address) 120static inline u64 sal_get_pcibus_info(u64 segment, u64 busnum, u64 address)
120{ 121{
121
122 struct ia64_sal_retval ret_stuff; 122 struct ia64_sal_retval ret_stuff;
123 ret_stuff.status = 0; 123 ret_stuff.status = 0;
124 ret_stuff.v0 = 0; 124 ret_stuff.v0 = 0;
@@ -215,7 +215,7 @@ static void __init sn_fixup_ionodes(void)
215 struct hubdev_info *hubdev; 215 struct hubdev_info *hubdev;
216 u64 status; 216 u64 status;
217 u64 nasid; 217 u64 nasid;
218 int i, widget, device; 218 int i, widget, device, size;
219 219
220 /* 220 /*
221 * Get SGI Specific HUB chipset information. 221 * Get SGI Specific HUB chipset information.
@@ -251,48 +251,37 @@ static void __init sn_fixup_ionodes(void)
251 if (!hubdev->hdi_flush_nasid_list.widget_p) 251 if (!hubdev->hdi_flush_nasid_list.widget_p)
252 continue; 252 continue;
253 253
254 size = (HUB_WIDGET_ID_MAX + 1) *
255 sizeof(struct sn_flush_device_kernel *);
254 hubdev->hdi_flush_nasid_list.widget_p = 256 hubdev->hdi_flush_nasid_list.widget_p =
255 kmalloc((HUB_WIDGET_ID_MAX + 1) * 257 kzalloc(size, GFP_KERNEL);
256 sizeof(struct sn_flush_device_kernel *), 258 if (!hubdev->hdi_flush_nasid_list.widget_p)
257 GFP_KERNEL); 259 BUG();
258 memset(hubdev->hdi_flush_nasid_list.widget_p, 0x0,
259 (HUB_WIDGET_ID_MAX + 1) *
260 sizeof(struct sn_flush_device_kernel *));
261 260
262 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) { 261 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) {
263 sn_flush_device_kernel = kmalloc(DEV_PER_WIDGET * 262 size = DEV_PER_WIDGET *
264 sizeof(struct 263 sizeof(struct sn_flush_device_kernel);
265 sn_flush_device_kernel), 264 sn_flush_device_kernel = kzalloc(size, GFP_KERNEL);
266 GFP_KERNEL);
267 if (!sn_flush_device_kernel) 265 if (!sn_flush_device_kernel)
268 BUG(); 266 BUG();
269 memset(sn_flush_device_kernel, 0x0,
270 DEV_PER_WIDGET *
271 sizeof(struct sn_flush_device_kernel));
272 267
273 dev_entry = sn_flush_device_kernel; 268 dev_entry = sn_flush_device_kernel;
274 for (device = 0; device < DEV_PER_WIDGET; 269 for (device = 0; device < DEV_PER_WIDGET;
275 device++,dev_entry++) { 270 device++,dev_entry++) {
276 dev_entry->common = kmalloc(sizeof(struct 271 size = sizeof(struct sn_flush_device_common);
277 sn_flush_device_common), 272 dev_entry->common = kzalloc(size, GFP_KERNEL);
278 GFP_KERNEL);
279 if (!dev_entry->common) 273 if (!dev_entry->common)
280 BUG(); 274 BUG();
281 memset(dev_entry->common, 0x0, sizeof(struct
282 sn_flush_device_common));
283 275
284 if (sn_prom_feature_available( 276 if (sn_prom_feature_available(
285 PRF_DEVICE_FLUSH_LIST)) 277 PRF_DEVICE_FLUSH_LIST))
286 status = sal_get_device_dmaflush_list( 278 status = sal_get_device_dmaflush_list(
287 nasid, 279 nasid, widget, device,
288 widget, 280 (u64)(dev_entry->common));
289 device,
290 (u64)(dev_entry->common));
291 else 281 else
292 status = sn_device_fixup_war(nasid, 282 status = sn_device_fixup_war(nasid,
293 widget, 283 widget, device,
294 device, 284 dev_entry->common);
295 dev_entry->common);
296 if (status != SALRET_OK) 285 if (status != SALRET_OK)
297 panic("SAL call failed: %s\n", 286 panic("SAL call failed: %s\n",
298 ia64_sal_strerror(status)); 287 ia64_sal_strerror(status));
@@ -383,13 +372,12 @@ void sn_pci_fixup_slot(struct pci_dev *dev)
383 372
384 pci_dev_get(dev); /* for the sysdata pointer */ 373 pci_dev_get(dev); /* for the sysdata pointer */
385 pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL); 374 pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL);
386 if (pcidev_info <= 0) 375 if (!pcidev_info)
387 BUG(); /* Cannot afford to run out of memory */ 376 BUG(); /* Cannot afford to run out of memory */
388 377
389 sn_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_KERNEL); 378 sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
390 if (sn_irq_info <= 0) 379 if (!sn_irq_info)
391 BUG(); /* Cannot afford to run out of memory */ 380 BUG(); /* Cannot afford to run out of memory */
392 memset(sn_irq_info, 0, sizeof(struct sn_irq_info));
393 381
394 /* Call to retrieve pci device information needed by kernel. */ 382 /* Call to retrieve pci device information needed by kernel. */
395 status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number, 383 status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number,
@@ -482,13 +470,13 @@ void sn_pci_fixup_slot(struct pci_dev *dev)
482 */ 470 */
483void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus) 471void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
484{ 472{
485 int status = 0; 473 int status;
486 int nasid, cnode; 474 int nasid, cnode;
487 struct pci_controller *controller; 475 struct pci_controller *controller;
488 struct sn_pci_controller *sn_controller; 476 struct sn_pci_controller *sn_controller;
489 struct pcibus_bussoft *prom_bussoft_ptr; 477 struct pcibus_bussoft *prom_bussoft_ptr;
490 struct hubdev_info *hubdev_info; 478 struct hubdev_info *hubdev_info;
491 void *provider_soft = NULL; 479 void *provider_soft;
492 struct sn_pcibus_provider *provider; 480 struct sn_pcibus_provider *provider;
493 481
494 status = sal_get_pcibus_info((u64) segment, (u64) busnum, 482 status = sal_get_pcibus_info((u64) segment, (u64) busnum,
@@ -535,6 +523,8 @@ void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
535 bus->sysdata = controller; 523 bus->sysdata = controller;
536 if (provider->bus_fixup) 524 if (provider->bus_fixup)
537 provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr, controller); 525 provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr, controller);
526 else
527 provider_soft = NULL;
538 528
539 if (provider_soft == NULL) { 529 if (provider_soft == NULL) {
540 /* fixup failed or not applicable */ 530 /* fixup failed or not applicable */
@@ -638,13 +628,8 @@ void sn_bus_free_sysdata(void)
638 628
639static int __init sn_pci_init(void) 629static int __init sn_pci_init(void)
640{ 630{
641 int i = 0; 631 int i, j;
642 int j = 0;
643 struct pci_dev *pci_dev = NULL; 632 struct pci_dev *pci_dev = NULL;
644 extern void sn_init_cpei_timer(void);
645#ifdef CONFIG_PROC_FS
646 extern void register_sn_procfs(void);
647#endif
648 633
649 if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM()) 634 if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM())
650 return 0; 635 return 0;
@@ -700,32 +685,29 @@ static int __init sn_pci_init(void)
700 */ 685 */
701void hubdev_init_node(nodepda_t * npda, cnodeid_t node) 686void hubdev_init_node(nodepda_t * npda, cnodeid_t node)
702{ 687{
703
704 struct hubdev_info *hubdev_info; 688 struct hubdev_info *hubdev_info;
689 int size;
690 pg_data_t *pg;
691
692 size = sizeof(struct hubdev_info);
705 693
706 if (node >= num_online_nodes()) /* Headless/memless IO nodes */ 694 if (node >= num_online_nodes()) /* Headless/memless IO nodes */
707 hubdev_info = 695 pg = NODE_DATA(0);
708 (struct hubdev_info *)alloc_bootmem_node(NODE_DATA(0),
709 sizeof(struct
710 hubdev_info));
711 else 696 else
712 hubdev_info = 697 pg = NODE_DATA(node);
713 (struct hubdev_info *)alloc_bootmem_node(NODE_DATA(node),
714 sizeof(struct
715 hubdev_info));
716 npda->pdinfo = (void *)hubdev_info;
717 698
699 hubdev_info = (struct hubdev_info *)alloc_bootmem_node(pg, size);
700
701 npda->pdinfo = (void *)hubdev_info;
718} 702}
719 703
720geoid_t 704geoid_t
721cnodeid_get_geoid(cnodeid_t cnode) 705cnodeid_get_geoid(cnodeid_t cnode)
722{ 706{
723
724 struct hubdev_info *hubdev; 707 struct hubdev_info *hubdev;
725 708
726 hubdev = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo); 709 hubdev = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
727 return hubdev->hdi_geoid; 710 return hubdev->hdi_geoid;
728
729} 711}
730 712
731subsys_initcall(sn_pci_init); 713subsys_initcall(sn_pci_init);
@@ -734,3 +716,4 @@ EXPORT_SYMBOL(sn_pci_unfixup_slot);
734EXPORT_SYMBOL(sn_pci_controller_fixup); 716EXPORT_SYMBOL(sn_pci_controller_fixup);
735EXPORT_SYMBOL(sn_bus_store_sysdata); 717EXPORT_SYMBOL(sn_bus_store_sysdata);
736EXPORT_SYMBOL(sn_bus_free_sysdata); 718EXPORT_SYMBOL(sn_bus_free_sysdata);
719EXPORT_SYMBOL(sn_pcidev_info_get);
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 48645ac120fc..5b84836c2171 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -75,7 +75,7 @@ EXPORT_SYMBOL(sn_rtc_cycles_per_second);
75DEFINE_PER_CPU(struct sn_hub_info_s, __sn_hub_info); 75DEFINE_PER_CPU(struct sn_hub_info_s, __sn_hub_info);
76EXPORT_PER_CPU_SYMBOL(__sn_hub_info); 76EXPORT_PER_CPU_SYMBOL(__sn_hub_info);
77 77
78DEFINE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_NUMNODES]); 78DEFINE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_COMPACT_NODES]);
79EXPORT_PER_CPU_SYMBOL(__sn_cnodeid_to_nasid); 79EXPORT_PER_CPU_SYMBOL(__sn_cnodeid_to_nasid);
80 80
81DEFINE_PER_CPU(struct nodepda_s *, __sn_nodepda); 81DEFINE_PER_CPU(struct nodepda_s *, __sn_nodepda);
@@ -317,6 +317,7 @@ struct pcdp_vga_device {
317#define PCDP_PCI_TRANS_IOPORT 0x02 317#define PCDP_PCI_TRANS_IOPORT 0x02
318#define PCDP_PCI_TRANS_MMIO 0x01 318#define PCDP_PCI_TRANS_MMIO 0x01
319 319
320#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
320static void 321static void
321sn_scan_pcdp(void) 322sn_scan_pcdp(void)
322{ 323{
@@ -358,6 +359,7 @@ sn_scan_pcdp(void)
358 break; /* once we find the primary, we're done */ 359 break; /* once we find the primary, we're done */
359 } 360 }
360} 361}
362#endif
361 363
362static unsigned long sn2_rtc_initial; 364static unsigned long sn2_rtc_initial;
363 365
diff --git a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
index 81c63b2f8ae9..6ae276d5d50c 100644
--- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c
+++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.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) 1999,2001-2004 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (C) 1999,2001-2004, 2006 Silicon Graphics, Inc. All Rights Reserved.
7 * 7 *
8 * Module to export the system's Firmware Interface Tables, including 8 * Module to export the system's Firmware Interface Tables, including
9 * PROM revision numbers and banners, in /proc 9 * PROM revision numbers and banners, in /proc
@@ -190,7 +190,7 @@ static int
190read_version_entry(char *page, char **start, off_t off, int count, int *eof, 190read_version_entry(char *page, char **start, off_t off, int count, int *eof,
191 void *data) 191 void *data)
192{ 192{
193 int len = 0; 193 int len;
194 194
195 /* data holds the NASID of the node */ 195 /* data holds the NASID of the node */
196 len = dump_version(page, (unsigned long)data); 196 len = dump_version(page, (unsigned long)data);
@@ -202,7 +202,7 @@ static int
202read_fit_entry(char *page, char **start, off_t off, int count, int *eof, 202read_fit_entry(char *page, char **start, off_t off, int count, int *eof,
203 void *data) 203 void *data)
204{ 204{
205 int len = 0; 205 int len;
206 206
207 /* data holds the NASID of the node */ 207 /* data holds the NASID of the node */
208 len = dump_fit(page, (unsigned long)data); 208 len = dump_fit(page, (unsigned long)data);
@@ -229,13 +229,16 @@ int __init prominfo_init(void)
229 struct proc_dir_entry *p; 229 struct proc_dir_entry *p;
230 cnodeid_t cnodeid; 230 cnodeid_t cnodeid;
231 unsigned long nasid; 231 unsigned long nasid;
232 int size;
232 char name[NODE_NAME_LEN]; 233 char name[NODE_NAME_LEN];
233 234
234 if (!ia64_platform_is("sn2")) 235 if (!ia64_platform_is("sn2"))
235 return 0; 236 return 0;
236 237
237 proc_entries = kmalloc(num_online_nodes() * sizeof(struct proc_dir_entry *), 238 size = num_online_nodes() * sizeof(struct proc_dir_entry *);
238 GFP_KERNEL); 239 proc_entries = kzalloc(size, GFP_KERNEL);
240 if (!proc_entries)
241 return -ENOMEM;
239 242
240 sgi_prominfo_entry = proc_mkdir("sgi_prominfo", NULL); 243 sgi_prominfo_entry = proc_mkdir("sgi_prominfo", NULL);
241 244
@@ -244,14 +247,12 @@ int __init prominfo_init(void)
244 sprintf(name, "node%d", cnodeid); 247 sprintf(name, "node%d", cnodeid);
245 *entp = proc_mkdir(name, sgi_prominfo_entry); 248 *entp = proc_mkdir(name, sgi_prominfo_entry);
246 nasid = cnodeid_to_nasid(cnodeid); 249 nasid = cnodeid_to_nasid(cnodeid);
247 p = create_proc_read_entry( 250 p = create_proc_read_entry("fit", 0, *entp, read_fit_entry,
248 "fit", 0, *entp, read_fit_entry, 251 (void *)nasid);
249 (void *)nasid);
250 if (p) 252 if (p)
251 p->owner = THIS_MODULE; 253 p->owner = THIS_MODULE;
252 p = create_proc_read_entry( 254 p = create_proc_read_entry("version", 0, *entp,
253 "version", 0, *entp, read_version_entry, 255 read_version_entry, (void *)nasid);
254 (void *)nasid);
255 if (p) 256 if (p)
256 p->owner = THIS_MODULE; 257 p->owner = THIS_MODULE;
257 entp++; 258 entp++;
@@ -263,7 +264,7 @@ int __init prominfo_init(void)
263void __exit prominfo_exit(void) 264void __exit prominfo_exit(void)
264{ 265{
265 struct proc_dir_entry **entp; 266 struct proc_dir_entry **entp;
266 unsigned cnodeid; 267 unsigned int cnodeid;
267 char name[NODE_NAME_LEN]; 268 char name[NODE_NAME_LEN];
268 269
269 entp = proc_entries; 270 entp = proc_entries;
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index f153a4c35c70..24eefb2fc55f 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -46,8 +46,14 @@ 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, short, int, volatile unsigned long *, unsigned long, 49extern unsigned long
50 volatile unsigned long *, unsigned long); 50sn2_ptc_deadlock_recovery_core(volatile unsigned long *, unsigned long,
51 volatile unsigned long *, unsigned long,
52 volatile unsigned long *, unsigned long);
53void
54sn2_ptc_deadlock_recovery(short *, short, short, int,
55 volatile unsigned long *, unsigned long,
56 volatile unsigned long *, unsigned long);
51 57
52/* 58/*
53 * Note: some is the following is captured here to make degugging easier 59 * Note: some is the following is captured here to make degugging easier
@@ -59,16 +65,6 @@ void sn2_ptc_deadlock_recovery(short *, short, short, int, volatile unsigned lon
59#define reset_max_active_on_deadlock() 1 65#define reset_max_active_on_deadlock() 1
60#define PTC_LOCK(sh1) ((sh1) ? &sn2_global_ptc_lock : &sn_nodepda->ptc_lock) 66#define PTC_LOCK(sh1) ((sh1) ? &sn2_global_ptc_lock : &sn_nodepda->ptc_lock)
61 67
62static inline void ptc_lock(int sh1, unsigned long *flagp)
63{
64 spin_lock_irqsave(PTC_LOCK(sh1), *flagp);
65}
66
67static inline void ptc_unlock(int sh1, unsigned long flags)
68{
69 spin_unlock_irqrestore(PTC_LOCK(sh1), flags);
70}
71
72struct ptc_stats { 68struct ptc_stats {
73 unsigned long ptc_l; 69 unsigned long ptc_l;
74 unsigned long change_rid; 70 unsigned long change_rid;
@@ -82,6 +78,8 @@ struct ptc_stats {
82 unsigned long shub_ptc_flushes_not_my_mm; 78 unsigned long shub_ptc_flushes_not_my_mm;
83}; 79};
84 80
81#define sn2_ptctest 0
82
85static inline unsigned long wait_piowc(void) 83static inline unsigned long wait_piowc(void)
86{ 84{
87 volatile unsigned long *piows; 85 volatile unsigned long *piows;
@@ -200,7 +198,7 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
200 max_active = max_active_pio(shub1); 198 max_active = max_active_pio(shub1);
201 199
202 itc = ia64_get_itc(); 200 itc = ia64_get_itc();
203 ptc_lock(shub1, &flags); 201 spin_lock_irqsave(PTC_LOCK(shub1), flags);
204 itc2 = ia64_get_itc(); 202 itc2 = ia64_get_itc();
205 203
206 __get_cpu_var(ptcstats).lock_itc_clocks += itc2 - itc; 204 __get_cpu_var(ptcstats).lock_itc_clocks += itc2 - itc;
@@ -258,7 +256,7 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
258 ia64_srlz_d(); 256 ia64_srlz_d();
259 } 257 }
260 258
261 ptc_unlock(shub1, flags); 259 spin_unlock_irqrestore(PTC_LOCK(shub1), flags);
262 260
263 preempt_enable(); 261 preempt_enable();
264} 262}
@@ -270,11 +268,12 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
270 * TLB flush transaction. The recovery sequence is somewhat tricky & is 268 * TLB flush transaction. The recovery sequence is somewhat tricky & is
271 * coded in assembly language. 269 * coded in assembly language.
272 */ 270 */
273void sn2_ptc_deadlock_recovery(short *nasids, short ib, short ie, int mynasid, volatile unsigned long *ptc0, unsigned long data0, 271
274 volatile unsigned long *ptc1, unsigned long data1) 272void
273sn2_ptc_deadlock_recovery(short *nasids, short ib, short ie, int mynasid,
274 volatile unsigned long *ptc0, unsigned long data0,
275 volatile unsigned long *ptc1, unsigned long data1)
275{ 276{
276 extern unsigned long sn2_ptc_deadlock_recovery_core(volatile unsigned long *, unsigned long,
277 volatile unsigned long *, unsigned long, volatile unsigned long *, unsigned long);
278 short nasid, i; 277 short nasid, i;
279 unsigned long *piows, zeroval, n; 278 unsigned long *piows, zeroval, n;
280 279
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index a06719d752a0..c686d9c12f7b 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -6,11 +6,11 @@
6 * Copyright (C) 2000-2005 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 2000-2005 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8#include <linux/config.h> 8#include <linux/config.h>
9#include <asm/uaccess.h>
10 9
11#ifdef CONFIG_PROC_FS 10#ifdef CONFIG_PROC_FS
12#include <linux/proc_fs.h> 11#include <linux/proc_fs.h>
13#include <linux/seq_file.h> 12#include <linux/seq_file.h>
13#include <asm/uaccess.h>
14#include <asm/sn/sn_sal.h> 14#include <asm/sn/sn_sal.h>
15 15
16static int partition_id_show(struct seq_file *s, void *p) 16static int partition_id_show(struct seq_file *s, void *p)
@@ -90,10 +90,10 @@ static int coherence_id_open(struct inode *inode, struct file *file)
90 return single_open(file, coherence_id_show, NULL); 90 return single_open(file, coherence_id_show, NULL);
91} 91}
92 92
93static struct proc_dir_entry *sn_procfs_create_entry( 93static struct proc_dir_entry
94 const char *name, struct proc_dir_entry *parent, 94*sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent,
95 int (*openfunc)(struct inode *, struct file *), 95 int (*openfunc)(struct inode *, struct file *),
96 int (*releasefunc)(struct inode *, struct file *)) 96 int (*releasefunc)(struct inode *, struct file *))
97{ 97{
98 struct proc_dir_entry *e = create_proc_entry(name, 0444, parent); 98 struct proc_dir_entry *e = create_proc_entry(name, 0444, parent);
99 99
@@ -126,24 +126,24 @@ void register_sn_procfs(void)
126 return; 126 return;
127 127
128 sn_procfs_create_entry("partition_id", sgi_proc_dir, 128 sn_procfs_create_entry("partition_id", sgi_proc_dir,
129 partition_id_open, single_release); 129 partition_id_open, single_release);
130 130
131 sn_procfs_create_entry("system_serial_number", sgi_proc_dir, 131 sn_procfs_create_entry("system_serial_number", sgi_proc_dir,
132 system_serial_number_open, single_release); 132 system_serial_number_open, single_release);
133 133
134 sn_procfs_create_entry("licenseID", sgi_proc_dir, 134 sn_procfs_create_entry("licenseID", sgi_proc_dir,
135 licenseID_open, single_release); 135 licenseID_open, single_release);
136 136
137 e = sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir, 137 e = sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir,
138 sn_force_interrupt_open, single_release); 138 sn_force_interrupt_open, single_release);
139 if (e) 139 if (e)
140 e->proc_fops->write = sn_force_interrupt_write_proc; 140 e->proc_fops->write = sn_force_interrupt_write_proc;
141 141
142 sn_procfs_create_entry("coherence_id", sgi_proc_dir, 142 sn_procfs_create_entry("coherence_id", sgi_proc_dir,
143 coherence_id_open, single_release); 143 coherence_id_open, single_release);
144 144
145 sn_procfs_create_entry("sn_topology", sgi_proc_dir, 145 sn_procfs_create_entry("sn_topology", sgi_proc_dir,
146 sn_topology_open, sn_topology_release); 146 sn_topology_open, sn_topology_release);
147} 147}
148 148
149#endif /* CONFIG_PROC_FS */ 149#endif /* CONFIG_PROC_FS */
diff --git a/arch/ia64/sn/kernel/sn2/timer.c b/arch/ia64/sn/kernel/sn2/timer.c
index deb9baf4d473..56a88b6df4b4 100644
--- a/arch/ia64/sn/kernel/sn2/timer.c
+++ b/arch/ia64/sn/kernel/sn2/timer.c
@@ -14,6 +14,7 @@
14 14
15#include <asm/hw_irq.h> 15#include <asm/hw_irq.h>
16#include <asm/system.h> 16#include <asm/system.h>
17#include <asm/timex.h>
17 18
18#include <asm/sn/leds.h> 19#include <asm/sn/leds.h>
19#include <asm/sn/shub_mmr.h> 20#include <asm/sn/shub_mmr.h>
@@ -28,9 +29,27 @@ static struct time_interpolator sn2_interpolator = {
28 .source = TIME_SOURCE_MMIO64 29 .source = TIME_SOURCE_MMIO64
29}; 30};
30 31
32/*
33 * sn udelay uses the RTC instead of the ITC because the ITC is not
34 * synchronized across all CPUs, and the thread may migrate to another CPU
35 * if preemption is enabled.
36 */
37static void
38ia64_sn_udelay (unsigned long usecs)
39{
40 unsigned long start = rtc_time();
41 unsigned long end = start +
42 usecs * sn_rtc_cycles_per_second / 1000000;
43
44 while (time_before((unsigned long)rtc_time(), end))
45 cpu_relax();
46}
47
31void __init sn_timer_init(void) 48void __init sn_timer_init(void)
32{ 49{
33 sn2_interpolator.frequency = sn_rtc_cycles_per_second; 50 sn2_interpolator.frequency = sn_rtc_cycles_per_second;
34 sn2_interpolator.addr = RTC_COUNTER_ADDR; 51 sn2_interpolator.addr = RTC_COUNTER_ADDR;
35 register_time_interpolator(&sn2_interpolator); 52 register_time_interpolator(&sn2_interpolator);
53
54 ia64_udelay = &ia64_sn_udelay;
36} 55}
diff --git a/arch/ia64/sn/kernel/sn2/timer_interrupt.c b/arch/ia64/sn/kernel/sn2/timer_interrupt.c
index adf5db2e2afe..fa7f69945917 100644
--- a/arch/ia64/sn/kernel/sn2/timer_interrupt.c
+++ b/arch/ia64/sn/kernel/sn2/timer_interrupt.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * 2 *
3 * 3 *
4 * Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved. 4 * Copyright (c) 2005, 2006 Silicon Graphics, Inc. All Rights Reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License 7 * under the terms of version 2 of the GNU General Public License
@@ -22,11 +22,6 @@
22 * License along with this program; if not, write the Free Software 22 * License along with this program; if not, write the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
24 * 24 *
25 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
26 * Mountain View, CA 94043, or:
27 *
28 * http://www.sgi.com
29 *
30 * For further information regarding this notice, see: 25 * For further information regarding this notice, see:
31 * 26 *
32 * http://oss.sgi.com/projects/GenInfo/NoticeExplan 27 * http://oss.sgi.com/projects/GenInfo/NoticeExplan
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index d263d3e8fbb9..8a56f8b5ffa2 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -284,12 +284,10 @@ struct sn_irq_info *tiocx_irq_alloc(nasid_t nasid, int widget, int irq,
284 if ((nasid & 1) == 0) 284 if ((nasid & 1) == 0)
285 return NULL; 285 return NULL;
286 286
287 sn_irq_info = kmalloc(sn_irq_size, GFP_KERNEL); 287 sn_irq_info = kzalloc(sn_irq_size, GFP_KERNEL);
288 if (sn_irq_info == NULL) 288 if (sn_irq_info == NULL)
289 return NULL; 289 return NULL;
290 290
291 memset(sn_irq_info, 0x0, sn_irq_size);
292
293 status = tiocx_intr_alloc(nasid, widget, __pa(sn_irq_info), irq, 291 status = tiocx_intr_alloc(nasid, widget, __pa(sn_irq_info), irq,
294 req_nasid, slice); 292 req_nasid, slice);
295 if (status) { 293 if (status) {
diff --git a/arch/ia64/sn/kernel/xpc_channel.c b/arch/ia64/sn/kernel/xpc_channel.c
index 36e5437a0fb6..cdf6856ce089 100644
--- a/arch/ia64/sn/kernel/xpc_channel.c
+++ b/arch/ia64/sn/kernel/xpc_channel.c
@@ -738,7 +738,9 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
738 738
739 /* make sure all activity has settled down first */ 739 /* make sure all activity has settled down first */
740 740
741 if (atomic_read(&ch->references) > 0) { 741 if (atomic_read(&ch->references) > 0 ||
742 ((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) &&
743 !(ch->flags & XPC_C_DISCONNECTINGCALLOUT_MADE))) {
742 return; 744 return;
743 } 745 }
744 DBUG_ON(atomic_read(&ch->kthreads_assigned) != 0); 746 DBUG_ON(atomic_read(&ch->kthreads_assigned) != 0);
@@ -775,7 +777,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
775 777
776 /* both sides are disconnected now */ 778 /* both sides are disconnected now */
777 779
778 if (ch->flags & XPC_C_CONNECTCALLOUT) { 780 if (ch->flags & XPC_C_DISCONNECTINGCALLOUT_MADE) {
779 spin_unlock_irqrestore(&ch->lock, *irq_flags); 781 spin_unlock_irqrestore(&ch->lock, *irq_flags);
780 xpc_disconnect_callout(ch, xpcDisconnected); 782 xpc_disconnect_callout(ch, xpcDisconnected);
781 spin_lock_irqsave(&ch->lock, *irq_flags); 783 spin_lock_irqsave(&ch->lock, *irq_flags);
@@ -1300,7 +1302,7 @@ xpc_process_msg_IPI(struct xpc_partition *part, int ch_number)
1300 "delivered=%d, partid=%d, channel=%d\n", 1302 "delivered=%d, partid=%d, channel=%d\n",
1301 nmsgs_sent, ch->partid, ch->number); 1303 nmsgs_sent, ch->partid, ch->number);
1302 1304
1303 if (ch->flags & XPC_C_CONNECTCALLOUT) { 1305 if (ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) {
1304 xpc_activate_kthreads(ch, nmsgs_sent); 1306 xpc_activate_kthreads(ch, nmsgs_sent);
1305 } 1307 }
1306 } 1308 }
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index 9cd460dfe27e..8cbf16432570 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -750,12 +750,16 @@ xpc_daemonize_kthread(void *args)
750 /* let registerer know that connection has been established */ 750 /* let registerer know that connection has been established */
751 751
752 spin_lock_irqsave(&ch->lock, irq_flags); 752 spin_lock_irqsave(&ch->lock, irq_flags);
753 if (!(ch->flags & XPC_C_CONNECTCALLOUT)) { 753 if (!(ch->flags & XPC_C_CONNECTEDCALLOUT)) {
754 ch->flags |= XPC_C_CONNECTCALLOUT; 754 ch->flags |= XPC_C_CONNECTEDCALLOUT;
755 spin_unlock_irqrestore(&ch->lock, irq_flags); 755 spin_unlock_irqrestore(&ch->lock, irq_flags);
756 756
757 xpc_connected_callout(ch); 757 xpc_connected_callout(ch);
758 758
759 spin_lock_irqsave(&ch->lock, irq_flags);
760 ch->flags |= XPC_C_CONNECTEDCALLOUT_MADE;
761 spin_unlock_irqrestore(&ch->lock, irq_flags);
762
759 /* 763 /*
760 * It is possible that while the callout was being 764 * It is possible that while the callout was being
761 * made that the remote partition sent some messages. 765 * made that the remote partition sent some messages.
@@ -777,15 +781,17 @@ xpc_daemonize_kthread(void *args)
777 781
778 if (atomic_dec_return(&ch->kthreads_assigned) == 0) { 782 if (atomic_dec_return(&ch->kthreads_assigned) == 0) {
779 spin_lock_irqsave(&ch->lock, irq_flags); 783 spin_lock_irqsave(&ch->lock, irq_flags);
780 if ((ch->flags & XPC_C_CONNECTCALLOUT) && 784 if ((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) &&
781 !(ch->flags & XPC_C_DISCONNECTCALLOUT)) { 785 !(ch->flags & XPC_C_DISCONNECTINGCALLOUT)) {
782 ch->flags |= XPC_C_DISCONNECTCALLOUT; 786 ch->flags |= XPC_C_DISCONNECTINGCALLOUT;
783 spin_unlock_irqrestore(&ch->lock, irq_flags); 787 spin_unlock_irqrestore(&ch->lock, irq_flags);
784 788
785 xpc_disconnect_callout(ch, xpcDisconnecting); 789 xpc_disconnect_callout(ch, xpcDisconnecting);
786 } else { 790
787 spin_unlock_irqrestore(&ch->lock, irq_flags); 791 spin_lock_irqsave(&ch->lock, irq_flags);
792 ch->flags |= XPC_C_DISCONNECTINGCALLOUT_MADE;
788 } 793 }
794 spin_unlock_irqrestore(&ch->lock, irq_flags);
789 if (atomic_dec_return(&part->nchannels_engaged) == 0) { 795 if (atomic_dec_return(&part->nchannels_engaged) == 0) {
790 xpc_mark_partition_disengaged(part); 796 xpc_mark_partition_disengaged(part);
791 xpc_IPI_send_disengage(part); 797 xpc_IPI_send_disengage(part);
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index 5a36292388eb..b4b84c269210 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -335,10 +335,10 @@ int sn_pci_legacy_read(struct pci_bus *bus, u16 port, u32 *val, u8 size)
335 */ 335 */
336 336
337 SAL_CALL(isrv, SN_SAL_IOIF_PCI_SAFE, 337 SAL_CALL(isrv, SN_SAL_IOIF_PCI_SAFE,
338 pci_domain_nr(bus), bus->number, 338 pci_domain_nr(bus), bus->number,
339 0, /* io */ 339 0, /* io */
340 0, /* read */ 340 0, /* read */
341 port, size, __pa(val)); 341 port, size, __pa(val));
342 342
343 if (isrv.status == 0) 343 if (isrv.status == 0)
344 return size; 344 return size;
@@ -381,10 +381,10 @@ int sn_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size)
381 */ 381 */
382 382
383 SAL_CALL(isrv, SN_SAL_IOIF_PCI_SAFE, 383 SAL_CALL(isrv, SN_SAL_IOIF_PCI_SAFE,
384 pci_domain_nr(bus), bus->number, 384 pci_domain_nr(bus), bus->number,
385 0, /* io */ 385 0, /* io */
386 1, /* write */ 386 1, /* write */
387 port, size, __pa(&val)); 387 port, size, __pa(&val));
388 388
389 if (isrv.status == 0) 389 if (isrv.status == 0)
390 return size; 390 return size;
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_ate.c b/arch/ia64/sn/pci/pcibr/pcibr_ate.c
index aa3fa5152a32..1f0253bfe0a0 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_ate.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_ate.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) 2001-2004 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 2001-2006 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8 8
9#include <linux/types.h> 9#include <linux/types.h>
@@ -12,7 +12,7 @@
12#include <asm/sn/pcibus_provider_defs.h> 12#include <asm/sn/pcibus_provider_defs.h>
13#include <asm/sn/pcidev.h> 13#include <asm/sn/pcidev.h>
14 14
15int pcibr_invalidate_ate = 0; /* by default don't invalidate ATE on free */ 15int pcibr_invalidate_ate; /* by default don't invalidate ATE on free */
16 16
17/* 17/*
18 * mark_ate: Mark the ate as either free or inuse. 18 * mark_ate: Mark the ate as either free or inuse.
@@ -20,14 +20,12 @@ int pcibr_invalidate_ate = 0; /* by default don't invalidate ATE on free */
20static void mark_ate(struct ate_resource *ate_resource, int start, int number, 20static void mark_ate(struct ate_resource *ate_resource, int start, int number,
21 u64 value) 21 u64 value)
22{ 22{
23
24 u64 *ate = ate_resource->ate; 23 u64 *ate = ate_resource->ate;
25 int index; 24 int index;
26 int length = 0; 25 int length = 0;
27 26
28 for (index = start; length < number; index++, length++) 27 for (index = start; length < number; index++, length++)
29 ate[index] = value; 28 ate[index] = value;
30
31} 29}
32 30
33/* 31/*
@@ -37,7 +35,6 @@ static void mark_ate(struct ate_resource *ate_resource, int start, int number,
37static int find_free_ate(struct ate_resource *ate_resource, int start, 35static int find_free_ate(struct ate_resource *ate_resource, int start,
38 int count) 36 int count)
39{ 37{
40
41 u64 *ate = ate_resource->ate; 38 u64 *ate = ate_resource->ate;
42 int index; 39 int index;
43 int start_free; 40 int start_free;
@@ -70,12 +67,10 @@ static int find_free_ate(struct ate_resource *ate_resource, int start,
70static inline void free_ate_resource(struct ate_resource *ate_resource, 67static inline void free_ate_resource(struct ate_resource *ate_resource,
71 int start) 68 int start)
72{ 69{
73
74 mark_ate(ate_resource, start, ate_resource->ate[start], 0); 70 mark_ate(ate_resource, start, ate_resource->ate[start], 0);
75 if ((ate_resource->lowest_free_index > start) || 71 if ((ate_resource->lowest_free_index > start) ||
76 (ate_resource->lowest_free_index < 0)) 72 (ate_resource->lowest_free_index < 0))
77 ate_resource->lowest_free_index = start; 73 ate_resource->lowest_free_index = start;
78
79} 74}
80 75
81/* 76/*
@@ -84,7 +79,6 @@ static inline void free_ate_resource(struct ate_resource *ate_resource,
84static inline int alloc_ate_resource(struct ate_resource *ate_resource, 79static inline int alloc_ate_resource(struct ate_resource *ate_resource,
85 int ate_needed) 80 int ate_needed)
86{ 81{
87
88 int start_index; 82 int start_index;
89 83
90 /* 84 /*
@@ -118,19 +112,12 @@ static inline int alloc_ate_resource(struct ate_resource *ate_resource,
118 */ 112 */
119int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count) 113int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count)
120{ 114{
121 int status = 0; 115 int status;
122 u64 flag; 116 unsigned long flags;
123 117
124 flag = pcibr_lock(pcibus_info); 118 spin_lock_irqsave(&pcibus_info->pbi_lock, flags);
125 status = alloc_ate_resource(&pcibus_info->pbi_int_ate_resource, count); 119 status = alloc_ate_resource(&pcibus_info->pbi_int_ate_resource, count);
126 120 spin_unlock_irqrestore(&pcibus_info->pbi_lock, flags);
127 if (status < 0) {
128 /* Failed to allocate */
129 pcibr_unlock(pcibus_info, flag);
130 return -1;
131 }
132
133 pcibr_unlock(pcibus_info, flag);
134 121
135 return status; 122 return status;
136} 123}
@@ -182,7 +169,7 @@ void pcibr_ate_free(struct pcibus_info *pcibus_info, int index)
182 ate_write(pcibus_info, index, count, (ate & ~PCI32_ATE_V)); 169 ate_write(pcibus_info, index, count, (ate & ~PCI32_ATE_V));
183 } 170 }
184 171
185 flags = pcibr_lock(pcibus_info); 172 spin_lock_irqsave(&pcibus_info->pbi_lock, flags);
186 free_ate_resource(&pcibus_info->pbi_int_ate_resource, index); 173 free_ate_resource(&pcibus_info->pbi_int_ate_resource, index);
187 pcibr_unlock(pcibus_info, flags); 174 spin_unlock_irqrestore(&pcibus_info->pbi_lock, flags);
188} 175}
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index 54ce5b7ceed2..9f86bb6519aa 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -137,14 +137,12 @@ pcibr_dmatrans_direct64(struct pcidev_info * info, u64 paddr,
137 pci_addr |= PCI64_ATTR_VIRTUAL; 137 pci_addr |= PCI64_ATTR_VIRTUAL;
138 138
139 return pci_addr; 139 return pci_addr;
140
141} 140}
142 141
143static dma_addr_t 142static dma_addr_t
144pcibr_dmatrans_direct32(struct pcidev_info * info, 143pcibr_dmatrans_direct32(struct pcidev_info * info,
145 u64 paddr, size_t req_size, u64 flags) 144 u64 paddr, size_t req_size, u64 flags)
146{ 145{
147
148 struct pcidev_info *pcidev_info = info->pdi_host_pcidev_info; 146 struct pcidev_info *pcidev_info = info->pdi_host_pcidev_info;
149 struct pcibus_info *pcibus_info = (struct pcibus_info *)pcidev_info-> 147 struct pcibus_info *pcibus_info = (struct pcibus_info *)pcidev_info->
150 pdi_pcibus_info; 148 pdi_pcibus_info;
@@ -171,7 +169,6 @@ pcibr_dmatrans_direct32(struct pcidev_info * info,
171 } 169 }
172 170
173 return PCI32_DIRECT_BASE | offset; 171 return PCI32_DIRECT_BASE | offset;
174
175} 172}
176 173
177/* 174/*
@@ -218,9 +215,8 @@ void sn_dma_flush(u64 addr)
218 u64 flags; 215 u64 flags;
219 u64 itte; 216 u64 itte;
220 struct hubdev_info *hubinfo; 217 struct hubdev_info *hubinfo;
221 volatile struct sn_flush_device_kernel *p; 218 struct sn_flush_device_kernel *p;
222 volatile struct sn_flush_device_common *common; 219 struct sn_flush_device_common *common;
223
224 struct sn_flush_nasid_entry *flush_nasid_list; 220 struct sn_flush_nasid_entry *flush_nasid_list;
225 221
226 if (!sn_ioif_inited) 222 if (!sn_ioif_inited)
@@ -310,8 +306,7 @@ void sn_dma_flush(u64 addr)
310 (common->sfdl_slot - 1)); 306 (common->sfdl_slot - 1));
311 } 307 }
312 } else { 308 } else {
313 spin_lock_irqsave((spinlock_t *)&p->sfdl_flush_lock, 309 spin_lock_irqsave(&p->sfdl_flush_lock, flags);
314 flags);
315 *common->sfdl_flush_addr = 0; 310 *common->sfdl_flush_addr = 0;
316 311
317 /* force an interrupt. */ 312 /* force an interrupt. */
@@ -322,8 +317,7 @@ void sn_dma_flush(u64 addr)
322 cpu_relax(); 317 cpu_relax();
323 318
324 /* okay, everything is synched up. */ 319 /* okay, everything is synched up. */
325 spin_unlock_irqrestore((spinlock_t *)&p->sfdl_flush_lock, 320 spin_unlock_irqrestore(&p->sfdl_flush_lock, flags);
326 flags);
327 } 321 }
328 return; 322 return;
329} 323}
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
index 2fac27049bf6..98f716bd92f0 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
@@ -163,9 +163,12 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
163 /* Setup the PMU ATE map */ 163 /* Setup the PMU ATE map */
164 soft->pbi_int_ate_resource.lowest_free_index = 0; 164 soft->pbi_int_ate_resource.lowest_free_index = 0;
165 soft->pbi_int_ate_resource.ate = 165 soft->pbi_int_ate_resource.ate =
166 kmalloc(soft->pbi_int_ate_size * sizeof(u64), GFP_KERNEL); 166 kzalloc(soft->pbi_int_ate_size * sizeof(u64), GFP_KERNEL);
167 memset(soft->pbi_int_ate_resource.ate, 0, 167
168 (soft->pbi_int_ate_size * sizeof(u64))); 168 if (!soft->pbi_int_ate_resource.ate) {
169 kfree(soft);
170 return NULL;
171 }
169 172
170 if (prom_bussoft->bs_asic_type == PCIIO_ASIC_TYPE_TIOCP) { 173 if (prom_bussoft->bs_asic_type == PCIIO_ASIC_TYPE_TIOCP) {
171 /* TIO PCI Bridge: find nearest node with CPUs */ 174 /* TIO PCI Bridge: find nearest node with CPUs */
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index fe55b28d3725..670cb49210af 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -29,28 +29,7 @@
29 29
30/* 30/*
31 * sys_tas() - test-and-set 31 * sys_tas() - test-and-set
32 * linuxthreads testing version
33 */ 32 */
34#ifndef CONFIG_SMP
35asmlinkage int sys_tas(int *addr)
36{
37 int oldval;
38 unsigned long flags;
39
40 if (!access_ok(VERIFY_WRITE, addr, sizeof (int)))
41 return -EFAULT;
42 local_irq_save(flags);
43 oldval = *addr;
44 if (!oldval)
45 *addr = 1;
46 local_irq_restore(flags);
47 return oldval;
48}
49#else /* CONFIG_SMP */
50#include <linux/spinlock.h>
51
52static DEFINE_SPINLOCK(tas_lock);
53
54asmlinkage int sys_tas(int *addr) 33asmlinkage int sys_tas(int *addr)
55{ 34{
56 int oldval; 35 int oldval;
@@ -58,15 +37,43 @@ asmlinkage int sys_tas(int *addr)
58 if (!access_ok(VERIFY_WRITE, addr, sizeof (int))) 37 if (!access_ok(VERIFY_WRITE, addr, sizeof (int)))
59 return -EFAULT; 38 return -EFAULT;
60 39
61 _raw_spin_lock(&tas_lock); 40 /* atomic operation:
62 oldval = *addr; 41 * oldval = *addr; *addr = 1;
63 if (!oldval) 42 */
64 *addr = 1; 43 __asm__ __volatile__ (
65 _raw_spin_unlock(&tas_lock); 44 DCACHE_CLEAR("%0", "r4", "%1")
45 " .fillinsn\n"
46 "1:\n"
47 " lock %0, @%1 -> unlock %2, @%1\n"
48 "2:\n"
49 /* NOTE:
50 * The m32r processor can accept interrupts only
51 * at the 32-bit instruction boundary.
52 * So, in the above code, the "unlock" instruction
53 * can be executed continuously after the "lock"
54 * instruction execution without any interruptions.
55 */
56 ".section .fixup,\"ax\"\n"
57 " .balign 4\n"
58 "3: ldi %0, #%3\n"
59 " seth r14, #high(2b)\n"
60 " or3 r14, r14, #low(2b)\n"
61 " jmp r14\n"
62 ".previous\n"
63 ".section __ex_table,\"a\"\n"
64 " .balign 4\n"
65 " .long 1b,3b\n"
66 ".previous\n"
67 : "=&r" (oldval)
68 : "r" (addr), "r" (1), "i"(-EFAULT)
69 : "r14", "memory"
70#ifdef CONFIG_CHIP_M32700_TS1
71 , "r4"
72#endif /* CONFIG_CHIP_M32700_TS1 */
73 );
66 74
67 return oldval; 75 return oldval;
68} 76}
69#endif /* CONFIG_SMP */
70 77
71/* 78/*
72 * sys_pipe() is the normal C calling standard for creating 79 * sys_pipe() is the normal C calling standard for creating
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 96b919828053..8849439e88dd 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -21,6 +21,10 @@ config GENERIC_CALIBRATE_DELAY
21 bool 21 bool
22 default y 22 default y
23 23
24config TIME_LOW_RES
25 bool
26 default y
27
24config ARCH_MAY_HAVE_PC_FDC 28config ARCH_MAY_HAVE_PC_FDC
25 bool 29 bool
26 depends on Q40 || (BROKEN && SUN3X) 30 depends on Q40 || (BROKEN && SUN3X)
diff --git a/arch/m68k/fpsp040/bindec.S b/arch/m68k/fpsp040/bindec.S
index 3ba446a99a12..72f1159cb804 100644
--- a/arch/m68k/fpsp040/bindec.S
+++ b/arch/m68k/fpsp040/bindec.S
@@ -131,9 +131,8 @@
131| Copyright (C) Motorola, Inc. 1990 131| Copyright (C) Motorola, Inc. 1990
132| All Rights Reserved 132| All Rights Reserved
133| 133|
134| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 134| For details on the license for this file, please see the
135| The copyright notice above does not evidence any 135| file, README, in this same directory.
136| actual or intended publication of such source code.
137 136
138|BINDEC idnt 2,1 | Motorola 040 Floating Point Software Package 137|BINDEC idnt 2,1 | Motorola 040 Floating Point Software Package
139 138
diff --git a/arch/m68k/fpsp040/binstr.S b/arch/m68k/fpsp040/binstr.S
index d53555c0a2b6..8a05ba92a8a0 100644
--- a/arch/m68k/fpsp040/binstr.S
+++ b/arch/m68k/fpsp040/binstr.S
@@ -60,9 +60,8 @@
60| Copyright (C) Motorola, Inc. 1990 60| Copyright (C) Motorola, Inc. 1990
61| All Rights Reserved 61| All Rights Reserved
62| 62|
63| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 63| For details on the license for this file, please see the
64| The copyright notice above does not evidence any 64| file, README, in this same directory.
65| actual or intended publication of such source code.
66 65
67|BINSTR idnt 2,1 | Motorola 040 Floating Point Software Package 66|BINSTR idnt 2,1 | Motorola 040 Floating Point Software Package
68 67
diff --git a/arch/m68k/fpsp040/bugfix.S b/arch/m68k/fpsp040/bugfix.S
index 942c4f6f4fd1..3bb9c84bb058 100644
--- a/arch/m68k/fpsp040/bugfix.S
+++ b/arch/m68k/fpsp040/bugfix.S
@@ -152,9 +152,8 @@
152| Copyright (C) Motorola, Inc. 1990 152| Copyright (C) Motorola, Inc. 1990
153| All Rights Reserved 153| All Rights Reserved
154| 154|
155| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 155| For details on the license for this file, please see the
156| The copyright notice above does not evidence any 156| file, README, in this same directory.
157| actual or intended publication of such source code.
158 157
159|BUGFIX idnt 2,1 | Motorola 040 Floating Point Software Package 158|BUGFIX idnt 2,1 | Motorola 040 Floating Point Software Package
160 159
diff --git a/arch/m68k/fpsp040/decbin.S b/arch/m68k/fpsp040/decbin.S
index 2160609e328d..16ed796bad87 100644
--- a/arch/m68k/fpsp040/decbin.S
+++ b/arch/m68k/fpsp040/decbin.S
@@ -69,9 +69,8 @@
69| Copyright (C) Motorola, Inc. 1990 69| Copyright (C) Motorola, Inc. 1990
70| All Rights Reserved 70| All Rights Reserved
71| 71|
72| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 72| For details on the license for this file, please see the
73| The copyright notice above does not evidence any 73| file, README, in this same directory.
74| actual or intended publication of such source code.
75 74
76|DECBIN idnt 2,1 | Motorola 040 Floating Point Software Package 75|DECBIN idnt 2,1 | Motorola 040 Floating Point Software Package
77 76
diff --git a/arch/m68k/fpsp040/do_func.S b/arch/m68k/fpsp040/do_func.S
index 81f6a9856dce..3eff99a80413 100644
--- a/arch/m68k/fpsp040/do_func.S
+++ b/arch/m68k/fpsp040/do_func.S
@@ -22,9 +22,8 @@
22| Copyright (C) Motorola, Inc. 1990 22| Copyright (C) Motorola, Inc. 1990
23| All Rights Reserved 23| All Rights Reserved
24| 24|
25| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 25| For details on the license for this file, please see the
26| The copyright notice above does not evidence any 26| file, README, in this same directory.
27| actual or intended publication of such source code.
28 27
29DO_FUNC: |idnt 2,1 | Motorola 040 Floating Point Software Package 28DO_FUNC: |idnt 2,1 | Motorola 040 Floating Point Software Package
30 29
diff --git a/arch/m68k/fpsp040/fpsp.h b/arch/m68k/fpsp040/fpsp.h
index 984a4eb8010a..5df4cd772934 100644
--- a/arch/m68k/fpsp040/fpsp.h
+++ b/arch/m68k/fpsp040/fpsp.h
@@ -5,9 +5,8 @@
5| Copyright (C) Motorola, Inc. 1990 5| Copyright (C) Motorola, Inc. 1990
6| All Rights Reserved 6| All Rights Reserved
7| 7|
8| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 8| For details on the license for this file, please see the
9| The copyright notice above does not evidence any 9| file, README, in this same directory.
10| actual or intended publication of such source code.
11 10
12| fpsp.h --- stack frame offsets during FPSP exception handling 11| fpsp.h --- stack frame offsets during FPSP exception handling
13| 12|
diff --git a/arch/m68k/fpsp040/gen_except.S b/arch/m68k/fpsp040/gen_except.S
index 401d06f39f73..3642cb7e3641 100644
--- a/arch/m68k/fpsp040/gen_except.S
+++ b/arch/m68k/fpsp040/gen_except.S
@@ -29,9 +29,8 @@
29| Copyright (C) Motorola, Inc. 1990 29| Copyright (C) Motorola, Inc. 1990
30| All Rights Reserved 30| All Rights Reserved
31| 31|
32| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 32| For details on the license for this file, please see the
33| The copyright notice above does not evidence any 33| file, README, in this same directory.
34| actual or intended publication of such source code.
35 34
36GEN_EXCEPT: |idnt 2,1 | Motorola 040 Floating Point Software Package 35GEN_EXCEPT: |idnt 2,1 | Motorola 040 Floating Point Software Package
37 36
diff --git a/arch/m68k/fpsp040/get_op.S b/arch/m68k/fpsp040/get_op.S
index c7c2f3727425..64c36d79ef83 100644
--- a/arch/m68k/fpsp040/get_op.S
+++ b/arch/m68k/fpsp040/get_op.S
@@ -54,9 +54,8 @@
54| Copyright (C) Motorola, Inc. 1990 54| Copyright (C) Motorola, Inc. 1990
55| All Rights Reserved 55| All Rights Reserved
56| 56|
57| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 57| For details on the license for this file, please see the
58| The copyright notice above does not evidence any 58| file, README, in this same directory.
59| actual or intended publication of such source code.
60 59
61GET_OP: |idnt 2,1 | Motorola 040 Floating Point Software Package 60GET_OP: |idnt 2,1 | Motorola 040 Floating Point Software Package
62 61
diff --git a/arch/m68k/fpsp040/kernel_ex.S b/arch/m68k/fpsp040/kernel_ex.S
index 476b711967ce..45bcf3455d34 100644
--- a/arch/m68k/fpsp040/kernel_ex.S
+++ b/arch/m68k/fpsp040/kernel_ex.S
@@ -12,9 +12,8 @@
12| Copyright (C) Motorola, Inc. 1990 12| Copyright (C) Motorola, Inc. 1990
13| All Rights Reserved 13| All Rights Reserved
14| 14|
15| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 15| For details on the license for this file, please see the
16| The copyright notice above does not evidence any 16| file, README, in this same directory.
17| actual or intended publication of such source code.
18 17
19KERNEL_EX: |idnt 2,1 | Motorola 040 Floating Point Software Package 18KERNEL_EX: |idnt 2,1 | Motorola 040 Floating Point Software Package
20 19
diff --git a/arch/m68k/fpsp040/res_func.S b/arch/m68k/fpsp040/res_func.S
index 8f6b95217865..d9cdf4383545 100644
--- a/arch/m68k/fpsp040/res_func.S
+++ b/arch/m68k/fpsp040/res_func.S
@@ -16,9 +16,8 @@
16| Copyright (C) Motorola, Inc. 1990 16| Copyright (C) Motorola, Inc. 1990
17| All Rights Reserved 17| All Rights Reserved
18| 18|
19| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 19| For details on the license for this file, please see the
20| The copyright notice above does not evidence any 20| file, README, in this same directory.
21| actual or intended publication of such source code.
22 21
23RES_FUNC: |idnt 2,1 | Motorola 040 Floating Point Software Package 22RES_FUNC: |idnt 2,1 | Motorola 040 Floating Point Software Package
24 23
diff --git a/arch/m68k/fpsp040/round.S b/arch/m68k/fpsp040/round.S
index 00f98068783f..f84ae0dd4358 100644
--- a/arch/m68k/fpsp040/round.S
+++ b/arch/m68k/fpsp040/round.S
@@ -8,9 +8,8 @@
8| Copyright (C) Motorola, Inc. 1990 8| Copyright (C) Motorola, Inc. 1990
9| All Rights Reserved 9| All Rights Reserved
10| 10|
11| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 11| For details on the license for this file, please see the
12| The copyright notice above does not evidence any 12| file, README, in this same directory.
13| actual or intended publication of such source code.
14 13
15|ROUND idnt 2,1 | Motorola 040 Floating Point Software Package 14|ROUND idnt 2,1 | Motorola 040 Floating Point Software Package
16 15
diff --git a/arch/m68k/fpsp040/sacos.S b/arch/m68k/fpsp040/sacos.S
index 83b00ab1c48f..513c7cca7318 100644
--- a/arch/m68k/fpsp040/sacos.S
+++ b/arch/m68k/fpsp040/sacos.S
@@ -38,9 +38,8 @@
38| Copyright (C) Motorola, Inc. 1990 38| Copyright (C) Motorola, Inc. 1990
39| All Rights Reserved 39| All Rights Reserved
40| 40|
41| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 41| For details on the license for this file, please see the
42| The copyright notice above does not evidence any 42| file, README, in this same directory.
43| actual or intended publication of such source code.
44 43
45|SACOS idnt 2,1 | Motorola 040 Floating Point Software Package 44|SACOS idnt 2,1 | Motorola 040 Floating Point Software Package
46 45
diff --git a/arch/m68k/fpsp040/sasin.S b/arch/m68k/fpsp040/sasin.S
index 5647a6043903..2a269a58ceaa 100644
--- a/arch/m68k/fpsp040/sasin.S
+++ b/arch/m68k/fpsp040/sasin.S
@@ -38,9 +38,8 @@
38| Copyright (C) Motorola, Inc. 1990 38| Copyright (C) Motorola, Inc. 1990
39| All Rights Reserved 39| All Rights Reserved
40| 40|
41| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 41| For details on the license for this file, please see the
42| The copyright notice above does not evidence any 42| file, README, in this same directory.
43| actual or intended publication of such source code.
44 43
45|SASIN idnt 2,1 | Motorola 040 Floating Point Software Package 44|SASIN idnt 2,1 | Motorola 040 Floating Point Software Package
46 45
diff --git a/arch/m68k/fpsp040/satan.S b/arch/m68k/fpsp040/satan.S
index 20dae222d51e..c8a664998f92 100644
--- a/arch/m68k/fpsp040/satan.S
+++ b/arch/m68k/fpsp040/satan.S
@@ -43,9 +43,8 @@
43| Copyright (C) Motorola, Inc. 1990 43| Copyright (C) Motorola, Inc. 1990
44| All Rights Reserved 44| All Rights Reserved
45| 45|
46| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 46| For details on the license for this file, please see the
47| The copyright notice above does not evidence any 47| file, README, in this same directory.
48| actual or intended publication of such source code.
49 48
50|satan idnt 2,1 | Motorola 040 Floating Point Software Package 49|satan idnt 2,1 | Motorola 040 Floating Point Software Package
51 50
diff --git a/arch/m68k/fpsp040/satanh.S b/arch/m68k/fpsp040/satanh.S
index 20f07810bcda..ba91f77a7571 100644
--- a/arch/m68k/fpsp040/satanh.S
+++ b/arch/m68k/fpsp040/satanh.S
@@ -45,9 +45,8 @@
45| Copyright (C) Motorola, Inc. 1990 45| Copyright (C) Motorola, Inc. 1990
46| All Rights Reserved 46| All Rights Reserved
47| 47|
48| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 48| For details on the license for this file, please see the
49| The copyright notice above does not evidence any 49| file, README, in this same directory.
50| actual or intended publication of such source code.
51 50
52|satanh idnt 2,1 | Motorola 040 Floating Point Software Package 51|satanh idnt 2,1 | Motorola 040 Floating Point Software Package
53 52
diff --git a/arch/m68k/fpsp040/scale.S b/arch/m68k/fpsp040/scale.S
index 5c9b805265f2..04829dd4f1f4 100644
--- a/arch/m68k/fpsp040/scale.S
+++ b/arch/m68k/fpsp040/scale.S
@@ -21,9 +21,8 @@
21| Copyright (C) Motorola, Inc. 1990 21| Copyright (C) Motorola, Inc. 1990
22| All Rights Reserved 22| All Rights Reserved
23| 23|
24| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 24| For details on the license for this file, please see the
25| The copyright notice above does not evidence any 25| file, README, in this same directory.
26| actual or intended publication of such source code.
27 26
28|SCALE idnt 2,1 | Motorola 040 Floating Point Software Package 27|SCALE idnt 2,1 | Motorola 040 Floating Point Software Package
29 28
diff --git a/arch/m68k/fpsp040/scosh.S b/arch/m68k/fpsp040/scosh.S
index e81edbb87642..07d3a4d7c86d 100644
--- a/arch/m68k/fpsp040/scosh.S
+++ b/arch/m68k/fpsp040/scosh.S
@@ -49,9 +49,8 @@
49| Copyright (C) Motorola, Inc. 1990 49| Copyright (C) Motorola, Inc. 1990
50| All Rights Reserved 50| All Rights Reserved
51| 51|
52| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 52| For details on the license for this file, please see the
53| The copyright notice above does not evidence any 53| file, README, in this same directory.
54| actual or intended publication of such source code.
55 54
56|SCOSH idnt 2,1 | Motorola 040 Floating Point Software Package 55|SCOSH idnt 2,1 | Motorola 040 Floating Point Software Package
57 56
diff --git a/arch/m68k/fpsp040/setox.S b/arch/m68k/fpsp040/setox.S
index 0aa75f9bf7d1..145af5447581 100644
--- a/arch/m68k/fpsp040/setox.S
+++ b/arch/m68k/fpsp040/setox.S
@@ -331,9 +331,8 @@
331| Copyright (C) Motorola, Inc. 1990 331| Copyright (C) Motorola, Inc. 1990
332| All Rights Reserved 332| All Rights Reserved
333| 333|
334| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 334| For details on the license for this file, please see the
335| The copyright notice above does not evidence any 335| file, README, in this same directory.
336| actual or intended publication of such source code.
337 336
338|setox idnt 2,1 | Motorola 040 Floating Point Software Package 337|setox idnt 2,1 | Motorola 040 Floating Point Software Package
339 338
diff --git a/arch/m68k/fpsp040/sgetem.S b/arch/m68k/fpsp040/sgetem.S
index 0fcbd045ba75..d9234f4aed57 100644
--- a/arch/m68k/fpsp040/sgetem.S
+++ b/arch/m68k/fpsp040/sgetem.S
@@ -24,9 +24,8 @@
24| Copyright (C) Motorola, Inc. 1990 24| Copyright (C) Motorola, Inc. 1990
25| All Rights Reserved 25| All Rights Reserved
26| 26|
27| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 27| For details on the license for this file, please see the
28| The copyright notice above does not evidence any 28| file, README, in this same directory.
29| actual or intended publication of such source code.
30 29
31|SGETEM idnt 2,1 | Motorola 040 Floating Point Software Package 30|SGETEM idnt 2,1 | Motorola 040 Floating Point Software Package
32 31
diff --git a/arch/m68k/fpsp040/sint.S b/arch/m68k/fpsp040/sint.S
index 0f9bd28e55a0..0e92d4e5d231 100644
--- a/arch/m68k/fpsp040/sint.S
+++ b/arch/m68k/fpsp040/sint.S
@@ -51,9 +51,8 @@
51| Copyright (C) Motorola, Inc. 1990 51| Copyright (C) Motorola, Inc. 1990
52| All Rights Reserved 52| All Rights Reserved
53| 53|
54| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 54| For details on the license for this file, please see the
55| The copyright notice above does not evidence any 55| file, README, in this same directory.
56| actual or intended publication of such source code.
57 56
58|SINT idnt 2,1 | Motorola 040 Floating Point Software Package 57|SINT idnt 2,1 | Motorola 040 Floating Point Software Package
59 58
diff --git a/arch/m68k/fpsp040/skeleton.S b/arch/m68k/fpsp040/skeleton.S
index a1629194e3fd..a8f41615d94a 100644
--- a/arch/m68k/fpsp040/skeleton.S
+++ b/arch/m68k/fpsp040/skeleton.S
@@ -30,9 +30,8 @@
30| Copyright (C) Motorola, Inc. 1990 30| Copyright (C) Motorola, Inc. 1990
31| All Rights Reserved 31| All Rights Reserved
32| 32|
33| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 33| For details on the license for this file, please see the
34| The copyright notice above does not evidence any 34| file, README, in this same directory.
35| actual or intended publication of such source code.
36 35
37| 36|
38| Modified for Linux-1.3.x by Jes Sorensen (jds@kom.auc.dk) 37| Modified for Linux-1.3.x by Jes Sorensen (jds@kom.auc.dk)
diff --git a/arch/m68k/fpsp040/slog2.S b/arch/m68k/fpsp040/slog2.S
index 517fa4563246..fac2c738382e 100644
--- a/arch/m68k/fpsp040/slog2.S
+++ b/arch/m68k/fpsp040/slog2.S
@@ -96,9 +96,8 @@
96| Copyright (C) Motorola, Inc. 1990 96| Copyright (C) Motorola, Inc. 1990
97| All Rights Reserved 97| All Rights Reserved
98| 98|
99| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 99| For details on the license for this file, please see the
100| The copyright notice above does not evidence any 100| file, README, in this same directory.
101| actual or intended publication of such source code.
102 101
103|SLOG2 idnt 2,1 | Motorola 040 Floating Point Software Package 102|SLOG2 idnt 2,1 | Motorola 040 Floating Point Software Package
104 103
diff --git a/arch/m68k/fpsp040/slogn.S b/arch/m68k/fpsp040/slogn.S
index 2aaa0725c035..d98eaf641ec4 100644
--- a/arch/m68k/fpsp040/slogn.S
+++ b/arch/m68k/fpsp040/slogn.S
@@ -63,9 +63,8 @@
63| Copyright (C) Motorola, Inc. 1990 63| Copyright (C) Motorola, Inc. 1990
64| All Rights Reserved 64| All Rights Reserved
65| 65|
66| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 66| For details on the license for this file, please see the
67| The copyright notice above does not evidence any 67| file, README, in this same directory.
68| actual or intended publication of such source code.
69 68
70|slogn idnt 2,1 | Motorola 040 Floating Point Software Package 69|slogn idnt 2,1 | Motorola 040 Floating Point Software Package
71 70
diff --git a/arch/m68k/fpsp040/smovecr.S b/arch/m68k/fpsp040/smovecr.S
index a0127fa55e9c..73c36512081b 100644
--- a/arch/m68k/fpsp040/smovecr.S
+++ b/arch/m68k/fpsp040/smovecr.S
@@ -15,9 +15,8 @@
15| Copyright (C) Motorola, Inc. 1990 15| Copyright (C) Motorola, Inc. 1990
16| All Rights Reserved 16| All Rights Reserved
17| 17|
18| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 18| For details on the license for this file, please see the
19| The copyright notice above does not evidence any 19| file, README, in this same directory.
20| actual or intended publication of such source code.
21 20
22|SMOVECR idnt 2,1 | Motorola 040 Floating Point Software Package 21|SMOVECR idnt 2,1 | Motorola 040 Floating Point Software Package
23 22
diff --git a/arch/m68k/fpsp040/srem_mod.S b/arch/m68k/fpsp040/srem_mod.S
index 8c8d7f50cc68..a27e70c9a0eb 100644
--- a/arch/m68k/fpsp040/srem_mod.S
+++ b/arch/m68k/fpsp040/srem_mod.S
@@ -66,9 +66,8 @@
66| Copyright (C) Motorola, Inc. 1990 66| Copyright (C) Motorola, Inc. 1990
67| All Rights Reserved 67| All Rights Reserved
68| 68|
69| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 69| For details on the license for this file, please see the
70| The copyright notice above does not evidence any 70| file, README, in this same directory.
71| actual or intended publication of such source code.
72 71
73SREM_MOD: |idnt 2,1 | Motorola 040 Floating Point Software Package 72SREM_MOD: |idnt 2,1 | Motorola 040 Floating Point Software Package
74 73
diff --git a/arch/m68k/fpsp040/ssin.S b/arch/m68k/fpsp040/ssin.S
index 043c91cdd657..a1ef8e01bf06 100644
--- a/arch/m68k/fpsp040/ssin.S
+++ b/arch/m68k/fpsp040/ssin.S
@@ -83,9 +83,8 @@
83| Copyright (C) Motorola, Inc. 1990 83| Copyright (C) Motorola, Inc. 1990
84| All Rights Reserved 84| All Rights Reserved
85| 85|
86| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 86| For details on the license for this file, please see the
87| The copyright notice above does not evidence any 87| file, README, in this same directory.
88| actual or intended publication of such source code.
89 88
90|SSIN idnt 2,1 | Motorola 040 Floating Point Software Package 89|SSIN idnt 2,1 | Motorola 040 Floating Point Software Package
91 90
diff --git a/arch/m68k/fpsp040/ssinh.S b/arch/m68k/fpsp040/ssinh.S
index c8b3308bb143..8a560edc7653 100644
--- a/arch/m68k/fpsp040/ssinh.S
+++ b/arch/m68k/fpsp040/ssinh.S
@@ -49,9 +49,8 @@
49| Copyright (C) Motorola, Inc. 1990 49| Copyright (C) Motorola, Inc. 1990
50| All Rights Reserved 50| All Rights Reserved
51| 51|
52| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 52| For details on the license for this file, please see the
53| The copyright notice above does not evidence any 53| file, README, in this same directory.
54| actual or intended publication of such source code.
55 54
56|SSINH idnt 2,1 | Motorola 040 Floating Point Software Package 55|SSINH idnt 2,1 | Motorola 040 Floating Point Software Package
57 56
diff --git a/arch/m68k/fpsp040/stan.S b/arch/m68k/fpsp040/stan.S
index b5c2a196e617..f8553aaececb 100644
--- a/arch/m68k/fpsp040/stan.S
+++ b/arch/m68k/fpsp040/stan.S
@@ -50,9 +50,8 @@
50| Copyright (C) Motorola, Inc. 1990 50| Copyright (C) Motorola, Inc. 1990
51| All Rights Reserved 51| All Rights Reserved
52| 52|
53| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 53| For details on the license for this file, please see the
54| The copyright notice above does not evidence any 54| file, README, in this same directory.
55| actual or intended publication of such source code.
56 55
57|STAN idnt 2,1 | Motorola 040 Floating Point Software Package 56|STAN idnt 2,1 | Motorola 040 Floating Point Software Package
58 57
diff --git a/arch/m68k/fpsp040/stanh.S b/arch/m68k/fpsp040/stanh.S
index 33b009802243..7e12e59ee8c7 100644
--- a/arch/m68k/fpsp040/stanh.S
+++ b/arch/m68k/fpsp040/stanh.S
@@ -49,9 +49,8 @@
49| Copyright (C) Motorola, Inc. 1990 49| Copyright (C) Motorola, Inc. 1990
50| All Rights Reserved 50| All Rights Reserved
51| 51|
52| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 52| For details on the license for this file, please see the
53| The copyright notice above does not evidence any 53| file, README, in this same directory.
54| actual or intended publication of such source code.
55 54
56|STANH idnt 2,1 | Motorola 040 Floating Point Software Package 55|STANH idnt 2,1 | Motorola 040 Floating Point Software Package
57 56
diff --git a/arch/m68k/fpsp040/sto_res.S b/arch/m68k/fpsp040/sto_res.S
index 0cdca3b060ad..484b47d4eaad 100644
--- a/arch/m68k/fpsp040/sto_res.S
+++ b/arch/m68k/fpsp040/sto_res.S
@@ -19,9 +19,8 @@
19| Copyright (C) Motorola, Inc. 1990 19| Copyright (C) Motorola, Inc. 1990
20| All Rights Reserved 20| All Rights Reserved
21| 21|
22| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 22| For details on the license for this file, please see the
23| The copyright notice above does not evidence any 23| file, README, in this same directory.
24| actual or intended publication of such source code.
25 24
26STO_RES: |idnt 2,1 | Motorola 040 Floating Point Software Package 25STO_RES: |idnt 2,1 | Motorola 040 Floating Point Software Package
27 26
diff --git a/arch/m68k/fpsp040/stwotox.S b/arch/m68k/fpsp040/stwotox.S
index 4e3c1407d3df..0d5e6a1436a6 100644
--- a/arch/m68k/fpsp040/stwotox.S
+++ b/arch/m68k/fpsp040/stwotox.S
@@ -76,9 +76,8 @@
76| Copyright (C) Motorola, Inc. 1990 76| Copyright (C) Motorola, Inc. 1990
77| All Rights Reserved 77| All Rights Reserved
78| 78|
79| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 79| For details on the license for this file, please see the
80| The copyright notice above does not evidence any 80| file, README, in this same directory.
81| actual or intended publication of such source code.
82 81
83|STWOTOX idnt 2,1 | Motorola 040 Floating Point Software Package 82|STWOTOX idnt 2,1 | Motorola 040 Floating Point Software Package
84 83
diff --git a/arch/m68k/fpsp040/tbldo.S b/arch/m68k/fpsp040/tbldo.S
index fe60cf4d20d7..fd5c37a5a2b9 100644
--- a/arch/m68k/fpsp040/tbldo.S
+++ b/arch/m68k/fpsp040/tbldo.S
@@ -17,9 +17,8 @@
17| Copyright (C) Motorola, Inc. 1990 17| Copyright (C) Motorola, Inc. 1990
18| All Rights Reserved 18| All Rights Reserved
19| 19|
20| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 20| For details on the license for this file, please see the
21| The copyright notice above does not evidence any 21| file, README, in this same directory.
22| actual or intended publication of such source code.
23 22
24|TBLDO idnt 2,1 | Motorola 040 Floating Point Software Package 23|TBLDO idnt 2,1 | Motorola 040 Floating Point Software Package
25 24
diff --git a/arch/m68k/fpsp040/util.S b/arch/m68k/fpsp040/util.S
index 452f3d65857b..65b26fa88c60 100644
--- a/arch/m68k/fpsp040/util.S
+++ b/arch/m68k/fpsp040/util.S
@@ -16,9 +16,8 @@
16| Copyright (C) Motorola, Inc. 1990 16| Copyright (C) Motorola, Inc. 1990
17| All Rights Reserved 17| All Rights Reserved
18| 18|
19| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 19| For details on the license for this file, please see the
20| The copyright notice above does not evidence any 20| file, README, in this same directory.
21| actual or intended publication of such source code.
22 21
23|UTIL idnt 2,1 | Motorola 040 Floating Point Software Package 22|UTIL idnt 2,1 | Motorola 040 Floating Point Software Package
24 23
diff --git a/arch/m68k/fpsp040/x_bsun.S b/arch/m68k/fpsp040/x_bsun.S
index 039247b09c8b..d5a576bfac79 100644
--- a/arch/m68k/fpsp040/x_bsun.S
+++ b/arch/m68k/fpsp040/x_bsun.S
@@ -13,9 +13,8 @@
13| Copyright (C) Motorola, Inc. 1990 13| Copyright (C) Motorola, Inc. 1990
14| All Rights Reserved 14| All Rights Reserved
15| 15|
16| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 16| For details on the license for this file, please see the
17| The copyright notice above does not evidence any 17| file, README, in this same directory.
18| actual or intended publication of such source code.
19 18
20X_BSUN: |idnt 2,1 | Motorola 040 Floating Point Software Package 19X_BSUN: |idnt 2,1 | Motorola 040 Floating Point Software Package
21 20
diff --git a/arch/m68k/fpsp040/x_fline.S b/arch/m68k/fpsp040/x_fline.S
index 3917710b0fde..264e126d1db7 100644
--- a/arch/m68k/fpsp040/x_fline.S
+++ b/arch/m68k/fpsp040/x_fline.S
@@ -13,9 +13,8 @@
13| Copyright (C) Motorola, Inc. 1990 13| Copyright (C) Motorola, Inc. 1990
14| All Rights Reserved 14| All Rights Reserved
15| 15|
16| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 16| For details on the license for this file, please see the
17| The copyright notice above does not evidence any 17| file, README, in this same directory.
18| actual or intended publication of such source code.
19 18
20X_FLINE: |idnt 2,1 | Motorola 040 Floating Point Software Package 19X_FLINE: |idnt 2,1 | Motorola 040 Floating Point Software Package
21 20
diff --git a/arch/m68k/fpsp040/x_operr.S b/arch/m68k/fpsp040/x_operr.S
index b0f54bcb49a7..e2c371c3a45d 100644
--- a/arch/m68k/fpsp040/x_operr.S
+++ b/arch/m68k/fpsp040/x_operr.S
@@ -43,9 +43,8 @@
43| Copyright (C) Motorola, Inc. 1990 43| Copyright (C) Motorola, Inc. 1990
44| All Rights Reserved 44| All Rights Reserved
45| 45|
46| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 46| For details on the license for this file, please see the
47| The copyright notice above does not evidence any 47| file, README, in this same directory.
48| actual or intended publication of such source code.
49 48
50X_OPERR: |idnt 2,1 | Motorola 040 Floating Point Software Package 49X_OPERR: |idnt 2,1 | Motorola 040 Floating Point Software Package
51 50
diff --git a/arch/m68k/fpsp040/x_ovfl.S b/arch/m68k/fpsp040/x_ovfl.S
index 22cb8b42c7b6..6fe4989ee31f 100644
--- a/arch/m68k/fpsp040/x_ovfl.S
+++ b/arch/m68k/fpsp040/x_ovfl.S
@@ -35,9 +35,8 @@
35| Copyright (C) Motorola, Inc. 1990 35| Copyright (C) Motorola, Inc. 1990
36| All Rights Reserved 36| All Rights Reserved
37| 37|
38| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 38| For details on the license for this file, please see the
39| The copyright notice above does not evidence any 39| file, README, in this same directory.
40| actual or intended publication of such source code.
41 40
42X_OVFL: |idnt 2,1 | Motorola 040 Floating Point Software Package 41X_OVFL: |idnt 2,1 | Motorola 040 Floating Point Software Package
43 42
diff --git a/arch/m68k/fpsp040/x_snan.S b/arch/m68k/fpsp040/x_snan.S
index 039af573312e..4ed766416378 100644
--- a/arch/m68k/fpsp040/x_snan.S
+++ b/arch/m68k/fpsp040/x_snan.S
@@ -22,9 +22,8 @@
22| Copyright (C) Motorola, Inc. 1990 22| Copyright (C) Motorola, Inc. 1990
23| All Rights Reserved 23| All Rights Reserved
24| 24|
25| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 25| For details on the license for this file, please see the
26| The copyright notice above does not evidence any 26| file, README, in this same directory.
27| actual or intended publication of such source code.
28 27
29X_SNAN: |idnt 2,1 | Motorola 040 Floating Point Software Package 28X_SNAN: |idnt 2,1 | Motorola 040 Floating Point Software Package
30 29
diff --git a/arch/m68k/fpsp040/x_store.S b/arch/m68k/fpsp040/x_store.S
index 4282fa67d449..402dc0c0ebc0 100644
--- a/arch/m68k/fpsp040/x_store.S
+++ b/arch/m68k/fpsp040/x_store.S
@@ -11,9 +11,8 @@
11| Copyright (C) Motorola, Inc. 1990 11| Copyright (C) Motorola, Inc. 1990
12| All Rights Reserved 12| All Rights Reserved
13| 13|
14| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 14| For details on the license for this file, please see the
15| The copyright notice above does not evidence any 15| file, README, in this same directory.
16| actual or intended publication of such source code.
17 16
18X_STORE: |idnt 2,1 | Motorola 040 Floating Point Software Package 17X_STORE: |idnt 2,1 | Motorola 040 Floating Point Software Package
19 18
diff --git a/arch/m68k/fpsp040/x_unfl.S b/arch/m68k/fpsp040/x_unfl.S
index 077fcc230fcc..eb772ff3b812 100644
--- a/arch/m68k/fpsp040/x_unfl.S
+++ b/arch/m68k/fpsp040/x_unfl.S
@@ -21,9 +21,8 @@
21| Copyright (C) Motorola, Inc. 1990 21| Copyright (C) Motorola, Inc. 1990
22| All Rights Reserved 22| All Rights Reserved
23| 23|
24| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 24| For details on the license for this file, please see the
25| The copyright notice above does not evidence any 25| file, README, in this same directory.
26| actual or intended publication of such source code.
27 26
28X_UNFL: |idnt 2,1 | Motorola 040 Floating Point Software Package 27X_UNFL: |idnt 2,1 | Motorola 040 Floating Point Software Package
29 28
diff --git a/arch/m68k/fpsp040/x_unimp.S b/arch/m68k/fpsp040/x_unimp.S
index 920cb9410e9e..6f382b21228b 100644
--- a/arch/m68k/fpsp040/x_unimp.S
+++ b/arch/m68k/fpsp040/x_unimp.S
@@ -22,9 +22,8 @@
22| Copyright (C) Motorola, Inc. 1990 22| Copyright (C) Motorola, Inc. 1990
23| All Rights Reserved 23| All Rights Reserved
24| 24|
25| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 25| For details on the license for this file, please see the
26| The copyright notice above does not evidence any 26| file, README, in this same directory.
27| actual or intended publication of such source code.
28 27
29X_UNIMP: |idnt 2,1 | Motorola 040 Floating Point Software Package 28X_UNIMP: |idnt 2,1 | Motorola 040 Floating Point Software Package
30 29
diff --git a/arch/m68k/fpsp040/x_unsupp.S b/arch/m68k/fpsp040/x_unsupp.S
index 4ec57285b683..d7cf46208c62 100644
--- a/arch/m68k/fpsp040/x_unsupp.S
+++ b/arch/m68k/fpsp040/x_unsupp.S
@@ -23,9 +23,8 @@
23| Copyright (C) Motorola, Inc. 1990 23| Copyright (C) Motorola, Inc. 1990
24| All Rights Reserved 24| All Rights Reserved
25| 25|
26| THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 26| For details on the license for this file, please see the
27| The copyright notice above does not evidence any 27| file, README, in this same directory.
28| actual or intended publication of such source code.
29 28
30X_UNSUPP: |idnt 2,1 | Motorola 040 Floating Point Software Package 29X_UNSUPP: |idnt 2,1 | Motorola 040 Floating Point Software Package
31 30
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 3f9cb55d0356..2d8ad0727b6b 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -129,6 +129,9 @@ void machine_power_off(void)
129 for (;;); 129 for (;;);
130} 130}
131 131
132void (*pm_power_off)(void) = machine_power_off;
133EXPORT_SYMBOL(pm_power_off);
134
132void show_regs(struct pt_regs * regs) 135void show_regs(struct pt_regs * regs)
133{ 136{
134 printk("\n"); 137 printk("\n");
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index e2a6e8648960..e50858dbc237 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -29,6 +29,10 @@ config GENERIC_CALIBRATE_DELAY
29 bool 29 bool
30 default y 30 default y
31 31
32config TIME_LOW_RES
33 bool
34 default y
35
32source "init/Kconfig" 36source "init/Kconfig"
33 37
34menu "Processor type and features" 38menu "Processor type and features"
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 6a57407df1bc..38c0f3360d51 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -94,7 +94,6 @@ endif
94# machines may also. Since BFD is incredibly buggy with respect to 94# machines may also. Since BFD is incredibly buggy with respect to
95# crossformat linking we rely on the elf2ecoff tool for format conversion. 95# crossformat linking we rely on the elf2ecoff tool for format conversion.
96# 96#
97cflags-y += -I $(TOPDIR)/include/asm/gcc
98cflags-y += -G 0 -mno-abicalls -fno-pic -pipe 97cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
99LDFLAGS_vmlinux += -G 0 -static -n -nostdlib 98LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
100MODFLAGS += -mlong-calls 99MODFLAGS += -mlong-calls
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index e17d3adff021..58c22cd344d3 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_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-rc4
4# Thu Nov 24 01:06:21 2005 4# Tue Feb 21 13:44:31 2006
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -144,7 +144,6 @@ CONFIG_PREEMPT_BKL=y
144# Code maturity level options 144# Code maturity level options
145# 145#
146CONFIG_EXPERIMENTAL=y 146CONFIG_EXPERIMENTAL=y
147CONFIG_CLEAN_COMPILE=y
148CONFIG_LOCK_KERNEL=y 147CONFIG_LOCK_KERNEL=y
149CONFIG_INIT_ENV_ARG_LIMIT=32 148CONFIG_INIT_ENV_ARG_LIMIT=32
150 149
@@ -250,6 +249,7 @@ CONFIG_NET=y
250# 249#
251# Networking options 250# Networking options
252# 251#
252# CONFIG_NETDEBUG is not set
253CONFIG_PACKET=y 253CONFIG_PACKET=y
254CONFIG_PACKET_MMAP=y 254CONFIG_PACKET_MMAP=y
255CONFIG_UNIX=y 255CONFIG_UNIX=y
@@ -289,6 +289,7 @@ CONFIG_TCP_CONG_BIC=y
289# SCTP Configuration (EXPERIMENTAL) 289# SCTP Configuration (EXPERIMENTAL)
290# 290#
291# CONFIG_IP_SCTP is not set 291# CONFIG_IP_SCTP is not set
292
292# CONFIG_ATM is not set 293# CONFIG_ATM is not set
293# CONFIG_BRIDGE is not set 294# CONFIG_BRIDGE is not set
294# CONFIG_VLAN_8021Q is not set 295# CONFIG_VLAN_8021Q is not set
@@ -448,7 +449,7 @@ CONFIG_SCSI_SAS_ATTRS=m
448# 449#
449# SCSI low-level drivers 450# SCSI low-level drivers
450# 451#
451CONFIG_ISCSI_TCP=m 452# CONFIG_ISCSI_TCP is not set
452# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 453# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
453# CONFIG_SCSI_3W_9XXX is not set 454# CONFIG_SCSI_3W_9XXX is not set
454# CONFIG_SCSI_ACARD is not set 455# CONFIG_SCSI_ACARD is not set
@@ -774,6 +775,10 @@ CONFIG_USB_ARCH_HAS_OHCI=y
774# 775#
775 776
776# 777#
778# EDAC - error detection and reporting (RAS)
779#
780
781#
777# File systems 782# File systems
778# 783#
779CONFIG_EXT2_FS=y 784CONFIG_EXT2_FS=y
diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c
index d8e2674a1543..4a9f1ecefaf2 100644
--- a/arch/mips/kernel/binfmt_elfn32.c
+++ b/arch/mips/kernel/binfmt_elfn32.c
@@ -103,8 +103,9 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
103 * one divide. 103 * one divide.
104 */ 104 */
105 u64 nsec = (u64)jiffies * TICK_NSEC; 105 u64 nsec = (u64)jiffies * TICK_NSEC;
106 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_usec); 106 long rem;
107 value->tv_usec /= NSEC_PER_USEC; 107 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &rem);
108 value->tv_usec = rem / NSEC_PER_USEC;
108} 109}
109 110
110#define ELF_CORE_EFLAGS EF_MIPS_ABI2 111#define ELF_CORE_EFLAGS EF_MIPS_ABI2
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
index cec5f327e360..e31813779895 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -105,8 +105,9 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
105 * one divide. 105 * one divide.
106 */ 106 */
107 u64 nsec = (u64)jiffies * TICK_NSEC; 107 u64 nsec = (u64)jiffies * TICK_NSEC;
108 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_usec); 108 long rem;
109 value->tv_usec /= NSEC_PER_USEC; 109 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &rem);
110 value->tv_usec = rem / NSEC_PER_USEC;
110} 111}
111 112
112#undef ELF_CORE_COPY_REGS 113#undef ELF_CORE_COPY_REGS
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 60353f5acc48..5f68b220c26d 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -230,6 +230,9 @@ sysn32_waitid(int which, compat_pid_t pid,
230 long ret; 230 long ret;
231 mm_segment_t old_fs = get_fs(); 231 mm_segment_t old_fs = get_fs();
232 232
233 if (!access_ok(VERIFY_WRITE, uinfo, sizeof(*uinfo)))
234 return -EFAULT;
235
233 set_fs (KERNEL_DS); 236 set_fs (KERNEL_DS);
234 ret = sys_waitid(which, pid, uinfo, options, 237 ret = sys_waitid(which, pid, uinfo, options,
235 uru ? (struct rusage __user *) &ru : NULL); 238 uru ? (struct rusage __user *) &ru : NULL);
@@ -1450,25 +1453,6 @@ sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *ti
1450 return sys_timer_create(clock, p, timer_id); 1453 return sys_timer_create(clock, p, timer_id);
1451} 1454}
1452 1455
1453asmlinkage long
1454sysn32_rt_sigtimedwait(const sigset_t __user *uthese,
1455 siginfo_t __user *uinfo,
1456 const struct compat_timespec __user *uts32,
1457 size_t sigsetsize)
1458{
1459 struct timespec __user *uts = NULL;
1460
1461 if (uts32) {
1462 struct timespec ts;
1463 uts = compat_alloc_user_space(sizeof(struct timespec));
1464 if (get_user(ts.tv_sec, &uts32->tv_sec) ||
1465 get_user(ts.tv_nsec, &uts32->tv_nsec) ||
1466 copy_to_user (uts, &ts, sizeof (ts)))
1467 return -EFAULT;
1468 }
1469 return sys_rt_sigtimedwait(uthese, uinfo, uts, sigsetsize);
1470}
1471
1472save_static_function(sys32_clone); 1456save_static_function(sys32_clone);
1473__attribute_used__ noinline static int 1457__attribute_used__ noinline static int
1474_sys32_clone(nabi_no_regargs struct pt_regs regs) 1458_sys32_clone(nabi_no_regargs struct pt_regs regs)
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 5232fc752935..092679c2dca9 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -25,6 +25,7 @@
25#include <linux/a.out.h> 25#include <linux/a.out.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/completion.h> 27#include <linux/completion.h>
28#include <linux/kallsyms.h>
28 29
29#include <asm/abi.h> 30#include <asm/abi.h>
30#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
@@ -272,46 +273,19 @@ long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
272 273
273static struct mips_frame_info { 274static struct mips_frame_info {
274 void *func; 275 void *func;
275 int omit_fp; /* compiled without fno-omit-frame-pointer */ 276 unsigned long func_size;
276 int frame_offset; 277 int frame_size;
277 int pc_offset; 278 int pc_offset;
278} schedule_frame, mfinfo[] = { 279} *schedule_frame, mfinfo[64];
279 { schedule, 0 }, /* must be first */ 280static int mfinfo_num;
280 /* arch/mips/kernel/semaphore.c */
281 { __down, 1 },
282 { __down_interruptible, 1 },
283 /* kernel/sched.c */
284#ifdef CONFIG_PREEMPT
285 { preempt_schedule, 0 },
286#endif
287 { wait_for_completion, 0 },
288 { interruptible_sleep_on, 0 },
289 { interruptible_sleep_on_timeout, 0 },
290 { sleep_on, 0 },
291 { sleep_on_timeout, 0 },
292 { yield, 0 },
293 { io_schedule, 0 },
294 { io_schedule_timeout, 0 },
295#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT)
296 { __preempt_spin_lock, 0 },
297 { __preempt_write_lock, 0 },
298#endif
299 /* kernel/timer.c */
300 { schedule_timeout, 1 },
301/* { nanosleep_restart, 1 }, */
302 /* lib/rwsem-spinlock.c */
303 { __down_read, 1 },
304 { __down_write, 1 },
305};
306 281
307static int mips_frame_info_initialized;
308static int __init get_frame_info(struct mips_frame_info *info) 282static int __init get_frame_info(struct mips_frame_info *info)
309{ 283{
310 int i; 284 int i;
311 void *func = info->func; 285 void *func = info->func;
312 union mips_instruction *ip = (union mips_instruction *)func; 286 union mips_instruction *ip = (union mips_instruction *)func;
313 info->pc_offset = -1; 287 info->pc_offset = -1;
314 info->frame_offset = info->omit_fp ? 0 : -1; 288 info->frame_size = 0;
315 for (i = 0; i < 128; i++, ip++) { 289 for (i = 0; i < 128; i++, ip++) {
316 /* if jal, jalr, jr, stop. */ 290 /* if jal, jalr, jr, stop. */
317 if (ip->j_format.opcode == jal_op || 291 if (ip->j_format.opcode == jal_op ||
@@ -320,6 +294,23 @@ static int __init get_frame_info(struct mips_frame_info *info)
320 ip->r_format.func == jr_op))) 294 ip->r_format.func == jr_op)))
321 break; 295 break;
322 296
297 if (info->func_size && i >= info->func_size / 4)
298 break;
299 if (
300#ifdef CONFIG_32BIT
301 ip->i_format.opcode == addiu_op &&
302#endif
303#ifdef CONFIG_64BIT
304 ip->i_format.opcode == daddiu_op &&
305#endif
306 ip->i_format.rs == 29 &&
307 ip->i_format.rt == 29) {
308 /* addiu/daddiu sp,sp,-imm */
309 if (info->frame_size)
310 continue;
311 info->frame_size = - ip->i_format.simmediate;
312 }
313
323 if ( 314 if (
324#ifdef CONFIG_32BIT 315#ifdef CONFIG_32BIT
325 ip->i_format.opcode == sw_op && 316 ip->i_format.opcode == sw_op &&
@@ -327,31 +318,20 @@ static int __init get_frame_info(struct mips_frame_info *info)
327#ifdef CONFIG_64BIT 318#ifdef CONFIG_64BIT
328 ip->i_format.opcode == sd_op && 319 ip->i_format.opcode == sd_op &&
329#endif 320#endif
330 ip->i_format.rs == 29) 321 ip->i_format.rs == 29 &&
331 { 322 ip->i_format.rt == 31) {
332 /* sw / sd $ra, offset($sp) */ 323 /* sw / sd $ra, offset($sp) */
333 if (ip->i_format.rt == 31) { 324 if (info->pc_offset != -1)
334 if (info->pc_offset != -1) 325 continue;
335 continue; 326 info->pc_offset =
336 info->pc_offset = 327 ip->i_format.simmediate / sizeof(long);
337 ip->i_format.simmediate / sizeof(long);
338 }
339 /* sw / sd $s8, offset($sp) */
340 if (ip->i_format.rt == 30) {
341//#if 0 /* gcc 3.4 does aggressive optimization... */
342 if (info->frame_offset != -1)
343 continue;
344//#endif
345 info->frame_offset =
346 ip->i_format.simmediate / sizeof(long);
347 }
348 } 328 }
349 } 329 }
350 if (info->pc_offset == -1 || info->frame_offset == -1) { 330 if (info->pc_offset == -1 || info->frame_size == 0) {
351 printk("Can't analyze prologue code at %p\n", func); 331 if (func == schedule)
332 printk("Can't analyze prologue code at %p\n", func);
352 info->pc_offset = -1; 333 info->pc_offset = -1;
353 info->frame_offset = -1; 334 info->frame_size = 0;
354 return -1;
355 } 335 }
356 336
357 return 0; 337 return 0;
@@ -359,25 +339,36 @@ static int __init get_frame_info(struct mips_frame_info *info)
359 339
360static int __init frame_info_init(void) 340static int __init frame_info_init(void)
361{ 341{
362 int i, found; 342 int i;
363 for (i = 0; i < ARRAY_SIZE(mfinfo); i++) 343#ifdef CONFIG_KALLSYMS
364 if (get_frame_info(&mfinfo[i])) 344 char *modname;
365 return -1; 345 char namebuf[KSYM_NAME_LEN + 1];
366 schedule_frame = mfinfo[0]; 346 unsigned long start, size, ofs;
367 /* bubble sort */ 347 extern char __sched_text_start[], __sched_text_end[];
368 do { 348 extern char __lock_text_start[], __lock_text_end[];
369 struct mips_frame_info tmp; 349
370 found = 0; 350 start = (unsigned long)__sched_text_start;
371 for (i = 1; i < ARRAY_SIZE(mfinfo); i++) { 351 for (i = 0; i < ARRAY_SIZE(mfinfo); i++) {
372 if (mfinfo[i-1].func > mfinfo[i].func) { 352 if (start == (unsigned long)schedule)
373 tmp = mfinfo[i]; 353 schedule_frame = &mfinfo[i];
374 mfinfo[i] = mfinfo[i-1]; 354 if (!kallsyms_lookup(start, &size, &ofs, &modname, namebuf))
375 mfinfo[i-1] = tmp; 355 break;
376 found = 1; 356 mfinfo[i].func = (void *)(start + ofs);
377 } 357 mfinfo[i].func_size = size;
378 } 358 start += size - ofs;
379 } while (found); 359 if (start >= (unsigned long)__lock_text_end)
380 mips_frame_info_initialized = 1; 360 break;
361 if (start == (unsigned long)__sched_text_end)
362 start = (unsigned long)__lock_text_start;
363 }
364#else
365 mfinfo[0].func = schedule;
366 schedule_frame = &mfinfo[0];
367#endif
368 for (i = 0; i < ARRAY_SIZE(mfinfo) && mfinfo[i].func; i++)
369 get_frame_info(&mfinfo[i]);
370
371 mfinfo_num = i;
381 return 0; 372 return 0;
382} 373}
383 374
@@ -394,47 +385,52 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
394 if (t->reg31 == (unsigned long) ret_from_fork) 385 if (t->reg31 == (unsigned long) ret_from_fork)
395 return t->reg31; 386 return t->reg31;
396 387
397 if (schedule_frame.pc_offset < 0) 388 if (!schedule_frame || schedule_frame->pc_offset < 0)
398 return 0; 389 return 0;
399 return ((unsigned long *)t->reg29)[schedule_frame.pc_offset]; 390 return ((unsigned long *)t->reg29)[schedule_frame->pc_offset];
400} 391}
401 392
402/* get_wchan - a maintenance nightmare^W^Wpain in the ass ... */ 393/* get_wchan - a maintenance nightmare^W^Wpain in the ass ... */
403unsigned long get_wchan(struct task_struct *p) 394unsigned long get_wchan(struct task_struct *p)
404{ 395{
405 unsigned long stack_page; 396 unsigned long stack_page;
406 unsigned long frame, pc; 397 unsigned long pc;
398#ifdef CONFIG_KALLSYMS
399 unsigned long frame;
400#endif
407 401
408 if (!p || p == current || p->state == TASK_RUNNING) 402 if (!p || p == current || p->state == TASK_RUNNING)
409 return 0; 403 return 0;
410 404
411 stack_page = (unsigned long)task_stack_page(p); 405 stack_page = (unsigned long)task_stack_page(p);
412 if (!stack_page || !mips_frame_info_initialized) 406 if (!stack_page || !mfinfo_num)
413 return 0; 407 return 0;
414 408
415 pc = thread_saved_pc(p); 409 pc = thread_saved_pc(p);
410#ifdef CONFIG_KALLSYMS
416 if (!in_sched_functions(pc)) 411 if (!in_sched_functions(pc))
417 return pc; 412 return pc;
418 413
419 frame = ((unsigned long *)p->thread.reg30)[schedule_frame.frame_offset]; 414 frame = p->thread.reg29 + schedule_frame->frame_size;
420 do { 415 do {
421 int i; 416 int i;
422 417
423 if (frame < stack_page || frame > stack_page + THREAD_SIZE - 32) 418 if (frame < stack_page || frame > stack_page + THREAD_SIZE - 32)
424 return 0; 419 return 0;
425 420
426 for (i = ARRAY_SIZE(mfinfo) - 1; i >= 0; i--) { 421 for (i = mfinfo_num - 1; i >= 0; i--) {
427 if (pc >= (unsigned long) mfinfo[i].func) 422 if (pc >= (unsigned long) mfinfo[i].func)
428 break; 423 break;
429 } 424 }
430 if (i < 0) 425 if (i < 0)
431 break; 426 break;
432 427
433 if (mfinfo[i].omit_fp)
434 break;
435 pc = ((unsigned long *)frame)[mfinfo[i].pc_offset]; 428 pc = ((unsigned long *)frame)[mfinfo[i].pc_offset];
436 frame = ((unsigned long *)frame)[mfinfo[i].frame_offset]; 429 if (!mfinfo[i].frame_size)
430 break;
431 frame += mfinfo[i].frame_size;
437 } while (in_sched_functions(pc)); 432 } while (in_sched_functions(pc));
433#endif
438 434
439 return pc; 435 return pc;
440} 436}
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index d7c4a38ed5ae..d83e033dbc87 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -623,7 +623,7 @@ einval: li v0, -EINVAL
623 sys sys_mknodat 4 /* 4290 */ 623 sys sys_mknodat 4 /* 4290 */
624 sys sys_fchownat 5 624 sys sys_fchownat 5
625 sys sys_futimesat 3 625 sys sys_futimesat 3
626 sys sys_newfstatat 4 626 sys sys_fstatat64 4
627 sys sys_unlinkat 3 627 sys sys_unlinkat 3
628 sys sys_renameat 4 /* 4295 */ 628 sys sys_renameat 4 /* 4295 */
629 sys sys_linkat 4 629 sys sys_linkat 4
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index bc4980cefc8b..d87b5446fa13 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -245,9 +245,9 @@ EXPORT(sysn32_call_table)
245 PTR sys_capget 245 PTR sys_capget
246 PTR sys_capset 246 PTR sys_capset
247 PTR sys32_rt_sigpending /* 6125 */ 247 PTR sys32_rt_sigpending /* 6125 */
248 PTR sysn32_rt_sigtimedwait 248 PTR compat_sys_rt_sigtimedwait
249 PTR sys_rt_sigqueueinfo 249 PTR sys_rt_sigqueueinfo
250 PTR sys32_rt_sigsuspend 250 PTR sysn32_rt_sigsuspend
251 PTR sys32_sigaltstack 251 PTR sys32_sigaltstack
252 PTR compat_sys_utime /* 6130 */ 252 PTR compat_sys_utime /* 6130 */
253 PTR sys_mknod 253 PTR sys_mknod
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index 0fbc492d24b4..36bfc2588aa3 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -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 __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? 32 : ALMASK)); 179 return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? ~(cpu_icache_line_size()-1) : 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/signal32.c b/arch/mips/kernel/signal32.c
index da3271e1fdac..237cd8a2cd32 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -4,7 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1991, 1992 Linus Torvalds 6 * Copyright (C) 1991, 1992 Linus Torvalds
7 * Copyright (C) 1994 - 2000 Ralf Baechle 7 * Copyright (C) 1994 - 2000, 2006 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */ 9 */
10#include <linux/cache.h> 10#include <linux/cache.h>
@@ -106,8 +106,6 @@ typedef struct compat_siginfo {
106 106
107#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 107#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
108 108
109extern int do_signal32(sigset_t *oldset, struct pt_regs *regs);
110
111/* 32-bit compatibility types */ 109/* 32-bit compatibility types */
112 110
113#define _NSIG_BPW32 32 111#define _NSIG_BPW32 32
@@ -198,7 +196,7 @@ __attribute_used__ noinline static int
198_sys32_sigsuspend(nabi_no_regargs struct pt_regs regs) 196_sys32_sigsuspend(nabi_no_regargs struct pt_regs regs)
199{ 197{
200 compat_sigset_t *uset; 198 compat_sigset_t *uset;
201 sigset_t newset, saveset; 199 sigset_t newset;
202 200
203 uset = (compat_sigset_t *) regs.regs[4]; 201 uset = (compat_sigset_t *) regs.regs[4];
204 if (get_sigset(&newset, uset)) 202 if (get_sigset(&newset, uset))
@@ -206,19 +204,15 @@ _sys32_sigsuspend(nabi_no_regargs struct pt_regs regs)
206 sigdelsetmask(&newset, ~_BLOCKABLE); 204 sigdelsetmask(&newset, ~_BLOCKABLE);
207 205
208 spin_lock_irq(&current->sighand->siglock); 206 spin_lock_irq(&current->sighand->siglock);
209 saveset = current->blocked; 207 current->saved_sigmask = current->blocked;
210 current->blocked = newset; 208 current->blocked = newset;
211 recalc_sigpending(); 209 recalc_sigpending();
212 spin_unlock_irq(&current->sighand->siglock); 210 spin_unlock_irq(&current->sighand->siglock);
213 211
214 regs.regs[2] = EINTR; 212 current->state = TASK_INTERRUPTIBLE;
215 regs.regs[7] = 1; 213 schedule();
216 while (1) { 214 set_thread_flag(TIF_RESTORE_SIGMASK);
217 current->state = TASK_INTERRUPTIBLE; 215 return -ERESTARTNOHAND;
218 schedule();
219 if (do_signal32(&saveset, &regs))
220 return -EINTR;
221 }
222} 216}
223 217
224save_static_function(sys32_rt_sigsuspend); 218save_static_function(sys32_rt_sigsuspend);
@@ -226,8 +220,8 @@ __attribute_used__ noinline static int
226_sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) 220_sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
227{ 221{
228 compat_sigset_t *uset; 222 compat_sigset_t *uset;
229 sigset_t newset, saveset; 223 sigset_t newset;
230 size_t sigsetsize; 224 size_t sigsetsize;
231 225
232 /* XXX Don't preclude handling different sized sigset_t's. */ 226 /* XXX Don't preclude handling different sized sigset_t's. */
233 sigsetsize = regs.regs[5]; 227 sigsetsize = regs.regs[5];
@@ -240,19 +234,15 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
240 sigdelsetmask(&newset, ~_BLOCKABLE); 234 sigdelsetmask(&newset, ~_BLOCKABLE);
241 235
242 spin_lock_irq(&current->sighand->siglock); 236 spin_lock_irq(&current->sighand->siglock);
243 saveset = current->blocked; 237 current->saved_sigmask = current->blocked;
244 current->blocked = newset; 238 current->blocked = newset;
245 recalc_sigpending(); 239 recalc_sigpending();
246 spin_unlock_irq(&current->sighand->siglock); 240 spin_unlock_irq(&current->sighand->siglock);
247 241
248 regs.regs[2] = EINTR; 242 current->state = TASK_INTERRUPTIBLE;
249 regs.regs[7] = 1; 243 schedule();
250 while (1) { 244 set_thread_flag(TIF_RESTORE_SIGMASK);
251 current->state = TASK_INTERRUPTIBLE; 245 return -ERESTARTNOHAND;
252 schedule();
253 if (do_signal32(&saveset, &regs))
254 return -EINTR;
255 }
256} 246}
257 247
258asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act, 248asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
@@ -537,7 +527,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
537 /* The ucontext contains a stack32_t, so we must convert! */ 527 /* The ucontext contains a stack32_t, so we must convert! */
538 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) 528 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
539 goto badframe; 529 goto badframe;
540 st.ss_size = (long) sp; 530 st.ss_sp = (void *)(long) sp;
541 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) 531 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
542 goto badframe; 532 goto badframe;
543 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) 533 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
@@ -783,7 +773,7 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
783 regs->regs[2] = EINTR; 773 regs->regs[2] = EINTR;
784 break; 774 break;
785 case ERESTARTSYS: 775 case ERESTARTSYS:
786 if(!(ka->sa.sa_flags & SA_RESTART)) { 776 if (!(ka->sa.sa_flags & SA_RESTART)) {
787 regs->regs[2] = EINTR; 777 regs->regs[2] = EINTR;
788 break; 778 break;
789 } 779 }
@@ -810,9 +800,10 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
810 return ret; 800 return ret;
811} 801}
812 802
813int do_signal32(sigset_t *oldset, struct pt_regs *regs) 803void do_signal32(struct pt_regs *regs)
814{ 804{
815 struct k_sigaction ka; 805 struct k_sigaction ka;
806 sigset_t *oldset;
816 siginfo_t info; 807 siginfo_t info;
817 int signr; 808 int signr;
818 809
@@ -822,17 +813,30 @@ int do_signal32(sigset_t *oldset, struct pt_regs *regs)
822 * if so. 813 * if so.
823 */ 814 */
824 if (!user_mode(regs)) 815 if (!user_mode(regs))
825 return 1; 816 return;
826 817
827 if (try_to_freeze()) 818 if (try_to_freeze())
828 goto no_signal; 819 goto no_signal;
829 820
830 if (!oldset) 821 if (test_thread_flag(TIF_RESTORE_SIGMASK))
822 oldset = &current->saved_sigmask;
823 else
831 oldset = &current->blocked; 824 oldset = &current->blocked;
832 825
833 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 826 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
834 if (signr > 0) 827 if (signr > 0) {
835 return handle_signal(signr, &info, &ka, oldset, regs); 828 /* Whee! Actually deliver the signal. */
829 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
830 /*
831 * A signal was successfully delivered; the saved
832 * sigmask will have been stored in the signal frame,
833 * and will be restored by sigreturn, so we can simply
834 * clear the TIF_RESTORE_SIGMASK flag.
835 */
836 if (test_thread_flag(TIF_RESTORE_SIGMASK))
837 clear_thread_flag(TIF_RESTORE_SIGMASK);
838 }
839 }
836 840
837no_signal: 841no_signal:
838 /* 842 /*
@@ -853,7 +857,15 @@ no_signal:
853 regs->cp0_epc -= 4; 857 regs->cp0_epc -= 4;
854 } 858 }
855 } 859 }
856 return 0; 860
861 /*
862 * If there's no signal to deliver, we just put the saved sigmask
863 * back
864 */
865 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
866 clear_thread_flag(TIF_RESTORE_SIGMASK);
867 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
868 }
857} 869}
858 870
859asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, 871asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act,
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index 384fc4a639a4..3e168c08a3a8 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -81,6 +81,39 @@ struct rt_sigframe_n32 {
81#endif 81#endif
82}; 82};
83 83
84extern void sigset_from_compat (sigset_t *set, compat_sigset_t *compat);
85
86save_static_function(sysn32_rt_sigsuspend);
87__attribute_used__ noinline static int
88_sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
89{
90 compat_sigset_t __user *unewset, uset;
91 size_t sigsetsize;
92 sigset_t newset;
93
94 /* XXX Don't preclude handling different sized sigset_t's. */
95 sigsetsize = regs.regs[5];
96 if (sigsetsize != sizeof(sigset_t))
97 return -EINVAL;
98
99 unewset = (compat_sigset_t __user *) regs.regs[4];
100 if (copy_from_user(&uset, unewset, sizeof(uset)))
101 return -EFAULT;
102 sigset_from_compat (&newset, &uset);
103 sigdelsetmask(&newset, ~_BLOCKABLE);
104
105 spin_lock_irq(&current->sighand->siglock);
106 current->saved_sigmask = current->blocked;
107 current->blocked = newset;
108 recalc_sigpending();
109 spin_unlock_irq(&current->sighand->siglock);
110
111 current->state = TASK_INTERRUPTIBLE;
112 schedule();
113 set_thread_flag(TIF_RESTORE_SIGMASK);
114 return -ERESTARTNOHAND;
115}
116
84save_static_function(sysn32_rt_sigreturn); 117save_static_function(sysn32_rt_sigreturn);
85__attribute_used__ noinline static void 118__attribute_used__ noinline static void
86_sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 119_sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
@@ -108,7 +141,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
108 /* The ucontext contains a stack32_t, so we must convert! */ 141 /* The ucontext contains a stack32_t, so we must convert! */
109 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) 142 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
110 goto badframe; 143 goto badframe;
111 st.ss_size = (long) sp; 144 st.ss_sp = (void *)(long) sp;
112 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) 145 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
113 goto badframe; 146 goto badframe;
114 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) 147 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 25472fcaf715..5e189862e523 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -29,6 +29,7 @@
29#include <linux/timex.h> 29#include <linux/timex.h>
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <linux/cpumask.h> 31#include <linux/cpumask.h>
32#include <linux/cpu.h>
32 33
33#include <asm/atomic.h> 34#include <asm/atomic.h>
34#include <asm/cpu.h> 35#include <asm/cpu.h>
@@ -424,6 +425,25 @@ void flush_tlb_one(unsigned long vaddr)
424 local_flush_tlb_one(vaddr); 425 local_flush_tlb_one(vaddr);
425} 426}
426 427
428static DEFINE_PER_CPU(struct cpu, cpu_devices);
429
430static int __init topology_init(void)
431{
432 int cpu;
433 int ret;
434
435 for_each_cpu(cpu) {
436 ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL);
437 if (ret)
438 printk(KERN_WARNING "topology_init: register_cpu %d "
439 "failed (%d)\n", cpu, ret);
440 }
441
442 return 0;
443}
444
445subsys_initcall(topology_init);
446
427EXPORT_SYMBOL(flush_tlb_page); 447EXPORT_SYMBOL(flush_tlb_page);
428EXPORT_SYMBOL(flush_tlb_one); 448EXPORT_SYMBOL(flush_tlb_one);
429EXPORT_SYMBOL(cpu_data); 449EXPORT_SYMBOL(cpu_data);
diff --git a/arch/mips/kernel/smp_mt.c b/arch/mips/kernel/smp_mt.c
index 794a1c3de2a4..c930364830d0 100644
--- a/arch/mips/kernel/smp_mt.c
+++ b/arch/mips/kernel/smp_mt.c
@@ -68,6 +68,8 @@ void __init sanitize_tlb_entries(void)
68 68
69 set_c0_mvpcontrol(MVPCONTROL_VPC); 69 set_c0_mvpcontrol(MVPCONTROL_VPC);
70 70
71 back_to_back_c0_hazard();
72
71 /* Disable TLB sharing */ 73 /* Disable TLB sharing */
72 clear_c0_mvpcontrol(MVPCONTROL_STLB); 74 clear_c0_mvpcontrol(MVPCONTROL_STLB);
73 75
@@ -102,35 +104,6 @@ void __init sanitize_tlb_entries(void)
102 clear_c0_mvpcontrol(MVPCONTROL_VPC); 104 clear_c0_mvpcontrol(MVPCONTROL_VPC);
103} 105}
104 106
105#if 0
106/*
107 * Use c0_MVPConf0 to find out how many CPUs are available, setting up
108 * phys_cpu_present_map and the logical/physical mappings.
109 */
110void __init prom_build_cpu_map(void)
111{
112 int i, num, ncpus;
113
114 cpus_clear(phys_cpu_present_map);
115
116 /* assume we boot on cpu 0.... */
117 cpu_set(0, phys_cpu_present_map);
118 __cpu_number_map[0] = 0;
119 __cpu_logical_map[0] = 0;
120
121 if (cpu_has_mipsmt) {
122 ncpus = ((read_c0_mvpconf0() & (MVPCONF0_PVPE)) >> MVPCONF0_PVPE_SHIFT) + 1;
123 for (i=1, num=0; i< NR_CPUS && i<ncpus; i++) {
124 cpu_set(i, phys_cpu_present_map);
125 __cpu_number_map[i] = ++num;
126 __cpu_logical_map[num] = i;
127 }
128
129 printk(KERN_INFO "%i available secondary CPU(s)\n", num);
130 }
131}
132#endif
133
134static void ipi_resched_dispatch (struct pt_regs *regs) 107static void ipi_resched_dispatch (struct pt_regs *regs)
135{ 108{
136 do_IRQ(MIPS_CPU_IPI_RESCHED_IRQ, regs); 109 do_IRQ(MIPS_CPU_IPI_RESCHED_IRQ, regs);
@@ -222,6 +195,9 @@ void prom_prepare_cpus(unsigned int max_cpus)
222 195
223 /* set config to be the same as vpe0, particularly kseg0 coherency alg */ 196 /* set config to be the same as vpe0, particularly kseg0 coherency alg */
224 write_vpe_c0_config( read_c0_config()); 197 write_vpe_c0_config( read_c0_config());
198
199 /* Propagate Config7 */
200 write_vpe_c0_config7(read_c0_config7());
225 } 201 }
226 202
227 } 203 }
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index c9d2b5147ca3..005debbfbe84 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.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) 1994 - 1999, 2000, 01 Ralf Baechle 6 * Copyright (C) 1994 - 1999, 2000, 01, 06 Ralf Baechle
7 * Copyright (C) 1995, 1996 Paul M. Antoine 7 * Copyright (C) 1995, 1996 Paul M. Antoine
8 * Copyright (C) 1998 Ulf Carlsson 8 * Copyright (C) 1998 Ulf Carlsson
9 * Copyright (C) 1999 Silicon Graphics, Inc. 9 * Copyright (C) 1999 Silicon Graphics, Inc.
@@ -548,6 +548,8 @@ asmlinkage void do_ov(struct pt_regs *regs)
548{ 548{
549 siginfo_t info; 549 siginfo_t info;
550 550
551 die_if_kernel("Integer overflow", regs);
552
551 info.si_code = FPE_INTOVF; 553 info.si_code = FPE_INTOVF;
552 info.si_signo = SIGFPE; 554 info.si_signo = SIGFPE;
553 info.si_errno = 0; 555 info.si_errno = 0;
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index e51c38cef88e..1b71d91e8268 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -471,61 +471,29 @@ struct flush_icache_range_args {
471static inline void local_r4k_flush_icache_range(void *args) 471static inline void local_r4k_flush_icache_range(void *args)
472{ 472{
473 struct flush_icache_range_args *fir_args = args; 473 struct flush_icache_range_args *fir_args = args;
474 unsigned long dc_lsize = cpu_dcache_line_size();
475 unsigned long ic_lsize = cpu_icache_line_size();
476 unsigned long sc_lsize = cpu_scache_line_size();
477 unsigned long start = fir_args->start; 474 unsigned long start = fir_args->start;
478 unsigned long end = fir_args->end; 475 unsigned long end = fir_args->end;
479 unsigned long addr, aend;
480 476
481 if (!cpu_has_ic_fills_f_dc) { 477 if (!cpu_has_ic_fills_f_dc) {
482 if (end - start > dcache_size) { 478 if (end - start > dcache_size) {
483 r4k_blast_dcache(); 479 r4k_blast_dcache();
484 } else { 480 } else {
485 R4600_HIT_CACHEOP_WAR_IMPL; 481 R4600_HIT_CACHEOP_WAR_IMPL;
486 addr = start & ~(dc_lsize - 1); 482 protected_blast_dcache_range(start, end);
487 aend = (end - 1) & ~(dc_lsize - 1);
488
489 while (1) {
490 /* Hit_Writeback_Inv_D */
491 protected_writeback_dcache_line(addr);
492 if (addr == aend)
493 break;
494 addr += dc_lsize;
495 }
496 } 483 }
497 484
498 if (!cpu_icache_snoops_remote_store) { 485 if (!cpu_icache_snoops_remote_store) {
499 if (end - start > scache_size) { 486 if (end - start > scache_size)
500 r4k_blast_scache(); 487 r4k_blast_scache();
501 } else { 488 else
502 addr = start & ~(sc_lsize - 1); 489 protected_blast_scache_range(start, end);
503 aend = (end - 1) & ~(sc_lsize - 1);
504
505 while (1) {
506 /* Hit_Writeback_Inv_SD */
507 protected_writeback_scache_line(addr);
508 if (addr == aend)
509 break;
510 addr += sc_lsize;
511 }
512 }
513 } 490 }
514 } 491 }
515 492
516 if (end - start > icache_size) 493 if (end - start > icache_size)
517 r4k_blast_icache(); 494 r4k_blast_icache();
518 else { 495 else
519 addr = start & ~(ic_lsize - 1); 496 protected_blast_icache_range(start, end);
520 aend = (end - 1) & ~(ic_lsize - 1);
521 while (1) {
522 /* Hit_Invalidate_I */
523 protected_flush_icache_line(addr);
524 if (addr == aend)
525 break;
526 addr += ic_lsize;
527 }
528 }
529} 497}
530 498
531static void r4k_flush_icache_range(unsigned long start, unsigned long end) 499static void r4k_flush_icache_range(unsigned long start, unsigned long end)
@@ -619,27 +587,14 @@ static void r4k_flush_icache_page(struct vm_area_struct *vma,
619 587
620static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size) 588static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
621{ 589{
622 unsigned long end, a;
623
624 /* Catch bad driver code */ 590 /* Catch bad driver code */
625 BUG_ON(size == 0); 591 BUG_ON(size == 0);
626 592
627 if (cpu_has_subset_pcaches) { 593 if (cpu_has_subset_pcaches) {
628 unsigned long sc_lsize = cpu_scache_line_size(); 594 if (size >= scache_size)
629
630 if (size >= scache_size) {
631 r4k_blast_scache(); 595 r4k_blast_scache();
632 return; 596 else
633 } 597 blast_scache_range(addr, addr + size);
634
635 a = addr & ~(sc_lsize - 1);
636 end = (addr + size - 1) & ~(sc_lsize - 1);
637 while (1) {
638 flush_scache_line(a); /* Hit_Writeback_Inv_SD */
639 if (a == end)
640 break;
641 a += sc_lsize;
642 }
643 return; 598 return;
644 } 599 }
645 600
@@ -651,17 +606,8 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
651 if (size >= dcache_size) { 606 if (size >= dcache_size) {
652 r4k_blast_dcache(); 607 r4k_blast_dcache();
653 } else { 608 } else {
654 unsigned long dc_lsize = cpu_dcache_line_size();
655
656 R4600_HIT_CACHEOP_WAR_IMPL; 609 R4600_HIT_CACHEOP_WAR_IMPL;
657 a = addr & ~(dc_lsize - 1); 610 blast_dcache_range(addr, addr + size);
658 end = (addr + size - 1) & ~(dc_lsize - 1);
659 while (1) {
660 flush_dcache_line(a); /* Hit_Writeback_Inv_D */
661 if (a == end)
662 break;
663 a += dc_lsize;
664 }
665 } 611 }
666 612
667 bc_wback_inv(addr, size); 613 bc_wback_inv(addr, size);
@@ -669,44 +615,22 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
669 615
670static void r4k_dma_cache_inv(unsigned long addr, unsigned long size) 616static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
671{ 617{
672 unsigned long end, a;
673
674 /* Catch bad driver code */ 618 /* Catch bad driver code */
675 BUG_ON(size == 0); 619 BUG_ON(size == 0);
676 620
677 if (cpu_has_subset_pcaches) { 621 if (cpu_has_subset_pcaches) {
678 unsigned long sc_lsize = cpu_scache_line_size(); 622 if (size >= scache_size)
679
680 if (size >= scache_size) {
681 r4k_blast_scache(); 623 r4k_blast_scache();
682 return; 624 else
683 } 625 blast_scache_range(addr, addr + size);
684
685 a = addr & ~(sc_lsize - 1);
686 end = (addr + size - 1) & ~(sc_lsize - 1);
687 while (1) {
688 flush_scache_line(a); /* Hit_Writeback_Inv_SD */
689 if (a == end)
690 break;
691 a += sc_lsize;
692 }
693 return; 626 return;
694 } 627 }
695 628
696 if (size >= dcache_size) { 629 if (size >= dcache_size) {
697 r4k_blast_dcache(); 630 r4k_blast_dcache();
698 } else { 631 } else {
699 unsigned long dc_lsize = cpu_dcache_line_size();
700
701 R4600_HIT_CACHEOP_WAR_IMPL; 632 R4600_HIT_CACHEOP_WAR_IMPL;
702 a = addr & ~(dc_lsize - 1); 633 blast_dcache_range(addr, addr + size);
703 end = (addr + size - 1) & ~(dc_lsize - 1);
704 while (1) {
705 flush_dcache_line(a); /* Hit_Writeback_Inv_D */
706 if (a == end)
707 break;
708 a += dc_lsize;
709 }
710 } 634 }
711 635
712 bc_inv(addr, size); 636 bc_inv(addr, size);
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
index 0a97a9434eba..7c572bea4a98 100644
--- a/arch/mips/mm/c-tx39.c
+++ b/arch/mips/mm/c-tx39.c
@@ -44,8 +44,6 @@ __asm__ __volatile__( \
44/* TX39H-style cache flush routines. */ 44/* TX39H-style cache flush routines. */
45static void tx39h_flush_icache_all(void) 45static void tx39h_flush_icache_all(void)
46{ 46{
47 unsigned long start = KSEG0;
48 unsigned long end = (start + icache_size);
49 unsigned long flags, config; 47 unsigned long flags, config;
50 48
51 /* disable icache (set ICE#) */ 49 /* disable icache (set ICE#) */
@@ -53,33 +51,18 @@ static void tx39h_flush_icache_all(void)
53 config = read_c0_conf(); 51 config = read_c0_conf();
54 write_c0_conf(config & ~TX39_CONF_ICE); 52 write_c0_conf(config & ~TX39_CONF_ICE);
55 TX39_STOP_STREAMING(); 53 TX39_STOP_STREAMING();
56 54 blast_icache16();
57 /* invalidate icache */
58 while (start < end) {
59 cache16_unroll32(start, Index_Invalidate_I);
60 start += 0x200;
61 }
62
63 write_c0_conf(config); 55 write_c0_conf(config);
64 local_irq_restore(flags); 56 local_irq_restore(flags);
65} 57}
66 58
67static void tx39h_dma_cache_wback_inv(unsigned long addr, unsigned long size) 59static void tx39h_dma_cache_wback_inv(unsigned long addr, unsigned long size)
68{ 60{
69 unsigned long end, a;
70 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
71
72 /* Catch bad driver code */ 61 /* Catch bad driver code */
73 BUG_ON(size == 0); 62 BUG_ON(size == 0);
74 63
75 iob(); 64 iob();
76 a = addr & ~(dc_lsize - 1); 65 blast_inv_dcache_range(addr, addr + size);
77 end = (addr + size - 1) & ~(dc_lsize - 1);
78 while (1) {
79 invalidate_dcache_line(a); /* Hit_Invalidate_D */
80 if (a == end) break;
81 a += dc_lsize;
82 }
83} 66}
84 67
85 68
@@ -241,42 +224,21 @@ static void tx39_flush_data_cache_page(unsigned long addr)
241 224
242static void tx39_flush_icache_range(unsigned long start, unsigned long end) 225static void tx39_flush_icache_range(unsigned long start, unsigned long end)
243{ 226{
244 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
245 unsigned long addr, aend;
246
247 if (end - start > dcache_size) 227 if (end - start > dcache_size)
248 tx39_blast_dcache(); 228 tx39_blast_dcache();
249 else { 229 else
250 addr = start & ~(dc_lsize - 1); 230 protected_blast_dcache_range(start, end);
251 aend = (end - 1) & ~(dc_lsize - 1);
252
253 while (1) {
254 /* Hit_Writeback_Inv_D */
255 protected_writeback_dcache_line(addr);
256 if (addr == aend)
257 break;
258 addr += dc_lsize;
259 }
260 }
261 231
262 if (end - start > icache_size) 232 if (end - start > icache_size)
263 tx39_blast_icache(); 233 tx39_blast_icache();
264 else { 234 else {
265 unsigned long flags, config; 235 unsigned long flags, config;
266 addr = start & ~(dc_lsize - 1);
267 aend = (end - 1) & ~(dc_lsize - 1);
268 /* disable icache (set ICE#) */ 236 /* disable icache (set ICE#) */
269 local_irq_save(flags); 237 local_irq_save(flags);
270 config = read_c0_conf(); 238 config = read_c0_conf();
271 write_c0_conf(config & ~TX39_CONF_ICE); 239 write_c0_conf(config & ~TX39_CONF_ICE);
272 TX39_STOP_STREAMING(); 240 TX39_STOP_STREAMING();
273 while (1) { 241 protected_blast_icache_range(start, end);
274 /* Hit_Invalidate_I */
275 protected_flush_icache_line(addr);
276 if (addr == aend)
277 break;
278 addr += dc_lsize;
279 }
280 write_c0_conf(config); 242 write_c0_conf(config);
281 local_irq_restore(flags); 243 local_irq_restore(flags);
282 } 244 }
@@ -311,7 +273,7 @@ static void tx39_flush_icache_page(struct vm_area_struct *vma, struct page *page
311 273
312static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size) 274static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size)
313{ 275{
314 unsigned long end, a; 276 unsigned long end;
315 277
316 if (((size | addr) & (PAGE_SIZE - 1)) == 0) { 278 if (((size | addr) & (PAGE_SIZE - 1)) == 0) {
317 end = addr + size; 279 end = addr + size;
@@ -322,20 +284,13 @@ static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size)
322 } else if (size > dcache_size) { 284 } else if (size > dcache_size) {
323 tx39_blast_dcache(); 285 tx39_blast_dcache();
324 } else { 286 } else {
325 unsigned long dc_lsize = current_cpu_data.dcache.linesz; 287 blast_dcache_range(addr, addr + size);
326 a = addr & ~(dc_lsize - 1);
327 end = (addr + size - 1) & ~(dc_lsize - 1);
328 while (1) {
329 flush_dcache_line(a); /* Hit_Writeback_Inv_D */
330 if (a == end) break;
331 a += dc_lsize;
332 }
333 } 288 }
334} 289}
335 290
336static void tx39_dma_cache_inv(unsigned long addr, unsigned long size) 291static void tx39_dma_cache_inv(unsigned long addr, unsigned long size)
337{ 292{
338 unsigned long end, a; 293 unsigned long end;
339 294
340 if (((size | addr) & (PAGE_SIZE - 1)) == 0) { 295 if (((size | addr) & (PAGE_SIZE - 1)) == 0) {
341 end = addr + size; 296 end = addr + size;
@@ -346,14 +301,7 @@ static void tx39_dma_cache_inv(unsigned long addr, unsigned long size)
346 } else if (size > dcache_size) { 301 } else if (size > dcache_size) {
347 tx39_blast_dcache(); 302 tx39_blast_dcache();
348 } else { 303 } else {
349 unsigned long dc_lsize = current_cpu_data.dcache.linesz; 304 blast_inv_dcache_range(addr, addr + size);
350 a = addr & ~(dc_lsize - 1);
351 end = (addr + size - 1) & ~(dc_lsize - 1);
352 while (1) {
353 invalidate_dcache_line(a); /* Hit_Invalidate_D */
354 if (a == end) break;
355 a += dc_lsize;
356 }
357 } 305 }
358} 306}
359 307
diff --git a/arch/mips/mm/cex-sb1.S b/arch/mips/mm/cex-sb1.S
index 0e71580774ff..e54a62f2807c 100644
--- a/arch/mips/mm/cex-sb1.S
+++ b/arch/mips/mm/cex-sb1.S
@@ -64,7 +64,7 @@ LEAF(except_vec2_sb1)
64 sd k0,0x170($0) 64 sd k0,0x170($0)
65 sd k1,0x178($0) 65 sd k1,0x178($0)
66 66
67#if CONFIG_SB1_CEX_ALWAYS_FATAL 67#ifdef CONFIG_SB1_CEX_ALWAYS_FATAL
68 j handle_vec2_sb1 68 j handle_vec2_sb1
69 nop 69 nop
70#else 70#else
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c
index f17f575f58f0..7f8fda962190 100644
--- a/arch/mips/pmc-sierra/yosemite/smp.c
+++ b/arch/mips/pmc-sierra/yosemite/smp.c
@@ -94,7 +94,7 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
94void prom_boot_secondary(int cpu, struct task_struct *idle) 94void prom_boot_secondary(int cpu, struct task_struct *idle)
95{ 95{
96 unsigned long gp = (unsigned long) task_thread_info(idle); 96 unsigned long gp = (unsigned long) task_thread_info(idle);
97 unsigned long sp = __KSTK_TOP(idle); 97 unsigned long sp = __KSTK_TOS(idle);
98 98
99 secondary_sp = sp; 99 secondary_sp = sp;
100 secondary_gp = gp; 100 secondary_gp = gp;
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig
index de46f62ac462..816aee7fcd25 100644
--- a/arch/mips/sibyte/Kconfig
+++ b/arch/mips/sibyte/Kconfig
@@ -102,11 +102,11 @@ config SIMULATION
102 Build a kernel suitable for running under the GDB simulator. 102 Build a kernel suitable for running under the GDB simulator.
103 Primarily adjusts the kernel's notion of time. 103 Primarily adjusts the kernel's notion of time.
104 104
105config CONFIG_SB1_CEX_ALWAYS_FATAL 105config SB1_CEX_ALWAYS_FATAL
106 bool "All cache exceptions considered fatal (no recovery attempted)" 106 bool "All cache exceptions considered fatal (no recovery attempted)"
107 depends on SIBYTE_SB1xxx_SOC 107 depends on SIBYTE_SB1xxx_SOC
108 108
109config CONFIG_SB1_CERR_STALL 109config SB1_CERR_STALL
110 bool "Stall (rather than panic) on fatal cache error" 110 bool "Stall (rather than panic) on fatal cache error"
111 depends on SIBYTE_SB1xxx_SOC 111 depends on SIBYTE_SB1xxx_SOC
112 112
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index b2a1ba5d23df..9cf7d713b13c 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -139,7 +139,7 @@ void bcm1480_unmask_irq(int cpu, int irq)
139#ifdef CONFIG_SMP 139#ifdef CONFIG_SMP
140static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask) 140static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
141{ 141{
142 int i = 0, old_cpu, cpu, int_on; 142 int i = 0, old_cpu, cpu, int_on, k;
143 u64 cur_ints; 143 u64 cur_ints;
144 irq_desc_t *desc = irq_desc + irq; 144 irq_desc_t *desc = irq_desc + irq;
145 unsigned long flags; 145 unsigned long flags;
@@ -165,7 +165,6 @@ static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
165 irq_dirty -= BCM1480_NR_IRQS_HALF; 165 irq_dirty -= BCM1480_NR_IRQS_HALF;
166 } 166 }
167 167
168 int k;
169 for (k=0; k<2; k++) { /* Loop through high and low interrupt mask register */ 168 for (k=0; k<2; k++) { /* Loop through high and low interrupt mask register */
170 cur_ints = ____raw_readq(IOADDR(A_BCM1480_IMR_MAPPER(old_cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + (k*BCM1480_IMR_HL_SPACING))); 169 cur_ints = ____raw_readq(IOADDR(A_BCM1480_IMR_MAPPER(old_cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + (k*BCM1480_IMR_HL_SPACING)));
171 int_on = !(cur_ints & (((u64) 1) << irq_dirty)); 170 int_on = !(cur_ints & (((u64) 1) << irq_dirty));
@@ -216,6 +215,7 @@ static void ack_bcm1480_irq(unsigned int irq)
216{ 215{
217 u64 pending; 216 u64 pending;
218 unsigned int irq_dirty; 217 unsigned int irq_dirty;
218 int k;
219 219
220 /* 220 /*
221 * If the interrupt was an HT interrupt, now is the time to 221 * If the interrupt was an HT interrupt, now is the time to
@@ -227,7 +227,6 @@ static void ack_bcm1480_irq(unsigned int irq)
227 if ((irq_dirty >= BCM1480_NR_IRQS_HALF) && (irq_dirty <= BCM1480_NR_IRQS)) { 227 if ((irq_dirty >= BCM1480_NR_IRQS_HALF) && (irq_dirty <= BCM1480_NR_IRQS)) {
228 irq_dirty -= BCM1480_NR_IRQS_HALF; 228 irq_dirty -= BCM1480_NR_IRQS_HALF;
229 } 229 }
230 int k;
231 for (k=0; k<2; k++) { /* Loop through high and low LDT interrupts */ 230 for (k=0; k<2; k++) { /* Loop through high and low LDT interrupts */
232 pending = __raw_readq(IOADDR(A_BCM1480_IMR_REGISTER(bcm1480_irq_owner[irq], 231 pending = __raw_readq(IOADDR(A_BCM1480_IMR_REGISTER(bcm1480_irq_owner[irq],
233 R_BCM1480_IMR_LDT_INTERRUPT_H + (k*BCM1480_IMR_HL_SPACING)))); 232 R_BCM1480_IMR_LDT_INTERRUPT_H + (k*BCM1480_IMR_HL_SPACING))));
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 7c914a4c67c3..eca33cfa8a4c 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -29,6 +29,11 @@ config GENERIC_CALIBRATE_DELAY
29 bool 29 bool
30 default y 30 default y
31 31
32config TIME_LOW_RES
33 bool
34 depends on SMP
35 default y
36
32config GENERIC_ISA_DMA 37config GENERIC_ISA_DMA
33 bool 38 bool
34 39
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 51d2480627d1..71011eadb872 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -377,15 +377,15 @@
377 ENTRY_SAME(inotify_init) 377 ENTRY_SAME(inotify_init)
378 ENTRY_SAME(inotify_add_watch) /* 270 */ 378 ENTRY_SAME(inotify_add_watch) /* 270 */
379 ENTRY_SAME(inotify_rm_watch) 379 ENTRY_SAME(inotify_rm_watch)
380 ENTRY_COMP(pselect6) 380 ENTRY_SAME(ni_syscall) /* 271 ENTRY_COMP(pselect6) */
381 ENTRY_COMP(ppoll) 381 ENTRY_SAME(ni_syscall) /* 272 ENTRY_COMP(ppoll) */
382 ENTRY_SAME(migrate_pages) 382 ENTRY_SAME(migrate_pages)
383 ENTRY_COMP(openat) /* 275 */ 383 ENTRY_COMP(openat) /* 275 */
384 ENTRY_SAME(mkdirat) 384 ENTRY_SAME(mkdirat)
385 ENTRY_SAME(mknodat) 385 ENTRY_SAME(mknodat)
386 ENTRY_SAME(fchownat) 386 ENTRY_SAME(fchownat)
387 ENTRY_COMP(futimesat) 387 ENTRY_COMP(futimesat)
388 ENTRY_COMP(newfstatat) /* 280 */ 388 ENTRY_SAME(fstatat64) /* 280 */
389 ENTRY_SAME(unlinkat) 389 ENTRY_SAME(unlinkat)
390 ENTRY_SAME(renameat) 390 ENTRY_SAME(renameat)
391 ENTRY_SAME(linkat) 391 ENTRY_SAME(linkat)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 81d3b3ddc206..a3fc7a23158f 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -168,6 +168,8 @@ endef
168 168
169archclean: 169archclean:
170 $(Q)$(MAKE) $(clean)=$(boot) 170 $(Q)$(MAKE) $(clean)=$(boot)
171
172archmrproper:
171 $(Q)rm -rf arch/$(ARCH)/include 173 $(Q)rm -rf arch/$(ARCH)/include
172 174
173archprepare: checkbin 175archprepare: checkbin
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig
index d6fed3f56580..2c3fd2007676 100644
--- a/arch/powerpc/configs/g5_defconfig
+++ b/arch/powerpc/configs/g5_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc5 3# Linux kernel version: 2.6.16-rc2
4# Tue Dec 20 15:59:30 2005 4# Fri Feb 10 17:33:08 2006
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -16,6 +16,10 @@ CONFIG_COMPAT=y
16CONFIG_SYSVIPC_COMPAT=y 16CONFIG_SYSVIPC_COMPAT=y
17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
18CONFIG_ARCH_MAY_HAVE_PC_FDC=y 18CONFIG_ARCH_MAY_HAVE_PC_FDC=y
19CONFIG_PPC_OF=y
20# CONFIG_PPC_UDBG_16550 is not set
21CONFIG_GENERIC_TBSYNC=y
22# CONFIG_DEFAULT_UIMAGE is not set
19 23
20# 24#
21# Processor support 25# Processor support
@@ -26,13 +30,12 @@ CONFIG_PPC_FPU=y
26CONFIG_ALTIVEC=y 30CONFIG_ALTIVEC=y
27CONFIG_PPC_STD_MMU=y 31CONFIG_PPC_STD_MMU=y
28CONFIG_SMP=y 32CONFIG_SMP=y
29CONFIG_NR_CPUS=2 33CONFIG_NR_CPUS=4
30 34
31# 35#
32# Code maturity level options 36# Code maturity level options
33# 37#
34CONFIG_EXPERIMENTAL=y 38CONFIG_EXPERIMENTAL=y
35CONFIG_CLEAN_COMPILE=y
36CONFIG_LOCK_KERNEL=y 39CONFIG_LOCK_KERNEL=y
37CONFIG_INIT_ENV_ARG_LIMIT=32 40CONFIG_INIT_ENV_ARG_LIMIT=32
38 41
@@ -47,8 +50,6 @@ CONFIG_POSIX_MQUEUE=y
47# CONFIG_BSD_PROCESS_ACCT is not set 50# CONFIG_BSD_PROCESS_ACCT is not set
48CONFIG_SYSCTL=y 51CONFIG_SYSCTL=y
49# CONFIG_AUDIT is not set 52# CONFIG_AUDIT is not set
50CONFIG_HOTPLUG=y
51CONFIG_KOBJECT_UEVENT=y
52CONFIG_IKCONFIG=y 53CONFIG_IKCONFIG=y
53CONFIG_IKCONFIG_PROC=y 54CONFIG_IKCONFIG_PROC=y
54# CONFIG_CPUSETS is not set 55# CONFIG_CPUSETS is not set
@@ -58,8 +59,10 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
58CONFIG_KALLSYMS=y 59CONFIG_KALLSYMS=y
59# CONFIG_KALLSYMS_ALL is not set 60# CONFIG_KALLSYMS_ALL is not set
60# CONFIG_KALLSYMS_EXTRA_PASS is not set 61# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y
61CONFIG_PRINTK=y 63CONFIG_PRINTK=y
62CONFIG_BUG=y 64CONFIG_BUG=y
65CONFIG_ELF_CORE=y
63CONFIG_BASE_FULL=y 66CONFIG_BASE_FULL=y
64CONFIG_FUTEX=y 67CONFIG_FUTEX=y
65CONFIG_EPOLL=y 68CONFIG_EPOLL=y
@@ -68,8 +71,10 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
68CONFIG_CC_ALIGN_LABELS=0 71CONFIG_CC_ALIGN_LABELS=0
69CONFIG_CC_ALIGN_LOOPS=0 72CONFIG_CC_ALIGN_LOOPS=0
70CONFIG_CC_ALIGN_JUMPS=0 73CONFIG_CC_ALIGN_JUMPS=0
74CONFIG_SLAB=y
71# CONFIG_TINY_SHMEM is not set 75# CONFIG_TINY_SHMEM is not set
72CONFIG_BASE_SMALL=0 76CONFIG_BASE_SMALL=0
77# CONFIG_SLOB is not set
73 78
74# 79#
75# Loadable module support 80# Loadable module support
@@ -112,13 +117,12 @@ CONFIG_PPC_PMAC=y
112CONFIG_PPC_PMAC64=y 117CONFIG_PPC_PMAC64=y
113# CONFIG_PPC_MAPLE is not set 118# CONFIG_PPC_MAPLE is not set
114# CONFIG_PPC_CELL is not set 119# CONFIG_PPC_CELL is not set
115CONFIG_PPC_OF=y
116CONFIG_U3_DART=y 120CONFIG_U3_DART=y
117CONFIG_MPIC=y 121CONFIG_MPIC=y
118# CONFIG_PPC_RTAS is not set 122# CONFIG_PPC_RTAS is not set
119# CONFIG_MMIO_NVRAM is not set 123# CONFIG_MMIO_NVRAM is not set
124CONFIG_MPIC_BROKEN_U3=y
120# CONFIG_PPC_MPC106 is not set 125# CONFIG_PPC_MPC106 is not set
121CONFIG_GENERIC_TBSYNC=y
122CONFIG_CPU_FREQ=y 126CONFIG_CPU_FREQ=y
123CONFIG_CPU_FREQ_TABLE=y 127CONFIG_CPU_FREQ_TABLE=y
124# CONFIG_CPU_FREQ_DEBUG is not set 128# CONFIG_CPU_FREQ_DEBUG is not set
@@ -151,6 +155,7 @@ CONFIG_FORCE_MAX_ZONEORDER=13
151CONFIG_IOMMU_VMERGE=y 155CONFIG_IOMMU_VMERGE=y
152# CONFIG_HOTPLUG_CPU is not set 156# CONFIG_HOTPLUG_CPU is not set
153CONFIG_KEXEC=y 157CONFIG_KEXEC=y
158# CONFIG_CRASH_DUMP is not set
154CONFIG_IRQ_ALL_CPUS=y 159CONFIG_IRQ_ALL_CPUS=y
155# CONFIG_NUMA is not set 160# CONFIG_NUMA is not set
156CONFIG_ARCH_SELECT_MEMORY_MODEL=y 161CONFIG_ARCH_SELECT_MEMORY_MODEL=y
@@ -202,6 +207,7 @@ CONFIG_NET=y
202# 207#
203# Networking options 208# Networking options
204# 209#
210# CONFIG_NETDEBUG is not set
205CONFIG_PACKET=y 211CONFIG_PACKET=y
206# CONFIG_PACKET_MMAP is not set 212# CONFIG_PACKET_MMAP is not set
207CONFIG_UNIX=y 213CONFIG_UNIX=y
@@ -239,6 +245,7 @@ CONFIG_NETFILTER=y
239# Core Netfilter Configuration 245# Core Netfilter Configuration
240# 246#
241# CONFIG_NETFILTER_NETLINK is not set 247# CONFIG_NETFILTER_NETLINK is not set
248# CONFIG_NETFILTER_XTABLES is not set
242 249
243# 250#
244# IP: Netfilter Configuration 251# IP: Netfilter Configuration
@@ -255,65 +262,6 @@ CONFIG_IP_NF_TFTP=m
255CONFIG_IP_NF_AMANDA=m 262CONFIG_IP_NF_AMANDA=m
256# CONFIG_IP_NF_PPTP is not set 263# CONFIG_IP_NF_PPTP is not set
257CONFIG_IP_NF_QUEUE=m 264CONFIG_IP_NF_QUEUE=m
258CONFIG_IP_NF_IPTABLES=m
259CONFIG_IP_NF_MATCH_LIMIT=m
260CONFIG_IP_NF_MATCH_IPRANGE=m
261CONFIG_IP_NF_MATCH_MAC=m
262CONFIG_IP_NF_MATCH_PKTTYPE=m
263CONFIG_IP_NF_MATCH_MARK=m
264CONFIG_IP_NF_MATCH_MULTIPORT=m
265CONFIG_IP_NF_MATCH_TOS=m
266CONFIG_IP_NF_MATCH_RECENT=m
267CONFIG_IP_NF_MATCH_ECN=m
268CONFIG_IP_NF_MATCH_DSCP=m
269CONFIG_IP_NF_MATCH_AH_ESP=m
270CONFIG_IP_NF_MATCH_LENGTH=m
271CONFIG_IP_NF_MATCH_TTL=m
272CONFIG_IP_NF_MATCH_TCPMSS=m
273CONFIG_IP_NF_MATCH_HELPER=m
274CONFIG_IP_NF_MATCH_STATE=m
275CONFIG_IP_NF_MATCH_CONNTRACK=m
276CONFIG_IP_NF_MATCH_OWNER=m
277CONFIG_IP_NF_MATCH_ADDRTYPE=m
278CONFIG_IP_NF_MATCH_REALM=m
279CONFIG_IP_NF_MATCH_SCTP=m
280# CONFIG_IP_NF_MATCH_DCCP is not set
281CONFIG_IP_NF_MATCH_COMMENT=m
282CONFIG_IP_NF_MATCH_CONNMARK=m
283CONFIG_IP_NF_MATCH_CONNBYTES=m
284CONFIG_IP_NF_MATCH_HASHLIMIT=m
285CONFIG_IP_NF_MATCH_STRING=m
286CONFIG_IP_NF_FILTER=m
287CONFIG_IP_NF_TARGET_REJECT=m
288CONFIG_IP_NF_TARGET_LOG=m
289CONFIG_IP_NF_TARGET_ULOG=m
290CONFIG_IP_NF_TARGET_TCPMSS=m
291CONFIG_IP_NF_TARGET_NFQUEUE=m
292CONFIG_IP_NF_NAT=m
293CONFIG_IP_NF_NAT_NEEDED=y
294CONFIG_IP_NF_TARGET_MASQUERADE=m
295CONFIG_IP_NF_TARGET_REDIRECT=m
296CONFIG_IP_NF_TARGET_NETMAP=m
297CONFIG_IP_NF_TARGET_SAME=m
298CONFIG_IP_NF_NAT_SNMP_BASIC=m
299CONFIG_IP_NF_NAT_IRC=m
300CONFIG_IP_NF_NAT_FTP=m
301CONFIG_IP_NF_NAT_TFTP=m
302CONFIG_IP_NF_NAT_AMANDA=m
303CONFIG_IP_NF_MANGLE=m
304CONFIG_IP_NF_TARGET_TOS=m
305CONFIG_IP_NF_TARGET_ECN=m
306CONFIG_IP_NF_TARGET_DSCP=m
307CONFIG_IP_NF_TARGET_MARK=m
308CONFIG_IP_NF_TARGET_CLASSIFY=m
309CONFIG_IP_NF_TARGET_TTL=m
310CONFIG_IP_NF_TARGET_CONNMARK=m
311CONFIG_IP_NF_TARGET_CLUSTERIP=m
312CONFIG_IP_NF_RAW=m
313CONFIG_IP_NF_TARGET_NOTRACK=m
314CONFIG_IP_NF_ARPTABLES=m
315CONFIG_IP_NF_ARPFILTER=m
316CONFIG_IP_NF_ARP_MANGLE=m
317 265
318# 266#
319# DCCP Configuration (EXPERIMENTAL) 267# DCCP Configuration (EXPERIMENTAL)
@@ -324,6 +272,11 @@ CONFIG_IP_NF_ARP_MANGLE=m
324# SCTP Configuration (EXPERIMENTAL) 272# SCTP Configuration (EXPERIMENTAL)
325# 273#
326# CONFIG_IP_SCTP is not set 274# CONFIG_IP_SCTP is not set
275
276#
277# TIPC Configuration (EXPERIMENTAL)
278#
279# CONFIG_TIPC is not set
327# CONFIG_ATM is not set 280# CONFIG_ATM is not set
328# CONFIG_BRIDGE is not set 281# CONFIG_BRIDGE is not set
329# CONFIG_VLAN_8021Q is not set 282# CONFIG_VLAN_8021Q is not set
@@ -342,7 +295,6 @@ CONFIG_LLC=y
342# QoS and/or fair queueing 295# QoS and/or fair queueing
343# 296#
344# CONFIG_NET_SCHED is not set 297# CONFIG_NET_SCHED is not set
345CONFIG_NET_CLS_ROUTE=y
346 298
347# 299#
348# Network testing 300# Network testing
@@ -545,13 +497,7 @@ CONFIG_SCSI_SATA_SVW=y
545# CONFIG_SCSI_IPR is not set 497# CONFIG_SCSI_IPR is not set
546# CONFIG_SCSI_QLOGIC_FC is not set 498# CONFIG_SCSI_QLOGIC_FC is not set
547# CONFIG_SCSI_QLOGIC_1280 is not set 499# CONFIG_SCSI_QLOGIC_1280 is not set
548CONFIG_SCSI_QLA2XXX=y 500# CONFIG_SCSI_QLA_FC is not set
549# CONFIG_SCSI_QLA21XX is not set
550# CONFIG_SCSI_QLA22XX is not set
551# CONFIG_SCSI_QLA2300 is not set
552# CONFIG_SCSI_QLA2322 is not set
553# CONFIG_SCSI_QLA6312 is not set
554# CONFIG_SCSI_QLA24XX is not set
555# CONFIG_SCSI_LPFC is not set 501# CONFIG_SCSI_LPFC is not set
556# CONFIG_SCSI_DC395x is not set 502# CONFIG_SCSI_DC395x is not set
557# CONFIG_SCSI_DC390T is not set 503# CONFIG_SCSI_DC390T is not set
@@ -614,7 +560,6 @@ CONFIG_IEEE1394_SBP2=m
614CONFIG_IEEE1394_ETH1394=m 560CONFIG_IEEE1394_ETH1394=m
615CONFIG_IEEE1394_DV1394=m 561CONFIG_IEEE1394_DV1394=m
616CONFIG_IEEE1394_RAWIO=y 562CONFIG_IEEE1394_RAWIO=y
617# CONFIG_IEEE1394_CMP is not set
618 563
619# 564#
620# I2O device support 565# I2O device support
@@ -630,6 +575,7 @@ CONFIG_THERM_PM72=y
630CONFIG_WINDFARM=y 575CONFIG_WINDFARM=y
631CONFIG_WINDFARM_PM81=y 576CONFIG_WINDFARM_PM81=y
632CONFIG_WINDFARM_PM91=y 577CONFIG_WINDFARM_PM91=y
578CONFIG_WINDFARM_PM112=y
633 579
634# 580#
635# Network device support 581# Network device support
@@ -682,8 +628,9 @@ CONFIG_E1000=y
682# CONFIG_R8169 is not set 628# CONFIG_R8169 is not set
683# CONFIG_SIS190 is not set 629# CONFIG_SIS190 is not set
684# CONFIG_SKGE is not set 630# CONFIG_SKGE is not set
631# CONFIG_SKY2 is not set
685# CONFIG_SK98LIN is not set 632# CONFIG_SK98LIN is not set
686CONFIG_TIGON3=m 633CONFIG_TIGON3=y
687# CONFIG_BNX2 is not set 634# CONFIG_BNX2 is not set
688# CONFIG_MV643XX_ETH is not set 635# CONFIG_MV643XX_ETH is not set
689 636
@@ -861,8 +808,7 @@ CONFIG_I2C_ALGOBIT=y
861# CONFIG_I2C_I801 is not set 808# CONFIG_I2C_I801 is not set
862# CONFIG_I2C_I810 is not set 809# CONFIG_I2C_I810 is not set
863# CONFIG_I2C_PIIX4 is not set 810# CONFIG_I2C_PIIX4 is not set
864CONFIG_I2C_KEYWEST=y 811CONFIG_I2C_POWERMAC=y
865CONFIG_I2C_PMAC_SMU=y
866# CONFIG_I2C_NFORCE2 is not set 812# CONFIG_I2C_NFORCE2 is not set
867# CONFIG_I2C_PARPORT_LIGHT is not set 813# CONFIG_I2C_PARPORT_LIGHT is not set
868# CONFIG_I2C_PROSAVAGE is not set 814# CONFIG_I2C_PROSAVAGE is not set
@@ -895,6 +841,12 @@ CONFIG_I2C_PMAC_SMU=y
895# CONFIG_I2C_DEBUG_CHIP is not set 841# CONFIG_I2C_DEBUG_CHIP is not set
896 842
897# 843#
844# SPI support
845#
846# CONFIG_SPI is not set
847# CONFIG_SPI_MASTER is not set
848
849#
898# Dallas's 1-wire bus 850# Dallas's 1-wire bus
899# 851#
900# CONFIG_W1 is not set 852# CONFIG_W1 is not set
@@ -961,7 +913,6 @@ CONFIG_FB_RADEON_I2C=y
961# CONFIG_FB_KYRO is not set 913# CONFIG_FB_KYRO is not set
962# CONFIG_FB_3DFX is not set 914# CONFIG_FB_3DFX is not set
963# CONFIG_FB_VOODOO1 is not set 915# CONFIG_FB_VOODOO1 is not set
964# CONFIG_FB_CYBLA is not set
965# CONFIG_FB_TRIDENT is not set 916# CONFIG_FB_TRIDENT is not set
966# CONFIG_FB_VIRTUAL is not set 917# CONFIG_FB_VIRTUAL is not set
967 918
@@ -1008,9 +959,10 @@ CONFIG_SND_OSSEMUL=y
1008CONFIG_SND_MIXER_OSS=m 959CONFIG_SND_MIXER_OSS=m
1009CONFIG_SND_PCM_OSS=m 960CONFIG_SND_PCM_OSS=m
1010CONFIG_SND_SEQUENCER_OSS=y 961CONFIG_SND_SEQUENCER_OSS=y
962# CONFIG_SND_DYNAMIC_MINORS is not set
963CONFIG_SND_SUPPORT_OLD_API=y
1011# CONFIG_SND_VERBOSE_PRINTK is not set 964# CONFIG_SND_VERBOSE_PRINTK is not set
1012# CONFIG_SND_DEBUG is not set 965# CONFIG_SND_DEBUG is not set
1013CONFIG_SND_GENERIC_DRIVER=y
1014 966
1015# 967#
1016# Generic devices 968# Generic devices
@@ -1024,6 +976,8 @@ CONFIG_SND_GENERIC_DRIVER=y
1024# 976#
1025# PCI devices 977# PCI devices
1026# 978#
979# CONFIG_SND_AD1889 is not set
980# CONFIG_SND_ALS4000 is not set
1027# CONFIG_SND_ALI5451 is not set 981# CONFIG_SND_ALI5451 is not set
1028# CONFIG_SND_ATIIXP is not set 982# CONFIG_SND_ATIIXP is not set
1029# CONFIG_SND_ATIIXP_MODEM is not set 983# CONFIG_SND_ATIIXP_MODEM is not set
@@ -1032,39 +986,38 @@ CONFIG_SND_GENERIC_DRIVER=y
1032# CONFIG_SND_AU8830 is not set 986# CONFIG_SND_AU8830 is not set
1033# CONFIG_SND_AZT3328 is not set 987# CONFIG_SND_AZT3328 is not set
1034# CONFIG_SND_BT87X is not set 988# CONFIG_SND_BT87X is not set
1035# CONFIG_SND_CS46XX is not set 989# CONFIG_SND_CA0106 is not set
990# CONFIG_SND_CMIPCI is not set
1036# CONFIG_SND_CS4281 is not set 991# CONFIG_SND_CS4281 is not set
992# CONFIG_SND_CS46XX is not set
1037# CONFIG_SND_EMU10K1 is not set 993# CONFIG_SND_EMU10K1 is not set
1038# CONFIG_SND_EMU10K1X is not set 994# CONFIG_SND_EMU10K1X is not set
1039# CONFIG_SND_CA0106 is not set
1040# CONFIG_SND_KORG1212 is not set
1041# CONFIG_SND_MIXART is not set
1042# CONFIG_SND_NM256 is not set
1043# CONFIG_SND_RME32 is not set
1044# CONFIG_SND_RME96 is not set
1045# CONFIG_SND_RME9652 is not set
1046# CONFIG_SND_HDSP is not set
1047# CONFIG_SND_HDSPM is not set
1048# CONFIG_SND_TRIDENT is not set
1049# CONFIG_SND_YMFPCI is not set
1050# CONFIG_SND_AD1889 is not set
1051# CONFIG_SND_ALS4000 is not set
1052# CONFIG_SND_CMIPCI is not set
1053# CONFIG_SND_ENS1370 is not set 995# CONFIG_SND_ENS1370 is not set
1054# CONFIG_SND_ENS1371 is not set 996# CONFIG_SND_ENS1371 is not set
1055# CONFIG_SND_ES1938 is not set 997# CONFIG_SND_ES1938 is not set
1056# CONFIG_SND_ES1968 is not set 998# CONFIG_SND_ES1968 is not set
1057# CONFIG_SND_MAESTRO3 is not set
1058# CONFIG_SND_FM801 is not set 999# CONFIG_SND_FM801 is not set
1000# CONFIG_SND_HDA_INTEL is not set
1001# CONFIG_SND_HDSP is not set
1002# CONFIG_SND_HDSPM is not set
1059# CONFIG_SND_ICE1712 is not set 1003# CONFIG_SND_ICE1712 is not set
1060# CONFIG_SND_ICE1724 is not set 1004# CONFIG_SND_ICE1724 is not set
1061# CONFIG_SND_INTEL8X0 is not set 1005# CONFIG_SND_INTEL8X0 is not set
1062# CONFIG_SND_INTEL8X0M is not set 1006# CONFIG_SND_INTEL8X0M is not set
1007# CONFIG_SND_KORG1212 is not set
1008# CONFIG_SND_MAESTRO3 is not set
1009# CONFIG_SND_MIXART is not set
1010# CONFIG_SND_NM256 is not set
1011# CONFIG_SND_PCXHR is not set
1012# CONFIG_SND_RME32 is not set
1013# CONFIG_SND_RME96 is not set
1014# CONFIG_SND_RME9652 is not set
1063# CONFIG_SND_SONICVIBES is not set 1015# CONFIG_SND_SONICVIBES is not set
1016# CONFIG_SND_TRIDENT is not set
1064# CONFIG_SND_VIA82XX is not set 1017# CONFIG_SND_VIA82XX is not set
1065# CONFIG_SND_VIA82XX_MODEM is not set 1018# CONFIG_SND_VIA82XX_MODEM is not set
1066# CONFIG_SND_VX222 is not set 1019# CONFIG_SND_VX222 is not set
1067# CONFIG_SND_HDA_INTEL is not set 1020# CONFIG_SND_YMFPCI is not set
1068 1021
1069# 1022#
1070# ALSA PowerMac devices 1023# ALSA PowerMac devices
@@ -1136,13 +1089,16 @@ CONFIG_USB_STORAGE_DPCM=y
1136CONFIG_USB_STORAGE_SDDR09=y 1089CONFIG_USB_STORAGE_SDDR09=y
1137CONFIG_USB_STORAGE_SDDR55=y 1090CONFIG_USB_STORAGE_SDDR55=y
1138CONFIG_USB_STORAGE_JUMPSHOT=y 1091CONFIG_USB_STORAGE_JUMPSHOT=y
1092# CONFIG_USB_STORAGE_ALAUDA is not set
1139# CONFIG_USB_STORAGE_ONETOUCH is not set 1093# CONFIG_USB_STORAGE_ONETOUCH is not set
1094# CONFIG_USB_LIBUSUAL is not set
1140 1095
1141# 1096#
1142# USB Input Devices 1097# USB Input Devices
1143# 1098#
1144CONFIG_USB_HID=y 1099CONFIG_USB_HID=y
1145CONFIG_USB_HIDINPUT=y 1100CONFIG_USB_HIDINPUT=y
1101# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1146CONFIG_HID_FF=y 1102CONFIG_HID_FF=y
1147CONFIG_HID_PID=y 1103CONFIG_HID_PID=y
1148CONFIG_LOGITECH_FF=y 1104CONFIG_LOGITECH_FF=y
@@ -1159,6 +1115,7 @@ CONFIG_USB_HIDDEV=y
1159# CONFIG_USB_YEALINK is not set 1115# CONFIG_USB_YEALINK is not set
1160# CONFIG_USB_XPAD is not set 1116# CONFIG_USB_XPAD is not set
1161# CONFIG_USB_ATI_REMOTE is not set 1117# CONFIG_USB_ATI_REMOTE is not set
1118# CONFIG_USB_ATI_REMOTE2 is not set
1162# CONFIG_USB_KEYSPAN_REMOTE is not set 1119# CONFIG_USB_KEYSPAN_REMOTE is not set
1163# CONFIG_USB_APPLETOUCH is not set 1120# CONFIG_USB_APPLETOUCH is not set
1164 1121
@@ -1207,6 +1164,7 @@ CONFIG_USB_SERIAL_GENERIC=y
1207# CONFIG_USB_SERIAL_AIRPRIME is not set 1164# CONFIG_USB_SERIAL_AIRPRIME is not set
1208# CONFIG_USB_SERIAL_ANYDATA is not set 1165# CONFIG_USB_SERIAL_ANYDATA is not set
1209CONFIG_USB_SERIAL_BELKIN=m 1166CONFIG_USB_SERIAL_BELKIN=m
1167# CONFIG_USB_SERIAL_WHITEHEAT is not set
1210CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m 1168CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
1211# CONFIG_USB_SERIAL_CP2101 is not set 1169# CONFIG_USB_SERIAL_CP2101 is not set
1212CONFIG_USB_SERIAL_CYPRESS_M8=m 1170CONFIG_USB_SERIAL_CYPRESS_M8=m
@@ -1288,6 +1246,10 @@ CONFIG_USB_EZUSB=y
1288# 1246#
1289 1247
1290# 1248#
1249# EDAC - error detection and reporting (RAS)
1250#
1251
1252#
1291# File systems 1253# File systems
1292# 1254#
1293CONFIG_EXT2_FS=y 1255CONFIG_EXT2_FS=y
@@ -1317,6 +1279,7 @@ CONFIG_XFS_EXPORT=y
1317CONFIG_XFS_SECURITY=y 1279CONFIG_XFS_SECURITY=y
1318CONFIG_XFS_POSIX_ACL=y 1280CONFIG_XFS_POSIX_ACL=y
1319# CONFIG_XFS_RT is not set 1281# CONFIG_XFS_RT is not set
1282# CONFIG_OCFS2_FS is not set
1320# CONFIG_MINIX_FS is not set 1283# CONFIG_MINIX_FS is not set
1321# CONFIG_ROMFS_FS is not set 1284# CONFIG_ROMFS_FS is not set
1322CONFIG_INOTIFY=y 1285CONFIG_INOTIFY=y
@@ -1357,6 +1320,7 @@ CONFIG_HUGETLBFS=y
1357CONFIG_HUGETLB_PAGE=y 1320CONFIG_HUGETLB_PAGE=y
1358CONFIG_RAMFS=y 1321CONFIG_RAMFS=y
1359# CONFIG_RELAYFS_FS is not set 1322# CONFIG_RELAYFS_FS is not set
1323# CONFIG_CONFIGFS_FS is not set
1360 1324
1361# 1325#
1362# Miscellaneous filesystems 1326# Miscellaneous filesystems
@@ -1426,6 +1390,7 @@ CONFIG_MSDOS_PARTITION=y
1426# CONFIG_SGI_PARTITION is not set 1390# CONFIG_SGI_PARTITION is not set
1427# CONFIG_ULTRIX_PARTITION is not set 1391# CONFIG_ULTRIX_PARTITION is not set
1428# CONFIG_SUN_PARTITION is not set 1392# CONFIG_SUN_PARTITION is not set
1393# CONFIG_KARMA_PARTITION is not set
1429# CONFIG_EFI_PARTITION is not set 1394# CONFIG_EFI_PARTITION is not set
1430 1395
1431# 1396#
@@ -1481,10 +1446,6 @@ CONFIG_CRC32=y
1481CONFIG_LIBCRC32C=m 1446CONFIG_LIBCRC32C=m
1482CONFIG_ZLIB_INFLATE=y 1447CONFIG_ZLIB_INFLATE=y
1483CONFIG_ZLIB_DEFLATE=m 1448CONFIG_ZLIB_DEFLATE=m
1484CONFIG_TEXTSEARCH=y
1485CONFIG_TEXTSEARCH_KMP=m
1486CONFIG_TEXTSEARCH_BM=m
1487CONFIG_TEXTSEARCH_FSM=m
1488 1449
1489# 1450#
1490# Instrumentation Support 1451# Instrumentation Support
@@ -1497,24 +1458,31 @@ CONFIG_OPROFILE=y
1497# Kernel hacking 1458# Kernel hacking
1498# 1459#
1499# CONFIG_PRINTK_TIME is not set 1460# CONFIG_PRINTK_TIME is not set
1500CONFIG_DEBUG_KERNEL=y
1501CONFIG_MAGIC_SYSRQ=y 1461CONFIG_MAGIC_SYSRQ=y
1462CONFIG_DEBUG_KERNEL=y
1502CONFIG_LOG_BUF_SHIFT=17 1463CONFIG_LOG_BUF_SHIFT=17
1503CONFIG_DETECT_SOFTLOCKUP=y 1464CONFIG_DETECT_SOFTLOCKUP=y
1504# CONFIG_SCHEDSTATS is not set 1465# CONFIG_SCHEDSTATS is not set
1505# CONFIG_DEBUG_SLAB is not set 1466# CONFIG_DEBUG_SLAB is not set
1467CONFIG_DEBUG_MUTEXES=y
1506# CONFIG_DEBUG_SPINLOCK is not set 1468# CONFIG_DEBUG_SPINLOCK is not set
1507# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1469# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1508# CONFIG_DEBUG_KOBJECT is not set 1470# CONFIG_DEBUG_KOBJECT is not set
1509# CONFIG_DEBUG_INFO is not set 1471# CONFIG_DEBUG_INFO is not set
1510CONFIG_DEBUG_FS=y 1472CONFIG_DEBUG_FS=y
1511# CONFIG_DEBUG_VM is not set 1473# CONFIG_DEBUG_VM is not set
1474CONFIG_FORCED_INLINING=y
1512# CONFIG_RCU_TORTURE_TEST is not set 1475# CONFIG_RCU_TORTURE_TEST is not set
1513# CONFIG_DEBUG_STACKOVERFLOW is not set 1476# CONFIG_DEBUG_STACKOVERFLOW is not set
1514# CONFIG_DEBUG_STACK_USAGE is not set 1477# CONFIG_DEBUG_STACK_USAGE is not set
1515# CONFIG_DEBUGGER is not set 1478# CONFIG_DEBUGGER is not set
1516CONFIG_IRQSTACKS=y 1479CONFIG_IRQSTACKS=y
1517CONFIG_BOOTX_TEXT=y 1480CONFIG_BOOTX_TEXT=y
1481# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
1482# CONFIG_PPC_EARLY_DEBUG_G5 is not set
1483# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
1484# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
1485# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
1518 1486
1519# 1487#
1520# Security options 1488# Security options
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index 6f6c6bed1aa5..0362a70aa97c 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc5 3# Linux kernel version: 2.6.16-rc2
4# Tue Dec 20 15:59:38 2005 4# Fri Feb 10 17:32:14 2006
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -16,6 +16,10 @@ CONFIG_COMPAT=y
16CONFIG_SYSVIPC_COMPAT=y 16CONFIG_SYSVIPC_COMPAT=y
17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
18CONFIG_ARCH_MAY_HAVE_PC_FDC=y 18CONFIG_ARCH_MAY_HAVE_PC_FDC=y
19CONFIG_PPC_OF=y
20CONFIG_PPC_UDBG_16550=y
21CONFIG_GENERIC_TBSYNC=y
22# CONFIG_DEFAULT_UIMAGE is not set
19 23
20# 24#
21# Processor support 25# Processor support
@@ -33,7 +37,6 @@ CONFIG_NR_CPUS=32
33# Code maturity level options 37# Code maturity level options
34# 38#
35CONFIG_EXPERIMENTAL=y 39CONFIG_EXPERIMENTAL=y
36CONFIG_CLEAN_COMPILE=y
37CONFIG_LOCK_KERNEL=y 40CONFIG_LOCK_KERNEL=y
38CONFIG_INIT_ENV_ARG_LIMIT=32 41CONFIG_INIT_ENV_ARG_LIMIT=32
39 42
@@ -48,8 +51,6 @@ CONFIG_POSIX_MQUEUE=y
48# CONFIG_BSD_PROCESS_ACCT is not set 51# CONFIG_BSD_PROCESS_ACCT is not set
49CONFIG_SYSCTL=y 52CONFIG_SYSCTL=y
50# CONFIG_AUDIT is not set 53# CONFIG_AUDIT is not set
51CONFIG_HOTPLUG=y
52CONFIG_KOBJECT_UEVENT=y
53CONFIG_IKCONFIG=y 54CONFIG_IKCONFIG=y
54CONFIG_IKCONFIG_PROC=y 55CONFIG_IKCONFIG_PROC=y
55CONFIG_CPUSETS=y 56CONFIG_CPUSETS=y
@@ -59,8 +60,10 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
59CONFIG_KALLSYMS=y 60CONFIG_KALLSYMS=y
60CONFIG_KALLSYMS_ALL=y 61CONFIG_KALLSYMS_ALL=y
61# CONFIG_KALLSYMS_EXTRA_PASS is not set 62# CONFIG_KALLSYMS_EXTRA_PASS is not set
63CONFIG_HOTPLUG=y
62CONFIG_PRINTK=y 64CONFIG_PRINTK=y
63CONFIG_BUG=y 65CONFIG_BUG=y
66CONFIG_ELF_CORE=y
64CONFIG_BASE_FULL=y 67CONFIG_BASE_FULL=y
65CONFIG_FUTEX=y 68CONFIG_FUTEX=y
66CONFIG_EPOLL=y 69CONFIG_EPOLL=y
@@ -69,8 +72,10 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
69CONFIG_CC_ALIGN_LABELS=0 72CONFIG_CC_ALIGN_LABELS=0
70CONFIG_CC_ALIGN_LOOPS=0 73CONFIG_CC_ALIGN_LOOPS=0
71CONFIG_CC_ALIGN_JUMPS=0 74CONFIG_CC_ALIGN_JUMPS=0
75CONFIG_SLAB=y
72# CONFIG_TINY_SHMEM is not set 76# CONFIG_TINY_SHMEM is not set
73CONFIG_BASE_SMALL=0 77CONFIG_BASE_SMALL=0
78# CONFIG_SLOB is not set
74 79
75# 80#
76# Loadable module support 81# Loadable module support
@@ -113,7 +118,6 @@ CONFIG_PPC_PMAC=y
113CONFIG_PPC_PMAC64=y 118CONFIG_PPC_PMAC64=y
114CONFIG_PPC_MAPLE=y 119CONFIG_PPC_MAPLE=y
115# CONFIG_PPC_CELL is not set 120# CONFIG_PPC_CELL is not set
116CONFIG_PPC_OF=y
117CONFIG_XICS=y 121CONFIG_XICS=y
118CONFIG_U3_DART=y 122CONFIG_U3_DART=y
119CONFIG_MPIC=y 123CONFIG_MPIC=y
@@ -124,8 +128,8 @@ CONFIG_RTAS_FLASH=m
124# CONFIG_MMIO_NVRAM is not set 128# CONFIG_MMIO_NVRAM is not set
125CONFIG_MPIC_BROKEN_U3=y 129CONFIG_MPIC_BROKEN_U3=y
126CONFIG_IBMVIO=y 130CONFIG_IBMVIO=y
131# CONFIG_IBMEBUS is not set
127# CONFIG_PPC_MPC106 is not set 132# CONFIG_PPC_MPC106 is not set
128CONFIG_GENERIC_TBSYNC=y
129CONFIG_CPU_FREQ=y 133CONFIG_CPU_FREQ=y
130CONFIG_CPU_FREQ_TABLE=y 134CONFIG_CPU_FREQ_TABLE=y
131# CONFIG_CPU_FREQ_DEBUG is not set 135# CONFIG_CPU_FREQ_DEBUG is not set
@@ -158,6 +162,7 @@ CONFIG_FORCE_MAX_ZONEORDER=13
158CONFIG_IOMMU_VMERGE=y 162CONFIG_IOMMU_VMERGE=y
159CONFIG_HOTPLUG_CPU=y 163CONFIG_HOTPLUG_CPU=y
160CONFIG_KEXEC=y 164CONFIG_KEXEC=y
165# CONFIG_CRASH_DUMP is not set
161CONFIG_IRQ_ALL_CPUS=y 166CONFIG_IRQ_ALL_CPUS=y
162CONFIG_PPC_SPLPAR=y 167CONFIG_PPC_SPLPAR=y
163CONFIG_EEH=y 168CONFIG_EEH=y
@@ -178,6 +183,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y
178CONFIG_SPARSEMEM_EXTREME=y 183CONFIG_SPARSEMEM_EXTREME=y
179# CONFIG_MEMORY_HOTPLUG is not set 184# CONFIG_MEMORY_HOTPLUG is not set
180CONFIG_SPLIT_PTLOCK_CPUS=4 185CONFIG_SPLIT_PTLOCK_CPUS=4
186CONFIG_MIGRATION=y
181# CONFIG_PPC_64K_PAGES is not set 187# CONFIG_PPC_64K_PAGES is not set
182# CONFIG_SCHED_SMT is not set 188# CONFIG_SCHED_SMT is not set
183CONFIG_PROC_DEVICETREE=y 189CONFIG_PROC_DEVICETREE=y
@@ -221,6 +227,7 @@ CONFIG_NET=y
221# 227#
222# Networking options 228# Networking options
223# 229#
230# CONFIG_NETDEBUG is not set
224CONFIG_PACKET=y 231CONFIG_PACKET=y
225# CONFIG_PACKET_MMAP is not set 232# CONFIG_PACKET_MMAP is not set
226CONFIG_UNIX=y 233CONFIG_UNIX=y
@@ -260,6 +267,7 @@ CONFIG_NETFILTER=y
260CONFIG_NETFILTER_NETLINK=y 267CONFIG_NETFILTER_NETLINK=y
261CONFIG_NETFILTER_NETLINK_QUEUE=m 268CONFIG_NETFILTER_NETLINK_QUEUE=m
262CONFIG_NETFILTER_NETLINK_LOG=m 269CONFIG_NETFILTER_NETLINK_LOG=m
270# CONFIG_NETFILTER_XTABLES is not set
263 271
264# 272#
265# IP: Netfilter Configuration 273# IP: Netfilter Configuration
@@ -277,65 +285,6 @@ CONFIG_IP_NF_TFTP=m
277CONFIG_IP_NF_AMANDA=m 285CONFIG_IP_NF_AMANDA=m
278# CONFIG_IP_NF_PPTP is not set 286# CONFIG_IP_NF_PPTP is not set
279CONFIG_IP_NF_QUEUE=m 287CONFIG_IP_NF_QUEUE=m
280CONFIG_IP_NF_IPTABLES=m
281CONFIG_IP_NF_MATCH_LIMIT=m
282CONFIG_IP_NF_MATCH_IPRANGE=m
283CONFIG_IP_NF_MATCH_MAC=m
284CONFIG_IP_NF_MATCH_PKTTYPE=m
285CONFIG_IP_NF_MATCH_MARK=m
286CONFIG_IP_NF_MATCH_MULTIPORT=m
287CONFIG_IP_NF_MATCH_TOS=m
288CONFIG_IP_NF_MATCH_RECENT=m
289CONFIG_IP_NF_MATCH_ECN=m
290CONFIG_IP_NF_MATCH_DSCP=m
291CONFIG_IP_NF_MATCH_AH_ESP=m
292CONFIG_IP_NF_MATCH_LENGTH=m
293CONFIG_IP_NF_MATCH_TTL=m
294CONFIG_IP_NF_MATCH_TCPMSS=m
295CONFIG_IP_NF_MATCH_HELPER=m
296CONFIG_IP_NF_MATCH_STATE=m
297CONFIG_IP_NF_MATCH_CONNTRACK=m
298CONFIG_IP_NF_MATCH_OWNER=m
299CONFIG_IP_NF_MATCH_ADDRTYPE=m
300CONFIG_IP_NF_MATCH_REALM=m
301CONFIG_IP_NF_MATCH_SCTP=m
302CONFIG_IP_NF_MATCH_DCCP=m
303CONFIG_IP_NF_MATCH_COMMENT=m
304CONFIG_IP_NF_MATCH_CONNMARK=m
305CONFIG_IP_NF_MATCH_CONNBYTES=m
306CONFIG_IP_NF_MATCH_HASHLIMIT=m
307CONFIG_IP_NF_MATCH_STRING=m
308CONFIG_IP_NF_FILTER=m
309CONFIG_IP_NF_TARGET_REJECT=m
310CONFIG_IP_NF_TARGET_LOG=m
311CONFIG_IP_NF_TARGET_ULOG=m
312CONFIG_IP_NF_TARGET_TCPMSS=m
313CONFIG_IP_NF_TARGET_NFQUEUE=m
314CONFIG_IP_NF_NAT=m
315CONFIG_IP_NF_NAT_NEEDED=y
316CONFIG_IP_NF_TARGET_MASQUERADE=m
317CONFIG_IP_NF_TARGET_REDIRECT=m
318CONFIG_IP_NF_TARGET_NETMAP=m
319CONFIG_IP_NF_TARGET_SAME=m
320CONFIG_IP_NF_NAT_SNMP_BASIC=m
321CONFIG_IP_NF_NAT_IRC=m
322CONFIG_IP_NF_NAT_FTP=m
323CONFIG_IP_NF_NAT_TFTP=m
324CONFIG_IP_NF_NAT_AMANDA=m
325CONFIG_IP_NF_MANGLE=m
326CONFIG_IP_NF_TARGET_TOS=m
327CONFIG_IP_NF_TARGET_ECN=m
328CONFIG_IP_NF_TARGET_DSCP=m
329CONFIG_IP_NF_TARGET_MARK=m
330CONFIG_IP_NF_TARGET_CLASSIFY=m
331CONFIG_IP_NF_TARGET_TTL=m
332CONFIG_IP_NF_TARGET_CONNMARK=m
333CONFIG_IP_NF_TARGET_CLUSTERIP=m
334CONFIG_IP_NF_RAW=m
335CONFIG_IP_NF_TARGET_NOTRACK=m
336CONFIG_IP_NF_ARPTABLES=m
337CONFIG_IP_NF_ARPFILTER=m
338CONFIG_IP_NF_ARP_MANGLE=m
339 288
340# 289#
341# DCCP Configuration (EXPERIMENTAL) 290# DCCP Configuration (EXPERIMENTAL)
@@ -346,6 +295,11 @@ CONFIG_IP_NF_ARP_MANGLE=m
346# SCTP Configuration (EXPERIMENTAL) 295# SCTP Configuration (EXPERIMENTAL)
347# 296#
348# CONFIG_IP_SCTP is not set 297# CONFIG_IP_SCTP is not set
298
299#
300# TIPC Configuration (EXPERIMENTAL)
301#
302# CONFIG_TIPC is not set
349# CONFIG_ATM is not set 303# CONFIG_ATM is not set
350# CONFIG_BRIDGE is not set 304# CONFIG_BRIDGE is not set
351# CONFIG_VLAN_8021Q is not set 305# CONFIG_VLAN_8021Q is not set
@@ -364,7 +318,6 @@ CONFIG_LLC=y
364# QoS and/or fair queueing 318# QoS and/or fair queueing
365# 319#
366# CONFIG_NET_SCHED is not set 320# CONFIG_NET_SCHED is not set
367CONFIG_NET_CLS_ROUTE=y
368 321
369# 322#
370# Network testing 323# Network testing
@@ -572,13 +525,7 @@ CONFIG_SCSI_IPR_TRACE=y
572CONFIG_SCSI_IPR_DUMP=y 525CONFIG_SCSI_IPR_DUMP=y
573# CONFIG_SCSI_QLOGIC_FC is not set 526# CONFIG_SCSI_QLOGIC_FC is not set
574# CONFIG_SCSI_QLOGIC_1280 is not set 527# CONFIG_SCSI_QLOGIC_1280 is not set
575CONFIG_SCSI_QLA2XXX=y 528# CONFIG_SCSI_QLA_FC is not set
576CONFIG_SCSI_QLA21XX=m
577CONFIG_SCSI_QLA22XX=m
578CONFIG_SCSI_QLA2300=m
579CONFIG_SCSI_QLA2322=m
580CONFIG_SCSI_QLA6312=m
581CONFIG_SCSI_QLA24XX=m
582CONFIG_SCSI_LPFC=m 529CONFIG_SCSI_LPFC=m
583# CONFIG_SCSI_DC395x is not set 530# CONFIG_SCSI_DC395x is not set
584# CONFIG_SCSI_DC390T is not set 531# CONFIG_SCSI_DC390T is not set
@@ -642,8 +589,6 @@ CONFIG_IEEE1394_SBP2=m
642CONFIG_IEEE1394_ETH1394=m 589CONFIG_IEEE1394_ETH1394=m
643CONFIG_IEEE1394_DV1394=m 590CONFIG_IEEE1394_DV1394=m
644CONFIG_IEEE1394_RAWIO=y 591CONFIG_IEEE1394_RAWIO=y
645CONFIG_IEEE1394_CMP=m
646CONFIG_IEEE1394_AMDTP=m
647 592
648# 593#
649# I2O device support 594# I2O device support
@@ -659,6 +604,7 @@ CONFIG_THERM_PM72=y
659CONFIG_WINDFARM=y 604CONFIG_WINDFARM=y
660CONFIG_WINDFARM_PM81=y 605CONFIG_WINDFARM_PM81=y
661CONFIG_WINDFARM_PM91=y 606CONFIG_WINDFARM_PM91=y
607CONFIG_WINDFARM_PM112=y
662 608
663# 609#
664# Network device support 610# Network device support
@@ -731,6 +677,7 @@ CONFIG_E1000=y
731# CONFIG_R8169 is not set 677# CONFIG_R8169 is not set
732# CONFIG_SIS190 is not set 678# CONFIG_SIS190 is not set
733# CONFIG_SKGE is not set 679# CONFIG_SKGE is not set
680# CONFIG_SKY2 is not set
734# CONFIG_SK98LIN is not set 681# CONFIG_SK98LIN is not set
735# CONFIG_VIA_VELOCITY is not set 682# CONFIG_VIA_VELOCITY is not set
736CONFIG_TIGON3=y 683CONFIG_TIGON3=y
@@ -853,6 +800,7 @@ CONFIG_HW_CONSOLE=y
853CONFIG_SERIAL_8250=y 800CONFIG_SERIAL_8250=y
854CONFIG_SERIAL_8250_CONSOLE=y 801CONFIG_SERIAL_8250_CONSOLE=y
855CONFIG_SERIAL_8250_NR_UARTS=4 802CONFIG_SERIAL_8250_NR_UARTS=4
803CONFIG_SERIAL_8250_RUNTIME_UARTS=4
856# CONFIG_SERIAL_8250_EXTENDED is not set 804# CONFIG_SERIAL_8250_EXTENDED is not set
857 805
858# 806#
@@ -880,6 +828,7 @@ CONFIG_HVCS=m
880# CONFIG_WATCHDOG is not set 828# CONFIG_WATCHDOG is not set
881# CONFIG_RTC is not set 829# CONFIG_RTC is not set
882CONFIG_GEN_RTC=y 830CONFIG_GEN_RTC=y
831# CONFIG_GEN_RTC_X is not set
883# CONFIG_DTLK is not set 832# CONFIG_DTLK is not set
884# CONFIG_R3964 is not set 833# CONFIG_R3964 is not set
885# CONFIG_APPLICOM is not set 834# CONFIG_APPLICOM is not set
@@ -923,8 +872,7 @@ CONFIG_I2C_AMD8111=y
923# CONFIG_I2C_I801 is not set 872# CONFIG_I2C_I801 is not set
924# CONFIG_I2C_I810 is not set 873# CONFIG_I2C_I810 is not set
925# CONFIG_I2C_PIIX4 is not set 874# CONFIG_I2C_PIIX4 is not set
926CONFIG_I2C_KEYWEST=y 875CONFIG_I2C_POWERMAC=y
927CONFIG_I2C_PMAC_SMU=y
928# CONFIG_I2C_NFORCE2 is not set 876# CONFIG_I2C_NFORCE2 is not set
929# CONFIG_I2C_PARPORT_LIGHT is not set 877# CONFIG_I2C_PARPORT_LIGHT is not set
930# CONFIG_I2C_PROSAVAGE is not set 878# CONFIG_I2C_PROSAVAGE is not set
@@ -957,6 +905,12 @@ CONFIG_I2C_PMAC_SMU=y
957# CONFIG_I2C_DEBUG_CHIP is not set 905# CONFIG_I2C_DEBUG_CHIP is not set
958 906
959# 907#
908# SPI support
909#
910# CONFIG_SPI is not set
911# CONFIG_SPI_MASTER is not set
912
913#
960# Dallas's 1-wire bus 914# Dallas's 1-wire bus
961# 915#
962# CONFIG_W1 is not set 916# CONFIG_W1 is not set
@@ -1028,7 +982,6 @@ CONFIG_FB_RADEON_I2C=y
1028# CONFIG_FB_KYRO is not set 982# CONFIG_FB_KYRO is not set
1029# CONFIG_FB_3DFX is not set 983# CONFIG_FB_3DFX is not set
1030# CONFIG_FB_VOODOO1 is not set 984# CONFIG_FB_VOODOO1 is not set
1031# CONFIG_FB_CYBLA is not set
1032# CONFIG_FB_TRIDENT is not set 985# CONFIG_FB_TRIDENT is not set
1033# CONFIG_FB_VIRTUAL is not set 986# CONFIG_FB_VIRTUAL is not set
1034 987
@@ -1073,9 +1026,10 @@ CONFIG_SND_OSSEMUL=y
1073CONFIG_SND_MIXER_OSS=m 1026CONFIG_SND_MIXER_OSS=m
1074CONFIG_SND_PCM_OSS=m 1027CONFIG_SND_PCM_OSS=m
1075CONFIG_SND_SEQUENCER_OSS=y 1028CONFIG_SND_SEQUENCER_OSS=y
1029# CONFIG_SND_DYNAMIC_MINORS is not set
1030CONFIG_SND_SUPPORT_OLD_API=y
1076# CONFIG_SND_VERBOSE_PRINTK is not set 1031# CONFIG_SND_VERBOSE_PRINTK is not set
1077# CONFIG_SND_DEBUG is not set 1032# CONFIG_SND_DEBUG is not set
1078CONFIG_SND_GENERIC_DRIVER=y
1079 1033
1080# 1034#
1081# Generic devices 1035# Generic devices
@@ -1089,6 +1043,8 @@ CONFIG_SND_GENERIC_DRIVER=y
1089# 1043#
1090# PCI devices 1044# PCI devices
1091# 1045#
1046# CONFIG_SND_AD1889 is not set
1047# CONFIG_SND_ALS4000 is not set
1092# CONFIG_SND_ALI5451 is not set 1048# CONFIG_SND_ALI5451 is not set
1093# CONFIG_SND_ATIIXP is not set 1049# CONFIG_SND_ATIIXP is not set
1094# CONFIG_SND_ATIIXP_MODEM is not set 1050# CONFIG_SND_ATIIXP_MODEM is not set
@@ -1097,39 +1053,38 @@ CONFIG_SND_GENERIC_DRIVER=y
1097# CONFIG_SND_AU8830 is not set 1053# CONFIG_SND_AU8830 is not set
1098# CONFIG_SND_AZT3328 is not set 1054# CONFIG_SND_AZT3328 is not set
1099# CONFIG_SND_BT87X is not set 1055# CONFIG_SND_BT87X is not set
1100# CONFIG_SND_CS46XX is not set 1056# CONFIG_SND_CA0106 is not set
1057# CONFIG_SND_CMIPCI is not set
1101# CONFIG_SND_CS4281 is not set 1058# CONFIG_SND_CS4281 is not set
1059# CONFIG_SND_CS46XX is not set
1102# CONFIG_SND_EMU10K1 is not set 1060# CONFIG_SND_EMU10K1 is not set
1103# CONFIG_SND_EMU10K1X is not set 1061# CONFIG_SND_EMU10K1X is not set
1104# CONFIG_SND_CA0106 is not set
1105# CONFIG_SND_KORG1212 is not set
1106# CONFIG_SND_MIXART is not set
1107# CONFIG_SND_NM256 is not set
1108# CONFIG_SND_RME32 is not set
1109# CONFIG_SND_RME96 is not set
1110# CONFIG_SND_RME9652 is not set
1111# CONFIG_SND_HDSP is not set
1112# CONFIG_SND_HDSPM is not set
1113# CONFIG_SND_TRIDENT is not set
1114# CONFIG_SND_YMFPCI is not set
1115# CONFIG_SND_AD1889 is not set
1116# CONFIG_SND_ALS4000 is not set
1117# CONFIG_SND_CMIPCI is not set
1118# CONFIG_SND_ENS1370 is not set 1062# CONFIG_SND_ENS1370 is not set
1119# CONFIG_SND_ENS1371 is not set 1063# CONFIG_SND_ENS1371 is not set
1120# CONFIG_SND_ES1938 is not set 1064# CONFIG_SND_ES1938 is not set
1121# CONFIG_SND_ES1968 is not set 1065# CONFIG_SND_ES1968 is not set
1122# CONFIG_SND_MAESTRO3 is not set
1123# CONFIG_SND_FM801 is not set 1066# CONFIG_SND_FM801 is not set
1067# CONFIG_SND_HDA_INTEL is not set
1068# CONFIG_SND_HDSP is not set
1069# CONFIG_SND_HDSPM is not set
1124# CONFIG_SND_ICE1712 is not set 1070# CONFIG_SND_ICE1712 is not set
1125# CONFIG_SND_ICE1724 is not set 1071# CONFIG_SND_ICE1724 is not set
1126# CONFIG_SND_INTEL8X0 is not set 1072# CONFIG_SND_INTEL8X0 is not set
1127# CONFIG_SND_INTEL8X0M is not set 1073# CONFIG_SND_INTEL8X0M is not set
1074# CONFIG_SND_KORG1212 is not set
1075# CONFIG_SND_MAESTRO3 is not set
1076# CONFIG_SND_MIXART is not set
1077# CONFIG_SND_NM256 is not set
1078# CONFIG_SND_PCXHR is not set
1079# CONFIG_SND_RME32 is not set
1080# CONFIG_SND_RME96 is not set
1081# CONFIG_SND_RME9652 is not set
1128# CONFIG_SND_SONICVIBES is not set 1082# CONFIG_SND_SONICVIBES is not set
1083# CONFIG_SND_TRIDENT is not set
1129# CONFIG_SND_VIA82XX is not set 1084# CONFIG_SND_VIA82XX is not set
1130# CONFIG_SND_VIA82XX_MODEM is not set 1085# CONFIG_SND_VIA82XX_MODEM is not set
1131# CONFIG_SND_VX222 is not set 1086# CONFIG_SND_VX222 is not set
1132# CONFIG_SND_HDA_INTEL is not set 1087# CONFIG_SND_YMFPCI is not set
1133 1088
1134# 1089#
1135# ALSA PowerMac devices 1090# ALSA PowerMac devices
@@ -1201,13 +1156,16 @@ CONFIG_USB_STORAGE=m
1201# CONFIG_USB_STORAGE_SDDR09 is not set 1156# CONFIG_USB_STORAGE_SDDR09 is not set
1202# CONFIG_USB_STORAGE_SDDR55 is not set 1157# CONFIG_USB_STORAGE_SDDR55 is not set
1203# CONFIG_USB_STORAGE_JUMPSHOT is not set 1158# CONFIG_USB_STORAGE_JUMPSHOT is not set
1159# CONFIG_USB_STORAGE_ALAUDA is not set
1204# CONFIG_USB_STORAGE_ONETOUCH is not set 1160# CONFIG_USB_STORAGE_ONETOUCH is not set
1161# CONFIG_USB_LIBUSUAL is not set
1205 1162
1206# 1163#
1207# USB Input Devices 1164# USB Input Devices
1208# 1165#
1209CONFIG_USB_HID=y 1166CONFIG_USB_HID=y
1210CONFIG_USB_HIDINPUT=y 1167CONFIG_USB_HIDINPUT=y
1168# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1211# CONFIG_HID_FF is not set 1169# CONFIG_HID_FF is not set
1212CONFIG_USB_HIDDEV=y 1170CONFIG_USB_HIDDEV=y
1213# CONFIG_USB_AIPTEK is not set 1171# CONFIG_USB_AIPTEK is not set
@@ -1221,6 +1179,7 @@ CONFIG_USB_HIDDEV=y
1221# CONFIG_USB_YEALINK is not set 1179# CONFIG_USB_YEALINK is not set
1222# CONFIG_USB_XPAD is not set 1180# CONFIG_USB_XPAD is not set
1223# CONFIG_USB_ATI_REMOTE is not set 1181# CONFIG_USB_ATI_REMOTE is not set
1182# CONFIG_USB_ATI_REMOTE2 is not set
1224# CONFIG_USB_KEYSPAN_REMOTE is not set 1183# CONFIG_USB_KEYSPAN_REMOTE is not set
1225# CONFIG_USB_APPLETOUCH is not set 1184# CONFIG_USB_APPLETOUCH is not set
1226 1185
@@ -1307,6 +1266,10 @@ CONFIG_INFINIBAND_IPOIB=m
1307# 1266#
1308 1267
1309# 1268#
1269# EDAC - error detection and reporting (RAS)
1270#
1271
1272#
1310# File systems 1273# File systems
1311# 1274#
1312CONFIG_EXT2_FS=y 1275CONFIG_EXT2_FS=y
@@ -1340,6 +1303,7 @@ CONFIG_XFS_EXPORT=y
1340CONFIG_XFS_SECURITY=y 1303CONFIG_XFS_SECURITY=y
1341CONFIG_XFS_POSIX_ACL=y 1304CONFIG_XFS_POSIX_ACL=y
1342# CONFIG_XFS_RT is not set 1305# CONFIG_XFS_RT is not set
1306# CONFIG_OCFS2_FS is not set
1343# CONFIG_MINIX_FS is not set 1307# CONFIG_MINIX_FS is not set
1344# CONFIG_ROMFS_FS is not set 1308# CONFIG_ROMFS_FS is not set
1345CONFIG_INOTIFY=y 1309CONFIG_INOTIFY=y
@@ -1379,6 +1343,7 @@ CONFIG_HUGETLBFS=y
1379CONFIG_HUGETLB_PAGE=y 1343CONFIG_HUGETLB_PAGE=y
1380CONFIG_RAMFS=y 1344CONFIG_RAMFS=y
1381# CONFIG_RELAYFS_FS is not set 1345# CONFIG_RELAYFS_FS is not set
1346# CONFIG_CONFIGFS_FS is not set
1382 1347
1383# 1348#
1384# Miscellaneous filesystems 1349# Miscellaneous filesystems
@@ -1449,6 +1414,7 @@ CONFIG_MSDOS_PARTITION=y
1449# CONFIG_SGI_PARTITION is not set 1414# CONFIG_SGI_PARTITION is not set
1450# CONFIG_ULTRIX_PARTITION is not set 1415# CONFIG_ULTRIX_PARTITION is not set
1451# CONFIG_SUN_PARTITION is not set 1416# CONFIG_SUN_PARTITION is not set
1417# CONFIG_KARMA_PARTITION is not set
1452# CONFIG_EFI_PARTITION is not set 1418# CONFIG_EFI_PARTITION is not set
1453 1419
1454# 1420#
@@ -1504,10 +1470,6 @@ CONFIG_CRC32=y
1504CONFIG_LIBCRC32C=m 1470CONFIG_LIBCRC32C=m
1505CONFIG_ZLIB_INFLATE=y 1471CONFIG_ZLIB_INFLATE=y
1506CONFIG_ZLIB_DEFLATE=m 1472CONFIG_ZLIB_DEFLATE=m
1507CONFIG_TEXTSEARCH=y
1508CONFIG_TEXTSEARCH_KMP=m
1509CONFIG_TEXTSEARCH_BM=m
1510CONFIG_TEXTSEARCH_FSM=m
1511 1473
1512# 1474#
1513# Instrumentation Support 1475# Instrumentation Support
@@ -1520,18 +1482,20 @@ CONFIG_OPROFILE=y
1520# Kernel hacking 1482# Kernel hacking
1521# 1483#
1522# CONFIG_PRINTK_TIME is not set 1484# CONFIG_PRINTK_TIME is not set
1523CONFIG_DEBUG_KERNEL=y
1524CONFIG_MAGIC_SYSRQ=y 1485CONFIG_MAGIC_SYSRQ=y
1486CONFIG_DEBUG_KERNEL=y
1525CONFIG_LOG_BUF_SHIFT=17 1487CONFIG_LOG_BUF_SHIFT=17
1526CONFIG_DETECT_SOFTLOCKUP=y 1488CONFIG_DETECT_SOFTLOCKUP=y
1527# CONFIG_SCHEDSTATS is not set 1489# CONFIG_SCHEDSTATS is not set
1528# CONFIG_DEBUG_SLAB is not set 1490# CONFIG_DEBUG_SLAB is not set
1491CONFIG_DEBUG_MUTEXES=y
1529# CONFIG_DEBUG_SPINLOCK is not set 1492# CONFIG_DEBUG_SPINLOCK is not set
1530# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1493# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1531# CONFIG_DEBUG_KOBJECT is not set 1494# CONFIG_DEBUG_KOBJECT is not set
1532# CONFIG_DEBUG_INFO is not set 1495# CONFIG_DEBUG_INFO is not set
1533CONFIG_DEBUG_FS=y 1496CONFIG_DEBUG_FS=y
1534# CONFIG_DEBUG_VM is not set 1497# CONFIG_DEBUG_VM is not set
1498CONFIG_FORCED_INLINING=y
1535# CONFIG_RCU_TORTURE_TEST is not set 1499# CONFIG_RCU_TORTURE_TEST is not set
1536CONFIG_DEBUG_STACKOVERFLOW=y 1500CONFIG_DEBUG_STACKOVERFLOW=y
1537CONFIG_DEBUG_STACK_USAGE=y 1501CONFIG_DEBUG_STACK_USAGE=y
@@ -1540,6 +1504,11 @@ CONFIG_XMON=y
1540# CONFIG_XMON_DEFAULT is not set 1504# CONFIG_XMON_DEFAULT is not set
1541CONFIG_IRQSTACKS=y 1505CONFIG_IRQSTACKS=y
1542CONFIG_BOOTX_TEXT=y 1506CONFIG_BOOTX_TEXT=y
1507# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
1508# CONFIG_PPC_EARLY_DEBUG_G5 is not set
1509# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
1510# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
1511# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
1543 1512
1544# 1513#
1545# Security options 1514# Security options
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index aa9893a1f6e8..daaf038a1faa 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc5 3# Linux kernel version: 2.6.16-rc2
4# Tue Dec 20 15:59:40 2005 4# Fri Feb 10 17:33:32 2006
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -16,6 +16,10 @@ CONFIG_COMPAT=y
16CONFIG_SYSVIPC_COMPAT=y 16CONFIG_SYSVIPC_COMPAT=y
17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
18CONFIG_ARCH_MAY_HAVE_PC_FDC=y 18CONFIG_ARCH_MAY_HAVE_PC_FDC=y
19CONFIG_PPC_OF=y
20CONFIG_PPC_UDBG_16550=y
21# CONFIG_GENERIC_TBSYNC is not set
22# CONFIG_DEFAULT_UIMAGE is not set
19 23
20# 24#
21# Processor support 25# Processor support
@@ -33,7 +37,6 @@ CONFIG_NR_CPUS=128
33# Code maturity level options 37# Code maturity level options
34# 38#
35CONFIG_EXPERIMENTAL=y 39CONFIG_EXPERIMENTAL=y
36CONFIG_CLEAN_COMPILE=y
37CONFIG_LOCK_KERNEL=y 40CONFIG_LOCK_KERNEL=y
38CONFIG_INIT_ENV_ARG_LIMIT=32 41CONFIG_INIT_ENV_ARG_LIMIT=32
39 42
@@ -49,8 +52,6 @@ CONFIG_POSIX_MQUEUE=y
49CONFIG_SYSCTL=y 52CONFIG_SYSCTL=y
50CONFIG_AUDIT=y 53CONFIG_AUDIT=y
51CONFIG_AUDITSYSCALL=y 54CONFIG_AUDITSYSCALL=y
52CONFIG_HOTPLUG=y
53CONFIG_KOBJECT_UEVENT=y
54CONFIG_IKCONFIG=y 55CONFIG_IKCONFIG=y
55CONFIG_IKCONFIG_PROC=y 56CONFIG_IKCONFIG_PROC=y
56CONFIG_CPUSETS=y 57CONFIG_CPUSETS=y
@@ -60,8 +61,10 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
60CONFIG_KALLSYMS=y 61CONFIG_KALLSYMS=y
61CONFIG_KALLSYMS_ALL=y 62CONFIG_KALLSYMS_ALL=y
62# CONFIG_KALLSYMS_EXTRA_PASS is not set 63# CONFIG_KALLSYMS_EXTRA_PASS is not set
64CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y 65CONFIG_PRINTK=y
64CONFIG_BUG=y 66CONFIG_BUG=y
67CONFIG_ELF_CORE=y
65CONFIG_BASE_FULL=y 68CONFIG_BASE_FULL=y
66CONFIG_FUTEX=y 69CONFIG_FUTEX=y
67CONFIG_EPOLL=y 70CONFIG_EPOLL=y
@@ -70,8 +73,10 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
70CONFIG_CC_ALIGN_LABELS=0 73CONFIG_CC_ALIGN_LABELS=0
71CONFIG_CC_ALIGN_LOOPS=0 74CONFIG_CC_ALIGN_LOOPS=0
72CONFIG_CC_ALIGN_JUMPS=0 75CONFIG_CC_ALIGN_JUMPS=0
76CONFIG_SLAB=y
73# CONFIG_TINY_SHMEM is not set 77# CONFIG_TINY_SHMEM is not set
74CONFIG_BASE_SMALL=0 78CONFIG_BASE_SMALL=0
79# CONFIG_SLOB is not set
75 80
76# 81#
77# Loadable module support 82# Loadable module support
@@ -113,7 +118,6 @@ CONFIG_PPC_PSERIES=y
113# CONFIG_PPC_PMAC is not set 118# CONFIG_PPC_PMAC is not set
114# CONFIG_PPC_MAPLE is not set 119# CONFIG_PPC_MAPLE is not set
115# CONFIG_PPC_CELL is not set 120# CONFIG_PPC_CELL is not set
116CONFIG_PPC_OF=y
117CONFIG_XICS=y 121CONFIG_XICS=y
118# CONFIG_U3_DART is not set 122# CONFIG_U3_DART is not set
119CONFIG_MPIC=y 123CONFIG_MPIC=y
@@ -123,8 +127,8 @@ CONFIG_RTAS_PROC=y
123CONFIG_RTAS_FLASH=m 127CONFIG_RTAS_FLASH=m
124# CONFIG_MMIO_NVRAM is not set 128# CONFIG_MMIO_NVRAM is not set
125CONFIG_IBMVIO=y 129CONFIG_IBMVIO=y
130# CONFIG_IBMEBUS is not set
126# CONFIG_PPC_MPC106 is not set 131# CONFIG_PPC_MPC106 is not set
127# CONFIG_GENERIC_TBSYNC is not set
128# CONFIG_CPU_FREQ is not set 132# CONFIG_CPU_FREQ is not set
129# CONFIG_WANT_EARLY_SERIAL is not set 133# CONFIG_WANT_EARLY_SERIAL is not set
130 134
@@ -145,6 +149,7 @@ CONFIG_FORCE_MAX_ZONEORDER=13
145CONFIG_IOMMU_VMERGE=y 149CONFIG_IOMMU_VMERGE=y
146CONFIG_HOTPLUG_CPU=y 150CONFIG_HOTPLUG_CPU=y
147CONFIG_KEXEC=y 151CONFIG_KEXEC=y
152# CONFIG_CRASH_DUMP is not set
148CONFIG_IRQ_ALL_CPUS=y 153CONFIG_IRQ_ALL_CPUS=y
149CONFIG_PPC_SPLPAR=y 154CONFIG_PPC_SPLPAR=y
150CONFIG_EEH=y 155CONFIG_EEH=y
@@ -165,6 +170,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y
165CONFIG_SPARSEMEM_EXTREME=y 170CONFIG_SPARSEMEM_EXTREME=y
166# CONFIG_MEMORY_HOTPLUG is not set 171# CONFIG_MEMORY_HOTPLUG is not set
167CONFIG_SPLIT_PTLOCK_CPUS=4 172CONFIG_SPLIT_PTLOCK_CPUS=4
173CONFIG_MIGRATION=y
168CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y 174CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
169# CONFIG_PPC_64K_PAGES is not set 175# CONFIG_PPC_64K_PAGES is not set
170CONFIG_SCHED_SMT=y 176CONFIG_SCHED_SMT=y
@@ -209,6 +215,7 @@ CONFIG_NET=y
209# 215#
210# Networking options 216# Networking options
211# 217#
218# CONFIG_NETDEBUG is not set
212CONFIG_PACKET=y 219CONFIG_PACKET=y
213# CONFIG_PACKET_MMAP is not set 220# CONFIG_PACKET_MMAP is not set
214CONFIG_UNIX=y 221CONFIG_UNIX=y
@@ -248,6 +255,7 @@ CONFIG_NETFILTER=y
248CONFIG_NETFILTER_NETLINK=y 255CONFIG_NETFILTER_NETLINK=y
249CONFIG_NETFILTER_NETLINK_QUEUE=m 256CONFIG_NETFILTER_NETLINK_QUEUE=m
250CONFIG_NETFILTER_NETLINK_LOG=m 257CONFIG_NETFILTER_NETLINK_LOG=m
258# CONFIG_NETFILTER_XTABLES is not set
251 259
252# 260#
253# IP: Netfilter Configuration 261# IP: Netfilter Configuration
@@ -265,65 +273,6 @@ CONFIG_IP_NF_TFTP=m
265CONFIG_IP_NF_AMANDA=m 273CONFIG_IP_NF_AMANDA=m
266# CONFIG_IP_NF_PPTP is not set 274# CONFIG_IP_NF_PPTP is not set
267CONFIG_IP_NF_QUEUE=m 275CONFIG_IP_NF_QUEUE=m
268CONFIG_IP_NF_IPTABLES=m
269CONFIG_IP_NF_MATCH_LIMIT=m
270CONFIG_IP_NF_MATCH_IPRANGE=m
271CONFIG_IP_NF_MATCH_MAC=m
272CONFIG_IP_NF_MATCH_PKTTYPE=m
273CONFIG_IP_NF_MATCH_MARK=m
274CONFIG_IP_NF_MATCH_MULTIPORT=m
275CONFIG_IP_NF_MATCH_TOS=m
276CONFIG_IP_NF_MATCH_RECENT=m
277CONFIG_IP_NF_MATCH_ECN=m
278CONFIG_IP_NF_MATCH_DSCP=m
279CONFIG_IP_NF_MATCH_AH_ESP=m
280CONFIG_IP_NF_MATCH_LENGTH=m
281CONFIG_IP_NF_MATCH_TTL=m
282CONFIG_IP_NF_MATCH_TCPMSS=m
283CONFIG_IP_NF_MATCH_HELPER=m
284CONFIG_IP_NF_MATCH_STATE=m
285CONFIG_IP_NF_MATCH_CONNTRACK=m
286CONFIG_IP_NF_MATCH_OWNER=m
287CONFIG_IP_NF_MATCH_ADDRTYPE=m
288CONFIG_IP_NF_MATCH_REALM=m
289CONFIG_IP_NF_MATCH_SCTP=m
290# CONFIG_IP_NF_MATCH_DCCP is not set
291CONFIG_IP_NF_MATCH_COMMENT=m
292CONFIG_IP_NF_MATCH_CONNMARK=m
293CONFIG_IP_NF_MATCH_CONNBYTES=m
294CONFIG_IP_NF_MATCH_HASHLIMIT=m
295CONFIG_IP_NF_MATCH_STRING=m
296CONFIG_IP_NF_FILTER=m
297CONFIG_IP_NF_TARGET_REJECT=m
298CONFIG_IP_NF_TARGET_LOG=m
299CONFIG_IP_NF_TARGET_ULOG=m
300CONFIG_IP_NF_TARGET_TCPMSS=m
301CONFIG_IP_NF_TARGET_NFQUEUE=m
302CONFIG_IP_NF_NAT=m
303CONFIG_IP_NF_NAT_NEEDED=y
304CONFIG_IP_NF_TARGET_MASQUERADE=m
305CONFIG_IP_NF_TARGET_REDIRECT=m
306CONFIG_IP_NF_TARGET_NETMAP=m
307CONFIG_IP_NF_TARGET_SAME=m
308CONFIG_IP_NF_NAT_SNMP_BASIC=m
309CONFIG_IP_NF_NAT_IRC=m
310CONFIG_IP_NF_NAT_FTP=m
311CONFIG_IP_NF_NAT_TFTP=m
312CONFIG_IP_NF_NAT_AMANDA=m
313CONFIG_IP_NF_MANGLE=m
314CONFIG_IP_NF_TARGET_TOS=m
315CONFIG_IP_NF_TARGET_ECN=m
316CONFIG_IP_NF_TARGET_DSCP=m
317CONFIG_IP_NF_TARGET_MARK=m
318CONFIG_IP_NF_TARGET_CLASSIFY=m
319CONFIG_IP_NF_TARGET_TTL=m
320CONFIG_IP_NF_TARGET_CONNMARK=m
321CONFIG_IP_NF_TARGET_CLUSTERIP=m
322CONFIG_IP_NF_RAW=m
323CONFIG_IP_NF_TARGET_NOTRACK=m
324CONFIG_IP_NF_ARPTABLES=m
325CONFIG_IP_NF_ARPFILTER=m
326CONFIG_IP_NF_ARP_MANGLE=m
327 276
328# 277#
329# DCCP Configuration (EXPERIMENTAL) 278# DCCP Configuration (EXPERIMENTAL)
@@ -334,6 +283,11 @@ CONFIG_IP_NF_ARP_MANGLE=m
334# SCTP Configuration (EXPERIMENTAL) 283# SCTP Configuration (EXPERIMENTAL)
335# 284#
336# CONFIG_IP_SCTP is not set 285# CONFIG_IP_SCTP is not set
286
287#
288# TIPC Configuration (EXPERIMENTAL)
289#
290# CONFIG_TIPC is not set
337# CONFIG_ATM is not set 291# CONFIG_ATM is not set
338# CONFIG_BRIDGE is not set 292# CONFIG_BRIDGE is not set
339# CONFIG_VLAN_8021Q is not set 293# CONFIG_VLAN_8021Q is not set
@@ -352,7 +306,6 @@ CONFIG_LLC=y
352# QoS and/or fair queueing 306# QoS and/or fair queueing
353# 307#
354# CONFIG_NET_SCHED is not set 308# CONFIG_NET_SCHED is not set
355CONFIG_NET_CLS_ROUTE=y
356 309
357# 310#
358# Network testing 311# Network testing
@@ -550,13 +503,7 @@ CONFIG_SCSI_IPR_TRACE=y
550CONFIG_SCSI_IPR_DUMP=y 503CONFIG_SCSI_IPR_DUMP=y
551# CONFIG_SCSI_QLOGIC_FC is not set 504# CONFIG_SCSI_QLOGIC_FC is not set
552# CONFIG_SCSI_QLOGIC_1280 is not set 505# CONFIG_SCSI_QLOGIC_1280 is not set
553CONFIG_SCSI_QLA2XXX=y 506# CONFIG_SCSI_QLA_FC is not set
554CONFIG_SCSI_QLA21XX=m
555CONFIG_SCSI_QLA22XX=m
556CONFIG_SCSI_QLA2300=m
557CONFIG_SCSI_QLA2322=m
558CONFIG_SCSI_QLA6312=m
559CONFIG_SCSI_QLA24XX=m
560CONFIG_SCSI_LPFC=m 507CONFIG_SCSI_LPFC=m
561# CONFIG_SCSI_DC395x is not set 508# CONFIG_SCSI_DC395x is not set
562# CONFIG_SCSI_DC390T is not set 509# CONFIG_SCSI_DC390T is not set
@@ -678,6 +625,7 @@ CONFIG_E1000=y
678# CONFIG_R8169 is not set 625# CONFIG_R8169 is not set
679# CONFIG_SIS190 is not set 626# CONFIG_SIS190 is not set
680# CONFIG_SKGE is not set 627# CONFIG_SKGE is not set
628# CONFIG_SKY2 is not set
681# CONFIG_SK98LIN is not set 629# CONFIG_SK98LIN is not set
682# CONFIG_VIA_VELOCITY is not set 630# CONFIG_VIA_VELOCITY is not set
683CONFIG_TIGON3=y 631CONFIG_TIGON3=y
@@ -803,6 +751,7 @@ CONFIG_HW_CONSOLE=y
803CONFIG_SERIAL_8250=y 751CONFIG_SERIAL_8250=y
804CONFIG_SERIAL_8250_CONSOLE=y 752CONFIG_SERIAL_8250_CONSOLE=y
805CONFIG_SERIAL_8250_NR_UARTS=4 753CONFIG_SERIAL_8250_NR_UARTS=4
754CONFIG_SERIAL_8250_RUNTIME_UARTS=4
806# CONFIG_SERIAL_8250_EXTENDED is not set 755# CONFIG_SERIAL_8250_EXTENDED is not set
807 756
808# 757#
@@ -909,6 +858,12 @@ CONFIG_I2C_ALGOBIT=y
909# CONFIG_I2C_DEBUG_CHIP is not set 858# CONFIG_I2C_DEBUG_CHIP is not set
910 859
911# 860#
861# SPI support
862#
863# CONFIG_SPI is not set
864# CONFIG_SPI_MASTER is not set
865
866#
912# Dallas's 1-wire bus 867# Dallas's 1-wire bus
913# 868#
914# CONFIG_W1 is not set 869# CONFIG_W1 is not set
@@ -976,7 +931,6 @@ CONFIG_FB_RADEON_I2C=y
976# CONFIG_FB_KYRO is not set 931# CONFIG_FB_KYRO is not set
977# CONFIG_FB_3DFX is not set 932# CONFIG_FB_3DFX is not set
978# CONFIG_FB_VOODOO1 is not set 933# CONFIG_FB_VOODOO1 is not set
979# CONFIG_FB_CYBLA is not set
980# CONFIG_FB_TRIDENT is not set 934# CONFIG_FB_TRIDENT is not set
981# CONFIG_FB_VIRTUAL is not set 935# CONFIG_FB_VIRTUAL is not set
982 936
@@ -1061,12 +1015,15 @@ CONFIG_USB_STORAGE=y
1061# CONFIG_USB_STORAGE_SDDR09 is not set 1015# CONFIG_USB_STORAGE_SDDR09 is not set
1062# CONFIG_USB_STORAGE_SDDR55 is not set 1016# CONFIG_USB_STORAGE_SDDR55 is not set
1063# CONFIG_USB_STORAGE_JUMPSHOT is not set 1017# CONFIG_USB_STORAGE_JUMPSHOT is not set
1018# CONFIG_USB_STORAGE_ALAUDA is not set
1019# CONFIG_USB_LIBUSUAL is not set
1064 1020
1065# 1021#
1066# USB Input Devices 1022# USB Input Devices
1067# 1023#
1068CONFIG_USB_HID=y 1024CONFIG_USB_HID=y
1069CONFIG_USB_HIDINPUT=y 1025CONFIG_USB_HIDINPUT=y
1026# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1070# CONFIG_HID_FF is not set 1027# CONFIG_HID_FF is not set
1071CONFIG_USB_HIDDEV=y 1028CONFIG_USB_HIDDEV=y
1072# CONFIG_USB_AIPTEK is not set 1029# CONFIG_USB_AIPTEK is not set
@@ -1080,6 +1037,7 @@ CONFIG_USB_HIDDEV=y
1080# CONFIG_USB_YEALINK is not set 1037# CONFIG_USB_YEALINK is not set
1081# CONFIG_USB_XPAD is not set 1038# CONFIG_USB_XPAD is not set
1082# CONFIG_USB_ATI_REMOTE is not set 1039# CONFIG_USB_ATI_REMOTE is not set
1040# CONFIG_USB_ATI_REMOTE2 is not set
1083# CONFIG_USB_KEYSPAN_REMOTE is not set 1041# CONFIG_USB_KEYSPAN_REMOTE is not set
1084# CONFIG_USB_APPLETOUCH is not set 1042# CONFIG_USB_APPLETOUCH is not set
1085 1043
@@ -1167,6 +1125,10 @@ CONFIG_INFINIBAND_IPOIB=m
1167# 1125#
1168 1126
1169# 1127#
1128# EDAC - error detection and reporting (RAS)
1129#
1130
1131#
1170# File systems 1132# File systems
1171# 1133#
1172CONFIG_EXT2_FS=y 1134CONFIG_EXT2_FS=y
@@ -1200,6 +1162,7 @@ CONFIG_XFS_EXPORT=y
1200CONFIG_XFS_SECURITY=y 1162CONFIG_XFS_SECURITY=y
1201CONFIG_XFS_POSIX_ACL=y 1163CONFIG_XFS_POSIX_ACL=y
1202# CONFIG_XFS_RT is not set 1164# CONFIG_XFS_RT is not set
1165# CONFIG_OCFS2_FS is not set
1203# CONFIG_MINIX_FS is not set 1166# CONFIG_MINIX_FS is not set
1204# CONFIG_ROMFS_FS is not set 1167# CONFIG_ROMFS_FS is not set
1205CONFIG_INOTIFY=y 1168CONFIG_INOTIFY=y
@@ -1240,6 +1203,7 @@ CONFIG_HUGETLBFS=y
1240CONFIG_HUGETLB_PAGE=y 1203CONFIG_HUGETLB_PAGE=y
1241CONFIG_RAMFS=y 1204CONFIG_RAMFS=y
1242# CONFIG_RELAYFS_FS is not set 1205# CONFIG_RELAYFS_FS is not set
1206# CONFIG_CONFIGFS_FS is not set
1243 1207
1244# 1208#
1245# Miscellaneous filesystems 1209# Miscellaneous filesystems
@@ -1351,10 +1315,6 @@ CONFIG_CRC32=y
1351CONFIG_LIBCRC32C=m 1315CONFIG_LIBCRC32C=m
1352CONFIG_ZLIB_INFLATE=y 1316CONFIG_ZLIB_INFLATE=y
1353CONFIG_ZLIB_DEFLATE=m 1317CONFIG_ZLIB_DEFLATE=m
1354CONFIG_TEXTSEARCH=y
1355CONFIG_TEXTSEARCH_KMP=m
1356CONFIG_TEXTSEARCH_BM=m
1357CONFIG_TEXTSEARCH_FSM=m
1358 1318
1359# 1319#
1360# Instrumentation Support 1320# Instrumentation Support
@@ -1367,18 +1327,20 @@ CONFIG_OPROFILE=y
1367# Kernel hacking 1327# Kernel hacking
1368# 1328#
1369# CONFIG_PRINTK_TIME is not set 1329# CONFIG_PRINTK_TIME is not set
1370CONFIG_DEBUG_KERNEL=y
1371CONFIG_MAGIC_SYSRQ=y 1330CONFIG_MAGIC_SYSRQ=y
1331CONFIG_DEBUG_KERNEL=y
1372CONFIG_LOG_BUF_SHIFT=17 1332CONFIG_LOG_BUF_SHIFT=17
1373CONFIG_DETECT_SOFTLOCKUP=y 1333CONFIG_DETECT_SOFTLOCKUP=y
1374# CONFIG_SCHEDSTATS is not set 1334# CONFIG_SCHEDSTATS is not set
1375# CONFIG_DEBUG_SLAB is not set 1335# CONFIG_DEBUG_SLAB is not set
1336CONFIG_DEBUG_MUTEXES=y
1376# CONFIG_DEBUG_SPINLOCK is not set 1337# CONFIG_DEBUG_SPINLOCK is not set
1377# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1338# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1378# CONFIG_DEBUG_KOBJECT is not set 1339# CONFIG_DEBUG_KOBJECT is not set
1379# CONFIG_DEBUG_INFO is not set 1340# CONFIG_DEBUG_INFO is not set
1380CONFIG_DEBUG_FS=y 1341CONFIG_DEBUG_FS=y
1381# CONFIG_DEBUG_VM is not set 1342# CONFIG_DEBUG_VM is not set
1343CONFIG_FORCED_INLINING=y
1382# CONFIG_RCU_TORTURE_TEST is not set 1344# CONFIG_RCU_TORTURE_TEST is not set
1383CONFIG_DEBUG_STACKOVERFLOW=y 1345CONFIG_DEBUG_STACKOVERFLOW=y
1384CONFIG_DEBUG_STACK_USAGE=y 1346CONFIG_DEBUG_STACK_USAGE=y
@@ -1387,6 +1349,11 @@ CONFIG_XMON=y
1387CONFIG_XMON_DEFAULT=y 1349CONFIG_XMON_DEFAULT=y
1388CONFIG_IRQSTACKS=y 1350CONFIG_IRQSTACKS=y
1389# CONFIG_BOOTX_TEXT is not set 1351# CONFIG_BOOTX_TEXT is not set
1352# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
1353# CONFIG_PPC_EARLY_DEBUG_G5 is not set
1354# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
1355# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
1356# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
1390 1357
1391# 1358#
1392# Security options 1359# Security options
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 8c21d378f5d2..778f22fd85d2 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -134,8 +134,10 @@ static void crash_kexec_prepare_cpus(void)
134 * the crash CPU will send an IPI and wait for other CPUs to 134 * the crash CPU will send an IPI and wait for other CPUs to
135 * respond. If not, proceed the kexec boot even though we failed to 135 * respond. If not, proceed the kexec boot even though we failed to
136 * capture other CPU states. 136 * capture other CPU states.
137 * Delay of at least 10 seconds.
137 */ 138 */
138 msecs = 1000000; 139 printk(KERN_ALERT "Sending IPI to other cpus...\n");
140 msecs = 10000;
139 while ((atomic_read(&waiting_for_crash_ipi) > 0) && (--msecs > 0)) { 141 while ((atomic_read(&waiting_for_crash_ipi) > 0) && (--msecs > 0)) {
140 barrier(); 142 barrier();
141 mdelay(1); 143 mdelay(1);
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 03b25f9359f8..a0579e859b21 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -714,6 +714,7 @@ AltiVecUnavailable:
714#ifdef CONFIG_ALTIVEC 714#ifdef CONFIG_ALTIVEC
715 bne load_up_altivec /* if from user, just load it up */ 715 bne load_up_altivec /* if from user, just load it up */
716#endif /* CONFIG_ALTIVEC */ 716#endif /* CONFIG_ALTIVEC */
717 addi r3,r1,STACK_FRAME_OVERHEAD
717 EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception) 718 EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception)
718 719
719PerformanceMonitor: 720PerformanceMonitor:
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 7ebb73665e9d..2b21ec499285 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -137,7 +137,7 @@ _GLOBAL(__secondary_hold)
137 ori r24,r24,MSR_RI 137 ori r24,r24,MSR_RI
138 mtmsrd r24 /* RI on */ 138 mtmsrd r24 /* RI on */
139 139
140 /* Grab our linux cpu number */ 140 /* Grab our physical cpu number */
141 mr r24,r3 141 mr r24,r3
142 142
143 /* Tell the master cpu we're here */ 143 /* Tell the master cpu we're here */
@@ -151,12 +151,7 @@ _GLOBAL(__secondary_hold)
151 cmpdi 0,r4,1 151 cmpdi 0,r4,1
152 bne 100b 152 bne 100b
153 153
154#ifdef CONFIG_HMT 154#if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
155 SET_REG_IMMEDIATE(r4, .hmt_init)
156 mtctr r4
157 bctr
158#else
159#ifdef CONFIG_SMP
160 LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init) 155 LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init)
161 mtctr r4 156 mtctr r4
162 mr r3,r24 157 mr r3,r24
@@ -164,7 +159,6 @@ _GLOBAL(__secondary_hold)
164#else 159#else
165 BUG_OPCODE 160 BUG_OPCODE
166#endif 161#endif
167#endif
168 162
169/* This value is used to mark exception frames on the stack. */ 163/* This value is used to mark exception frames on the stack. */
170 .section ".toc","aw" 164 .section ".toc","aw"
@@ -319,7 +313,6 @@ exception_marker:
319label##_pSeries: \ 313label##_pSeries: \
320 HMT_MEDIUM; \ 314 HMT_MEDIUM; \
321 mtspr SPRN_SPRG1,r13; /* save r13 */ \ 315 mtspr SPRN_SPRG1,r13; /* save r13 */ \
322 RUNLATCH_ON(r13); \
323 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) 316 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
324 317
325#define STD_EXCEPTION_ISERIES(n, label, area) \ 318#define STD_EXCEPTION_ISERIES(n, label, area) \
@@ -327,7 +320,6 @@ label##_pSeries: \
327label##_iSeries: \ 320label##_iSeries: \
328 HMT_MEDIUM; \ 321 HMT_MEDIUM; \
329 mtspr SPRN_SPRG1,r13; /* save r13 */ \ 322 mtspr SPRN_SPRG1,r13; /* save r13 */ \
330 RUNLATCH_ON(r13); \
331 EXCEPTION_PROLOG_ISERIES_1(area); \ 323 EXCEPTION_PROLOG_ISERIES_1(area); \
332 EXCEPTION_PROLOG_ISERIES_2; \ 324 EXCEPTION_PROLOG_ISERIES_2; \
333 b label##_common 325 b label##_common
@@ -337,7 +329,6 @@ label##_iSeries: \
337label##_iSeries: \ 329label##_iSeries: \
338 HMT_MEDIUM; \ 330 HMT_MEDIUM; \
339 mtspr SPRN_SPRG1,r13; /* save r13 */ \ 331 mtspr SPRN_SPRG1,r13; /* save r13 */ \
340 RUNLATCH_ON(r13); \
341 EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \ 332 EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \
342 lbz r10,PACAPROCENABLED(r13); \ 333 lbz r10,PACAPROCENABLED(r13); \
343 cmpwi 0,r10,0; \ 334 cmpwi 0,r10,0; \
@@ -390,6 +381,7 @@ label##_common: \
390label##_common: \ 381label##_common: \
391 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ 382 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
392 DISABLE_INTS; \ 383 DISABLE_INTS; \
384 bl .ppc64_runlatch_on; \
393 addi r3,r1,STACK_FRAME_OVERHEAD; \ 385 addi r3,r1,STACK_FRAME_OVERHEAD; \
394 bl hdlr; \ 386 bl hdlr; \
395 b .ret_from_except_lite 387 b .ret_from_except_lite
@@ -407,7 +399,6 @@ __start_interrupts:
407_machine_check_pSeries: 399_machine_check_pSeries:
408 HMT_MEDIUM 400 HMT_MEDIUM
409 mtspr SPRN_SPRG1,r13 /* save r13 */ 401 mtspr SPRN_SPRG1,r13 /* save r13 */
410 RUNLATCH_ON(r13)
411 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) 402 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
412 403
413 . = 0x300 404 . = 0x300
@@ -434,7 +425,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
434data_access_slb_pSeries: 425data_access_slb_pSeries:
435 HMT_MEDIUM 426 HMT_MEDIUM
436 mtspr SPRN_SPRG1,r13 427 mtspr SPRN_SPRG1,r13
437 RUNLATCH_ON(r13)
438 mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ 428 mfspr r13,SPRN_SPRG3 /* get paca address into r13 */
439 std r3,PACA_EXSLB+EX_R3(r13) 429 std r3,PACA_EXSLB+EX_R3(r13)
440 mfspr r3,SPRN_DAR 430 mfspr r3,SPRN_DAR
@@ -460,7 +450,6 @@ data_access_slb_pSeries:
460instruction_access_slb_pSeries: 450instruction_access_slb_pSeries:
461 HMT_MEDIUM 451 HMT_MEDIUM
462 mtspr SPRN_SPRG1,r13 452 mtspr SPRN_SPRG1,r13
463 RUNLATCH_ON(r13)
464 mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ 453 mfspr r13,SPRN_SPRG3 /* get paca address into r13 */
465 std r3,PACA_EXSLB+EX_R3(r13) 454 std r3,PACA_EXSLB+EX_R3(r13)
466 mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */ 455 mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */
@@ -491,7 +480,6 @@ instruction_access_slb_pSeries:
491 .globl system_call_pSeries 480 .globl system_call_pSeries
492system_call_pSeries: 481system_call_pSeries:
493 HMT_MEDIUM 482 HMT_MEDIUM
494 RUNLATCH_ON(r9)
495 mr r9,r13 483 mr r9,r13
496 mfmsr r10 484 mfmsr r10
497 mfspr r13,SPRN_SPRG3 485 mfspr r13,SPRN_SPRG3
@@ -575,7 +563,6 @@ slb_miss_user_pseries:
575system_reset_fwnmi: 563system_reset_fwnmi:
576 HMT_MEDIUM 564 HMT_MEDIUM
577 mtspr SPRN_SPRG1,r13 /* save r13 */ 565 mtspr SPRN_SPRG1,r13 /* save r13 */
578 RUNLATCH_ON(r13)
579 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) 566 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common)
580 567
581 .globl machine_check_fwnmi 568 .globl machine_check_fwnmi
@@ -583,7 +570,6 @@ system_reset_fwnmi:
583machine_check_fwnmi: 570machine_check_fwnmi:
584 HMT_MEDIUM 571 HMT_MEDIUM
585 mtspr SPRN_SPRG1,r13 /* save r13 */ 572 mtspr SPRN_SPRG1,r13 /* save r13 */
586 RUNLATCH_ON(r13)
587 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) 573 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
588 574
589#ifdef CONFIG_PPC_ISERIES 575#ifdef CONFIG_PPC_ISERIES
@@ -894,7 +880,6 @@ unrecov_fer:
894 .align 7 880 .align 7
895 .globl data_access_common 881 .globl data_access_common
896data_access_common: 882data_access_common:
897 RUNLATCH_ON(r10) /* It wont fit in the 0x300 handler */
898 mfspr r10,SPRN_DAR 883 mfspr r10,SPRN_DAR
899 std r10,PACA_EXGEN+EX_DAR(r13) 884 std r10,PACA_EXGEN+EX_DAR(r13)
900 mfspr r10,SPRN_DSISR 885 mfspr r10,SPRN_DSISR
@@ -1042,6 +1027,7 @@ hardware_interrupt_common:
1042 EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN) 1027 EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN)
1043hardware_interrupt_entry: 1028hardware_interrupt_entry:
1044 DISABLE_INTS 1029 DISABLE_INTS
1030 bl .ppc64_runlatch_on
1045 addi r3,r1,STACK_FRAME_OVERHEAD 1031 addi r3,r1,STACK_FRAME_OVERHEAD
1046 bl .do_IRQ 1032 bl .do_IRQ
1047 b .ret_from_except_lite 1033 b .ret_from_except_lite
@@ -1816,22 +1802,6 @@ _STATIC(start_here_multiplatform)
1816 ori r6,r6,MSR_RI 1802 ori r6,r6,MSR_RI
1817 mtmsrd r6 /* RI on */ 1803 mtmsrd r6 /* RI on */
1818 1804
1819#ifdef CONFIG_HMT
1820 /* Start up the second thread on cpu 0 */
1821 mfspr r3,SPRN_PVR
1822 srwi r3,r3,16
1823 cmpwi r3,0x34 /* Pulsar */
1824 beq 90f
1825 cmpwi r3,0x36 /* Icestar */
1826 beq 90f
1827 cmpwi r3,0x37 /* SStar */
1828 beq 90f
1829 b 91f /* HMT not supported */
183090: li r3,0
1831 bl .hmt_start_secondary
183291:
1833#endif
1834
1835 /* The following gets the stack and TOC set up with the regs */ 1805 /* The following gets the stack and TOC set up with the regs */
1836 /* pointing to the real addr of the kernel stack. This is */ 1806 /* pointing to the real addr of the kernel stack. This is */
1837 /* all done to support the C function call below which sets */ 1807 /* all done to support the C function call below which sets */
@@ -1945,77 +1915,8 @@ _STATIC(start_here_common)
1945 1915
1946 bl .start_kernel 1916 bl .start_kernel
1947 1917
1948_GLOBAL(hmt_init) 1918 /* Not reached */
1949#ifdef CONFIG_HMT 1919 BUG_OPCODE
1950 LOAD_REG_IMMEDIATE(r5, hmt_thread_data)
1951 mfspr r7,SPRN_PVR
1952 srwi r7,r7,16
1953 cmpwi r7,0x34 /* Pulsar */
1954 beq 90f
1955 cmpwi r7,0x36 /* Icestar */
1956 beq 91f
1957 cmpwi r7,0x37 /* SStar */
1958 beq 91f
1959 b 101f
196090: mfspr r6,SPRN_PIR
1961 andi. r6,r6,0x1f
1962 b 92f
196391: mfspr r6,SPRN_PIR
1964 andi. r6,r6,0x3ff
196592: sldi r4,r24,3
1966 stwx r6,r5,r4
1967 bl .hmt_start_secondary
1968 b 101f
1969
1970__hmt_secondary_hold:
1971 LOAD_REG_IMMEDIATE(r5, hmt_thread_data)
1972 clrldi r5,r5,4
1973 li r7,0
1974 mfspr r6,SPRN_PIR
1975 mfspr r8,SPRN_PVR
1976 srwi r8,r8,16
1977 cmpwi r8,0x34
1978 bne 93f
1979 andi. r6,r6,0x1f
1980 b 103f
198193: andi. r6,r6,0x3f
1982
1983103: lwzx r8,r5,r7
1984 cmpw r8,r6
1985 beq 104f
1986 addi r7,r7,8
1987 b 103b
1988
1989104: addi r7,r7,4
1990 lwzx r9,r5,r7
1991 mr r24,r9
1992101:
1993#endif
1994 mr r3,r24
1995 b .pSeries_secondary_smp_init
1996
1997#ifdef CONFIG_HMT
1998_GLOBAL(hmt_start_secondary)
1999 LOAD_REG_IMMEDIATE(r4,__hmt_secondary_hold)
2000 clrldi r4,r4,4
2001 mtspr SPRN_NIADORM, r4
2002 mfspr r4, SPRN_MSRDORM
2003 li r5, -65
2004 and r4, r4, r5
2005 mtspr SPRN_MSRDORM, r4
2006 lis r4,0xffef
2007 ori r4,r4,0x7403
2008 mtspr SPRN_TSC, r4
2009 li r4,0x1f4
2010 mtspr SPRN_TST, r4
2011 mfspr r4, SPRN_HID0
2012 ori r4, r4, 0x1
2013 mtspr SPRN_HID0, r4
2014 mfspr r4, SPRN_CTRLF
2015 oris r4, r4, 0x40
2016 mtspr SPRN_CTRLT, r4
2017 blr
2018#endif
2019 1920
2020/* 1921/*
2021 * We put a few things here that have to be page-aligned. 1922 * We put a few things here that have to be page-aligned.
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 1ae96a8ed7e2..e789fef4eb8a 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -341,7 +341,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
341 const char *system_id = ""; 341 const char *system_id = "";
342 unsigned int *lp_index_ptr, lp_index = 0; 342 unsigned int *lp_index_ptr, lp_index = 0;
343 struct device_node *rtas_node; 343 struct device_node *rtas_node;
344 int *lrdrp; 344 int *lrdrp = NULL;
345 345
346 rootdn = find_path_device("/"); 346 rootdn = find_path_device("/");
347 if (rootdn) { 347 if (rootdn) {
@@ -362,7 +362,9 @@ static int lparcfg_data(struct seq_file *m, void *v)
362 seq_printf(m, "partition_id=%d\n", (int)lp_index); 362 seq_printf(m, "partition_id=%d\n", (int)lp_index);
363 363
364 rtas_node = find_path_device("/rtas"); 364 rtas_node = find_path_device("/rtas");
365 lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", NULL); 365 if (rtas_node)
366 lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity",
367 NULL);
366 368
367 if (lrdrp == NULL) { 369 if (lrdrp == NULL) {
368 partition_potential_processors = vdso_data->processorCount; 370 partition_potential_processors = vdso_data->processorCount;
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index d6431440c54f..ee166c586642 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -26,8 +26,6 @@
26#include <asm/prom.h> 26#include <asm/prom.h>
27#include <asm/smp.h> 27#include <asm/smp.h>
28 28
29#define HASH_GROUP_SIZE 0x80 /* size of each hash group, asm/mmu.h */
30
31int default_machine_kexec_prepare(struct kimage *image) 29int default_machine_kexec_prepare(struct kimage *image)
32{ 30{
33 int i; 31 int i;
@@ -61,7 +59,7 @@ int default_machine_kexec_prepare(struct kimage *image)
61 */ 59 */
62 if (htab_address) { 60 if (htab_address) {
63 low = __pa(htab_address); 61 low = __pa(htab_address);
64 high = low + (htab_hash_mask + 1) * HASH_GROUP_SIZE; 62 high = low + htab_size_bytes;
65 63
66 for (i = 0; i < image->nr_segments; i++) { 64 for (i = 0; i < image->nr_segments; i++) {
67 begin = image->segment[i].mem; 65 begin = image->segment[i].mem;
@@ -294,7 +292,7 @@ void default_machine_kexec(struct kimage *image)
294} 292}
295 293
296/* Values we need to export to the second kernel via the device tree. */ 294/* Values we need to export to the second kernel via the device tree. */
297static unsigned long htab_base, htab_size, kernel_end; 295static unsigned long htab_base, kernel_end;
298 296
299static struct property htab_base_prop = { 297static struct property htab_base_prop = {
300 .name = "linux,htab-base", 298 .name = "linux,htab-base",
@@ -305,7 +303,7 @@ static struct property htab_base_prop = {
305static struct property htab_size_prop = { 303static struct property htab_size_prop = {
306 .name = "linux,htab-size", 304 .name = "linux,htab-size",
307 .length = sizeof(unsigned long), 305 .length = sizeof(unsigned long),
308 .value = (unsigned char *)&htab_size, 306 .value = (unsigned char *)&htab_size_bytes,
309}; 307};
310 308
311static struct property kernel_end_prop = { 309static struct property kernel_end_prop = {
@@ -331,8 +329,6 @@ static void __init export_htab_values(void)
331 329
332 htab_base = __pa(htab_address); 330 htab_base = __pa(htab_address);
333 prom_add_property(node, &htab_base_prop); 331 prom_add_property(node, &htab_base_prop);
334
335 htab_size = 1UL << ppc64_pft_size;
336 prom_add_property(node, &htab_size_prop); 332 prom_add_property(node, &htab_size_prop);
337 333
338 out: 334 out:
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index b212d3e64b8d..af32922db65b 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -78,15 +78,8 @@ EXPORT_SYMBOL(sys_sigreturn);
78EXPORT_SYMBOL(strcpy); 78EXPORT_SYMBOL(strcpy);
79EXPORT_SYMBOL(strncpy); 79EXPORT_SYMBOL(strncpy);
80EXPORT_SYMBOL(strcat); 80EXPORT_SYMBOL(strcat);
81EXPORT_SYMBOL(strncat);
82EXPORT_SYMBOL(strchr);
83EXPORT_SYMBOL(strrchr);
84EXPORT_SYMBOL(strpbrk);
85EXPORT_SYMBOL(strstr);
86EXPORT_SYMBOL(strlen); 81EXPORT_SYMBOL(strlen);
87EXPORT_SYMBOL(strnlen);
88EXPORT_SYMBOL(strcmp); 82EXPORT_SYMBOL(strcmp);
89EXPORT_SYMBOL(strncmp);
90EXPORT_SYMBOL(strcasecmp); 83EXPORT_SYMBOL(strcasecmp);
91 84
92EXPORT_SYMBOL(csum_partial); 85EXPORT_SYMBOL(csum_partial);
@@ -184,9 +177,6 @@ EXPORT_SYMBOL(adb_try_handler_change);
184EXPORT_SYMBOL(cuda_request); 177EXPORT_SYMBOL(cuda_request);
185EXPORT_SYMBOL(cuda_poll); 178EXPORT_SYMBOL(cuda_poll);
186#endif /* CONFIG_ADB_CUDA */ 179#endif /* CONFIG_ADB_CUDA */
187#ifdef CONFIG_PPC_PMAC
188EXPORT_SYMBOL(sys_ctrler);
189#endif
190#ifdef CONFIG_VT 180#ifdef CONFIG_VT
191EXPORT_SYMBOL(kd_mksound); 181EXPORT_SYMBOL(kd_mksound);
192#endif 182#endif
@@ -204,7 +194,6 @@ EXPORT_SYMBOL(__lshrdi3);
204EXPORT_SYMBOL(memcpy); 194EXPORT_SYMBOL(memcpy);
205EXPORT_SYMBOL(memset); 195EXPORT_SYMBOL(memset);
206EXPORT_SYMBOL(memmove); 196EXPORT_SYMBOL(memmove);
207EXPORT_SYMBOL(memscan);
208EXPORT_SYMBOL(memcmp); 197EXPORT_SYMBOL(memcmp);
209EXPORT_SYMBOL(memchr); 198EXPORT_SYMBOL(memchr);
210 199
@@ -213,7 +202,6 @@ EXPORT_SYMBOL(screen_info);
213#endif 202#endif
214 203
215#ifdef CONFIG_PPC32 204#ifdef CONFIG_PPC32
216EXPORT_SYMBOL(__delay);
217EXPORT_SYMBOL(timer_interrupt); 205EXPORT_SYMBOL(timer_interrupt);
218EXPORT_SYMBOL(irq_desc); 206EXPORT_SYMBOL(irq_desc);
219EXPORT_SYMBOL(tb_ticks_per_jiffy); 207EXPORT_SYMBOL(tb_ticks_per_jiffy);
@@ -221,10 +209,6 @@ EXPORT_SYMBOL(console_drivers);
221EXPORT_SYMBOL(cacheable_memcpy); 209EXPORT_SYMBOL(cacheable_memcpy);
222#endif 210#endif
223 211
224EXPORT_SYMBOL(__up);
225EXPORT_SYMBOL(__down);
226EXPORT_SYMBOL(__down_interruptible);
227
228#ifdef CONFIG_8xx 212#ifdef CONFIG_8xx
229EXPORT_SYMBOL(cpm_install_handler); 213EXPORT_SYMBOL(cpm_install_handler);
230EXPORT_SYMBOL(cpm_free_handler); 214EXPORT_SYMBOL(cpm_free_handler);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 1201880cab40..dd774c3c9302 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -886,3 +886,35 @@ void dump_stack(void)
886 show_stack(current, NULL); 886 show_stack(current, NULL);
887} 887}
888EXPORT_SYMBOL(dump_stack); 888EXPORT_SYMBOL(dump_stack);
889
890#ifdef CONFIG_PPC64
891void ppc64_runlatch_on(void)
892{
893 unsigned long ctrl;
894
895 if (cpu_has_feature(CPU_FTR_CTRL) && !test_thread_flag(TIF_RUNLATCH)) {
896 HMT_medium();
897
898 ctrl = mfspr(SPRN_CTRLF);
899 ctrl |= CTRL_RUNLATCH;
900 mtspr(SPRN_CTRLT, ctrl);
901
902 set_thread_flag(TIF_RUNLATCH);
903 }
904}
905
906void ppc64_runlatch_off(void)
907{
908 unsigned long ctrl;
909
910 if (cpu_has_feature(CPU_FTR_CTRL) && test_thread_flag(TIF_RUNLATCH)) {
911 HMT_medium();
912
913 clear_thread_flag(TIF_RUNLATCH);
914
915 ctrl = mfspr(SPRN_CTRLF);
916 ctrl &= ~CTRL_RUNLATCH;
917 mtspr(SPRN_CTRLT, ctrl);
918 }
919}
920#endif
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ec7153f4d47c..d34fe537400e 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -205,14 +205,6 @@ static cell_t __initdata regbuf[1024];
205 205
206#define MAX_CPU_THREADS 2 206#define MAX_CPU_THREADS 2
207 207
208/* TO GO */
209#ifdef CONFIG_HMT
210struct {
211 unsigned int pir;
212 unsigned int threadid;
213} hmt_thread_data[NR_CPUS];
214#endif /* CONFIG_HMT */
215
216/* 208/*
217 * Error results ... some OF calls will return "-1" on error, some 209 * Error results ... some OF calls will return "-1" on error, some
218 * will return 0, some will return either. To simplify, here are 210 * will return 0, some will return either. To simplify, here are
@@ -1319,10 +1311,6 @@ static void __init prom_hold_cpus(void)
1319 */ 1311 */
1320 *spinloop = 0; 1312 *spinloop = 0;
1321 1313
1322#ifdef CONFIG_HMT
1323 for (i = 0; i < NR_CPUS; i++)
1324 RELOC(hmt_thread_data)[i].pir = 0xdeadbeef;
1325#endif
1326 /* look for cpus */ 1314 /* look for cpus */
1327 for (node = 0; prom_next_node(&node); ) { 1315 for (node = 0; prom_next_node(&node); ) {
1328 type[0] = 0; 1316 type[0] = 0;
@@ -1389,32 +1377,6 @@ static void __init prom_hold_cpus(void)
1389 /* Reserve cpu #s for secondary threads. They start later. */ 1377 /* Reserve cpu #s for secondary threads. They start later. */
1390 cpuid += cpu_threads; 1378 cpuid += cpu_threads;
1391 } 1379 }
1392#ifdef CONFIG_HMT
1393 /* Only enable HMT on processors that provide support. */
1394 if (__is_processor(PV_PULSAR) ||
1395 __is_processor(PV_ICESTAR) ||
1396 __is_processor(PV_SSTAR)) {
1397 prom_printf(" starting secondary threads\n");
1398
1399 for (i = 0; i < NR_CPUS; i += 2) {
1400 if (!cpu_online(i))
1401 continue;
1402
1403 if (i == 0) {
1404 unsigned long pir = mfspr(SPRN_PIR);
1405 if (__is_processor(PV_PULSAR)) {
1406 RELOC(hmt_thread_data)[i].pir =
1407 pir & 0x1f;
1408 } else {
1409 RELOC(hmt_thread_data)[i].pir =
1410 pir & 0x3ff;
1411 }
1412 }
1413 }
1414 } else {
1415 prom_printf("Processor is not HMT capable\n");
1416 }
1417#endif
1418 1380
1419 if (cpuid > NR_CPUS) 1381 if (cpuid > NR_CPUS)
1420 prom_printf("WARNING: maximum CPUs (" __stringify(NR_CPUS) 1382 prom_printf("WARNING: maximum CPUs (" __stringify(NR_CPUS)
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index a717dff695ef..f96c49b03ba0 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -311,8 +311,6 @@ void smp_release_cpus(void)
311 311
312 DBG(" <- smp_release_cpus()\n"); 312 DBG(" <- smp_release_cpus()\n");
313} 313}
314#else
315#define smp_release_cpus()
316#endif /* CONFIG_SMP || CONFIG_KEXEC */ 314#endif /* CONFIG_SMP || CONFIG_KEXEC */
317 315
318/* 316/*
@@ -473,10 +471,12 @@ void __init setup_system(void)
473 check_smt_enabled(); 471 check_smt_enabled();
474 smp_setup_cpu_maps(); 472 smp_setup_cpu_maps();
475 473
474#ifdef CONFIG_SMP
476 /* Release secondary cpus out of their spinloops at 0x60 now that 475 /* Release secondary cpus out of their spinloops at 0x60 now that
477 * we can map physical -> logical CPU ids 476 * we can map physical -> logical CPU ids
478 */ 477 */
479 smp_release_cpus(); 478 smp_release_cpus();
479#endif
480 480
481 printk("Starting Linux PPC64 %s\n", system_utsname.version); 481 printk("Starting Linux PPC64 %s\n", system_utsname.version);
482 482
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 475249dc2350..cd75ab2908fa 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -176,7 +176,6 @@ struct timex32 {
176}; 176};
177 177
178extern int do_adjtimex(struct timex *); 178extern int do_adjtimex(struct timex *);
179extern void ppc_adjtimex(void);
180 179
181asmlinkage long compat_sys_adjtimex(struct timex32 __user *utp) 180asmlinkage long compat_sys_adjtimex(struct timex32 __user *utp)
182{ 181{
@@ -209,9 +208,6 @@ asmlinkage long compat_sys_adjtimex(struct timex32 __user *utp)
209 208
210 ret = do_adjtimex(&txc); 209 ret = do_adjtimex(&txc);
211 210
212 /* adjust the conversion of TB to time of day to track adjtimex */
213 ppc_adjtimex();
214
215 if(put_user(txc.modes, &utp->modes) || 211 if(put_user(txc.modes, &utp->modes) ||
216 __put_user(txc.offset, &utp->offset) || 212 __put_user(txc.offset, &utp->offset) ||
217 __put_user(txc.freq, &utp->freq) || 213 __put_user(txc.freq, &utp->freq) ||
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 1886045a2fd8..2a7ddc579379 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -50,6 +50,7 @@
50#include <linux/security.h> 50#include <linux/security.h>
51#include <linux/percpu.h> 51#include <linux/percpu.h>
52#include <linux/rtc.h> 52#include <linux/rtc.h>
53#include <linux/jiffies.h>
53 54
54#include <asm/io.h> 55#include <asm/io.h>
55#include <asm/processor.h> 56#include <asm/processor.h>
@@ -99,7 +100,15 @@ EXPORT_SYMBOL(tb_ticks_per_usec);
99unsigned long tb_ticks_per_sec; 100unsigned long tb_ticks_per_sec;
100u64 tb_to_xs; 101u64 tb_to_xs;
101unsigned tb_to_us; 102unsigned tb_to_us;
102unsigned long processor_freq; 103
104#define TICKLEN_SCALE (SHIFT_SCALE - 10)
105u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */
106u64 ticklen_to_xs; /* 0.64 fraction */
107
108/* If last_tick_len corresponds to about 1/HZ seconds, then
109 last_tick_len << TICKLEN_SHIFT will be about 2^63. */
110#define TICKLEN_SHIFT (63 - 30 - TICKLEN_SCALE + SHIFT_HZ)
111
103DEFINE_SPINLOCK(rtc_lock); 112DEFINE_SPINLOCK(rtc_lock);
104EXPORT_SYMBOL_GPL(rtc_lock); 113EXPORT_SYMBOL_GPL(rtc_lock);
105 114
@@ -113,10 +122,6 @@ extern unsigned long wall_jiffies;
113extern struct timezone sys_tz; 122extern struct timezone sys_tz;
114static long timezone_offset; 123static long timezone_offset;
115 124
116void ppc_adjtimex(void);
117
118static unsigned adjusting_time = 0;
119
120unsigned long ppc_proc_freq; 125unsigned long ppc_proc_freq;
121unsigned long ppc_tb_freq; 126unsigned long ppc_tb_freq;
122 127
@@ -178,8 +183,7 @@ static __inline__ void timer_check_rtc(void)
178 */ 183 */
179 if (ppc_md.set_rtc_time && ntp_synced() && 184 if (ppc_md.set_rtc_time && ntp_synced() &&
180 xtime.tv_sec - last_rtc_update >= 659 && 185 xtime.tv_sec - last_rtc_update >= 659 &&
181 abs((xtime.tv_nsec/1000) - (1000000-1000000/HZ)) < 500000/HZ && 186 abs((xtime.tv_nsec/1000) - (1000000-1000000/HZ)) < 500000/HZ) {
182 jiffies - wall_jiffies == 1) {
183 struct rtc_time tm; 187 struct rtc_time tm;
184 to_tm(xtime.tv_sec + 1 + timezone_offset, &tm); 188 to_tm(xtime.tv_sec + 1 + timezone_offset, &tm);
185 tm.tm_year -= 1900; 189 tm.tm_year -= 1900;
@@ -226,15 +230,14 @@ void do_gettimeofday(struct timeval *tv)
226 if (__USE_RTC()) { 230 if (__USE_RTC()) {
227 /* do this the old way */ 231 /* do this the old way */
228 unsigned long flags, seq; 232 unsigned long flags, seq;
229 unsigned int sec, nsec, usec, lost; 233 unsigned int sec, nsec, usec;
230 234
231 do { 235 do {
232 seq = read_seqbegin_irqsave(&xtime_lock, flags); 236 seq = read_seqbegin_irqsave(&xtime_lock, flags);
233 sec = xtime.tv_sec; 237 sec = xtime.tv_sec;
234 nsec = xtime.tv_nsec + tb_ticks_since(tb_last_stamp); 238 nsec = xtime.tv_nsec + tb_ticks_since(tb_last_stamp);
235 lost = jiffies - wall_jiffies;
236 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 239 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
237 usec = nsec / 1000 + lost * (1000000 / HZ); 240 usec = nsec / 1000;
238 while (usec >= 1000000) { 241 while (usec >= 1000000) {
239 usec -= 1000000; 242 usec -= 1000000;
240 ++sec; 243 ++sec;
@@ -248,23 +251,6 @@ void do_gettimeofday(struct timeval *tv)
248 251
249EXPORT_SYMBOL(do_gettimeofday); 252EXPORT_SYMBOL(do_gettimeofday);
250 253
251/* Synchronize xtime with do_gettimeofday */
252
253static inline void timer_sync_xtime(unsigned long cur_tb)
254{
255#ifdef CONFIG_PPC64
256 /* why do we do this? */
257 struct timeval my_tv;
258
259 __do_gettimeofday(&my_tv, cur_tb);
260
261 if (xtime.tv_sec <= my_tv.tv_sec) {
262 xtime.tv_sec = my_tv.tv_sec;
263 xtime.tv_nsec = my_tv.tv_usec * 1000;
264 }
265#endif
266}
267
268/* 254/*
269 * There are two copies of tb_to_xs and stamp_xsec so that no 255 * There are two copies of tb_to_xs and stamp_xsec so that no
270 * lock is needed to access and use these values in 256 * lock is needed to access and use these values in
@@ -323,15 +309,30 @@ static __inline__ void timer_recalc_offset(u64 cur_tb)
323{ 309{
324 unsigned long offset; 310 unsigned long offset;
325 u64 new_stamp_xsec; 311 u64 new_stamp_xsec;
312 u64 tlen, t2x;
326 313
327 if (__USE_RTC()) 314 if (__USE_RTC())
328 return; 315 return;
316 tlen = current_tick_length();
329 offset = cur_tb - do_gtod.varp->tb_orig_stamp; 317 offset = cur_tb - do_gtod.varp->tb_orig_stamp;
330 if ((offset & 0x80000000u) == 0) 318 if (tlen == last_tick_len && offset < 0x80000000u) {
331 return; 319 /* check that we're still in sync; if not, resync */
332 new_stamp_xsec = do_gtod.varp->stamp_xsec 320 struct timeval tv;
333 + mulhdu(offset, do_gtod.varp->tb_to_xs); 321 __do_gettimeofday(&tv, cur_tb);
334 update_gtod(cur_tb, new_stamp_xsec, do_gtod.varp->tb_to_xs); 322 if (tv.tv_sec <= xtime.tv_sec &&
323 (tv.tv_sec < xtime.tv_sec ||
324 tv.tv_usec * 1000 <= xtime.tv_nsec))
325 return;
326 }
327 if (tlen != last_tick_len) {
328 t2x = mulhdu(tlen << TICKLEN_SHIFT, ticklen_to_xs);
329 last_tick_len = tlen;
330 } else
331 t2x = do_gtod.varp->tb_to_xs;
332 new_stamp_xsec = (u64) xtime.tv_nsec * XSEC_PER_SEC;
333 do_div(new_stamp_xsec, 1000000000);
334 new_stamp_xsec += (u64) xtime.tv_sec * XSEC_PER_SEC;
335 update_gtod(cur_tb, new_stamp_xsec, t2x);
335} 336}
336 337
337#ifdef CONFIG_SMP 338#ifdef CONFIG_SMP
@@ -462,13 +463,10 @@ void timer_interrupt(struct pt_regs * regs)
462 write_seqlock(&xtime_lock); 463 write_seqlock(&xtime_lock);
463 tb_last_jiffy += tb_ticks_per_jiffy; 464 tb_last_jiffy += tb_ticks_per_jiffy;
464 tb_last_stamp = per_cpu(last_jiffy, cpu); 465 tb_last_stamp = per_cpu(last_jiffy, cpu);
465 timer_recalc_offset(tb_last_jiffy);
466 do_timer(regs); 466 do_timer(regs);
467 timer_sync_xtime(tb_last_jiffy); 467 timer_recalc_offset(tb_last_jiffy);
468 timer_check_rtc(); 468 timer_check_rtc();
469 write_sequnlock(&xtime_lock); 469 write_sequnlock(&xtime_lock);
470 if (adjusting_time && (time_adjust == 0))
471 ppc_adjtimex();
472 } 470 }
473 471
474 next_dec = tb_ticks_per_jiffy - ticks; 472 next_dec = tb_ticks_per_jiffy - ticks;
@@ -492,16 +490,18 @@ void timer_interrupt(struct pt_regs * regs)
492 490
493void wakeup_decrementer(void) 491void wakeup_decrementer(void)
494{ 492{
495 int i; 493 unsigned long ticks;
496 494
497 set_dec(tb_ticks_per_jiffy);
498 /* 495 /*
499 * We don't expect this to be called on a machine with a 601, 496 * The timebase gets saved on sleep and restored on wakeup,
500 * so using get_tbl is fine. 497 * so all we need to do is to reset the decrementer.
501 */ 498 */
502 tb_last_stamp = tb_last_jiffy = get_tb(); 499 ticks = tb_ticks_since(__get_cpu_var(last_jiffy));
503 for_each_cpu(i) 500 if (ticks < tb_ticks_per_jiffy)
504 per_cpu(last_jiffy, i) = tb_last_stamp; 501 ticks = tb_ticks_per_jiffy - ticks;
502 else
503 ticks = 1;
504 set_dec(ticks);
505} 505}
506 506
507#ifdef CONFIG_SMP 507#ifdef CONFIG_SMP
@@ -541,8 +541,8 @@ int do_settimeofday(struct timespec *tv)
541 time_t wtm_sec, new_sec = tv->tv_sec; 541 time_t wtm_sec, new_sec = tv->tv_sec;
542 long wtm_nsec, new_nsec = tv->tv_nsec; 542 long wtm_nsec, new_nsec = tv->tv_nsec;
543 unsigned long flags; 543 unsigned long flags;
544 long int tb_delta; 544 u64 new_xsec;
545 u64 new_xsec, tb_delta_xs; 545 unsigned long tb_delta;
546 546
547 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) 547 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
548 return -EINVAL; 548 return -EINVAL;
@@ -563,9 +563,19 @@ int do_settimeofday(struct timespec *tv)
563 first_settimeofday = 0; 563 first_settimeofday = 0;
564 } 564 }
565#endif 565#endif
566
567 /*
568 * Subtract off the number of nanoseconds since the
569 * beginning of the last tick.
570 * Note that since we don't increment jiffies_64 anywhere other
571 * than in do_timer (since we don't have a lost tick problem),
572 * wall_jiffies will always be the same as jiffies,
573 * and therefore the (jiffies - wall_jiffies) computation
574 * has been removed.
575 */
566 tb_delta = tb_ticks_since(tb_last_stamp); 576 tb_delta = tb_ticks_since(tb_last_stamp);
567 tb_delta += (jiffies - wall_jiffies) * tb_ticks_per_jiffy; 577 tb_delta = mulhdu(tb_delta, do_gtod.varp->tb_to_xs); /* in xsec */
568 tb_delta_xs = mulhdu(tb_delta, do_gtod.varp->tb_to_xs); 578 new_nsec -= SCALE_XSEC(tb_delta, 1000000000);
569 579
570 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - new_sec); 580 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - new_sec);
571 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - new_nsec); 581 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - new_nsec);
@@ -580,12 +590,12 @@ int do_settimeofday(struct timespec *tv)
580 590
581 ntp_clear(); 591 ntp_clear();
582 592
583 new_xsec = 0; 593 new_xsec = xtime.tv_nsec;
584 if (new_nsec != 0) { 594 if (new_xsec != 0) {
585 new_xsec = (u64)new_nsec * XSEC_PER_SEC; 595 new_xsec *= XSEC_PER_SEC;
586 do_div(new_xsec, NSEC_PER_SEC); 596 do_div(new_xsec, NSEC_PER_SEC);
587 } 597 }
588 new_xsec += (u64)new_sec * XSEC_PER_SEC - tb_delta_xs; 598 new_xsec += (u64)xtime.tv_sec * XSEC_PER_SEC;
589 update_gtod(tb_last_jiffy, new_xsec, do_gtod.varp->tb_to_xs); 599 update_gtod(tb_last_jiffy, new_xsec, do_gtod.varp->tb_to_xs);
590 600
591 vdso_data->tz_minuteswest = sys_tz.tz_minuteswest; 601 vdso_data->tz_minuteswest = sys_tz.tz_minuteswest;
@@ -671,7 +681,7 @@ void __init time_init(void)
671 unsigned long flags; 681 unsigned long flags;
672 unsigned long tm = 0; 682 unsigned long tm = 0;
673 struct div_result res; 683 struct div_result res;
674 u64 scale; 684 u64 scale, x;
675 unsigned shift; 685 unsigned shift;
676 686
677 if (ppc_md.time_init != NULL) 687 if (ppc_md.time_init != NULL)
@@ -693,11 +703,36 @@ void __init time_init(void)
693 } 703 }
694 704
695 tb_ticks_per_jiffy = ppc_tb_freq / HZ; 705 tb_ticks_per_jiffy = ppc_tb_freq / HZ;
696 tb_ticks_per_sec = tb_ticks_per_jiffy * HZ; 706 tb_ticks_per_sec = ppc_tb_freq;
697 tb_ticks_per_usec = ppc_tb_freq / 1000000; 707 tb_ticks_per_usec = ppc_tb_freq / 1000000;
698 tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000); 708 tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000);
699 div128_by_32(1024*1024, 0, tb_ticks_per_sec, &res); 709
700 tb_to_xs = res.result_low; 710 /*
711 * Calculate the length of each tick in ns. It will not be
712 * exactly 1e9/HZ unless ppc_tb_freq is divisible by HZ.
713 * We compute 1e9 * tb_ticks_per_jiffy / ppc_tb_freq,
714 * rounded up.
715 */
716 x = (u64) NSEC_PER_SEC * tb_ticks_per_jiffy + ppc_tb_freq - 1;
717 do_div(x, ppc_tb_freq);
718 tick_nsec = x;
719 last_tick_len = x << TICKLEN_SCALE;
720
721 /*
722 * Compute ticklen_to_xs, which is a factor which gets multiplied
723 * by (last_tick_len << TICKLEN_SHIFT) to get a tb_to_xs value.
724 * It is computed as:
725 * ticklen_to_xs = 2^N / (tb_ticks_per_jiffy * 1e9)
726 * where N = 64 + 20 - TICKLEN_SCALE - TICKLEN_SHIFT
727 * so as to give the result as a 0.64 fixed-point fraction.
728 */
729 div128_by_32(1ULL << (64 + 20 - TICKLEN_SCALE - TICKLEN_SHIFT), 0,
730 tb_ticks_per_jiffy, &res);
731 div128_by_32(res.result_high, res.result_low, NSEC_PER_SEC, &res);
732 ticklen_to_xs = res.result_low;
733
734 /* Compute tb_to_xs from tick_nsec */
735 tb_to_xs = mulhdu(last_tick_len << TICKLEN_SHIFT, ticklen_to_xs);
701 736
702 /* 737 /*
703 * Compute scale factor for sched_clock. 738 * Compute scale factor for sched_clock.
@@ -724,6 +759,14 @@ void __init time_init(void)
724 tm = get_boot_time(); 759 tm = get_boot_time();
725 760
726 write_seqlock_irqsave(&xtime_lock, flags); 761 write_seqlock_irqsave(&xtime_lock, flags);
762
763 /* If platform provided a timezone (pmac), we correct the time */
764 if (timezone_offset) {
765 sys_tz.tz_minuteswest = -timezone_offset / 60;
766 sys_tz.tz_dsttime = 0;
767 tm -= timezone_offset;
768 }
769
727 xtime.tv_sec = tm; 770 xtime.tv_sec = tm;
728 xtime.tv_nsec = 0; 771 xtime.tv_nsec = 0;
729 do_gtod.varp = &do_gtod.vars[0]; 772 do_gtod.varp = &do_gtod.vars[0];
@@ -738,18 +781,11 @@ void __init time_init(void)
738 vdso_data->tb_orig_stamp = tb_last_jiffy; 781 vdso_data->tb_orig_stamp = tb_last_jiffy;
739 vdso_data->tb_update_count = 0; 782 vdso_data->tb_update_count = 0;
740 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; 783 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec;
741 vdso_data->stamp_xsec = xtime.tv_sec * XSEC_PER_SEC; 784 vdso_data->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC;
742 vdso_data->tb_to_xs = tb_to_xs; 785 vdso_data->tb_to_xs = tb_to_xs;
743 786
744 time_freq = 0; 787 time_freq = 0;
745 788
746 /* If platform provided a timezone (pmac), we correct the time */
747 if (timezone_offset) {
748 sys_tz.tz_minuteswest = -timezone_offset / 60;
749 sys_tz.tz_dsttime = 0;
750 xtime.tv_sec -= timezone_offset;
751 }
752
753 last_rtc_update = xtime.tv_sec; 789 last_rtc_update = xtime.tv_sec;
754 set_normalized_timespec(&wall_to_monotonic, 790 set_normalized_timespec(&wall_to_monotonic,
755 -xtime.tv_sec, -xtime.tv_nsec); 791 -xtime.tv_sec, -xtime.tv_nsec);
@@ -759,126 +795,6 @@ void __init time_init(void)
759 set_dec(tb_ticks_per_jiffy); 795 set_dec(tb_ticks_per_jiffy);
760} 796}
761 797
762/*
763 * After adjtimex is called, adjust the conversion of tb ticks
764 * to microseconds to keep do_gettimeofday synchronized
765 * with ntpd.
766 *
767 * Use the time_adjust, time_freq and time_offset computed by adjtimex to
768 * adjust the frequency.
769 */
770
771/* #define DEBUG_PPC_ADJTIMEX 1 */
772
773void ppc_adjtimex(void)
774{
775#ifdef CONFIG_PPC64
776 unsigned long den, new_tb_ticks_per_sec, tb_ticks, old_xsec,
777 new_tb_to_xs, new_xsec, new_stamp_xsec;
778 unsigned long tb_ticks_per_sec_delta;
779 long delta_freq, ltemp;
780 struct div_result divres;
781 unsigned long flags;
782 long singleshot_ppm = 0;
783
784 /*
785 * Compute parts per million frequency adjustment to
786 * accomplish the time adjustment implied by time_offset to be
787 * applied over the elapsed time indicated by time_constant.
788 * Use SHIFT_USEC to get it into the same units as
789 * time_freq.
790 */
791 if ( time_offset < 0 ) {
792 ltemp = -time_offset;
793 ltemp <<= SHIFT_USEC - SHIFT_UPDATE;
794 ltemp >>= SHIFT_KG + time_constant;
795 ltemp = -ltemp;
796 } else {
797 ltemp = time_offset;
798 ltemp <<= SHIFT_USEC - SHIFT_UPDATE;
799 ltemp >>= SHIFT_KG + time_constant;
800 }
801
802 /* If there is a single shot time adjustment in progress */
803 if ( time_adjust ) {
804#ifdef DEBUG_PPC_ADJTIMEX
805 printk("ppc_adjtimex: ");
806 if ( adjusting_time == 0 )
807 printk("starting ");
808 printk("single shot time_adjust = %ld\n", time_adjust);
809#endif
810
811 adjusting_time = 1;
812
813 /*
814 * Compute parts per million frequency adjustment
815 * to match time_adjust
816 */
817 singleshot_ppm = tickadj * HZ;
818 /*
819 * The adjustment should be tickadj*HZ to match the code in
820 * linux/kernel/timer.c, but experiments show that this is too
821 * large. 3/4 of tickadj*HZ seems about right
822 */
823 singleshot_ppm -= singleshot_ppm / 4;
824 /* Use SHIFT_USEC to get it into the same units as time_freq */
825 singleshot_ppm <<= SHIFT_USEC;
826 if ( time_adjust < 0 )
827 singleshot_ppm = -singleshot_ppm;
828 }
829 else {
830#ifdef DEBUG_PPC_ADJTIMEX
831 if ( adjusting_time )
832 printk("ppc_adjtimex: ending single shot time_adjust\n");
833#endif
834 adjusting_time = 0;
835 }
836
837 /* Add up all of the frequency adjustments */
838 delta_freq = time_freq + ltemp + singleshot_ppm;
839
840 /*
841 * Compute a new value for tb_ticks_per_sec based on
842 * the frequency adjustment
843 */
844 den = 1000000 * (1 << (SHIFT_USEC - 8));
845 if ( delta_freq < 0 ) {
846 tb_ticks_per_sec_delta = ( tb_ticks_per_sec * ( (-delta_freq) >> (SHIFT_USEC - 8))) / den;
847 new_tb_ticks_per_sec = tb_ticks_per_sec + tb_ticks_per_sec_delta;
848 }
849 else {
850 tb_ticks_per_sec_delta = ( tb_ticks_per_sec * ( delta_freq >> (SHIFT_USEC - 8))) / den;
851 new_tb_ticks_per_sec = tb_ticks_per_sec - tb_ticks_per_sec_delta;
852 }
853
854#ifdef DEBUG_PPC_ADJTIMEX
855 printk("ppc_adjtimex: ltemp = %ld, time_freq = %ld, singleshot_ppm = %ld\n", ltemp, time_freq, singleshot_ppm);
856 printk("ppc_adjtimex: tb_ticks_per_sec - base = %ld new = %ld\n", tb_ticks_per_sec, new_tb_ticks_per_sec);
857#endif
858
859 /*
860 * Compute a new value of tb_to_xs (used to convert tb to
861 * microseconds) and a new value of stamp_xsec which is the
862 * time (in 1/2^20 second units) corresponding to
863 * tb_orig_stamp. This new value of stamp_xsec compensates
864 * for the change in frequency (implied by the new tb_to_xs)
865 * which guarantees that the current time remains the same.
866 */
867 write_seqlock_irqsave( &xtime_lock, flags );
868 tb_ticks = get_tb() - do_gtod.varp->tb_orig_stamp;
869 div128_by_32(1024*1024, 0, new_tb_ticks_per_sec, &divres);
870 new_tb_to_xs = divres.result_low;
871 new_xsec = mulhdu(tb_ticks, new_tb_to_xs);
872
873 old_xsec = mulhdu(tb_ticks, do_gtod.varp->tb_to_xs);
874 new_stamp_xsec = do_gtod.varp->stamp_xsec + old_xsec - new_xsec;
875
876 update_gtod(do_gtod.varp->tb_orig_stamp, new_stamp_xsec, new_tb_to_xs);
877
878 write_sequnlock_irqrestore( &xtime_lock, flags );
879#endif /* CONFIG_PPC64 */
880}
881
882 798
883#define FEBRUARY 2 799#define FEBRUARY 2
884#define STARTOFTIME 1970 800#define STARTOFTIME 1970
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index d96bcfe4c6f6..33654d1b1b43 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -403,12 +403,17 @@ static void native_hpte_clear(void)
403 */ 403 */
404 hpte_v = hptep->v; 404 hpte_v = hptep->v;
405 405
406 /*
407 * Call __tlbie() here rather than tlbie() since we
408 * already hold the native_tlbie_lock.
409 */
406 if (hpte_v & HPTE_V_VALID) { 410 if (hpte_v & HPTE_V_VALID) {
407 hptep->v = 0; 411 hptep->v = 0;
408 tlbie(slot2va(hpte_v, slot), MMU_PAGE_4K, 0); 412 __tlbie(slot2va(hpte_v, slot), MMU_PAGE_4K);
409 } 413 }
410 } 414 }
411 415
416 asm volatile("eieio; tlbsync; ptesync":::"memory");
412 spin_unlock(&native_tlbie_lock); 417 spin_unlock(&native_tlbie_lock);
413 local_irq_restore(flags); 418 local_irq_restore(flags);
414} 419}
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 95b4cd6b65e0..ae2c919cbecd 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -88,6 +88,7 @@ static unsigned long _SDR1;
88struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT]; 88struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
89 89
90hpte_t *htab_address; 90hpte_t *htab_address;
91unsigned long htab_size_bytes;
91unsigned long htab_hash_mask; 92unsigned long htab_hash_mask;
92int mmu_linear_psize = MMU_PAGE_4K; 93int mmu_linear_psize = MMU_PAGE_4K;
93int mmu_virtual_psize = MMU_PAGE_4K; 94int mmu_virtual_psize = MMU_PAGE_4K;
@@ -399,7 +400,7 @@ void create_section_mapping(unsigned long start, unsigned long end)
399 400
400void __init htab_initialize(void) 401void __init htab_initialize(void)
401{ 402{
402 unsigned long table, htab_size_bytes; 403 unsigned long table;
403 unsigned long pteg_count; 404 unsigned long pteg_count;
404 unsigned long mode_rw; 405 unsigned long mode_rw;
405 unsigned long base = 0, size = 0; 406 unsigned long base = 0, size = 0;
diff --git a/arch/powerpc/oprofile/Kconfig b/arch/powerpc/oprofile/Kconfig
index eb2dece76a54..d03c0e5ca870 100644
--- a/arch/powerpc/oprofile/Kconfig
+++ b/arch/powerpc/oprofile/Kconfig
@@ -1,4 +1,5 @@
1config PROFILING 1config PROFILING
2 depends on !PPC_ISERIES
2 bool "Profiling support (EXPERIMENTAL)" 3 bool "Profiling support (EXPERIMENTAL)"
3 help 4 help
4 Say Y here to enable the extended profiling support mechanisms used 5 Say Y here to enable the extended profiling support mechanisms used
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c
index 0b885300d1d1..8ca7b9396355 100644
--- a/arch/powerpc/platforms/iseries/lpevents.c
+++ b/arch/powerpc/platforms/iseries/lpevents.c
@@ -184,6 +184,8 @@ void setup_hvlpevent_queue(void)
184{ 184{
185 void *eventStack; 185 void *eventStack;
186 186
187 spin_lock_init(&hvlpevent_queue.lock);
188
187 /* Allocate a page for the Event Stack. */ 189 /* Allocate a page for the Event Stack. */
188 eventStack = alloc_bootmem_pages(LpEventStackSize); 190 eventStack = alloc_bootmem_pages(LpEventStackSize);
189 memset(eventStack, 0, LpEventStackSize); 191 memset(eventStack, 0, LpEventStackSize);
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index 3f8790146b00..3ecc4a652d82 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -648,6 +648,7 @@ static void yield_shared_processor(void)
648 * here and let the timer_interrupt code sort out the actual time. 648 * here and let the timer_interrupt code sort out the actual time.
649 */ 649 */
650 get_lppaca()->int_dword.fields.decr_int = 1; 650 get_lppaca()->int_dword.fields.decr_int = 1;
651 ppc64_runlatch_on();
651 process_iSeries_events(); 652 process_iSeries_events();
652} 653}
653 654
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 7d4099a34f92..85d6c93659cc 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -435,8 +435,8 @@ void __init maple_pci_init(void)
435 PCI_DN(np)->busno = 0xf0; 435 PCI_DN(np)->busno = 0xf0;
436 } 436 }
437 437
438 /* Tell pci.c to use the common resource allocation mecanism */ 438 /* Tell pci.c to not change any resource allocations. */
439 pci_probe_only = 0; 439 pci_probe_only = 1;
440 440
441 /* Allow all IO */ 441 /* Allow all IO */
442 io_page_mask = -1; 442 io_page_mask = -1;
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 50ed8890dd33..c8b4a2b115a9 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -1644,10 +1644,10 @@ static void intrepid_shutdown(struct macio_chip *macio, int sleep_mode)
1644 KL0_SCC_CELL_ENABLE); 1644 KL0_SCC_CELL_ENABLE);
1645 1645
1646 MACIO_BIC(KEYLARGO_FCR1, 1646 MACIO_BIC(KEYLARGO_FCR1,
1647 /*KL1_USB2_CELL_ENABLE |*/
1648 KL1_I2S0_CELL_ENABLE | KL1_I2S0_CLK_ENABLE_BIT | 1647 KL1_I2S0_CELL_ENABLE | KL1_I2S0_CLK_ENABLE_BIT |
1649 KL1_I2S0_ENABLE | KL1_I2S1_CELL_ENABLE | 1648 KL1_I2S0_ENABLE | KL1_I2S1_CELL_ENABLE |
1650 KL1_I2S1_CLK_ENABLE_BIT | KL1_I2S1_ENABLE); 1649 KL1_I2S1_CLK_ENABLE_BIT | KL1_I2S1_ENABLE |
1650 KL1_EIDE0_ENABLE);
1651 if (pmac_mb.board_flags & PMAC_MB_MOBILE) 1651 if (pmac_mb.board_flags & PMAC_MB_MOBILE)
1652 MACIO_BIC(KEYLARGO_FCR1, KL1_UIDE_RESET_N); 1652 MACIO_BIC(KEYLARGO_FCR1, KL1_UIDE_RESET_N);
1653 1653
@@ -2181,7 +2181,7 @@ static struct pmac_mb_def pmac_mb_defs[] = {
2181 }, 2181 },
2182 { "PowerMac10,1", "Mac mini", 2182 { "PowerMac10,1", "Mac mini",
2183 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, 2183 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2184 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER, 2184 PMAC_MB_MAY_SLEEP,
2185 }, 2185 },
2186 { "iMac,1", "iMac (first generation)", 2186 { "iMac,1", "iMac (first generation)",
2187 PMAC_TYPE_ORIG_IMAC, paddington_features, 2187 PMAC_TYPE_ORIG_IMAC, paddington_features,
@@ -2293,11 +2293,11 @@ static struct pmac_mb_def pmac_mb_defs[] = {
2293 }, 2293 },
2294 { "PowerBook5,8", "PowerBook G4 15\"", 2294 { "PowerBook5,8", "PowerBook G4 15\"",
2295 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, 2295 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2296 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, 2296 PMAC_MB_MAY_SLEEP | PMAC_MB_MOBILE,
2297 }, 2297 },
2298 { "PowerBook5,9", "PowerBook G4 17\"", 2298 { "PowerBook5,9", "PowerBook G4 17\"",
2299 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, 2299 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2300 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, 2300 PMAC_MB_MAY_SLEEP | PMAC_MB_MOBILE,
2301 }, 2301 },
2302 { "PowerBook6,1", "PowerBook G4 12\"", 2302 { "PowerBook6,1", "PowerBook G4 12\"",
2303 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, 2303 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index e3fc3407bb1f..4e5c8f8d869d 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -9,13 +9,6 @@ config PPC_SPLPAR
9 processors, that is, which share physical processors between 9 processors, that is, which share physical processors between
10 two or more partitions. 10 two or more partitions.
11 11
12config HMT
13 bool "Hardware multithreading"
14 depends on SMP && PPC_PSERIES && BROKEN
15 help
16 This option enables hardware multithreading on RS64 cpus.
17 pSeries systems p620 and p660 have such a cpu type.
18
19config EEH 12config EEH
20 bool "PCI Extended Error Handling (EEH)" if EMBEDDED 13 bool "PCI Extended Error Handling (EEH)" if EMBEDDED
21 depends on PPC_PSERIES 14 depends on PPC_PSERIES
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 8e6b1ed1396e..8d710af50756 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -292,7 +292,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
292 if (start_cpu == RTAS_UNKNOWN_SERVICE) 292 if (start_cpu == RTAS_UNKNOWN_SERVICE)
293 return 1; 293 return 1;
294 294
295 status = rtas_call(start_cpu, 3, 1, NULL, pcpu, start_here, lcpu); 295 status = rtas_call(start_cpu, 3, 1, NULL, pcpu, start_here, pcpu);
296 if (status != 0) { 296 if (status != 0) {
297 printk(KERN_ERR "start-cpu failed: %i\n", status); 297 printk(KERN_ERR "start-cpu failed: %i\n", status);
298 return 0; 298 return 0;
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 4f26304d0263..7dcdfcb3c984 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -234,7 +234,7 @@ static void mpic_shutdown_ht_interrupt(struct mpic *mpic, unsigned int source,
234 spin_lock_irqsave(&mpic->fixup_lock, flags); 234 spin_lock_irqsave(&mpic->fixup_lock, flags);
235 writeb(0x10 + 2 * fixup->index, fixup->base + 2); 235 writeb(0x10 + 2 * fixup->index, fixup->base + 2);
236 tmp = readl(fixup->base + 4); 236 tmp = readl(fixup->base + 4);
237 tmp &= ~1U; 237 tmp |= 1;
238 writel(tmp, fixup->base + 4); 238 writel(tmp, fixup->base + 4);
239 spin_unlock_irqrestore(&mpic->fixup_lock, flags); 239 spin_unlock_irqrestore(&mpic->fixup_lock, flags);
240} 240}
@@ -446,14 +446,15 @@ static unsigned int mpic_startup_irq(unsigned int irq)
446#ifdef CONFIG_MPIC_BROKEN_U3 446#ifdef CONFIG_MPIC_BROKEN_U3
447 struct mpic *mpic = mpic_from_irq(irq); 447 struct mpic *mpic = mpic_from_irq(irq);
448 unsigned int src = irq - mpic->irq_offset; 448 unsigned int src = irq - mpic->irq_offset;
449#endif /* CONFIG_MPIC_BROKEN_U3 */
450
451 mpic_enable_irq(irq);
449 452
453#ifdef CONFIG_MPIC_BROKEN_U3
450 if (mpic_is_ht_interrupt(mpic, src)) 454 if (mpic_is_ht_interrupt(mpic, src))
451 mpic_startup_ht_interrupt(mpic, src, irq_desc[irq].status); 455 mpic_startup_ht_interrupt(mpic, src, irq_desc[irq].status);
452
453#endif /* CONFIG_MPIC_BROKEN_U3 */ 456#endif /* CONFIG_MPIC_BROKEN_U3 */
454 457
455 mpic_enable_irq(irq);
456
457 return 0; 458 return 0;
458} 459}
459 460
diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
index c5a890dca9cf..53ea845fb911 100644
--- a/arch/ppc/kernel/head.S
+++ b/arch/ppc/kernel/head.S
@@ -751,6 +751,7 @@ AltiVecUnavailable:
751#ifdef CONFIG_ALTIVEC 751#ifdef CONFIG_ALTIVEC
752 bne load_up_altivec /* if from user, just load it up */ 752 bne load_up_altivec /* if from user, just load it up */
753#endif /* CONFIG_ALTIVEC */ 753#endif /* CONFIG_ALTIVEC */
754 addi r3,r1,STACK_FRAME_OVERHEAD
754 EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception) 755 EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception)
755 756
756#ifdef CONFIG_PPC64BRIDGE 757#ifdef CONFIG_PPC64BRIDGE
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
index 15bd9b448a48..82adb4601348 100644
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -93,15 +93,8 @@ EXPORT_SYMBOL(test_and_change_bit);
93EXPORT_SYMBOL(strcpy); 93EXPORT_SYMBOL(strcpy);
94EXPORT_SYMBOL(strncpy); 94EXPORT_SYMBOL(strncpy);
95EXPORT_SYMBOL(strcat); 95EXPORT_SYMBOL(strcat);
96EXPORT_SYMBOL(strncat);
97EXPORT_SYMBOL(strchr);
98EXPORT_SYMBOL(strrchr);
99EXPORT_SYMBOL(strpbrk);
100EXPORT_SYMBOL(strstr);
101EXPORT_SYMBOL(strlen); 96EXPORT_SYMBOL(strlen);
102EXPORT_SYMBOL(strnlen);
103EXPORT_SYMBOL(strcmp); 97EXPORT_SYMBOL(strcmp);
104EXPORT_SYMBOL(strncmp);
105EXPORT_SYMBOL(strcasecmp); 98EXPORT_SYMBOL(strcasecmp);
106EXPORT_SYMBOL(__div64_32); 99EXPORT_SYMBOL(__div64_32);
107 100
@@ -253,7 +246,6 @@ EXPORT_SYMBOL(memcpy);
253EXPORT_SYMBOL(cacheable_memcpy); 246EXPORT_SYMBOL(cacheable_memcpy);
254EXPORT_SYMBOL(memset); 247EXPORT_SYMBOL(memset);
255EXPORT_SYMBOL(memmove); 248EXPORT_SYMBOL(memmove);
256EXPORT_SYMBOL(memscan);
257EXPORT_SYMBOL(memcmp); 249EXPORT_SYMBOL(memcmp);
258EXPORT_SYMBOL(memchr); 250EXPORT_SYMBOL(memchr);
259 251
diff --git a/arch/ppc/xmon/adb.c b/arch/ppc/xmon/adb.c
deleted file mode 100644
index e91384dcccac..000000000000
--- a/arch/ppc/xmon/adb.c
+++ /dev/null
@@ -1,212 +0,0 @@
1/*
2 * Copyright (C) 1996 Paul Mackerras.
3 */
4#include "nonstdio.h"
5#include "privinst.h"
6
7#define scanhex xmon_scanhex
8#define skipbl xmon_skipbl
9
10#define ADB_B (*(volatile unsigned char *)0xf3016000)
11#define ADB_SR (*(volatile unsigned char *)0xf3017400)
12#define ADB_ACR (*(volatile unsigned char *)0xf3017600)
13#define ADB_IFR (*(volatile unsigned char *)0xf3017a00)
14
15static inline void eieio(void) { asm volatile ("eieio" : :); }
16
17#define N_ADB_LOG 1000
18struct adb_log {
19 unsigned char b;
20 unsigned char ifr;
21 unsigned char acr;
22 unsigned int time;
23} adb_log[N_ADB_LOG];
24int n_adb_log;
25
26void
27init_adb_log(void)
28{
29 adb_log[0].b = ADB_B;
30 adb_log[0].ifr = ADB_IFR;
31 adb_log[0].acr = ADB_ACR;
32 adb_log[0].time = get_dec();
33 n_adb_log = 0;
34}
35
36void
37dump_adb_log(void)
38{
39 unsigned t, t0;
40 struct adb_log *ap;
41 int i;
42
43 ap = adb_log;
44 t0 = ap->time;
45 for (i = 0; i <= n_adb_log; ++i, ++ap) {
46 t = t0 - ap->time;
47 printf("b=%x ifr=%x acr=%x at %d.%.7d\n", ap->b, ap->ifr, ap->acr,
48 t / 1000000000, (t % 1000000000) / 100);
49 }
50}
51
52void
53adb_chklog(void)
54{
55 struct adb_log *ap = &adb_log[n_adb_log + 1];
56
57 ap->b = ADB_B;
58 ap->ifr = ADB_IFR;
59 ap->acr = ADB_ACR;
60 if (ap->b != ap[-1].b || (ap->ifr & 4) != (ap[-1].ifr & 4)
61 || ap->acr != ap[-1].acr) {
62 ap->time = get_dec();
63 ++n_adb_log;
64 }
65}
66
67int
68adb_bitwait(int bmask, int bval, int fmask, int fval)
69{
70 int i;
71 struct adb_log *ap;
72
73 for (i = 10000; i > 0; --i) {
74 adb_chklog();
75 ap = &adb_log[n_adb_log];
76 if ((ap->b & bmask) == bval && (ap->ifr & fmask) == fval)
77 return 0;
78 }
79 return -1;
80}
81
82int
83adb_wait(void)
84{
85 if (adb_bitwait(0, 0, 4, 4) < 0) {
86 printf("adb: ready wait timeout\n");
87 return -1;
88 }
89 return 0;
90}
91
92void
93adb_readin(void)
94{
95 int i, j;
96 unsigned char d[64];
97
98 if (ADB_B & 8) {
99 printf("ADB_B: %x\n", ADB_B);
100 return;
101 }
102 i = 0;
103 adb_wait();
104 j = ADB_SR;
105 eieio();
106 ADB_B &= ~0x20;
107 eieio();
108 for (;;) {
109 if (adb_wait() < 0)
110 break;
111 d[i++] = ADB_SR;
112 eieio();
113 if (ADB_B & 8)
114 break;
115 ADB_B ^= 0x10;
116 eieio();
117 }
118 ADB_B |= 0x30;
119 if (adb_wait() == 0)
120 j = ADB_SR;
121 for (j = 0; j < i; ++j)
122 printf("%.2x ", d[j]);
123 printf("\n");
124}
125
126int
127adb_write(unsigned char *d, int i)
128{
129 int j;
130 unsigned x;
131
132 if ((ADB_B & 8) == 0) {
133 printf("r: ");
134 adb_readin();
135 }
136 for (;;) {
137 ADB_ACR = 0x1c;
138 eieio();
139 ADB_SR = d[0];
140 eieio();
141 ADB_B &= ~0x20;
142 eieio();
143 if (ADB_B & 8)
144 break;
145 ADB_ACR = 0xc;
146 eieio();
147 ADB_B |= 0x20;
148 eieio();
149 adb_readin();
150 }
151 adb_wait();
152 for (j = 1; j < i; ++j) {
153 ADB_SR = d[j];
154 eieio();
155 ADB_B ^= 0x10;
156 eieio();
157 if (adb_wait() < 0)
158 break;
159 }
160 ADB_ACR = 0xc;
161 eieio();
162 x = ADB_SR;
163 eieio();
164 ADB_B |= 0x30;
165 return j;
166}
167
168void
169adbcmds(void)
170{
171 char cmd;
172 unsigned rtcu, rtcl, dec, pdec, x;
173 int i, j;
174 unsigned char d[64];
175
176 cmd = skipbl();
177 switch (cmd) {
178 case 't':
179 for (;;) {
180 rtcl = get_rtcl();
181 rtcu = get_rtcu();
182 dec = get_dec();
183 printf("rtc u=%u l=%u dec=%x (%d = %d.%.7d)\n",
184 rtcu, rtcl, dec, pdec - dec, (pdec - dec) / 1000000000,
185 ((pdec - dec) % 1000000000) / 100);
186 pdec = dec;
187 if (cmd == 'x')
188 break;
189 while (xmon_read(stdin, &cmd, 1) != 1)
190 ;
191 }
192 break;
193 case 'r':
194 init_adb_log();
195 while (adb_bitwait(8, 0, 0, 0) == 0)
196 adb_readin();
197 break;
198 case 'w':
199 i = 0;
200 while (scanhex(&x))
201 d[i++] = x;
202 init_adb_log();
203 j = adb_write(d, i);
204 printf("sent %d bytes\n", j);
205 while (adb_bitwait(8, 0, 0, 0) == 0)
206 adb_readin();
207 break;
208 case 'l':
209 dump_adb_log();
210 break;
211 }
212}
diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c
index 4344cbe9b5c5..ff86b2d814cb 100644
--- a/arch/ppc/xmon/start.c
+++ b/arch/ppc/xmon/start.c
@@ -6,16 +6,11 @@
6#include <asm/machdep.h> 6#include <asm/machdep.h>
7#include <asm/io.h> 7#include <asm/io.h>
8#include <asm/page.h> 8#include <asm/page.h>
9#include <linux/adb.h>
10#include <linux/pmu.h>
11#include <linux/cuda.h>
12#include <linux/kernel.h> 9#include <linux/kernel.h>
13#include <linux/errno.h> 10#include <linux/errno.h>
14#include <linux/sysrq.h> 11#include <linux/sysrq.h>
15#include <linux/bitops.h> 12#include <linux/bitops.h>
16#include <asm/xmon.h> 13#include <asm/xmon.h>
17#include <asm/prom.h>
18#include <asm/bootx.h>
19#include <asm/machdep.h> 14#include <asm/machdep.h>
20#include <asm/errno.h> 15#include <asm/errno.h>
21#include <asm/processor.h> 16#include <asm/processor.h>
@@ -26,9 +21,7 @@ static volatile unsigned char *sccc, *sccd;
26unsigned int TXRDY, RXRDY, DLAB; 21unsigned int TXRDY, RXRDY, DLAB;
27static int xmon_expect(const char *str, unsigned int timeout); 22static int xmon_expect(const char *str, unsigned int timeout);
28 23
29static int use_screen;
30static int via_modem; 24static int via_modem;
31static int xmon_use_sccb;
32 25
33#define TB_SPEED 25000000 26#define TB_SPEED 25000000
34 27
@@ -46,47 +39,6 @@ void buf_access(void)
46 sccd[3] &= ~DLAB; /* reset DLAB */ 39 sccd[3] &= ~DLAB; /* reset DLAB */
47} 40}
48 41
49extern int adb_init(void);
50
51#ifdef CONFIG_PPC_CHRP
52/*
53 * This looks in the "ranges" property for the primary PCI host bridge
54 * to find the physical address of the start of PCI/ISA I/O space.
55 * It is basically a cut-down version of pci_process_bridge_OF_ranges.
56 */
57static unsigned long chrp_find_phys_io_base(void)
58{
59 struct device_node *node;
60 unsigned int *ranges;
61 unsigned long base = CHRP_ISA_IO_BASE;
62 int rlen = 0;
63 int np;
64
65 node = find_devices("isa");
66 if (node != NULL) {
67 node = node->parent;
68 if (node == NULL || node->type == NULL
69 || strcmp(node->type, "pci") != 0)
70 node = NULL;
71 }
72 if (node == NULL)
73 node = find_devices("pci");
74 if (node == NULL)
75 return base;
76
77 ranges = (unsigned int *) get_property(node, "ranges", &rlen);
78 np = prom_n_addr_cells(node) + 5;
79 while ((rlen -= np * sizeof(unsigned int)) >= 0) {
80 if ((ranges[0] >> 24) == 1 && ranges[2] == 0) {
81 /* I/O space starting at 0, grab the phys base */
82 base = ranges[np - 3];
83 break;
84 }
85 ranges += np;
86 }
87 return base;
88}
89#endif /* CONFIG_PPC_CHRP */
90 42
91#ifdef CONFIG_MAGIC_SYSRQ 43#ifdef CONFIG_MAGIC_SYSRQ
92static void sysrq_handle_xmon(int key, struct pt_regs *regs, 44static void sysrq_handle_xmon(int key, struct pt_regs *regs,
@@ -109,22 +61,6 @@ xmon_map_scc(void)
109#ifdef CONFIG_PPC_MULTIPLATFORM 61#ifdef CONFIG_PPC_MULTIPLATFORM
110 volatile unsigned char *base; 62 volatile unsigned char *base;
111 63
112#ifdef CONFIG_PPC_CHRP
113 base = (volatile unsigned char *) isa_io_base;
114 if (_machine == _MACH_chrp)
115 base = (volatile unsigned char *)
116 ioremap(chrp_find_phys_io_base(), 0x1000);
117
118 sccc = base + 0x3fd;
119 sccd = base + 0x3f8;
120 if (xmon_use_sccb) {
121 sccc -= 0x100;
122 sccd -= 0x100;
123 }
124 TXRDY = 0x20;
125 RXRDY = 1;
126 DLAB = 0x80;
127#endif /* CONFIG_PPC_CHRP */
128#elif defined(CONFIG_GEMINI) 64#elif defined(CONFIG_GEMINI)
129 /* should already be mapped by the kernel boot */ 65 /* should already be mapped by the kernel boot */
130 sccc = (volatile unsigned char *) 0xffeffb0d; 66 sccc = (volatile unsigned char *) 0xffeffb0d;
@@ -143,22 +79,9 @@ xmon_map_scc(void)
143 register_sysrq_key('x', &sysrq_xmon_op); 79 register_sysrq_key('x', &sysrq_xmon_op);
144} 80}
145 81
146static int scc_initialized = 0; 82static int scc_initialized;
147 83
148void xmon_init_scc(void); 84void xmon_init_scc(void);
149extern void cuda_poll(void);
150
151static inline void do_poll_adb(void)
152{
153#ifdef CONFIG_ADB_PMU
154 if (sys_ctrler == SYS_CTRLER_PMU)
155 pmu_poll_adb();
156#endif /* CONFIG_ADB_PMU */
157#ifdef CONFIG_ADB_CUDA
158 if (sys_ctrler == SYS_CTRLER_CUDA)
159 cuda_poll();
160#endif /* CONFIG_ADB_CUDA */
161}
162 85
163int 86int
164xmon_write(void *handle, void *ptr, int nb) 87xmon_write(void *handle, void *ptr, int nb)
@@ -176,20 +99,12 @@ xmon_write(void *handle, void *ptr, int nb)
176 break; 99 break;
177#endif 100#endif
178 101
179#ifdef CONFIG_BOOTX_TEXT
180 if (use_screen) {
181 /* write it on the screen */
182 for (i = 0; i < nb; ++i)
183 btext_drawchar(*p++);
184 goto out;
185 }
186#endif
187 if (!scc_initialized) 102 if (!scc_initialized)
188 xmon_init_scc(); 103 xmon_init_scc();
189 ct = 0; 104 ct = 0;
190 for (i = 0; i < nb; ++i) { 105 for (i = 0; i < nb; ++i) {
191 while ((*sccc & TXRDY) == 0) 106 while ((*sccc & TXRDY) == 0)
192 do_poll_adb(); 107 ;
193 c = p[i]; 108 c = p[i];
194 if (c == '\n' && !ct) { 109 if (c == '\n' && !ct) {
195 c = '\r'; 110 c = '\r';
@@ -203,7 +118,6 @@ xmon_write(void *handle, void *ptr, int nb)
203 eieio(); 118 eieio();
204 } 119 }
205 120
206 out:
207#ifdef CONFIG_SMP 121#ifdef CONFIG_SMP
208 if (!locked) 122 if (!locked)
209 clear_bit(0, &xmon_write_lock); 123 clear_bit(0, &xmon_write_lock);
@@ -212,65 +126,7 @@ xmon_write(void *handle, void *ptr, int nb)
212} 126}
213 127
214int xmon_wants_key; 128int xmon_wants_key;
215int xmon_adb_keycode;
216
217#ifdef CONFIG_BOOTX_TEXT
218static int xmon_adb_shiftstate;
219
220static unsigned char xmon_keytab[128] =
221 "asdfhgzxcv\000bqwer" /* 0x00 - 0x0f */
222 "yt123465=97-80]o" /* 0x10 - 0x1f */
223 "u[ip\rlj'k;\\,/nm." /* 0x20 - 0x2f */
224 "\t `\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */
225 "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */
226 "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */
227
228static unsigned char xmon_shift_keytab[128] =
229 "ASDFHGZXCV\000BQWER" /* 0x00 - 0x0f */
230 "YT!@#$^%+(&_*)}O" /* 0x10 - 0x1f */
231 "U{IP\rLJ\"K:|<?NM>" /* 0x20 - 0x2f */
232 "\t ~\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */
233 "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */
234 "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */
235
236static int
237xmon_get_adb_key(void)
238{
239 int k, t, on;
240 129
241 xmon_wants_key = 1;
242 for (;;) {
243 xmon_adb_keycode = -1;
244 t = 0;
245 on = 0;
246 do {
247 if (--t < 0) {
248 on = 1 - on;
249 btext_drawchar(on? 0xdb: 0x20);
250 btext_drawchar('\b');
251 t = 200000;
252 }
253 do_poll_adb();
254 } while (xmon_adb_keycode == -1);
255 k = xmon_adb_keycode;
256 if (on)
257 btext_drawstring(" \b");
258
259 /* test for shift keys */
260 if ((k & 0x7f) == 0x38 || (k & 0x7f) == 0x7b) {
261 xmon_adb_shiftstate = (k & 0x80) == 0;
262 continue;
263 }
264 if (k >= 0x80)
265 continue; /* ignore up transitions */
266 k = (xmon_adb_shiftstate? xmon_shift_keytab: xmon_keytab)[k];
267 if (k != 0)
268 break;
269 }
270 xmon_wants_key = 0;
271 return k;
272}
273#endif /* CONFIG_BOOTX_TEXT */
274 130
275int 131int
276xmon_read(void *handle, void *ptr, int nb) 132xmon_read(void *handle, void *ptr, int nb)
@@ -278,18 +134,11 @@ xmon_read(void *handle, void *ptr, int nb)
278 char *p = ptr; 134 char *p = ptr;
279 int i; 135 int i;
280 136
281#ifdef CONFIG_BOOTX_TEXT
282 if (use_screen) {
283 for (i = 0; i < nb; ++i)
284 *p++ = xmon_get_adb_key();
285 return i;
286 }
287#endif
288 if (!scc_initialized) 137 if (!scc_initialized)
289 xmon_init_scc(); 138 xmon_init_scc();
290 for (i = 0; i < nb; ++i) { 139 for (i = 0; i < nb; ++i) {
291 while ((*sccc & RXRDY) == 0) 140 while ((*sccc & RXRDY) == 0)
292 do_poll_adb(); 141 ;
293 buf_access(); 142 buf_access();
294 *p++ = *sccd; 143 *p++ = *sccd;
295 } 144 }
@@ -300,7 +149,7 @@ int
300xmon_read_poll(void) 149xmon_read_poll(void)
301{ 150{
302 if ((*sccc & RXRDY) == 0) { 151 if ((*sccc & RXRDY) == 0) {
303 do_poll_adb(); 152 ;
304 return -1; 153 return -1;
305 } 154 }
306 buf_access(); 155 buf_access();
@@ -310,15 +159,6 @@ xmon_read_poll(void)
310void 159void
311xmon_init_scc(void) 160xmon_init_scc(void)
312{ 161{
313 if ( _machine == _MACH_chrp )
314 {
315 sccd[3] = 0x83; eieio(); /* LCR = 8N1 + DLAB */
316 sccd[0] = 12; eieio(); /* DLL = 9600 baud */
317 sccd[1] = 0; eieio();
318 sccd[2] = 0; eieio(); /* FCR = 0 */
319 sccd[3] = 3; eieio(); /* LCR = 8N1 */
320 sccd[1] = 0; eieio(); /* IER = 0 */
321 }
322 scc_initialized = 1; 162 scc_initialized = 1;
323 if (via_modem) { 163 if (via_modem) {
324 for (;;) { 164 for (;;) {
@@ -334,22 +174,6 @@ xmon_init_scc(void)
334 } 174 }
335} 175}
336 176
337#if 0
338extern int (*prom_entry)(void *);
339
340int
341xmon_exit(void)
342{
343 struct prom_args {
344 char *service;
345 } args;
346
347 for (;;) {
348 args.service = "exit";
349 (*prom_entry)(&args);
350 }
351}
352#endif
353 177
354void *xmon_stdin; 178void *xmon_stdin;
355void *xmon_stdout; 179void *xmon_stdout;
diff --git a/arch/ppc/xmon/xmon.c b/arch/ppc/xmon/xmon.c
index bdaf6597b4c2..06fa44b5c647 100644
--- a/arch/ppc/xmon/xmon.c
+++ b/arch/ppc/xmon/xmon.c
@@ -12,8 +12,6 @@
12#include <linux/kallsyms.h> 12#include <linux/kallsyms.h>
13#include <asm/ptrace.h> 13#include <asm/ptrace.h>
14#include <asm/string.h> 14#include <asm/string.h>
15#include <asm/prom.h>
16#include <asm/bootx.h>
17#include <asm/machdep.h> 15#include <asm/machdep.h>
18#include <asm/xmon.h> 16#include <asm/xmon.h>
19#include "nonstdio.h" 17#include "nonstdio.h"
@@ -101,9 +99,6 @@ void cacheflush(void);
101static void cpu_cmd(void); 99static void cpu_cmd(void);
102#endif /* CONFIG_SMP */ 100#endif /* CONFIG_SMP */
103static void csum(void); 101static void csum(void);
104#ifdef CONFIG_BOOTX_TEXT
105static void vidcmds(void);
106#endif
107static void bootcmds(void); 102static void bootcmds(void);
108static void proccall(void); 103static void proccall(void);
109static void printtime(void); 104static void printtime(void);
@@ -522,11 +517,6 @@ cmds(struct pt_regs *excp)
522 cpu_cmd(); 517 cpu_cmd();
523 break; 518 break;
524#endif /* CONFIG_SMP */ 519#endif /* CONFIG_SMP */
525#ifdef CONFIG_BOOTX_TEXT
526 case 'v':
527 vidcmds();
528 break;
529#endif
530 case 'z': 520 case 'z':
531 bootcmds(); 521 bootcmds();
532 break; 522 break;
@@ -618,43 +608,6 @@ static void cpu_cmd(void)
618} 608}
619#endif /* CONFIG_SMP */ 609#endif /* CONFIG_SMP */
620 610
621#ifdef CONFIG_BOOTX_TEXT
622extern boot_infos_t disp_bi;
623
624static void vidcmds(void)
625{
626 int c = inchar();
627 unsigned int val, w;
628 extern int boot_text_mapped;
629
630 if (!boot_text_mapped)
631 return;
632 if (c != '\n' && scanhex(&val)) {
633 switch (c) {
634 case 'd':
635 w = disp_bi.dispDeviceRowBytes
636 / (disp_bi.dispDeviceDepth >> 3);
637 disp_bi.dispDeviceDepth = val;
638 disp_bi.dispDeviceRowBytes = w * (val >> 3);
639 return;
640 case 'p':
641 disp_bi.dispDeviceRowBytes = val;
642 return;
643 case 'w':
644 disp_bi.dispDeviceRect[2] = val;
645 return;
646 case 'h':
647 disp_bi.dispDeviceRect[3] = val;
648 return;
649 }
650 }
651 printf("W = %d (0x%x) H = %d (0x%x) D = %d (0x%x) P = %d (0x%x)\n",
652 disp_bi.dispDeviceRect[2], disp_bi.dispDeviceRect[2],
653 disp_bi.dispDeviceRect[3], disp_bi.dispDeviceRect[3],
654 disp_bi.dispDeviceDepth, disp_bi.dispDeviceDepth,
655 disp_bi.dispDeviceRowBytes, disp_bi.dispDeviceRowBytes);
656}
657#endif /* CONFIG_BOOTX_TEXT */
658 611
659static unsigned short fcstab[256] = { 612static unsigned short fcstab[256] = {
660 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 613 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
@@ -1020,7 +973,6 @@ dump_hash_table(void)
1020} 973}
1021#else 974#else
1022 975
1023#ifndef CONFIG_PPC64BRIDGE
1024static void 976static void
1025dump_hash_table_seg(unsigned seg, unsigned start, unsigned end) 977dump_hash_table_seg(unsigned seg, unsigned start, unsigned end)
1026{ 978{
@@ -1079,66 +1031,6 @@ dump_hash_table_seg(unsigned seg, unsigned start, unsigned end)
1079 printf(" ... %x\n", last_va); 1031 printf(" ... %x\n", last_va);
1080} 1032}
1081 1033
1082#else /* CONFIG_PPC64BRIDGE */
1083static void
1084dump_hash_table_seg(unsigned seg, unsigned start, unsigned end)
1085{
1086 extern void *Hash;
1087 extern unsigned long Hash_size;
1088 unsigned *htab = Hash;
1089 unsigned hsize = Hash_size;
1090 unsigned v, hmask, va, last_va;
1091 int found, last_found, i;
1092 unsigned *hg, w1, last_w2, last_va0;
1093
1094 last_found = 0;
1095 hmask = hsize / 128 - 1;
1096 va = start;
1097 start = (start >> 12) & 0xffff;
1098 end = (end >> 12) & 0xffff;
1099 for (v = start; v < end; ++v) {
1100 found = 0;
1101 hg = htab + (((v ^ seg) & hmask) * 32);
1102 w1 = 1 | (seg << 12) | ((v & 0xf800) >> 4);
1103 for (i = 0; i < 8; ++i, hg += 4) {
1104 if (hg[1] == w1) {
1105 found = 1;
1106 break;
1107 }
1108 }
1109 if (!found) {
1110 w1 ^= 2;
1111 hg = htab + ((~(v ^ seg) & hmask) * 32);
1112 for (i = 0; i < 8; ++i, hg += 4) {
1113 if (hg[1] == w1) {
1114 found = 1;
1115 break;
1116 }
1117 }
1118 }
1119 if (!(last_found && found && (hg[3] & ~0x180) == last_w2 + 4096)) {
1120 if (last_found) {
1121 if (last_va != last_va0)
1122 printf(" ... %x", last_va);
1123 printf("\n");
1124 }
1125 if (found) {
1126 printf("%x to %x", va, hg[3]);
1127 last_va0 = va;
1128 }
1129 last_found = found;
1130 }
1131 if (found) {
1132 last_w2 = hg[3] & ~0x180;
1133 last_va = va;
1134 }
1135 va += 4096;
1136 }
1137 if (last_found)
1138 printf(" ... %x\n", last_va);
1139}
1140#endif /* CONFIG_PPC64BRIDGE */
1141
1142static unsigned hash_ctx; 1034static unsigned hash_ctx;
1143static unsigned hash_start; 1035static unsigned hash_start;
1144static unsigned hash_end; 1036static unsigned hash_end;
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index b66602ad7b33..b7ca5bf9acfc 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -80,6 +80,10 @@ config HOTPLUG_CPU
80 can be controlled through /sys/devices/system/cpu/cpu#. 80 can be controlled through /sys/devices/system/cpu/cpu#.
81 Say N if you want to disable CPU hotplug. 81 Say N if you want to disable CPU hotplug.
82 82
83config DEFAULT_MIGRATION_COST
84 int
85 default "1000000"
86
83config MATHEMU 87config MATHEMU
84 bool "IEEE FPU emulation" 88 bool "IEEE FPU emulation"
85 depends on MARCH_G5 89 depends on MARCH_G5
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 3525c91204d4..f8d0cd540a06 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16-rc1 3# Linux kernel version: 2.6.16-rc2
4# Thu Jan 19 10:58:53 2006 4# Wed Feb 8 10:44:39 2006
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_RWSEM_XCHGADD_ALGORITHM=y 7CONFIG_RWSEM_XCHGADD_ALGORITHM=y
@@ -12,7 +12,6 @@ CONFIG_S390=y
12# Code maturity level options 12# Code maturity level options
13# 13#
14CONFIG_EXPERIMENTAL=y 14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_LOCK_KERNEL=y 15CONFIG_LOCK_KERNEL=y
17CONFIG_INIT_ENV_ARG_LIMIT=32 16CONFIG_INIT_ENV_ARG_LIMIT=32
18 17
@@ -154,6 +153,7 @@ CONFIG_NET=y
154# 153#
155# Networking options 154# Networking options
156# 155#
156# CONFIG_NETDEBUG is not set
157CONFIG_PACKET=y 157CONFIG_PACKET=y
158# CONFIG_PACKET_MMAP is not set 158# CONFIG_PACKET_MMAP is not set
159CONFIG_UNIX=y 159CONFIG_UNIX=y
@@ -607,6 +607,7 @@ CONFIG_MSDOS_PARTITION=y
607# Instrumentation Support 607# Instrumentation Support
608# 608#
609# CONFIG_PROFILING is not set 609# CONFIG_PROFILING is not set
610# CONFIG_STATISTICS is not set
610 611
611# 612#
612# Kernel hacking 613# Kernel hacking
@@ -624,7 +625,7 @@ CONFIG_DEBUG_MUTEXES=y
624# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 625# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
625# CONFIG_DEBUG_KOBJECT is not set 626# CONFIG_DEBUG_KOBJECT is not set
626# CONFIG_DEBUG_INFO is not set 627# CONFIG_DEBUG_INFO is not set
627# CONFIG_DEBUG_FS is not set 628CONFIG_DEBUG_FS=y
628# CONFIG_DEBUG_VM is not set 629# CONFIG_DEBUG_VM is not set
629CONFIG_FORCED_INLINING=y 630CONFIG_FORCED_INLINING=y
630# CONFIG_RCU_TORTURE_TEST is not set 631# CONFIG_RCU_TORTURE_TEST is not set
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index cc20f0e3a7d3..cc058dc3bc8b 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -905,6 +905,26 @@ asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * sta
905 return ret; 905 return ret;
906} 906}
907 907
908asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename,
909 struct stat64_emu31 __user* statbuf, int flag)
910{
911 struct kstat stat;
912 int error = -EINVAL;
913
914 if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
915 goto out;
916
917 if (flag & AT_SYMLINK_NOFOLLOW)
918 error = vfs_lstat_fd(dfd, filename, &stat);
919 else
920 error = vfs_stat_fd(dfd, filename, &stat);
921
922 if (!error)
923 error = cp_stat64(statbuf, &stat);
924out:
925 return error;
926}
927
908/* 928/*
909 * Linux/i386 didn't use to be able to handle more than 929 * Linux/i386 didn't use to be able to handle more than
910 * 4 system call parameters, so these system calls used a memory 930 * 4 system call parameters, so these system calls used a memory
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index ef706694a0c1..5291b5f8788d 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -195,9 +195,6 @@ sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
195 return ret; 195 return ret;
196} 196}
197 197
198int
199do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact);
200
201asmlinkage long 198asmlinkage long
202sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, 199sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
203 struct sigaction32 __user *oact, size_t sigsetsize) 200 struct sigaction32 __user *oact, size_t sigsetsize)
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 83b33fe1923c..615964cca15f 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1523,13 +1523,13 @@ compat_sys_futimesat_wrapper:
1523 llgtr %r4,%r4 # struct timeval * 1523 llgtr %r4,%r4 # struct timeval *
1524 jg compat_sys_futimesat 1524 jg compat_sys_futimesat
1525 1525
1526 .globl compat_sys_newfstatat_wrapper 1526 .globl sys32_fstatat64_wrapper
1527compat_sys_newfstatat_wrapper: 1527sys32_fstatat64_wrapper:
1528 llgfr %r2,%r2 # unsigned int 1528 llgfr %r2,%r2 # unsigned int
1529 llgtr %r3,%r3 # char * 1529 llgtr %r3,%r3 # char *
1530 llgtr %r4,%r4 # struct stat * 1530 llgtr %r4,%r4 # struct stat64 *
1531 lgfr %r5,%r5 # int 1531 lgfr %r5,%r5 # int
1532 jg compat_sys_newfstatat 1532 jg sys32_fstatat64
1533 1533
1534 .globl sys_unlinkat_wrapper 1534 .globl sys_unlinkat_wrapper
1535sys_unlinkat_wrapper: 1535sys_unlinkat_wrapper:
@@ -1602,3 +1602,8 @@ compat_sys_ppoll_wrapper:
1602 llgtr %r5,%r5 # const sigset_t * 1602 llgtr %r5,%r5 # const sigset_t *
1603 llgfr %r6,%r6 # size_t 1603 llgfr %r6,%r6 # size_t
1604 jg compat_sys_ppoll 1604 jg compat_sys_ppoll
1605
1606 .globl sys_unshare_wrapper
1607sys_unshare_wrapper:
1608 llgfr %r2,%r2 # unsigned long
1609 jg sys_unshare
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index f0ed5c642c74..bad81b5832db 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -12,15 +12,16 @@
12 * on the S390 architecture. 12 * on the S390 architecture.
13 */ 13 */
14 14
15#include <asm/cio.h>
16#include <asm/setup.h>
17#include <linux/device.h> 15#include <linux/device.h>
18#include <linux/mm.h> 16#include <linux/mm.h>
19#include <linux/kexec.h> 17#include <linux/kexec.h>
20#include <linux/delay.h> 18#include <linux/delay.h>
19#include <asm/cio.h>
20#include <asm/setup.h>
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
22#include <asm/pgalloc.h> 22#include <asm/pgalloc.h>
23#include <asm/system.h> 23#include <asm/system.h>
24#include <asm/smp.h>
24 25
25static void kexec_halt_all_cpus(void *); 26static void kexec_halt_all_cpus(void *);
26 27
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 008c74526fd3..da6fbae8df91 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -128,8 +128,10 @@ void default_idle(void)
128 __ctl_set_bit(8, 15); 128 __ctl_set_bit(8, 15);
129 129
130#ifdef CONFIG_HOTPLUG_CPU 130#ifdef CONFIG_HOTPLUG_CPU
131 if (cpu_is_offline(cpu)) 131 if (cpu_is_offline(cpu)) {
132 preempt_enable_no_resched();
132 cpu_die(); 133 cpu_die();
134 }
133#endif 135#endif
134 136
135 local_mcck_disable(); 137 local_mcck_disable();
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index de8784267473..24f62f16c0e5 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -600,6 +600,7 @@ setup_arch(char **cmdline_p)
600 init_mm.brk = (unsigned long) &_end; 600 init_mm.brk = (unsigned long) &_end;
601 601
602 parse_cmdline_early(cmdline_p); 602 parse_cmdline_early(cmdline_p);
603 parse_early_param();
603 604
604 setup_memory(); 605 setup_memory();
605 setup_resources(); 606 setup_resources();
@@ -607,6 +608,7 @@ setup_arch(char **cmdline_p)
607 608
608 cpu_init(); 609 cpu_init();
609 __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr; 610 __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr;
611 smp_setup_cpu_possible_map();
610 612
611 /* 613 /*
612 * Create kernel page tables and switch to virtual addressing. 614 * Create kernel page tables and switch to virtual addressing.
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index cbfcfd02a43a..7dbe00c76c6b 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -1,8 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/smp.c 2 * arch/s390/kernel/smp.c
3 * 3 *
4 * S390 version 4 * Copyright (C) IBM Corp. 1999,2006
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 5 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com) 6 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 * Heiko Carstens (heiko.carstens@de.ibm.com) 7 * Heiko Carstens (heiko.carstens@de.ibm.com)
@@ -41,8 +40,6 @@
41#include <asm/cpcmd.h> 40#include <asm/cpcmd.h>
42#include <asm/tlbflush.h> 41#include <asm/tlbflush.h>
43 42
44/* prototypes */
45
46extern volatile int __cpu_logical_map[]; 43extern volatile int __cpu_logical_map[];
47 44
48/* 45/*
@@ -51,13 +48,11 @@ extern volatile int __cpu_logical_map[];
51 48
52struct _lowcore *lowcore_ptr[NR_CPUS]; 49struct _lowcore *lowcore_ptr[NR_CPUS];
53 50
54cpumask_t cpu_online_map; 51cpumask_t cpu_online_map = CPU_MASK_NONE;
55cpumask_t cpu_possible_map; 52cpumask_t cpu_possible_map = CPU_MASK_NONE;
56 53
57static struct task_struct *current_set[NR_CPUS]; 54static struct task_struct *current_set[NR_CPUS];
58 55
59EXPORT_SYMBOL(cpu_online_map);
60
61/* 56/*
62 * Reboot, halt and power_off routines for SMP. 57 * Reboot, halt and power_off routines for SMP.
63 */ 58 */
@@ -490,10 +485,10 @@ void smp_ctl_clear_bit(int cr, int bit) {
490 * Lets check how many CPUs we have. 485 * Lets check how many CPUs we have.
491 */ 486 */
492 487
493void 488static unsigned int
494__init smp_check_cpus(unsigned int max_cpus) 489__init smp_count_cpus(void)
495{ 490{
496 int cpu, num_cpus; 491 unsigned int cpu, num_cpus;
497 __u16 boot_cpu_addr; 492 __u16 boot_cpu_addr;
498 493
499 /* 494 /*
@@ -503,22 +498,20 @@ __init smp_check_cpus(unsigned int max_cpus)
503 boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr; 498 boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr;
504 current_thread_info()->cpu = 0; 499 current_thread_info()->cpu = 0;
505 num_cpus = 1; 500 num_cpus = 1;
506 for (cpu = 0; cpu <= 65535 && num_cpus < max_cpus; cpu++) { 501 for (cpu = 0; cpu <= 65535; cpu++) {
507 if ((__u16) cpu == boot_cpu_addr) 502 if ((__u16) cpu == boot_cpu_addr)
508 continue; 503 continue;
509 __cpu_logical_map[num_cpus] = (__u16) cpu; 504 __cpu_logical_map[1] = (__u16) cpu;
510 if (signal_processor(num_cpus, sigp_sense) == 505 if (signal_processor(1, sigp_sense) ==
511 sigp_not_operational) 506 sigp_not_operational)
512 continue; 507 continue;
513 cpu_set(num_cpus, cpu_present_map);
514 num_cpus++; 508 num_cpus++;
515 } 509 }
516 510
517 for (cpu = 1; cpu < max_cpus; cpu++)
518 cpu_set(cpu, cpu_possible_map);
519
520 printk("Detected %d CPU's\n",(int) num_cpus); 511 printk("Detected %d CPU's\n",(int) num_cpus);
521 printk("Boot cpu address %2X\n", boot_cpu_addr); 512 printk("Boot cpu address %2X\n", boot_cpu_addr);
513
514 return num_cpus;
522} 515}
523 516
524/* 517/*
@@ -679,6 +672,44 @@ __cpu_up(unsigned int cpu)
679 return 0; 672 return 0;
680} 673}
681 674
675static unsigned int __initdata additional_cpus;
676static unsigned int __initdata possible_cpus;
677
678void __init smp_setup_cpu_possible_map(void)
679{
680 unsigned int phy_cpus, pos_cpus, cpu;
681
682 phy_cpus = smp_count_cpus();
683 pos_cpus = min(phy_cpus + additional_cpus, (unsigned int) NR_CPUS);
684
685 if (possible_cpus)
686 pos_cpus = min(possible_cpus, (unsigned int) NR_CPUS);
687
688 for (cpu = 0; cpu < pos_cpus; cpu++)
689 cpu_set(cpu, cpu_possible_map);
690
691 phy_cpus = min(phy_cpus, pos_cpus);
692
693 for (cpu = 0; cpu < phy_cpus; cpu++)
694 cpu_set(cpu, cpu_present_map);
695}
696
697#ifdef CONFIG_HOTPLUG_CPU
698
699static int __init setup_additional_cpus(char *s)
700{
701 additional_cpus = simple_strtoul(s, NULL, 0);
702 return 0;
703}
704early_param("additional_cpus", setup_additional_cpus);
705
706static int __init setup_possible_cpus(char *s)
707{
708 possible_cpus = simple_strtoul(s, NULL, 0);
709 return 0;
710}
711early_param("possible_cpus", setup_possible_cpus);
712
682int 713int
683__cpu_disable(void) 714__cpu_disable(void)
684{ 715{
@@ -747,6 +778,8 @@ cpu_die(void)
747 for(;;); 778 for(;;);
748} 779}
749 780
781#endif /* CONFIG_HOTPLUG_CPU */
782
750/* 783/*
751 * Cycle through the processors and setup structures. 784 * Cycle through the processors and setup structures.
752 */ 785 */
@@ -760,7 +793,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
760 /* request the 0x1201 emergency signal external interrupt */ 793 /* request the 0x1201 emergency signal external interrupt */
761 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) 794 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0)
762 panic("Couldn't request external interrupt 0x1201"); 795 panic("Couldn't request external interrupt 0x1201");
763 smp_check_cpus(max_cpus);
764 memset(lowcore_ptr,0,sizeof(lowcore_ptr)); 796 memset(lowcore_ptr,0,sizeof(lowcore_ptr));
765 /* 797 /*
766 * Initialize prefix pages and stacks for all possible cpus 798 * Initialize prefix pages and stacks for all possible cpus
@@ -809,8 +841,6 @@ void __devinit smp_prepare_boot_cpu(void)
809 BUG_ON(smp_processor_id() != 0); 841 BUG_ON(smp_processor_id() != 0);
810 842
811 cpu_set(0, cpu_online_map); 843 cpu_set(0, cpu_online_map);
812 cpu_set(0, cpu_present_map);
813 cpu_set(0, cpu_possible_map);
814 S390_lowcore.percpu_offset = __per_cpu_offset[0]; 844 S390_lowcore.percpu_offset = __per_cpu_offset[0];
815 current_set[0] = current; 845 current_set[0] = current;
816} 846}
@@ -849,6 +879,7 @@ static int __init topology_init(void)
849 879
850subsys_initcall(topology_init); 880subsys_initcall(topology_init);
851 881
882EXPORT_SYMBOL(cpu_online_map);
852EXPORT_SYMBOL(cpu_possible_map); 883EXPORT_SYMBOL(cpu_possible_map);
853EXPORT_SYMBOL(lowcore_ptr); 884EXPORT_SYMBOL(lowcore_ptr);
854EXPORT_SYMBOL(smp_ctl_set_bit); 885EXPORT_SYMBOL(smp_ctl_set_bit);
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 3280345efacd..7c88d85c3597 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -301,7 +301,7 @@ SYSCALL(sys_mkdirat,sys_mkdirat,sys_mkdirat_wrapper)
301SYSCALL(sys_mknodat,sys_mknodat,sys_mknodat_wrapper) /* 290 */ 301SYSCALL(sys_mknodat,sys_mknodat,sys_mknodat_wrapper) /* 290 */
302SYSCALL(sys_fchownat,sys_fchownat,sys_fchownat_wrapper) 302SYSCALL(sys_fchownat,sys_fchownat,sys_fchownat_wrapper)
303SYSCALL(sys_futimesat,sys_futimesat,compat_sys_futimesat_wrapper) 303SYSCALL(sys_futimesat,sys_futimesat,compat_sys_futimesat_wrapper)
304SYSCALL(sys_newfstatat,sys_newfstatat,compat_sys_newfstatat_wrapper) 304SYSCALL(sys_fstatat64,sys_newfstatat,sys32_fstatat64_wrapper)
305SYSCALL(sys_unlinkat,sys_unlinkat,sys_unlinkat_wrapper) 305SYSCALL(sys_unlinkat,sys_unlinkat,sys_unlinkat_wrapper)
306SYSCALL(sys_renameat,sys_renameat,sys_renameat_wrapper) /* 295 */ 306SYSCALL(sys_renameat,sys_renameat,sys_renameat_wrapper) /* 295 */
307SYSCALL(sys_linkat,sys_linkat,sys_linkat_wrapper) 307SYSCALL(sys_linkat,sys_linkat,sys_linkat_wrapper)
@@ -311,3 +311,4 @@ SYSCALL(sys_fchmodat,sys_fchmodat,sys_fchmodat_wrapper)
311SYSCALL(sys_faccessat,sys_faccessat,sys_faccessat_wrapper) /* 300 */ 311SYSCALL(sys_faccessat,sys_faccessat,sys_faccessat_wrapper) /* 300 */
312SYSCALL(sys_pselect6,sys_pselect6,compat_sys_pselect6_wrapper) 312SYSCALL(sys_pselect6,sys_pselect6,compat_sys_pselect6_wrapper)
313SYSCALL(sys_ppoll,sys_ppoll,compat_sys_ppoll_wrapper) 313SYSCALL(sys_ppoll,sys_ppoll,compat_sys_ppoll_wrapper)
314SYSCALL(sys_unshare,sys_unshare,sys_unshare_wrapper)
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c
index e96c35bddac7..71f0a2fb3078 100644
--- a/arch/s390/lib/delay.c
+++ b/arch/s390/lib/delay.c
@@ -30,7 +30,7 @@ void __delay(unsigned long loops)
30 */ 30 */
31 __asm__ __volatile__( 31 __asm__ __volatile__(
32 "0: brct %0,0b" 32 "0: brct %0,0b"
33 : /* no outputs */ : "r" (loops/2) ); 33 : /* no outputs */ : "r" ((loops/2) + 1));
34} 34}
35 35
36/* 36/*
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 504d56f8ca7f..e73621d03a28 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -446,7 +446,7 @@ endmenu
446 446
447config ISA_DMA_API 447config ISA_DMA_API
448 bool 448 bool
449 depends on MPC1211 449 depends on SH_MPC1211
450 default y 450 default y
451 451
452menu "Kernel features" 452menu "Kernel features"
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index c0314705d73a..768de64b371f 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -76,7 +76,7 @@ sys_call_table:
76/*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink 76/*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
77/*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid 77/*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
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_fstatat64
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, sys_unshare 81/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
82 82
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 9264ccbaaafa..417727bd87ba 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -428,6 +428,27 @@ asmlinkage long compat_sys_fstat64(unsigned int fd,
428 return error; 428 return error;
429} 429}
430 430
431asmlinkage long compat_sys_fstatat64(unsigned int dfd, char __user *filename,
432 struct compat_stat64 __user * statbuf, int flag)
433{
434 struct kstat stat;
435 int error = -EINVAL;
436
437 if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
438 goto out;
439
440 if (flag & AT_SYMLINK_NOFOLLOW)
441 error = vfs_lstat_fd(dfd, filename, &stat);
442 else
443 error = vfs_stat_fd(dfd, filename, &stat);
444
445 if (!error)
446 error = cp_compat_stat64(&stat, statbuf);
447
448out:
449 return error;
450}
451
431asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2) 452asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2)
432{ 453{
433 return sys_sysfs(option, arg1, arg2); 454 return sys_sysfs(option, arg1, arg2);
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index a19168510be2..c3adb7ac167d 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -77,7 +77,7 @@ sys_call_table32:
77/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink 77/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
78 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid 78 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
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_fstatat64
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, sys_unshare 82 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
83 83
@@ -146,7 +146,7 @@ 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, sys_newfstatat 149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64
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, sys_unshare 151 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
152 152
diff --git a/arch/v850/Kconfig b/arch/v850/Kconfig
index 04494638b963..e7fc3e500342 100644
--- a/arch/v850/Kconfig
+++ b/arch/v850/Kconfig
@@ -28,6 +28,10 @@ config GENERIC_IRQ_PROBE
28 bool 28 bool
29 default y 29 default y
30 30
31config TIME_LOW_RES
32 bool
33 default y
34
31# Turn off some random 386 crap that can affect device config 35# Turn off some random 386 crap that can affect device config
32config ISA 36config ISA
33 bool 37 bool
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 56832929a543..ce4de61ed85d 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/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-rc1-git2 3# Linux kernel version: 2.6.16-rc3-git9
4# Thu Jan 19 10:05:21 2006 4# Sat Feb 18 00:27:03 2006
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -21,7 +21,6 @@ CONFIG_DMI=y
21# Code maturity level options 21# Code maturity level options
22# 22#
23CONFIG_EXPERIMENTAL=y 23CONFIG_EXPERIMENTAL=y
24CONFIG_CLEAN_COMPILE=y
25CONFIG_LOCK_KERNEL=y 24CONFIG_LOCK_KERNEL=y
26CONFIG_INIT_ENV_ARG_LIMIT=32 25CONFIG_INIT_ENV_ARG_LIMIT=32
27 26
@@ -267,6 +266,7 @@ CONFIG_NET=y
267# 266#
268# Networking options 267# Networking options
269# 268#
269# CONFIG_NETDEBUG is not set
270CONFIG_PACKET=y 270CONFIG_PACKET=y
271# CONFIG_PACKET_MMAP is not set 271# CONFIG_PACKET_MMAP is not set
272CONFIG_UNIX=y 272CONFIG_UNIX=y
@@ -446,7 +446,6 @@ CONFIG_BLK_DEV_PIIX=y
446# CONFIG_BLK_DEV_NS87415 is not set 446# CONFIG_BLK_DEV_NS87415 is not set
447# CONFIG_BLK_DEV_PDC202XX_OLD is not set 447# CONFIG_BLK_DEV_PDC202XX_OLD is not set
448CONFIG_BLK_DEV_PDC202XX_NEW=y 448CONFIG_BLK_DEV_PDC202XX_NEW=y
449# CONFIG_PDC202XX_FORCE is not set
450# CONFIG_BLK_DEV_SVWKS is not set 449# CONFIG_BLK_DEV_SVWKS is not set
451# CONFIG_BLK_DEV_SIIMAGE is not set 450# CONFIG_BLK_DEV_SIIMAGE is not set
452# CONFIG_BLK_DEV_SIS5513 is not set 451# CONFIG_BLK_DEV_SIS5513 is not set
@@ -573,7 +572,33 @@ CONFIG_FUSION_MAX_SGE=128
573# 572#
574# IEEE 1394 (FireWire) support 573# IEEE 1394 (FireWire) support
575# 574#
576# CONFIG_IEEE1394 is not set 575CONFIG_IEEE1394=y
576
577#
578# Subsystem Options
579#
580# CONFIG_IEEE1394_VERBOSEDEBUG is not set
581# CONFIG_IEEE1394_OUI_DB is not set
582# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set
583# CONFIG_IEEE1394_EXPORT_FULL_API is not set
584
585#
586# Device Drivers
587#
588
589#
590# Texas Instruments PCILynx requires I2C
591#
592CONFIG_IEEE1394_OHCI1394=y
593
594#
595# Protocol Drivers
596#
597# CONFIG_IEEE1394_VIDEO1394 is not set
598# CONFIG_IEEE1394_SBP2 is not set
599# CONFIG_IEEE1394_ETH1394 is not set
600# CONFIG_IEEE1394_DV1394 is not set
601CONFIG_IEEE1394_RAWIO=y
577 602
578# 603#
579# I2O device support 604# I2O device support
@@ -772,6 +797,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4
772# 797#
773CONFIG_SERIAL_CORE=y 798CONFIG_SERIAL_CORE=y
774CONFIG_SERIAL_CORE_CONSOLE=y 799CONFIG_SERIAL_CORE_CONSOLE=y
800# CONFIG_SERIAL_JSM is not set
775CONFIG_UNIX98_PTYS=y 801CONFIG_UNIX98_PTYS=y
776CONFIG_LEGACY_PTYS=y 802CONFIG_LEGACY_PTYS=y
777CONFIG_LEGACY_PTY_COUNT=256 803CONFIG_LEGACY_PTY_COUNT=256
@@ -871,6 +897,7 @@ CONFIG_HPET_MMAP=y
871# 897#
872CONFIG_HWMON=y 898CONFIG_HWMON=y
873# CONFIG_HWMON_VID is not set 899# CONFIG_HWMON_VID is not set
900# CONFIG_SENSORS_F71805F is not set
874# CONFIG_SENSORS_HDAPS is not set 901# CONFIG_SENSORS_HDAPS is not set
875# CONFIG_HWMON_DEBUG_CHIP is not set 902# CONFIG_HWMON_DEBUG_CHIP is not set
876 903
@@ -1101,7 +1128,6 @@ CONFIG_USB_MON=y
1101# EDAC - error detection and reporting (RAS) 1128# EDAC - error detection and reporting (RAS)
1102# 1129#
1103# CONFIG_EDAC is not set 1130# CONFIG_EDAC is not set
1104# CONFIG_EDAC_POLL is not set
1105 1131
1106# 1132#
1107# Firmware Drivers 1133# Firmware Drivers
@@ -1296,9 +1322,7 @@ CONFIG_DEBUG_FS=y
1296# CONFIG_DEBUG_VM is not set 1322# CONFIG_DEBUG_VM is not set
1297# CONFIG_FRAME_POINTER is not set 1323# CONFIG_FRAME_POINTER is not set
1298# CONFIG_FORCED_INLINING is not set 1324# CONFIG_FORCED_INLINING is not set
1299# CONFIG_UNWIND_INFO is not set
1300# CONFIG_RCU_TORTURE_TEST is not set 1325# CONFIG_RCU_TORTURE_TEST is not set
1301CONFIG_INIT_DEBUG=y
1302# CONFIG_DEBUG_RODATA is not set 1326# CONFIG_DEBUG_RODATA is not set
1303# CONFIG_IOMMU_DEBUG is not set 1327# CONFIG_IOMMU_DEBUG is not set
1304 1328
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index ada4535d0161..00dee176c08e 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -677,7 +677,7 @@ ia32_sys_call_table:
677 .quad sys_mknodat 677 .quad sys_mknodat
678 .quad sys_fchownat 678 .quad sys_fchownat
679 .quad compat_sys_futimesat 679 .quad compat_sys_futimesat
680 .quad compat_sys_newfstatat /* 300 */ 680 .quad sys32_fstatat /* 300 */
681 .quad sys_unlinkat 681 .quad sys_unlinkat
682 .quad sys_renameat 682 .quad sys_renameat
683 .quad sys_linkat 683 .quad sys_linkat
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index 54481af5344a..2bc55af95419 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -180,6 +180,28 @@ sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf)
180 return ret; 180 return ret;
181} 181}
182 182
183asmlinkage long
184sys32_fstatat(unsigned int dfd, char __user *filename,
185 struct stat64 __user* statbuf, int flag)
186{
187 struct kstat stat;
188 int error = -EINVAL;
189
190 if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
191 goto out;
192
193 if (flag & AT_SYMLINK_NOFOLLOW)
194 error = vfs_lstat_fd(dfd, filename, &stat);
195 else
196 error = vfs_stat_fd(dfd, filename, &stat);
197
198 if (!error)
199 error = cp_stat64(statbuf, &stat);
200
201out:
202 return error;
203}
204
183/* 205/*
184 * Linux/i386 didn't use to be able to handle more than 206 * Linux/i386 didn't use to be able to handle more than
185 * 4 system call parameters, so these system calls used a memory 207 * 4 system call parameters, so these system calls used a memory
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 6147770b4347..e5b14c57eaa0 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -708,7 +708,7 @@ static void setup_APIC_timer(unsigned int clocks)
708 local_irq_save(flags); 708 local_irq_save(flags);
709 709
710 /* wait for irq slice */ 710 /* wait for irq slice */
711 if (vxtime.hpet_address) { 711 if (vxtime.hpet_address && hpet_use_timer) {
712 int trigger = hpet_readl(HPET_T0_CMP); 712 int trigger = hpet_readl(HPET_T0_CMP);
713 while (hpet_readl(HPET_COUNTER) >= trigger) 713 while (hpet_readl(HPET_COUNTER) >= trigger)
714 /* do nothing */ ; 714 /* do nothing */ ;
@@ -1152,6 +1152,7 @@ __setup("noapicmaintimer", setup_noapicmaintimer);
1152static __init int setup_apicpmtimer(char *s) 1152static __init int setup_apicpmtimer(char *s)
1153{ 1153{
1154 apic_calibrate_pmtmr = 1; 1154 apic_calibrate_pmtmr = 1;
1155 notsc_setup(NULL);
1155 return setup_apicmaintimer(NULL); 1156 return setup_apicmaintimer(NULL);
1156} 1157}
1157__setup("apicpmtimer", setup_apicpmtimer); 1158__setup("apicpmtimer", setup_apicpmtimer);
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index b150c87a08c6..7c10e9009d61 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -554,6 +554,7 @@ iret_label:
554 /* running with kernel gs */ 554 /* running with kernel gs */
555bad_iret: 555bad_iret:
556 movq $-9999,%rdi /* better code? */ 556 movq $-9999,%rdi /* better code? */
557 sti
557 jmp do_exit 558 jmp do_exit
558 .previous 559 .previous
559 560
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index 692c737feddb..02fc7fa0ea28 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -213,6 +213,11 @@ ENTRY(early_idt_handler)
213 cmpl $2,early_recursion_flag(%rip) 213 cmpl $2,early_recursion_flag(%rip)
214 jz 1f 214 jz 1f
215 call dump_stack 215 call dump_stack
216#ifdef CONFIG_KALLSYMS
217 leaq early_idt_ripmsg(%rip),%rdi
218 movq 8(%rsp),%rsi # get rip again
219 call __print_symbol
220#endif
2161: hlt 2211: hlt
217 jmp 1b 222 jmp 1b
218early_recursion_flag: 223early_recursion_flag:
@@ -220,6 +225,8 @@ early_recursion_flag:
220 225
221early_idt_msg: 226early_idt_msg:
222 .asciz "PANIC: early exception rip %lx error %lx cr2 %lx\n" 227 .asciz "PANIC: early exception rip %lx error %lx cr2 %lx\n"
228early_idt_ripmsg:
229 .asciz "RIP %s\n"
223 230
224.code32 231.code32
225ENTRY(no_long_mode) 232ENTRY(no_long_mode)
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 4282d72b2a26..2585c1d92b26 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -30,6 +30,9 @@
30#include <linux/mc146818rtc.h> 30#include <linux/mc146818rtc.h>
31#include <linux/acpi.h> 31#include <linux/acpi.h>
32#include <linux/sysdev.h> 32#include <linux/sysdev.h>
33#ifdef CONFIG_ACPI
34#include <acpi/acpi_bus.h>
35#endif
33 36
34#include <asm/io.h> 37#include <asm/io.h>
35#include <asm/smp.h> 38#include <asm/smp.h>
@@ -260,6 +263,8 @@ __setup("apic", enable_ioapic_setup);
260 263
261 And another hack to disable the IOMMU on VIA chipsets. 264 And another hack to disable the IOMMU on VIA chipsets.
262 265
266 ... and others. Really should move this somewhere else.
267
263 Kludge-O-Rama. */ 268 Kludge-O-Rama. */
264void __init check_ioapic(void) 269void __init check_ioapic(void)
265{ 270{
@@ -307,6 +312,17 @@ void __init check_ioapic(void)
307 case PCI_VENDOR_ID_ATI: 312 case PCI_VENDOR_ID_ATI:
308 if (apic_runs_main_timer != 0) 313 if (apic_runs_main_timer != 0)
309 break; 314 break;
315#ifdef CONFIG_ACPI
316 /* Don't do this for laptops right
317 right now because their timer
318 doesn't necessarily tick in C2/3 */
319 if (acpi_fadt.revision >= 3 &&
320 (acpi_fadt.plvl2_lat + acpi_fadt.plvl3_lat) < 1100) {
321 printk(KERN_INFO
322"ATI board detected, but seems to be a laptop. Timer might be shakey, sorry\n");
323 break;
324 }
325#endif
310 printk(KERN_INFO 326 printk(KERN_INFO
311 "ATI board detected. Using APIC/PM timer.\n"); 327 "ATI board detected. Using APIC/PM timer.\n");
312 apic_runs_main_timer = 1; 328 apic_runs_main_timer = 1;
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index dc49bfb6db0a..9013a90b5c2e 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -288,9 +288,9 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
288 288
289 memcpy(str,mpc->mpc_productid,12); 289 memcpy(str,mpc->mpc_productid,12);
290 str[12]=0; 290 str[12]=0;
291 printk(KERN_INFO "Product ID: %s ",str); 291 printk("Product ID: %s ",str);
292 292
293 printk(KERN_INFO "APIC at: 0x%X\n",mpc->mpc_lapic); 293 printk("APIC at: 0x%X\n",mpc->mpc_lapic);
294 294
295 /* save the local APIC address, it might be non-default */ 295 /* save the local APIC address, it might be non-default */
296 if (!acpi_lapic) 296 if (!acpi_lapic)
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 8be407a1f62d..5bf17e41cd2d 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -236,6 +236,7 @@ static void enable_lapic_nmi_watchdog(void)
236{ 236{
237 if (nmi_active < 0) { 237 if (nmi_active < 0) {
238 nmi_watchdog = NMI_LOCAL_APIC; 238 nmi_watchdog = NMI_LOCAL_APIC;
239 touch_nmi_watchdog();
239 setup_apic_nmi_watchdog(); 240 setup_apic_nmi_watchdog();
240 } 241 }
241} 242}
@@ -456,15 +457,17 @@ static DEFINE_PER_CPU(int, nmi_touch);
456 457
457void touch_nmi_watchdog (void) 458void touch_nmi_watchdog (void)
458{ 459{
459 int i; 460 if (nmi_watchdog > 0) {
461 unsigned cpu;
460 462
461 /* 463 /*
462 * Tell other CPUs to reset their alert counters. We cannot 464 * Tell other CPUs to reset their alert counters. We cannot
463 * do it ourselves because the alert count increase is not 465 * do it ourselves because the alert count increase is not
464 * atomic. 466 * atomic.
465 */ 467 */
466 for (i = 0; i < NR_CPUS; i++) 468 for_each_present_cpu (cpu)
467 per_cpu(nmi_touch, i) = 1; 469 per_cpu(nmi_touch, cpu) = 1;
470 }
468 471
469 touch_softlockup_watchdog(); 472 touch_softlockup_watchdog();
470} 473}
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index 2fe23a6c361b..dd0718dc178b 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -310,7 +310,7 @@ void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int di
310 310
311 for (i = 0; i < nents; i++) { 311 for (i = 0; i < nents; i++) {
312 struct scatterlist *s = &sg[i]; 312 struct scatterlist *s = &sg[i];
313 if (!s->dma_length || !s->length) 313 if (!s->dma_length)
314 break; 314 break;
315 dma_unmap_single(dev, s->dma_address, s->dma_length, dir); 315 dma_unmap_single(dev, s->dma_address, s->dma_length, dir);
316 } 316 }
@@ -364,7 +364,6 @@ static int __dma_map_cont(struct scatterlist *sg, int start, int stopat,
364 364
365 BUG_ON(i > start && s->offset); 365 BUG_ON(i > start && s->offset);
366 if (i == start) { 366 if (i == start) {
367 *sout = *s;
368 sout->dma_address = iommu_bus_base; 367 sout->dma_address = iommu_bus_base;
369 sout->dma_address += iommu_page*PAGE_SIZE + s->offset; 368 sout->dma_address += iommu_page*PAGE_SIZE + s->offset;
370 sout->dma_length = s->length; 369 sout->dma_length = s->length;
@@ -379,7 +378,7 @@ static int __dma_map_cont(struct scatterlist *sg, int start, int stopat,
379 SET_LEAK(iommu_page); 378 SET_LEAK(iommu_page);
380 addr += PAGE_SIZE; 379 addr += PAGE_SIZE;
381 iommu_page++; 380 iommu_page++;
382 } 381 }
383 } 382 }
384 BUG_ON(iommu_page - iommu_start != pages); 383 BUG_ON(iommu_page - iommu_start != pages);
385 return 0; 384 return 0;
@@ -391,7 +390,6 @@ static inline int dma_map_cont(struct scatterlist *sg, int start, int stopat,
391{ 390{
392 if (!need) { 391 if (!need) {
393 BUG_ON(stopat - start != 1); 392 BUG_ON(stopat - start != 1);
394 *sout = sg[start];
395 sout->dma_length = sg[start].length; 393 sout->dma_length = sg[start].length;
396 return 0; 394 return 0;
397 } 395 }
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index dba7237be5c1..67841d11ed1f 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -59,7 +59,7 @@ static int notsc __initdata = 0;
59unsigned int cpu_khz; /* TSC clocks / usec, not used here */ 59unsigned int cpu_khz; /* TSC clocks / usec, not used here */
60static unsigned long hpet_period; /* fsecs / HPET clock */ 60static unsigned long hpet_period; /* fsecs / HPET clock */
61unsigned long hpet_tick; /* HPET clocks / interrupt */ 61unsigned long hpet_tick; /* HPET clocks / interrupt */
62static int hpet_use_timer; /* Use counter of hpet for time keeping, otherwise PIT */ 62int hpet_use_timer; /* Use counter of hpet for time keeping, otherwise PIT */
63unsigned long vxtime_hz = PIT_TICK_RATE; 63unsigned long vxtime_hz = PIT_TICK_RATE;
64int report_lost_ticks; /* command line option */ 64int report_lost_ticks; /* command line option */
65unsigned long long monotonic_base; 65unsigned long long monotonic_base;
@@ -326,7 +326,10 @@ static noinline void handle_lost_ticks(int lost, struct pt_regs *regs)
326 print_symbol("rip %s\n", regs->rip); 326 print_symbol("rip %s\n", regs->rip);
327 if (vxtime.mode == VXTIME_TSC && vxtime.hpet_address) { 327 if (vxtime.mode == VXTIME_TSC && vxtime.hpet_address) {
328 printk(KERN_WARNING "Falling back to HPET\n"); 328 printk(KERN_WARNING "Falling back to HPET\n");
329 vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick; 329 if (hpet_use_timer)
330 vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick;
331 else
332 vxtime.last = hpet_readl(HPET_COUNTER);
330 vxtime.mode = VXTIME_HPET; 333 vxtime.mode = VXTIME_HPET;
331 do_gettimeoffset = do_gettimeoffset_hpet; 334 do_gettimeoffset = do_gettimeoffset_hpet;
332 } 335 }
@@ -988,7 +991,10 @@ void __init time_init_gtod(void)
988 notsc = 1; 991 notsc = 1;
989 if (vxtime.hpet_address && notsc) { 992 if (vxtime.hpet_address && notsc) {
990 timetype = hpet_use_timer ? "HPET" : "PIT/HPET"; 993 timetype = hpet_use_timer ? "HPET" : "PIT/HPET";
991 vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick; 994 if (hpet_use_timer)
995 vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick;
996 else
997 vxtime.last = hpet_readl(HPET_COUNTER);
992 vxtime.mode = VXTIME_HPET; 998 vxtime.mode = VXTIME_HPET;
993 do_gettimeoffset = do_gettimeoffset_hpet; 999 do_gettimeoffset = do_gettimeoffset_hpet;
994#ifdef CONFIG_X86_PM_TIMER 1000#ifdef CONFIG_X86_PM_TIMER
@@ -1321,8 +1327,7 @@ static int __init nohpet_setup(char *s)
1321 1327
1322__setup("nohpet", nohpet_setup); 1328__setup("nohpet", nohpet_setup);
1323 1329
1324 1330int __init notsc_setup(char *s)
1325static int __init notsc_setup(char *s)
1326{ 1331{
1327 notsc = 1; 1332 notsc = 1;
1328 return 0; 1333 return 0;
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index ee1b2da9e5e7..28d50dc540e8 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -90,6 +90,20 @@ static inline void conditional_sti(struct pt_regs *regs)
90 local_irq_enable(); 90 local_irq_enable();
91} 91}
92 92
93static inline void preempt_conditional_sti(struct pt_regs *regs)
94{
95 preempt_disable();
96 if (regs->eflags & X86_EFLAGS_IF)
97 local_irq_enable();
98}
99
100static inline void preempt_conditional_cli(struct pt_regs *regs)
101{
102 if (regs->eflags & X86_EFLAGS_IF)
103 local_irq_disable();
104 preempt_enable_no_resched();
105}
106
93static int kstack_depth_to_print = 10; 107static int kstack_depth_to_print = 10;
94 108
95#ifdef CONFIG_KALLSYMS 109#ifdef CONFIG_KALLSYMS
@@ -693,7 +707,7 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,
693 SIGTRAP) == NOTIFY_STOP) 707 SIGTRAP) == NOTIFY_STOP)
694 return; 708 return;
695 709
696 conditional_sti(regs); 710 preempt_conditional_sti(regs);
697 711
698 /* Mask out spurious debug traps due to lazy DR7 setting */ 712 /* Mask out spurious debug traps due to lazy DR7 setting */
699 if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) { 713 if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) {
@@ -738,11 +752,13 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,
738 752
739clear_dr7: 753clear_dr7:
740 set_debugreg(0UL, 7); 754 set_debugreg(0UL, 7);
755 preempt_conditional_cli(regs);
741 return; 756 return;
742 757
743clear_TF_reenable: 758clear_TF_reenable:
744 set_tsk_thread_flag(tsk, TIF_SINGLESTEP); 759 set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
745 regs->eflags &= ~TF_MASK; 760 regs->eflags &= ~TF_MASK;
761 preempt_conditional_cli(regs);
746} 762}
747 763
748static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr) 764static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr)
diff --git a/arch/x86_64/mm/k8topology.c b/arch/x86_64/mm/k8topology.c
index a5663e0bb01c..dd60e71fdba6 100644
--- a/arch/x86_64/mm/k8topology.c
+++ b/arch/x86_64/mm/k8topology.c
@@ -155,7 +155,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
155 if (!found) 155 if (!found)
156 return -1; 156 return -1;
157 157
158 memnode_shift = compute_hash_shift(nodes, numnodes); 158 memnode_shift = compute_hash_shift(nodes, 8);
159 if (memnode_shift < 0) { 159 if (memnode_shift < 0) {
160 printk(KERN_ERR "No NUMA node hash function found. Contact maintainer\n"); 160 printk(KERN_ERR "No NUMA node hash function found. Contact maintainer\n");
161 return -1; 161 return -1;
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 6ef9f9a76235..22e51beee8d3 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -351,7 +351,7 @@ void __init init_cpu_to_node(void)
351 continue; 351 continue;
352 if (apicid_to_node[apicid] == NUMA_NO_NODE) 352 if (apicid_to_node[apicid] == NUMA_NO_NODE)
353 continue; 353 continue;
354 cpu_to_node[i] = apicid_to_node[apicid]; 354 numa_set_node(i,apicid_to_node[apicid]);
355 } 355 }
356} 356}
357 357
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index cd25300726fc..482c25767369 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -228,7 +228,8 @@ static int nodes_cover_memory(void)
228 } 228 }
229 229
230 e820ram = end_pfn - e820_hole_size(0, end_pfn); 230 e820ram = end_pfn - e820_hole_size(0, end_pfn);
231 if (pxmram < e820ram) { 231 /* We seem to lose 3 pages somewhere. Allow a bit of slack. */
232 if ((long)(e820ram - pxmram) >= 1*1024*1024) {
232 printk(KERN_ERR 233 printk(KERN_ERR
233 "SRAT: PXMs only cover %luMB of your %luMB e820 RAM. Not used.\n", 234 "SRAT: PXMs only cover %luMB of your %luMB e820 RAM. Not used.\n",
234 (pxmram << PAGE_SHIFT) >> 20, 235 (pxmram << PAGE_SHIFT) >> 20,
@@ -270,7 +271,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
270 return -1; 271 return -1;
271 } 272 }
272 273
273 memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed)); 274 memnode_shift = compute_hash_shift(nodes, MAX_NUMNODES);
274 if (memnode_shift < 0) { 275 if (memnode_shift < 0) {
275 printk(KERN_ERR 276 printk(KERN_ERR
276 "SRAT: No NUMA node hash function found. Contact maintainer\n"); 277 "SRAT: No NUMA node hash function found. Contact maintainer\n");
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 7d6481d9fbec..4038dbfa63a0 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -391,8 +391,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
391 * Ensure a 32-bit boundary for the structure 391 * Ensure a 32-bit boundary for the structure
392 */ 392 */
393 extra_struct_bytes = 393 extra_struct_bytes =
394 ACPI_ROUND_UP_to_32_bITS(resource_length) - 394 ACPI_ROUND_UP_to_32_bITS(resource_length);
395 resource_length;
396 break; 395 break;
397 396
398 case ACPI_RESOURCE_NAME_END_TAG: 397 case ACPI_RESOURCE_NAME_END_TAG:
@@ -408,8 +407,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
408 * Add vendor data and ensure a 32-bit boundary for the structure 407 * Add vendor data and ensure a 32-bit boundary for the structure
409 */ 408 */
410 extra_struct_bytes = 409 extra_struct_bytes =
411 ACPI_ROUND_UP_to_32_bITS(resource_length) - 410 ACPI_ROUND_UP_to_32_bITS(resource_length);
412 resource_length;
413 break; 411 break;
414 412
415 case ACPI_RESOURCE_NAME_ADDRESS32: 413 case ACPI_RESOURCE_NAME_ADDRESS32:
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 4e7dbcc425ff..bc9b2bcd7dba 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -58,6 +58,7 @@
58#include <linux/suspend.h> 58#include <linux/suspend.h>
59#include <scsi/scsi_cmnd.h> 59#include <scsi/scsi_cmnd.h>
60#include <scsi/scsi_ioctl.h> 60#include <scsi/scsi_ioctl.h>
61#include <scsi/scsi.h>
61 62
62#include <asm/uaccess.h> 63#include <asm/uaccess.h>
63 64
@@ -380,6 +381,7 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *
380 memcpy(rq->cmd, cgc->cmd, CDROM_PACKET_SIZE); 381 memcpy(rq->cmd, cgc->cmd, CDROM_PACKET_SIZE);
381 if (sizeof(rq->cmd) > CDROM_PACKET_SIZE) 382 if (sizeof(rq->cmd) > CDROM_PACKET_SIZE)
382 memset(rq->cmd + CDROM_PACKET_SIZE, 0, sizeof(rq->cmd) - CDROM_PACKET_SIZE); 383 memset(rq->cmd + CDROM_PACKET_SIZE, 0, sizeof(rq->cmd) - CDROM_PACKET_SIZE);
384 rq->cmd_len = COMMAND_SIZE(rq->cmd[0]);
383 385
384 rq->ref_count++; 386 rq->ref_count++;
385 rq->flags |= REQ_NOMERGE; 387 rq->flags |= REQ_NOMERGE;
@@ -645,7 +647,7 @@ static void pkt_copy_bio_data(struct bio *src_bio, int seg, int offs, struct pag
645 * b) The data can be used as cache to avoid read requests if we receive a 647 * b) The data can be used as cache to avoid read requests if we receive a
646 * new write request for the same zone. 648 * new write request for the same zone.
647 */ 649 */
648static void pkt_make_local_copy(struct packet_data *pkt, struct page **pages, int *offsets) 650static void pkt_make_local_copy(struct packet_data *pkt, struct bio_vec *bvec)
649{ 651{
650 int f, p, offs; 652 int f, p, offs;
651 653
@@ -653,15 +655,15 @@ static void pkt_make_local_copy(struct packet_data *pkt, struct page **pages, in
653 p = 0; 655 p = 0;
654 offs = 0; 656 offs = 0;
655 for (f = 0; f < pkt->frames; f++) { 657 for (f = 0; f < pkt->frames; f++) {
656 if (pages[f] != pkt->pages[p]) { 658 if (bvec[f].bv_page != pkt->pages[p]) {
657 void *vfrom = kmap_atomic(pages[f], KM_USER0) + offsets[f]; 659 void *vfrom = kmap_atomic(bvec[f].bv_page, KM_USER0) + bvec[f].bv_offset;
658 void *vto = page_address(pkt->pages[p]) + offs; 660 void *vto = page_address(pkt->pages[p]) + offs;
659 memcpy(vto, vfrom, CD_FRAMESIZE); 661 memcpy(vto, vfrom, CD_FRAMESIZE);
660 kunmap_atomic(vfrom, KM_USER0); 662 kunmap_atomic(vfrom, KM_USER0);
661 pages[f] = pkt->pages[p]; 663 bvec[f].bv_page = pkt->pages[p];
662 offsets[f] = offs; 664 bvec[f].bv_offset = offs;
663 } else { 665 } else {
664 BUG_ON(offsets[f] != offs); 666 BUG_ON(bvec[f].bv_offset != offs);
665 } 667 }
666 offs += CD_FRAMESIZE; 668 offs += CD_FRAMESIZE;
667 if (offs >= PAGE_SIZE) { 669 if (offs >= PAGE_SIZE) {
@@ -991,18 +993,17 @@ try_next_bio:
991static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt) 993static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
992{ 994{
993 struct bio *bio; 995 struct bio *bio;
994 struct page *pages[PACKET_MAX_SIZE];
995 int offsets[PACKET_MAX_SIZE];
996 int f; 996 int f;
997 int frames_write; 997 int frames_write;
998 struct bio_vec *bvec = pkt->w_bio->bi_io_vec;
998 999
999 for (f = 0; f < pkt->frames; f++) { 1000 for (f = 0; f < pkt->frames; f++) {
1000 pages[f] = pkt->pages[(f * CD_FRAMESIZE) / PAGE_SIZE]; 1001 bvec[f].bv_page = pkt->pages[(f * CD_FRAMESIZE) / PAGE_SIZE];
1001 offsets[f] = (f * CD_FRAMESIZE) % PAGE_SIZE; 1002 bvec[f].bv_offset = (f * CD_FRAMESIZE) % PAGE_SIZE;
1002 } 1003 }
1003 1004
1004 /* 1005 /*
1005 * Fill-in pages[] and offsets[] with data from orig_bios. 1006 * Fill-in bvec with data from orig_bios.
1006 */ 1007 */
1007 frames_write = 0; 1008 frames_write = 0;
1008 spin_lock(&pkt->lock); 1009 spin_lock(&pkt->lock);
@@ -1024,11 +1025,11 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
1024 } 1025 }
1025 1026
1026 if (src_bvl->bv_len - src_offs >= CD_FRAMESIZE) { 1027 if (src_bvl->bv_len - src_offs >= CD_FRAMESIZE) {
1027 pages[f] = src_bvl->bv_page; 1028 bvec[f].bv_page = src_bvl->bv_page;
1028 offsets[f] = src_bvl->bv_offset + src_offs; 1029 bvec[f].bv_offset = src_bvl->bv_offset + src_offs;
1029 } else { 1030 } else {
1030 pkt_copy_bio_data(bio, segment, src_offs, 1031 pkt_copy_bio_data(bio, segment, src_offs,
1031 pages[f], offsets[f]); 1032 bvec[f].bv_page, bvec[f].bv_offset);
1032 } 1033 }
1033 src_offs += CD_FRAMESIZE; 1034 src_offs += CD_FRAMESIZE;
1034 frames_write++; 1035 frames_write++;
@@ -1042,7 +1043,7 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
1042 BUG_ON(frames_write != pkt->write_size); 1043 BUG_ON(frames_write != pkt->write_size);
1043 1044
1044 if (test_bit(PACKET_MERGE_SEGS, &pd->flags) || (pkt->write_size < pkt->frames)) { 1045 if (test_bit(PACKET_MERGE_SEGS, &pd->flags) || (pkt->write_size < pkt->frames)) {
1045 pkt_make_local_copy(pkt, pages, offsets); 1046 pkt_make_local_copy(pkt, bvec);
1046 pkt->cache_valid = 1; 1047 pkt->cache_valid = 1;
1047 } else { 1048 } else {
1048 pkt->cache_valid = 0; 1049 pkt->cache_valid = 0;
@@ -1055,17 +1056,9 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
1055 pkt->w_bio->bi_bdev = pd->bdev; 1056 pkt->w_bio->bi_bdev = pd->bdev;
1056 pkt->w_bio->bi_end_io = pkt_end_io_packet_write; 1057 pkt->w_bio->bi_end_io = pkt_end_io_packet_write;
1057 pkt->w_bio->bi_private = pkt; 1058 pkt->w_bio->bi_private = pkt;
1058 for (f = 0; f < pkt->frames; f++) { 1059 for (f = 0; f < pkt->frames; f++)
1059 if ((f + 1 < pkt->frames) && (pages[f + 1] == pages[f]) && 1060 if (!bio_add_page(pkt->w_bio, bvec[f].bv_page, CD_FRAMESIZE, bvec[f].bv_offset))
1060 (offsets[f + 1] = offsets[f] + CD_FRAMESIZE)) { 1061 BUG();
1061 if (!bio_add_page(pkt->w_bio, pages[f], CD_FRAMESIZE * 2, offsets[f]))
1062 BUG();
1063 f++;
1064 } else {
1065 if (!bio_add_page(pkt->w_bio, pages[f], CD_FRAMESIZE, offsets[f]))
1066 BUG();
1067 }
1068 }
1069 VPRINTK("pktcdvd: vcnt=%d\n", pkt->w_bio->bi_vcnt); 1062 VPRINTK("pktcdvd: vcnt=%d\n", pkt->w_bio->bi_vcnt);
1070 1063
1071 atomic_set(&pkt->io_wait, 1); 1064 atomic_set(&pkt->io_wait, 1);
@@ -1504,40 +1497,42 @@ static int pkt_set_write_settings(struct pktcdvd_device *pd)
1504} 1497}
1505 1498
1506/* 1499/*
1507 * 0 -- we can write to this track, 1 -- we can't 1500 * 1 -- we can write to this track, 0 -- we can't
1508 */ 1501 */
1509static int pkt_good_track(track_information *ti) 1502static int pkt_writable_track(struct pktcdvd_device *pd, track_information *ti)
1510{ 1503{
1511 /* 1504 switch (pd->mmc3_profile) {
1512 * only good for CD-RW at the moment, not DVD-RW 1505 case 0x1a: /* DVD+RW */
1513 */ 1506 case 0x12: /* DVD-RAM */
1507 /* The track is always writable on DVD+RW/DVD-RAM */
1508 return 1;
1509 default:
1510 break;
1511 }
1514 1512
1515 /* 1513 if (!ti->packet || !ti->fp)
1516 * FIXME: only for FP
1517 */
1518 if (ti->fp == 0)
1519 return 0; 1514 return 0;
1520 1515
1521 /* 1516 /*
1522 * "good" settings as per Mt Fuji. 1517 * "good" settings as per Mt Fuji.
1523 */ 1518 */
1524 if (ti->rt == 0 && ti->blank == 0 && ti->packet == 1) 1519 if (ti->rt == 0 && ti->blank == 0)
1525 return 0; 1520 return 1;
1526 1521
1527 if (ti->rt == 0 && ti->blank == 1 && ti->packet == 1) 1522 if (ti->rt == 0 && ti->blank == 1)
1528 return 0; 1523 return 1;
1529 1524
1530 if (ti->rt == 1 && ti->blank == 0 && ti->packet == 1) 1525 if (ti->rt == 1 && ti->blank == 0)
1531 return 0; 1526 return 1;
1532 1527
1533 printk("pktcdvd: bad state %d-%d-%d\n", ti->rt, ti->blank, ti->packet); 1528 printk("pktcdvd: bad state %d-%d-%d\n", ti->rt, ti->blank, ti->packet);
1534 return 1; 1529 return 0;
1535} 1530}
1536 1531
1537/* 1532/*
1538 * 0 -- we can write to this disc, 1 -- we can't 1533 * 1 -- we can write to this disc, 0 -- we can't
1539 */ 1534 */
1540static int pkt_good_disc(struct pktcdvd_device *pd, disc_information *di) 1535static int pkt_writable_disc(struct pktcdvd_device *pd, disc_information *di)
1541{ 1536{
1542 switch (pd->mmc3_profile) { 1537 switch (pd->mmc3_profile) {
1543 case 0x0a: /* CD-RW */ 1538 case 0x0a: /* CD-RW */
@@ -1546,10 +1541,10 @@ static int pkt_good_disc(struct pktcdvd_device *pd, disc_information *di)
1546 case 0x1a: /* DVD+RW */ 1541 case 0x1a: /* DVD+RW */
1547 case 0x13: /* DVD-RW */ 1542 case 0x13: /* DVD-RW */
1548 case 0x12: /* DVD-RAM */ 1543 case 0x12: /* DVD-RAM */
1549 return 0;
1550 default:
1551 printk("pktcdvd: Wrong disc profile (%x)\n", pd->mmc3_profile);
1552 return 1; 1544 return 1;
1545 default:
1546 VPRINTK("pktcdvd: Wrong disc profile (%x)\n", pd->mmc3_profile);
1547 return 0;
1553 } 1548 }
1554 1549
1555 /* 1550 /*
@@ -1558,25 +1553,25 @@ static int pkt_good_disc(struct pktcdvd_device *pd, disc_information *di)
1558 */ 1553 */
1559 if (di->disc_type == 0xff) { 1554 if (di->disc_type == 0xff) {
1560 printk("pktcdvd: Unknown disc. No track?\n"); 1555 printk("pktcdvd: Unknown disc. No track?\n");
1561 return 1; 1556 return 0;
1562 } 1557 }
1563 1558
1564 if (di->disc_type != 0x20 && di->disc_type != 0) { 1559 if (di->disc_type != 0x20 && di->disc_type != 0) {
1565 printk("pktcdvd: Wrong disc type (%x)\n", di->disc_type); 1560 printk("pktcdvd: Wrong disc type (%x)\n", di->disc_type);
1566 return 1; 1561 return 0;
1567 } 1562 }
1568 1563
1569 if (di->erasable == 0) { 1564 if (di->erasable == 0) {
1570 printk("pktcdvd: Disc not erasable\n"); 1565 printk("pktcdvd: Disc not erasable\n");
1571 return 1; 1566 return 0;
1572 } 1567 }
1573 1568
1574 if (di->border_status == PACKET_SESSION_RESERVED) { 1569 if (di->border_status == PACKET_SESSION_RESERVED) {
1575 printk("pktcdvd: Can't write to last track (reserved)\n"); 1570 printk("pktcdvd: Can't write to last track (reserved)\n");
1576 return 1; 1571 return 0;
1577 } 1572 }
1578 1573
1579 return 0; 1574 return 1;
1580} 1575}
1581 1576
1582static int pkt_probe_settings(struct pktcdvd_device *pd) 1577static int pkt_probe_settings(struct pktcdvd_device *pd)
@@ -1601,23 +1596,9 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
1601 return ret; 1596 return ret;
1602 } 1597 }
1603 1598
1604 if (pkt_good_disc(pd, &di)) 1599 if (!pkt_writable_disc(pd, &di))
1605 return -ENXIO; 1600 return -EROFS;
1606 1601
1607 switch (pd->mmc3_profile) {
1608 case 0x1a: /* DVD+RW */
1609 printk("pktcdvd: inserted media is DVD+RW\n");
1610 break;
1611 case 0x13: /* DVD-RW */
1612 printk("pktcdvd: inserted media is DVD-RW\n");
1613 break;
1614 case 0x12: /* DVD-RAM */
1615 printk("pktcdvd: inserted media is DVD-RAM\n");
1616 break;
1617 default:
1618 printk("pktcdvd: inserted media is CD-R%s\n", di.erasable ? "W" : "");
1619 break;
1620 }
1621 pd->type = di.erasable ? PACKET_CDRW : PACKET_CDR; 1602 pd->type = di.erasable ? PACKET_CDRW : PACKET_CDR;
1622 1603
1623 track = 1; /* (di.last_track_msb << 8) | di.last_track_lsb; */ 1604 track = 1; /* (di.last_track_msb << 8) | di.last_track_lsb; */
@@ -1626,9 +1607,9 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
1626 return ret; 1607 return ret;
1627 } 1608 }
1628 1609
1629 if (pkt_good_track(&ti)) { 1610 if (!pkt_writable_track(pd, &ti)) {
1630 printk("pktcdvd: can't write to this track\n"); 1611 printk("pktcdvd: can't write to this track\n");
1631 return -ENXIO; 1612 return -EROFS;
1632 } 1613 }
1633 1614
1634 /* 1615 /*
@@ -1642,7 +1623,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
1642 } 1623 }
1643 if (pd->settings.size > PACKET_MAX_SECTORS) { 1624 if (pd->settings.size > PACKET_MAX_SECTORS) {
1644 printk("pktcdvd: packet size is too big\n"); 1625 printk("pktcdvd: packet size is too big\n");
1645 return -ENXIO; 1626 return -EROFS;
1646 } 1627 }
1647 pd->settings.fp = ti.fp; 1628 pd->settings.fp = ti.fp;
1648 pd->offset = (be32_to_cpu(ti.track_start) << 2) & (pd->settings.size - 1); 1629 pd->offset = (be32_to_cpu(ti.track_start) << 2) & (pd->settings.size - 1);
@@ -1684,7 +1665,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
1684 break; 1665 break;
1685 default: 1666 default:
1686 printk("pktcdvd: unknown data mode\n"); 1667 printk("pktcdvd: unknown data mode\n");
1687 return 1; 1668 return -EROFS;
1688 } 1669 }
1689 return 0; 1670 return 0;
1690} 1671}
@@ -1894,8 +1875,8 @@ static int pkt_open_write(struct pktcdvd_device *pd)
1894 unsigned int write_speed, media_write_speed, read_speed; 1875 unsigned int write_speed, media_write_speed, read_speed;
1895 1876
1896 if ((ret = pkt_probe_settings(pd))) { 1877 if ((ret = pkt_probe_settings(pd))) {
1897 DPRINTK("pktcdvd: %s failed probe\n", pd->name); 1878 VPRINTK("pktcdvd: %s failed probe\n", pd->name);
1898 return -EIO; 1879 return ret;
1899 } 1880 }
1900 1881
1901 if ((ret = pkt_set_write_settings(pd))) { 1882 if ((ret = pkt_set_write_settings(pd))) {
@@ -2053,10 +2034,9 @@ static int pkt_open(struct inode *inode, struct file *file)
2053 goto out_dec; 2034 goto out_dec;
2054 } 2035 }
2055 } else { 2036 } else {
2056 if (pkt_open_dev(pd, file->f_mode & FMODE_WRITE)) { 2037 ret = pkt_open_dev(pd, file->f_mode & FMODE_WRITE);
2057 ret = -EIO; 2038 if (ret)
2058 goto out_dec; 2039 goto out_dec;
2059 }
2060 /* 2040 /*
2061 * needed here as well, since ext2 (among others) may change 2041 * needed here as well, since ext2 (among others) may change
2062 * the blocksize at mount time 2042 * the blocksize at mount time
@@ -2436,11 +2416,12 @@ static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
2436 * The door gets locked when the device is opened, so we 2416 * The door gets locked when the device is opened, so we
2437 * have to unlock it or else the eject command fails. 2417 * have to unlock it or else the eject command fails.
2438 */ 2418 */
2439 pkt_lock_door(pd, 0); 2419 if (pd->refcnt == 1)
2420 pkt_lock_door(pd, 0);
2440 return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); 2421 return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg);
2441 2422
2442 default: 2423 default:
2443 printk("pktcdvd: Unknown ioctl for %s (%x)\n", pd->name, cmd); 2424 VPRINTK("pktcdvd: Unknown ioctl for %s (%x)\n", pd->name, cmd);
2444 return -ENOTTY; 2425 return -ENOTTY;
2445 } 2426 }
2446 2427
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index e522d19ad886..7e21b1ff27c4 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -474,18 +474,6 @@ static int bt3c_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long
474/* ======================== Card services HCI interaction ======================== */ 474/* ======================== Card services HCI interaction ======================== */
475 475
476 476
477static struct device *bt3c_device(void)
478{
479 static struct device dev = {
480 .bus_id = "pcmcia",
481 };
482 kobject_set_name(&dev.kobj, "bt3c");
483 kobject_init(&dev.kobj);
484
485 return &dev;
486}
487
488
489static int bt3c_load_firmware(bt3c_info_t *info, unsigned char *firmware, int count) 477static int bt3c_load_firmware(bt3c_info_t *info, unsigned char *firmware, int count)
490{ 478{
491 char *ptr = (char *) firmware; 479 char *ptr = (char *) firmware;
@@ -574,6 +562,7 @@ static int bt3c_open(bt3c_info_t *info)
574{ 562{
575 const struct firmware *firmware; 563 const struct firmware *firmware;
576 struct hci_dev *hdev; 564 struct hci_dev *hdev;
565 client_handle_t handle;
577 int err; 566 int err;
578 567
579 spin_lock_init(&(info->lock)); 568 spin_lock_init(&(info->lock));
@@ -605,8 +594,10 @@ static int bt3c_open(bt3c_info_t *info)
605 594
606 hdev->owner = THIS_MODULE; 595 hdev->owner = THIS_MODULE;
607 596
597 handle = info->link.handle;
598
608 /* Load firmware */ 599 /* Load firmware */
609 err = request_firmware(&firmware, "BT3CPCC.bin", bt3c_device()); 600 err = request_firmware(&firmware, "BT3CPCC.bin", &handle_to_dev(handle));
610 if (err < 0) { 601 if (err < 0) {
611 BT_ERR("Firmware request failed"); 602 BT_ERR("Firmware request failed");
612 goto error; 603 goto error;
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
index 486ed8a11b59..a4d425d2dce2 100644
--- a/drivers/char/agp/Kconfig
+++ b/drivers/char/agp/Kconfig
@@ -15,22 +15,23 @@ config AGP
15 due to kernel allocation issues), you could use PCI accesses 15 due to kernel allocation issues), you could use PCI accesses
16 and have up to a couple gigs of texture space. 16 and have up to a couple gigs of texture space.
17 17
18 Note that this is the only means to have XFree4/GLX use 18 Note that this is the only means to have X/GLX use
19 write-combining with MTRR support on the AGP bus. Without it, OpenGL 19 write-combining with MTRR support on the AGP bus. Without it, OpenGL
20 direct rendering will be a lot slower but still faster than PIO. 20 direct rendering will be a lot slower but still faster than PIO.
21 21
22 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
23 use GLX or DRI. If unsure, say N.
24
25 To compile this driver as a module, choose M here: the 22 To compile this driver as a module, choose M here: the
26 module will be called agpgart. 23 module will be called agpgart.
27 24
25 You should say Y here if you want to use GLX or DRI.
26
27 If unsure, say N.
28
28config AGP_ALI 29config AGP_ALI
29 tristate "ALI chipset support" 30 tristate "ALI chipset support"
30 depends on AGP && X86_32 31 depends on AGP && X86_32
31 ---help--- 32 ---help---
32 This option gives you AGP support for the GLX component of 33 This option gives you AGP support for the GLX component of
33 XFree86 4.x on the following ALi chipsets. The supported chipsets 34 X on the following ALi chipsets. The supported chipsets
34 include M1541, M1621, M1631, M1632, M1641,M1647,and M1651. 35 include M1541, M1621, M1631, M1632, M1641,M1647,and M1651.
35 For the ALi-chipset question, ALi suggests you refer to 36 For the ALi-chipset question, ALi suggests you refer to
36 <http://www.ali.com.tw/eng/support/index.shtml>. 37 <http://www.ali.com.tw/eng/support/index.shtml>.
@@ -40,28 +41,19 @@ config AGP_ALI
40 timing issues, this chipset cannot do AGP 2x with the G200. 41 timing issues, this chipset cannot do AGP 2x with the G200.
41 This is a hardware limitation. AGP 1x seems to be fine, though. 42 This is a hardware limitation. AGP 1x seems to be fine, though.
42 43
43 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
44 use GLX or DRI. If unsure, say N.
45
46config AGP_ATI 44config AGP_ATI
47 tristate "ATI chipset support" 45 tristate "ATI chipset support"
48 depends on AGP && X86_32 46 depends on AGP && X86_32
49 ---help--- 47 ---help---
50 This option gives you AGP support for the GLX component of 48 This option gives you AGP support for the GLX component of
51 XFree86 4.x on the ATI RadeonIGP family of chipsets. 49 X on the ATI RadeonIGP family of chipsets.
52
53 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
54 use GLX or DRI. If unsure, say N.
55 50
56config AGP_AMD 51config AGP_AMD
57 tristate "AMD Irongate, 761, and 762 chipset support" 52 tristate "AMD Irongate, 761, and 762 chipset support"
58 depends on AGP && X86_32 53 depends on AGP && X86_32
59 help 54 help
60 This option gives you AGP support for the GLX component of 55 This option gives you AGP support for the GLX component of
61 XFree86 4.x on AMD Irongate, 761, and 762 chipsets. 56 X on AMD Irongate, 761, and 762 chipsets.
62
63 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
64 use GLX or DRI. If unsure, say N.
65 57
66config AGP_AMD64 58config AGP_AMD64
67 tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU 59 tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU
@@ -69,45 +61,38 @@ config AGP_AMD64
69 default y if GART_IOMMU 61 default y if GART_IOMMU
70 help 62 help
71 This option gives you AGP support for the GLX component of 63 This option gives you AGP support for the GLX component of
72 XFree86 4.x using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs. 64 X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
73 You still need an external AGP bridge like the AMD 8151, VIA 65 You still need an external AGP bridge like the AMD 8151, VIA
74 K8T400M, SiS755. It may also support other AGP bridges when loaded 66 K8T400M, SiS755. It may also support other AGP bridges when loaded
75 with agp_try_unsupported=1. 67 with agp_try_unsupported=1.
76 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
77 use GLX or DRI. If unsure, say Y
78 68
79config AGP_INTEL 69config AGP_INTEL
80 tristate "Intel 440LX/BX/GX, I8xx and E7x05 chipset support" 70 tristate "Intel 440LX/BX/GX, I8xx and E7x05 chipset support"
81 depends on AGP && X86 71 depends on AGP && X86
82 help 72 help
83 This option gives you AGP support for the GLX component of XFree86 4.x 73 This option gives you AGP support for the GLX component of X
84 on Intel 440LX/BX/GX, 815, 820, 830, 840, 845, 850, 860, 875, 74 on Intel 440LX/BX/GX, 815, 820, 830, 840, 845, 850, 860, 875,
85 E7205 and E7505 chipsets and full support for the 810, 815, 830M, 845G, 75 E7205 and E7505 chipsets and full support for the 810, 815, 830M,
86 852GM, 855GM, 865G and I915 integrated graphics chipsets. 76 845G, 852GM, 855GM, 865G and I915 integrated graphics chipsets.
77
87 78
88 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
89 use GLX or DRI, or if you have any Intel integrated graphics
90 chipsets. If unsure, say Y.
91 79
92config AGP_NVIDIA 80config AGP_NVIDIA
93 tristate "NVIDIA nForce/nForce2 chipset support" 81 tristate "NVIDIA nForce/nForce2 chipset support"
94 depends on AGP && X86_32 82 depends on AGP && X86_32
95 help 83 help
96 This option gives you AGP support for the GLX component of 84 This option gives you AGP support for the GLX component of
97 XFree86 4.x on the following NVIDIA chipsets. The supported chipsets 85 X on NVIDIA chipsets including nForce and nForce2
98 include nForce and nForce2
99 86
100config AGP_SIS 87config AGP_SIS
101 tristate "SiS chipset support" 88 tristate "SiS chipset support"
102 depends on AGP && X86_32 89 depends on AGP && X86_32
103 help 90 help
104 This option gives you AGP support for the GLX component of 91 This option gives you AGP support for the GLX component of
105 XFree86 4.x on Silicon Integrated Systems [SiS] chipsets. 92 X on Silicon Integrated Systems [SiS] chipsets.
106 93
107 Note that 5591/5592 AGP chipsets are NOT supported. 94 Note that 5591/5592 AGP chipsets are NOT supported.
108 95
109 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
110 use GLX or DRI. If unsure, say N.
111 96
112config AGP_SWORKS 97config AGP_SWORKS
113 tristate "Serverworks LE/HE chipset support" 98 tristate "Serverworks LE/HE chipset support"
@@ -121,10 +106,7 @@ config AGP_VIA
121 depends on AGP && X86_32 106 depends on AGP && X86_32
122 help 107 help
123 This option gives you AGP support for the GLX component of 108 This option gives you AGP support for the GLX component of
124 XFree86 4.x on VIA MVP3/Apollo Pro chipsets. 109 X on VIA MVP3/Apollo Pro chipsets.
125
126 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
127 use GLX or DRI. If unsure, say N.
128 110
129config AGP_I460 111config AGP_I460
130 tristate "Intel 460GX chipset support" 112 tristate "Intel 460GX chipset support"
@@ -159,9 +141,6 @@ config AGP_EFFICEON
159 This option gives you AGP support for the Transmeta Efficeon 141 This option gives you AGP support for the Transmeta Efficeon
160 series processors with integrated northbridges. 142 series processors with integrated northbridges.
161 143
162 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
163 use GLX or DRI. If unsure, say Y.
164
165config AGP_SGI_TIOCA 144config AGP_SGI_TIOCA
166 tristate "SGI TIO chipset AGP support" 145 tristate "SGI TIO chipset AGP support"
167 depends on AGP && (IA64_SGI_SN2 || IA64_GENERIC) 146 depends on AGP && (IA64_SGI_SN2 || IA64_GENERIC)
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 9964c508c111..1251b2515bbe 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -516,8 +516,10 @@ static int __devinit nforce3_agp_init(struct pci_dev *pdev)
516 pci_read_config_dword (hammers[0], AMD64_GARTAPERTUREBASE, &apbase); 516 pci_read_config_dword (hammers[0], AMD64_GARTAPERTUREBASE, &apbase);
517 517
518 /* if x86-64 aperture base is beyond 4G, exit here */ 518 /* if x86-64 aperture base is beyond 4G, exit here */
519 if ( (apbase & 0x7fff) >> (32 - 25) ) 519 if ( (apbase & 0x7fff) >> (32 - 25) ) {
520 return -ENODEV; 520 printk(KERN_INFO PFX "aperture base > 4G\n");
521 return -ENODEV;
522 }
521 523
522 apbase = (apbase & 0x7fff) << 25; 524 apbase = (apbase & 0x7fff) << 25;
523 525
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 268f78d926d3..efef9999f1cf 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -468,9 +468,7 @@ static int __devinit agp_serverworks_probe(struct pci_dev *pdev,
468 468
469 switch (pdev->device) { 469 switch (pdev->device) {
470 case 0x0006: 470 case 0x0006:
471 /* ServerWorks CNB20HE 471 printk (KERN_ERR PFX "ServerWorks CNB20HE is unsupported due to lack of documentation.\n");
472 Fail silently.*/
473 printk (KERN_ERR PFX "Detected ServerWorks CNB20HE chipset: No AGP present.\n");
474 return -ENODEV; 472 return -ENODEV;
475 473
476 case PCI_DEVICE_ID_SERVERWORKS_HE: 474 case PCI_DEVICE_ID_SERVERWORKS_HE:
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h
index 8fd6357a48da..2c17e88a8847 100644
--- a/drivers/char/drm/drm_pciids.h
+++ b/drivers/char/drm/drm_pciids.h
@@ -85,7 +85,6 @@
85 {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ 85 {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \
86 {0x1002, 0x596A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 86 {0x1002, 0x596A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
87 {0x1002, 0x596B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 87 {0x1002, 0x596B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
88 {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \
89 {0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \ 88 {0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \
90 {0x1002, 0x5c62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 89 {0x1002, 0x5c62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
91 {0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \ 90 {0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c
index a1381c61aa63..d3879ac9970f 100644
--- a/drivers/char/drm/i915_irq.c
+++ b/drivers/char/drm/i915_irq.c
@@ -202,10 +202,15 @@ void i915_driver_irq_postinstall(drm_device_t * dev)
202void i915_driver_irq_uninstall(drm_device_t * dev) 202void i915_driver_irq_uninstall(drm_device_t * dev)
203{ 203{
204 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 204 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
205 u16 temp;
206
205 if (!dev_priv) 207 if (!dev_priv)
206 return; 208 return;
207 209
208 I915_WRITE16(I915REG_HWSTAM, 0xffff); 210 I915_WRITE16(I915REG_HWSTAM, 0xffff);
209 I915_WRITE16(I915REG_INT_MASK_R, 0xffff); 211 I915_WRITE16(I915REG_INT_MASK_R, 0xffff);
210 I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); 212 I915_WRITE16(I915REG_INT_ENABLE_R, 0x0);
213
214 temp = I915_READ16(I915REG_INT_IDENTITY_R);
215 I915_WRITE16(I915REG_INT_IDENTITY_R, temp);
211} 216}
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c
index 291dbf4c8186..c08fa5076f05 100644
--- a/drivers/char/drm/r300_cmdbuf.c
+++ b/drivers/char/drm/r300_cmdbuf.c
@@ -161,6 +161,7 @@ void r300_init_reg_flags(void)
161 ADD_RANGE(R300_VAP_PVS_CNTL_1, 3); 161 ADD_RANGE(R300_VAP_PVS_CNTL_1, 3);
162 ADD_RANGE(R300_GB_ENABLE, 1); 162 ADD_RANGE(R300_GB_ENABLE, 1);
163 ADD_RANGE(R300_GB_MSPOS0, 5); 163 ADD_RANGE(R300_GB_MSPOS0, 5);
164 ADD_RANGE(R300_TX_CNTL, 1);
164 ADD_RANGE(R300_TX_ENABLE, 1); 165 ADD_RANGE(R300_TX_ENABLE, 1);
165 ADD_RANGE(0x4200, 4); 166 ADD_RANGE(0x4200, 4);
166 ADD_RANGE(0x4214, 1); 167 ADD_RANGE(0x4214, 1);
@@ -489,6 +490,50 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv,
489 490
490 return 0; 491 return 0;
491} 492}
493static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv,
494 drm_radeon_kcmd_buffer_t *cmdbuf)
495{
496 u32 *cmd = (u32 *) cmdbuf->buf;
497 int count, ret;
498 RING_LOCALS;
499
500 count=(cmd[0]>>16) & 0x3fff;
501
502 if (cmd[0] & 0x8000) {
503 u32 offset;
504
505 if (cmd[1] & (RADEON_GMC_SRC_PITCH_OFFSET_CNTL
506 | RADEON_GMC_DST_PITCH_OFFSET_CNTL)) {
507 offset = cmd[2] << 10;
508 ret = r300_check_offset(dev_priv, offset);
509 if (ret) {
510 DRM_ERROR("Invalid bitblt first offset is %08X\n", offset);
511 return DRM_ERR(EINVAL);
512 }
513 }
514
515 if ((cmd[1] & RADEON_GMC_SRC_PITCH_OFFSET_CNTL) &&
516 (cmd[1] & RADEON_GMC_DST_PITCH_OFFSET_CNTL)) {
517 offset = cmd[3] << 10;
518 ret = r300_check_offset(dev_priv, offset);
519 if (ret) {
520 DRM_ERROR("Invalid bitblt second offset is %08X\n", offset);
521 return DRM_ERR(EINVAL);
522 }
523
524 }
525 }
526
527 BEGIN_RING(count+2);
528 OUT_RING(cmd[0]);
529 OUT_RING_TABLE((int *)(cmdbuf->buf + 4), count + 1);
530 ADVANCE_RING();
531
532 cmdbuf->buf += (count+2)*4;
533 cmdbuf->bufsz -= (count+2)*4;
534
535 return 0;
536}
492 537
493static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, 538static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv,
494 drm_radeon_kcmd_buffer_t *cmdbuf) 539 drm_radeon_kcmd_buffer_t *cmdbuf)
@@ -527,6 +572,9 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv,
527 case RADEON_3D_LOAD_VBPNTR: /* load vertex array pointers */ 572 case RADEON_3D_LOAD_VBPNTR: /* load vertex array pointers */
528 return r300_emit_3d_load_vbpntr(dev_priv, cmdbuf, header); 573 return r300_emit_3d_load_vbpntr(dev_priv, cmdbuf, header);
529 574
575 case RADEON_CNTL_BITBLT_MULTI:
576 return r300_emit_bitblt_multi(dev_priv, cmdbuf);
577
530 case RADEON_CP_3D_DRAW_IMMD_2: /* triggers drawing using in-packet vertex data */ 578 case RADEON_CP_3D_DRAW_IMMD_2: /* triggers drawing using in-packet vertex data */
531 case RADEON_CP_3D_DRAW_VBUF_2: /* triggers drawing of vertex buffers setup elsewhere */ 579 case RADEON_CP_3D_DRAW_VBUF_2: /* triggers drawing of vertex buffers setup elsewhere */
532 case RADEON_CP_3D_DRAW_INDX_2: /* triggers drawing using indices to vertex buffer */ 580 case RADEON_CP_3D_DRAW_INDX_2: /* triggers drawing using indices to vertex buffer */
diff --git a/drivers/char/drm/r300_reg.h b/drivers/char/drm/r300_reg.h
index a0ed20e25221..d1e19954406b 100644
--- a/drivers/char/drm/r300_reg.h
+++ b/drivers/char/drm/r300_reg.h
@@ -451,6 +451,9 @@ I am fairly certain that they are correct unless stated otherwise in comments.
451/* END */ 451/* END */
452 452
453/* gap */ 453/* gap */
454/* Zero to flush caches. */
455#define R300_TX_CNTL 0x4100
456
454/* The upper enable bits are guessed, based on fglrx reported limits. */ 457/* The upper enable bits are guessed, based on fglrx reported limits. */
455#define R300_TX_ENABLE 0x4104 458#define R300_TX_ENABLE 0x4104
456# define R300_TX_ENABLE_0 (1 << 0) 459# define R300_TX_ENABLE_0 (1 << 0)
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 498b19b1d641..1f7d2ab8c4fc 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -90,9 +90,10 @@
90 * 1.19- Add support for gart table in FB memory and PCIE r300 90 * 1.19- Add support for gart table in FB memory and PCIE r300
91 * 1.20- Add support for r300 texrect 91 * 1.20- Add support for r300 texrect
92 * 1.21- Add support for card type getparam 92 * 1.21- Add support for card type getparam
93 * 1.22- Add support for texture cache flushes (R300_TX_CNTL)
93 */ 94 */
94#define DRIVER_MAJOR 1 95#define DRIVER_MAJOR 1
95#define DRIVER_MINOR 21 96#define DRIVER_MINOR 22
96#define DRIVER_PATCHLEVEL 0 97#define DRIVER_PATCHLEVEL 0
97 98
98/* 99/*
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 57539d8f9f7c..09dc4b01232c 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -150,17 +150,6 @@ static void rs_wait_until_sent(struct tty_struct *, int);
150/* Standard COM flags (except for COM4, because of the 8514 problem) */ 150/* Standard COM flags (except for COM4, because of the 8514 problem) */
151#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) 151#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
152 152
153/*
154 * tmp_buf is used as a temporary buffer by serial_write. We need to
155 * lock it in case the memcpy_fromfs blocks while swapping in a page,
156 * and some other program tries to do a serial write at the same time.
157 * Since the lock will only come under contention when the system is
158 * swapping and available memory is low, it makes sense to share one
159 * buffer across all the serial ports, since it significantly saves
160 * memory if large numbers of serial ports are open.
161 */
162static unsigned char *tmp_buf;
163
164static inline int serial_paranoia_check(struct esp_struct *info, 153static inline int serial_paranoia_check(struct esp_struct *info,
165 char *name, const char *routine) 154 char *name, const char *routine)
166{ 155{
@@ -1267,7 +1256,7 @@ static int rs_write(struct tty_struct * tty,
1267 if (serial_paranoia_check(info, tty->name, "rs_write")) 1256 if (serial_paranoia_check(info, tty->name, "rs_write"))
1268 return 0; 1257 return 0;
1269 1258
1270 if (!tty || !info->xmit_buf || !tmp_buf) 1259 if (!tty || !info->xmit_buf)
1271 return 0; 1260 return 0;
1272 1261
1273 while (1) { 1262 while (1) {
@@ -2291,11 +2280,7 @@ static int esp_open(struct tty_struct *tty, struct file * filp)
2291 tty->driver_data = info; 2280 tty->driver_data = info;
2292 info->tty = tty; 2281 info->tty = tty;
2293 2282
2294 if (!tmp_buf) { 2283 spin_unlock_irqrestore(&info->lock, flags);
2295 tmp_buf = (unsigned char *) get_zeroed_page(GFP_KERNEL);
2296 if (!tmp_buf)
2297 return -ENOMEM;
2298 }
2299 2284
2300 /* 2285 /*
2301 * Start up serial port 2286 * Start up serial port
@@ -2602,9 +2587,6 @@ static void __exit espserial_exit(void)
2602 free_pages((unsigned long)dma_buffer, 2587 free_pages((unsigned long)dma_buffer,
2603 get_order(DMA_BUFFER_SZ)); 2588 get_order(DMA_BUFFER_SZ));
2604 2589
2605 if (tmp_buf)
2606 free_page((unsigned long)tmp_buf);
2607
2608 while (free_pio_buf) { 2590 while (free_pio_buf) {
2609 pio_buf = free_pio_buf->next; 2591 pio_buf = free_pio_buf->next;
2610 kfree(free_pio_buf); 2592 kfree(free_pio_buf);
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 66a2fee06eb9..ef140ebde117 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -956,22 +956,18 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
956 } 956 }
957 } else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) { 957 } else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) {
958 struct acpi_resource_extended_irq *irqp; 958 struct acpi_resource_extended_irq *irqp;
959 int i; 959 int i, irq;
960 960
961 irqp = &res->data.extended_irq; 961 irqp = &res->data.extended_irq;
962 962
963 if (irqp->interrupt_count > 0) { 963 for (i = 0; i < irqp->interrupt_count; i++) {
964 hdp->hd_nirqs = irqp->interrupt_count; 964 irq = acpi_register_gsi(irqp->interrupts[i],
965 965 irqp->triggering, irqp->polarity);
966 for (i = 0; i < hdp->hd_nirqs; i++) { 966 if (irq < 0)
967 int rc = 967 return AE_ERROR;
968 acpi_register_gsi(irqp->interrupts[i], 968
969 irqp->triggering, 969 hdp->hd_irq[hdp->hd_nirqs] = irq;
970 irqp->polarity); 970 hdp->hd_nirqs++;
971 if (rc < 0)
972 return AE_ERROR;
973 hdp->hd_irq[i] = rc;
974 }
975 } 971 }
976 } 972 }
977 973
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 1994a92d4733..f65b2e14a485 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -335,6 +335,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
335 } /* else count == 0 */ 335 } /* else count == 0 */
336 336
337 tty->driver_data = hp; 337 tty->driver_data = hp;
338 tty->low_latency = 1; /* Makes flushes to ldisc synchronous. */
339
338 hp->tty = tty; 340 hp->tty = tty;
339 /* Save for request_irq outside of spin_lock. */ 341 /* Save for request_irq outside of spin_lock. */
340 irq = hp->irq; 342 irq = hp->irq;
@@ -633,9 +635,6 @@ static int hvc_poll(struct hvc_struct *hp)
633 tty_insert_flip_char(tty, buf[i], 0); 635 tty_insert_flip_char(tty, buf[i], 0);
634 } 636 }
635 637
636 if (count)
637 tty_schedule_flip(tty);
638
639 /* 638 /*
640 * Account for the total amount read in one loop, and if above 639 * Account for the total amount read in one loop, and if above
641 * 64 bytes, we do a quick schedule loop to let the tty grok 640 * 64 bytes, we do a quick schedule loop to let the tty grok
@@ -656,6 +655,9 @@ static int hvc_poll(struct hvc_struct *hp)
656 bail: 655 bail:
657 spin_unlock_irqrestore(&hp->lock, flags); 656 spin_unlock_irqrestore(&hp->lock, flags);
658 657
658 if (read_total)
659 tty_flip_buffer_push(tty);
660
659 return poll_mask; 661 return poll_mask;
660} 662}
661 663
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 5765f672e853..d58f82318853 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -243,7 +243,7 @@ static struct sysrq_key_op sysrq_term_op = {
243 243
244static void moom_callback(void *ignored) 244static void moom_callback(void *ignored)
245{ 245{
246 out_of_memory(GFP_KERNEL, 0); 246 out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL], GFP_KERNEL, 0);
247} 247}
248 248
249static DECLARE_WORK(moom_work, moom_callback, NULL); 249static DECLARE_WORK(moom_work, moom_callback, NULL);
diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c
index 41a94bc79f67..eb2eb3e12d6a 100644
--- a/drivers/char/tipar.c
+++ b/drivers/char/tipar.c
@@ -250,12 +250,17 @@ tipar_open(struct inode *inode, struct file *file)
250{ 250{
251 unsigned int minor = iminor(inode) - TIPAR_MINOR; 251 unsigned int minor = iminor(inode) - TIPAR_MINOR;
252 252
253 if (minor > tp_count - 1) 253 if (tp_count == 0 || minor > tp_count - 1)
254 return -ENXIO; 254 return -ENXIO;
255 255
256 if (test_and_set_bit(minor, &opened)) 256 if (test_and_set_bit(minor, &opened))
257 return -EBUSY; 257 return -EBUSY;
258 258
259 if (!table[minor].dev) {
260 printk(KERN_ERR "%s: NULL device for minor %u\n",
261 __FUNCTION__, minor);
262 return -ENXIO;
263 }
259 parport_claim_or_block(table[minor].dev); 264 parport_claim_or_block(table[minor].dev);
260 init_ti_parallel(minor); 265 init_ti_parallel(minor);
261 parport_release(table[minor].dev); 266 parport_release(table[minor].dev);
@@ -510,16 +515,20 @@ tipar_init_module(void)
510 err = PTR_ERR(tipar_class); 515 err = PTR_ERR(tipar_class);
511 goto out_chrdev; 516 goto out_chrdev;
512 } 517 }
513 if (parport_register_driver(&tipar_driver)) { 518 if (parport_register_driver(&tipar_driver) || tp_count == 0) {
514 printk(KERN_ERR "tipar: unable to register with parport\n"); 519 printk(KERN_ERR "tipar: unable to register with parport\n");
515 err = -EIO; 520 err = -EIO;
516 goto out; 521 goto out_class;
517 } 522 }
518 523
519 err = 0; 524 err = 0;
520 goto out; 525 goto out;
521 526
527out_class:
528 class_destroy(tipar_class);
529
522out_chrdev: 530out_chrdev:
531 devfs_remove("ticables/par");
523 unregister_chrdev(TIPAR_MAJOR, "tipar"); 532 unregister_chrdev(TIPAR_MAJOR, "tipar");
524out: 533out:
525 return err; 534 return err;
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
index ec7590951af5..24095f6ee6da 100644
--- a/drivers/char/tpm/tpm_infineon.c
+++ b/drivers/char/tpm/tpm_infineon.c
@@ -33,6 +33,7 @@
33static int TPM_INF_DATA; 33static int TPM_INF_DATA;
34static int TPM_INF_ADDR; 34static int TPM_INF_ADDR;
35static int TPM_INF_BASE; 35static int TPM_INF_BASE;
36static int TPM_INF_ADDR_LEN;
36static int TPM_INF_PORT_LEN; 37static int TPM_INF_PORT_LEN;
37 38
38/* TPM header definitions */ 39/* TPM header definitions */
@@ -195,6 +196,7 @@ static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count)
195 int i; 196 int i;
196 int ret; 197 int ret;
197 u32 size = 0; 198 u32 size = 0;
199 number_of_wtx = 0;
198 200
199recv_begin: 201recv_begin:
200 /* start receiving header */ 202 /* start receiving header */
@@ -378,24 +380,35 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
378 if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && 380 if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) &&
379 !(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) { 381 !(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) {
380 TPM_INF_ADDR = pnp_port_start(dev, 0); 382 TPM_INF_ADDR = pnp_port_start(dev, 0);
383 TPM_INF_ADDR_LEN = pnp_port_len(dev, 0);
381 TPM_INF_DATA = (TPM_INF_ADDR + 1); 384 TPM_INF_DATA = (TPM_INF_ADDR + 1);
382 TPM_INF_BASE = pnp_port_start(dev, 1); 385 TPM_INF_BASE = pnp_port_start(dev, 1);
383 TPM_INF_PORT_LEN = pnp_port_len(dev, 1); 386 TPM_INF_PORT_LEN = pnp_port_len(dev, 1);
384 if (!TPM_INF_PORT_LEN) 387 if ((TPM_INF_PORT_LEN < 4) || (TPM_INF_ADDR_LEN < 2)) {
385 return -EINVAL; 388 rc = -EINVAL;
389 goto err_last;
390 }
386 dev_info(&dev->dev, "Found %s with ID %s\n", 391 dev_info(&dev->dev, "Found %s with ID %s\n",
387 dev->name, dev_id->id); 392 dev->name, dev_id->id);
388 if (!((TPM_INF_BASE >> 8) & 0xff)) 393 if (!((TPM_INF_BASE >> 8) & 0xff)) {
389 return -EINVAL; 394 rc = -EINVAL;
395 goto err_last;
396 }
390 /* publish my base address and request region */ 397 /* publish my base address and request region */
391 tpm_inf.base = TPM_INF_BASE; 398 tpm_inf.base = TPM_INF_BASE;
392 if (request_region 399 if (request_region
393 (tpm_inf.base, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) { 400 (tpm_inf.base, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) {
394 release_region(tpm_inf.base, TPM_INF_PORT_LEN); 401 rc = -EINVAL;
395 return -EINVAL; 402 goto err_last;
403 }
404 if (request_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN,
405 "tpm_infineon0") == NULL) {
406 rc = -EINVAL;
407 goto err_last;
396 } 408 }
397 } else { 409 } else {
398 return -EINVAL; 410 rc = -EINVAL;
411 goto err_last;
399 } 412 }
400 413
401 /* query chip for its vendor, its version number a.s.o. */ 414 /* query chip for its vendor, its version number a.s.o. */
@@ -443,8 +456,8 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
443 dev_err(&dev->dev, 456 dev_err(&dev->dev,
444 "Could not set IO-ports to 0x%lx\n", 457 "Could not set IO-ports to 0x%lx\n",
445 tpm_inf.base); 458 tpm_inf.base);
446 release_region(tpm_inf.base, TPM_INF_PORT_LEN); 459 rc = -EIO;
447 return -EIO; 460 goto err_release_region;
448 } 461 }
449 462
450 /* activate register */ 463 /* activate register */
@@ -471,14 +484,21 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
471 484
472 rc = tpm_register_hardware(&dev->dev, &tpm_inf); 485 rc = tpm_register_hardware(&dev->dev, &tpm_inf);
473 if (rc < 0) { 486 if (rc < 0) {
474 release_region(tpm_inf.base, TPM_INF_PORT_LEN); 487 rc = -ENODEV;
475 return -ENODEV; 488 goto err_release_region;
476 } 489 }
477 return 0; 490 return 0;
478 } else { 491 } else {
479 dev_info(&dev->dev, "No Infineon TPM found!\n"); 492 rc = -ENODEV;
480 return -ENODEV; 493 goto err_release_region;
481 } 494 }
495
496err_release_region:
497 release_region(tpm_inf.base, TPM_INF_PORT_LEN);
498 release_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN);
499
500err_last:
501 return rc;
482} 502}
483 503
484static __devexit void tpm_inf_pnp_remove(struct pnp_dev *dev) 504static __devexit void tpm_inf_pnp_remove(struct pnp_dev *dev)
@@ -518,5 +538,5 @@ module_exit(cleanup_inf);
518 538
519MODULE_AUTHOR("Marcel Selhorst <selhorst@crypto.rub.de>"); 539MODULE_AUTHOR("Marcel Selhorst <selhorst@crypto.rub.de>");
520MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2"); 540MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2");
521MODULE_VERSION("1.6"); 541MODULE_VERSION("1.7");
522MODULE_LICENSE("GPL"); 542MODULE_LICENSE("GPL");
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 076e07c1da38..e9bba94fc898 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;
@@ -1836,7 +1841,6 @@ static void release_dev(struct file * filp)
1836 tty_closing = tty->count <= 1; 1841 tty_closing = tty->count <= 1;
1837 o_tty_closing = o_tty && 1842 o_tty_closing = o_tty &&
1838 (o_tty->count <= (pty_master ? 1 : 0)); 1843 (o_tty->count <= (pty_master ? 1 : 0));
1839 up(&tty_sem);
1840 do_sleep = 0; 1844 do_sleep = 0;
1841 1845
1842 if (tty_closing) { 1846 if (tty_closing) {
@@ -1864,6 +1868,7 @@ static void release_dev(struct file * filp)
1864 1868
1865 printk(KERN_WARNING "release_dev: %s: read/write wait queue " 1869 printk(KERN_WARNING "release_dev: %s: read/write wait queue "
1866 "active!\n", tty_name(tty, buf)); 1870 "active!\n", tty_name(tty, buf));
1871 up(&tty_sem);
1867 schedule(); 1872 schedule();
1868 } 1873 }
1869 1874
@@ -1872,8 +1877,6 @@ static void release_dev(struct file * filp)
1872 * both sides, and we've completed the last operation that could 1877 * both sides, and we've completed the last operation that could
1873 * block, so it's safe to proceed with closing. 1878 * block, so it's safe to proceed with closing.
1874 */ 1879 */
1875
1876 down(&tty_sem);
1877 if (pty_master) { 1880 if (pty_master) {
1878 if (--o_tty->count < 0) { 1881 if (--o_tty->count < 0) {
1879 printk(KERN_WARNING "release_dev: bad pty slave count " 1882 printk(KERN_WARNING "release_dev: bad pty slave count "
@@ -1887,7 +1890,6 @@ static void release_dev(struct file * filp)
1887 tty->count, tty_name(tty, buf)); 1890 tty->count, tty_name(tty, buf));
1888 tty->count = 0; 1891 tty->count = 0;
1889 } 1892 }
1890 up(&tty_sem);
1891 1893
1892 /* 1894 /*
1893 * We've decremented tty->count, so we need to remove this file 1895 * We've decremented tty->count, so we need to remove this file
@@ -1932,6 +1934,8 @@ static void release_dev(struct file * filp)
1932 read_unlock(&tasklist_lock); 1934 read_unlock(&tasklist_lock);
1933 } 1935 }
1934 1936
1937 up(&tty_sem);
1938
1935 /* check whether both sides are closing ... */ 1939 /* check whether both sides are closing ... */
1936 if (!tty_closing || (o_tty && !o_tty_closing)) 1940 if (!tty_closing || (o_tty && !o_tty_closing))
1937 return; 1941 return;
@@ -2752,6 +2756,9 @@ static void flush_to_ldisc(void *private_)
2752 unsigned long flags; 2756 unsigned long flags;
2753 struct tty_ldisc *disc; 2757 struct tty_ldisc *disc;
2754 struct tty_buffer *tbuf; 2758 struct tty_buffer *tbuf;
2759 int count;
2760 char *char_buf;
2761 unsigned char *flag_buf;
2755 2762
2756 disc = tty_ldisc_ref(tty); 2763 disc = tty_ldisc_ref(tty);
2757 if (disc == NULL) /* !TTY_LDISC */ 2764 if (disc == NULL) /* !TTY_LDISC */
@@ -2765,16 +2772,20 @@ static void flush_to_ldisc(void *private_)
2765 goto out; 2772 goto out;
2766 } 2773 }
2767 spin_lock_irqsave(&tty->buf.lock, flags); 2774 spin_lock_irqsave(&tty->buf.lock, flags);
2768 while((tbuf = tty->buf.head) != NULL && !tbuf->active) { 2775 while((tbuf = tty->buf.head) != NULL) {
2776 while ((count = tbuf->commit - tbuf->read) != 0) {
2777 char_buf = tbuf->char_buf_ptr + tbuf->read;
2778 flag_buf = tbuf->flag_buf_ptr + tbuf->read;
2779 tbuf->read += count;
2780 spin_unlock_irqrestore(&tty->buf.lock, flags);
2781 disc->receive_buf(tty, char_buf, flag_buf, count);
2782 spin_lock_irqsave(&tty->buf.lock, flags);
2783 }
2784 if (tbuf->active)
2785 break;
2769 tty->buf.head = tbuf->next; 2786 tty->buf.head = tbuf->next;
2770 if (tty->buf.head == NULL) 2787 if (tty->buf.head == NULL)
2771 tty->buf.tail = NULL; 2788 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); 2789 tty_buffer_free(tty, tbuf);
2779 } 2790 }
2780 spin_unlock_irqrestore(&tty->buf.lock, flags); 2791 spin_unlock_irqrestore(&tty->buf.lock, flags);
@@ -2871,8 +2882,10 @@ void tty_flip_buffer_push(struct tty_struct *tty)
2871{ 2882{
2872 unsigned long flags; 2883 unsigned long flags;
2873 spin_lock_irqsave(&tty->buf.lock, flags); 2884 spin_lock_irqsave(&tty->buf.lock, flags);
2874 if (tty->buf.tail != NULL) 2885 if (tty->buf.tail != NULL) {
2875 tty->buf.tail->active = 0; 2886 tty->buf.tail->active = 0;
2887 tty->buf.tail->commit = tty->buf.tail->used;
2888 }
2876 spin_unlock_irqrestore(&tty->buf.lock, flags); 2889 spin_unlock_irqrestore(&tty->buf.lock, flags);
2877 2890
2878 if (tty->low_latency) 2891 if (tty->low_latency)
diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c
index 37c9e13ad3ac..8d6b249ad66b 100644
--- a/drivers/char/watchdog/pcwd.c
+++ b/drivers/char/watchdog/pcwd.c
@@ -49,29 +49,37 @@
49 * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/ 49 * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/
50 */ 50 */
51 51
52#include <linux/module.h> 52#include <linux/config.h> /* For CONFIG_WATCHDOG_NOWAYOUT/... */
53#include <linux/moduleparam.h> 53#include <linux/module.h> /* For module specific items */
54#include <linux/types.h> 54#include <linux/moduleparam.h> /* For new moduleparam's */
55#include <linux/timer.h> 55#include <linux/types.h> /* For standard types (like size_t) */
56#include <linux/jiffies.h> 56#include <linux/errno.h> /* For the -ENODEV/... values */
57#include <linux/config.h> 57#include <linux/kernel.h> /* For printk/panic/... */
58#include <linux/wait.h> 58#include <linux/delay.h> /* For mdelay function */
59#include <linux/slab.h> 59#include <linux/timer.h> /* For timer related operations */
60#include <linux/ioport.h> 60#include <linux/jiffies.h> /* For jiffies stuff */
61#include <linux/delay.h> 61#include <linux/miscdevice.h> /* For MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR) */
62#include <linux/fs.h> 62#include <linux/watchdog.h> /* For the watchdog specific items */
63#include <linux/miscdevice.h> 63#include <linux/notifier.h> /* For notifier support */
64#include <linux/watchdog.h> 64#include <linux/reboot.h> /* For reboot_notifier stuff */
65#include <linux/notifier.h> 65#include <linux/init.h> /* For __init/__exit/... */
66#include <linux/init.h> 66#include <linux/fs.h> /* For file operations */
67#include <linux/spinlock.h> 67#include <linux/ioport.h> /* For io-port access */
68#include <linux/reboot.h> 68#include <linux/spinlock.h> /* For spin_lock/spin_unlock/... */
69#include <linux/sched.h> /* TASK_INTERRUPTIBLE, set_current_state() and friends */ 69#include <linux/sched.h> /* TASK_INTERRUPTIBLE, set_current_state() and friends */
70#include <asm/uaccess.h> 70#include <linux/slab.h> /* For kmalloc */
71#include <asm/io.h>
72 71
73#define WD_VER "1.16 (06/12/2004)" 72#include <asm/uaccess.h> /* For copy_to_user/put_user/... */
74#define PFX "pcwd: " 73#include <asm/io.h> /* For inb/outb/... */
74
75/* Module and version information */
76#define WATCHDOG_VERSION "1.16"
77#define WATCHDOG_DATE "03 Jan 2006"
78#define WATCHDOG_DRIVER_NAME "ISA-PC Watchdog"
79#define WATCHDOG_NAME "pcwd"
80#define PFX WATCHDOG_NAME ": "
81#define DRIVER_VERSION WATCHDOG_DRIVER_NAME " driver, v" WATCHDOG_VERSION " (" WATCHDOG_DATE ")\n"
82#define WD_VER WATCHDOG_VERSION " (" WATCHDOG_DATE ")"
75 83
76/* 84/*
77 * It should be noted that PCWD_REVISION_B was removed because A and B 85 * It should be noted that PCWD_REVISION_B was removed because A and B
@@ -85,36 +93,38 @@
85 93
86/* 94/*
87 * These are the defines that describe the control status bits for the 95 * These are the defines that describe the control status bits for the
88 * PC Watchdog card, revision A. 96 * PCI-PC Watchdog card.
89 */ 97*/
98/* Port 1 : Control Status #1 for the PC Watchdog card, revision A. */
90#define WD_WDRST 0x01 /* Previously reset state */ 99#define WD_WDRST 0x01 /* Previously reset state */
91#define WD_T110 0x02 /* Temperature overheat sense */ 100#define WD_T110 0x02 /* Temperature overheat sense */
92#define WD_HRTBT 0x04 /* Heartbeat sense */ 101#define WD_HRTBT 0x04 /* Heartbeat sense */
93#define WD_RLY2 0x08 /* External relay triggered */ 102#define WD_RLY2 0x08 /* External relay triggered */
94#define WD_SRLY2 0x80 /* Software external relay triggered */ 103#define WD_SRLY2 0x80 /* Software external relay triggered */
95 104/* Port 1 : Control Status #1 for the PC Watchdog card, revision C. */
96/*
97 * These are the defines that describe the control status bits for the
98 * PC Watchdog card, revision C.
99 */
100#define WD_REVC_WTRP 0x01 /* Watchdog Trip status */ 105#define WD_REVC_WTRP 0x01 /* Watchdog Trip status */
101#define WD_REVC_HRBT 0x02 /* Watchdog Heartbeat */ 106#define WD_REVC_HRBT 0x02 /* Watchdog Heartbeat */
102#define WD_REVC_TTRP 0x04 /* Temperature Trip status */ 107#define WD_REVC_TTRP 0x04 /* Temperature Trip status */
108/* Port 2 : Control Status #2 */
109#define WD_WDIS 0x10 /* Watchdog Disabled */
110#define WD_ENTP 0x20 /* Watchdog Enable Temperature Trip */
111#define WD_SSEL 0x40 /* Watchdog Switch Select (1:SW1 <-> 0:SW2) */
112#define WD_WCMD 0x80 /* Watchdog Command Mode */
103 113
104/* max. time we give an ISA watchdog card to process a command */ 114/* max. time we give an ISA watchdog card to process a command */
105/* 500ms for each 4 bit response (according to spec.) */ 115/* 500ms for each 4 bit response (according to spec.) */
106#define ISA_COMMAND_TIMEOUT 1000 116#define ISA_COMMAND_TIMEOUT 1000
107 117
108/* Watchdog's internal commands */ 118/* Watchdog's internal commands */
109#define CMD_ISA_IDLE 0x00 119#define CMD_ISA_IDLE 0x00
110#define CMD_ISA_VERSION_INTEGER 0x01 120#define CMD_ISA_VERSION_INTEGER 0x01
111#define CMD_ISA_VERSION_TENTH 0x02 121#define CMD_ISA_VERSION_TENTH 0x02
112#define CMD_ISA_VERSION_HUNDRETH 0x03 122#define CMD_ISA_VERSION_HUNDRETH 0x03
113#define CMD_ISA_VERSION_MINOR 0x04 123#define CMD_ISA_VERSION_MINOR 0x04
114#define CMD_ISA_SWITCH_SETTINGS 0x05 124#define CMD_ISA_SWITCH_SETTINGS 0x05
115#define CMD_ISA_DELAY_TIME_2SECS 0x0A 125#define CMD_ISA_DELAY_TIME_2SECS 0x0A
116#define CMD_ISA_DELAY_TIME_4SECS 0x0B 126#define CMD_ISA_DELAY_TIME_4SECS 0x0B
117#define CMD_ISA_DELAY_TIME_8SECS 0x0C 127#define CMD_ISA_DELAY_TIME_8SECS 0x0C
118 128
119/* 129/*
120 * We are using an kernel timer to do the pinging of the watchdog 130 * We are using an kernel timer to do the pinging of the watchdog
@@ -130,15 +140,17 @@ static int cards_found;
130/* internal variables */ 140/* internal variables */
131static atomic_t open_allowed = ATOMIC_INIT(1); 141static atomic_t open_allowed = ATOMIC_INIT(1);
132static char expect_close; 142static char expect_close;
133static struct timer_list timer;
134static unsigned long next_heartbeat;
135static int temp_panic; 143static int temp_panic;
136static int revision; /* The card's revision */ 144static struct { /* this is private data for each ISA-PC watchdog card */
137static int supports_temp; /* Wether or not the card has a temperature device */ 145 int revision; /* The card's revision */
138static int command_mode; /* Wether or not the card is in command mode */ 146 int supports_temp; /* Wether or not the card has a temperature device */
139static int initial_status; /* The card's boot status */ 147 int command_mode; /* Wether or not the card is in command mode */
140static int current_readport; /* The cards I/O address */ 148 int boot_status; /* The card's boot status */
141static spinlock_t io_lock; 149 int io_addr; /* The cards I/O address */
150 spinlock_t io_lock; /* the lock for io operations */
151 struct timer_list timer; /* The timer that pings the watchdog */
152 unsigned long next_heartbeat; /* the next_heartbeat for the timer */
153} pcwd_private;
142 154
143/* module parameters */ 155/* module parameters */
144#define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat */ 156#define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat */
@@ -161,14 +173,14 @@ static int send_isa_command(int cmd)
161 int port0, last_port0; /* Double read for stabilising */ 173 int port0, last_port0; /* Double read for stabilising */
162 174
163 /* The WCMD bit must be 1 and the command is only 4 bits in size */ 175 /* The WCMD bit must be 1 and the command is only 4 bits in size */
164 control_status = (cmd & 0x0F) | 0x80; 176 control_status = (cmd & 0x0F) | WD_WCMD;
165 outb_p(control_status, current_readport + 2); 177 outb_p(control_status, pcwd_private.io_addr + 2);
166 udelay(ISA_COMMAND_TIMEOUT); 178 udelay(ISA_COMMAND_TIMEOUT);
167 179
168 port0 = inb_p(current_readport); 180 port0 = inb_p(pcwd_private.io_addr);
169 for (i = 0; i < 25; ++i) { 181 for (i = 0; i < 25; ++i) {
170 last_port0 = port0; 182 last_port0 = port0;
171 port0 = inb_p(current_readport); 183 port0 = inb_p(pcwd_private.io_addr);
172 184
173 if (port0 == last_port0) 185 if (port0 == last_port0)
174 break; /* Data is stable */ 186 break; /* Data is stable */
@@ -184,7 +196,7 @@ static int set_command_mode(void)
184 int i, found=0, count=0; 196 int i, found=0, count=0;
185 197
186 /* Set the card into command mode */ 198 /* Set the card into command mode */
187 spin_lock(&io_lock); 199 spin_lock(&pcwd_private.io_lock);
188 while ((!found) && (count < 3)) { 200 while ((!found) && (count < 3)) {
189 i = send_isa_command(CMD_ISA_IDLE); 201 i = send_isa_command(CMD_ISA_IDLE);
190 202
@@ -192,15 +204,15 @@ static int set_command_mode(void)
192 found = 1; 204 found = 1;
193 else if (i == 0xF3) { 205 else if (i == 0xF3) {
194 /* Card does not like what we've done to it */ 206 /* Card does not like what we've done to it */
195 outb_p(0x00, current_readport + 2); 207 outb_p(0x00, pcwd_private.io_addr + 2);
196 udelay(1200); /* Spec says wait 1ms */ 208 udelay(1200); /* Spec says wait 1ms */
197 outb_p(0x00, current_readport + 2); 209 outb_p(0x00, pcwd_private.io_addr + 2);
198 udelay(ISA_COMMAND_TIMEOUT); 210 udelay(ISA_COMMAND_TIMEOUT);
199 } 211 }
200 count++; 212 count++;
201 } 213 }
202 spin_unlock(&io_lock); 214 spin_unlock(&pcwd_private.io_lock);
203 command_mode = found; 215 pcwd_private.command_mode = found;
204 216
205 return(found); 217 return(found);
206} 218}
@@ -208,12 +220,95 @@ static int set_command_mode(void)
208static void unset_command_mode(void) 220static void unset_command_mode(void)
209{ 221{
210 /* Set the card into normal mode */ 222 /* Set the card into normal mode */
211 spin_lock(&io_lock); 223 spin_lock(&pcwd_private.io_lock);
212 outb_p(0x00, current_readport + 2); 224 outb_p(0x00, pcwd_private.io_addr + 2);
213 udelay(ISA_COMMAND_TIMEOUT); 225 udelay(ISA_COMMAND_TIMEOUT);
214 spin_unlock(&io_lock); 226 spin_unlock(&pcwd_private.io_lock);
227
228 pcwd_private.command_mode = 0;
229}
230
231static inline void pcwd_check_temperature_support(void)
232{
233 if (inb(pcwd_private.io_addr) != 0xF0)
234 pcwd_private.supports_temp = 1;
235}
236
237static inline char *get_firmware(void)
238{
239 int one, ten, hund, minor;
240 char *ret;
241
242 ret = kmalloc(6, GFP_KERNEL);
243 if(ret == NULL)
244 return NULL;
245
246 if (set_command_mode()) {
247 one = send_isa_command(CMD_ISA_VERSION_INTEGER);
248 ten = send_isa_command(CMD_ISA_VERSION_TENTH);
249 hund = send_isa_command(CMD_ISA_VERSION_HUNDRETH);
250 minor = send_isa_command(CMD_ISA_VERSION_MINOR);
251 sprintf(ret, "%c.%c%c%c", one, ten, hund, minor);
252 }
253 else
254 sprintf(ret, "ERROR");
255
256 unset_command_mode();
257 return(ret);
258}
259
260static inline int pcwd_get_option_switches(void)
261{
262 int option_switches=0;
263
264 if (set_command_mode()) {
265 /* Get switch settings */
266 option_switches = send_isa_command(CMD_ISA_SWITCH_SETTINGS);
267 }
268
269 unset_command_mode();
270 return(option_switches);
271}
272
273static void pcwd_show_card_info(void)
274{
275 char *firmware;
276 int option_switches;
277
278 /* Get some extra info from the hardware (in command/debug/diag mode) */
279 if (pcwd_private.revision == PCWD_REVISION_A)
280 printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", pcwd_private.io_addr);
281 else if (pcwd_private.revision == PCWD_REVISION_C) {
282 firmware = get_firmware();
283 printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n",
284 pcwd_private.io_addr, firmware);
285 kfree(firmware);
286 option_switches = pcwd_get_option_switches();
287 printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n",
288 option_switches,
289 ((option_switches & 0x10) ? "ON" : "OFF"),
290 ((option_switches & 0x08) ? "ON" : "OFF"));
291
292 /* Reprogram internal heartbeat to 2 seconds */
293 if (set_command_mode()) {
294 send_isa_command(CMD_ISA_DELAY_TIME_2SECS);
295 unset_command_mode();
296 }
297 }
298
299 if (pcwd_private.supports_temp)
300 printk(KERN_INFO PFX "Temperature Option Detected\n");
301
302 if (pcwd_private.boot_status & WDIOF_CARDRESET)
303 printk(KERN_INFO PFX "Previous reboot was caused by the card\n");
304
305 if (pcwd_private.boot_status & WDIOF_OVERHEAT) {
306 printk(KERN_EMERG PFX "Card senses a CPU Overheat. Panicking!\n");
307 printk(KERN_EMERG PFX "CPU Overheat\n");
308 }
215 309
216 command_mode = 0; 310 if (pcwd_private.boot_status == 0)
311 printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n");
217} 312}
218 313
219static void pcwd_timer_ping(unsigned long data) 314static void pcwd_timer_ping(unsigned long data)
@@ -222,25 +317,25 @@ static void pcwd_timer_ping(unsigned long data)
222 317
223 /* If we got a heartbeat pulse within the WDT_INTERVAL 318 /* If we got a heartbeat pulse within the WDT_INTERVAL
224 * we agree to ping the WDT */ 319 * we agree to ping the WDT */
225 if(time_before(jiffies, next_heartbeat)) { 320 if(time_before(jiffies, pcwd_private.next_heartbeat)) {
226 /* Ping the watchdog */ 321 /* Ping the watchdog */
227 spin_lock(&io_lock); 322 spin_lock(&pcwd_private.io_lock);
228 if (revision == PCWD_REVISION_A) { 323 if (pcwd_private.revision == PCWD_REVISION_A) {
229 /* Rev A cards are reset by setting the WD_WDRST bit in register 1 */ 324 /* Rev A cards are reset by setting the WD_WDRST bit in register 1 */
230 wdrst_stat = inb_p(current_readport); 325 wdrst_stat = inb_p(pcwd_private.io_addr);
231 wdrst_stat &= 0x0F; 326 wdrst_stat &= 0x0F;
232 wdrst_stat |= WD_WDRST; 327 wdrst_stat |= WD_WDRST;
233 328
234 outb_p(wdrst_stat, current_readport + 1); 329 outb_p(wdrst_stat, pcwd_private.io_addr + 1);
235 } else { 330 } else {
236 /* Re-trigger watchdog by writing to port 0 */ 331 /* Re-trigger watchdog by writing to port 0 */
237 outb_p(0x00, current_readport); 332 outb_p(0x00, pcwd_private.io_addr);
238 } 333 }
239 334
240 /* Re-set the timer interval */ 335 /* Re-set the timer interval */
241 mod_timer(&timer, jiffies + WDT_INTERVAL); 336 mod_timer(&pcwd_private.timer, jiffies + WDT_INTERVAL);
242 337
243 spin_unlock(&io_lock); 338 spin_unlock(&pcwd_private.io_lock);
244 } else { 339 } else {
245 printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); 340 printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n");
246 } 341 }
@@ -250,19 +345,19 @@ static int pcwd_start(void)
250{ 345{
251 int stat_reg; 346 int stat_reg;
252 347
253 next_heartbeat = jiffies + (heartbeat * HZ); 348 pcwd_private.next_heartbeat = jiffies + (heartbeat * HZ);
254 349
255 /* Start the timer */ 350 /* Start the timer */
256 mod_timer(&timer, jiffies + WDT_INTERVAL); 351 mod_timer(&pcwd_private.timer, jiffies + WDT_INTERVAL);
257 352
258 /* Enable the port */ 353 /* Enable the port */
259 if (revision == PCWD_REVISION_C) { 354 if (pcwd_private.revision == PCWD_REVISION_C) {
260 spin_lock(&io_lock); 355 spin_lock(&pcwd_private.io_lock);
261 outb_p(0x00, current_readport + 3); 356 outb_p(0x00, pcwd_private.io_addr + 3);
262 udelay(ISA_COMMAND_TIMEOUT); 357 udelay(ISA_COMMAND_TIMEOUT);
263 stat_reg = inb_p(current_readport + 2); 358 stat_reg = inb_p(pcwd_private.io_addr + 2);
264 spin_unlock(&io_lock); 359 spin_unlock(&pcwd_private.io_lock);
265 if (stat_reg & 0x10) { 360 if (stat_reg & WD_WDIS) {
266 printk(KERN_INFO PFX "Could not start watchdog\n"); 361 printk(KERN_INFO PFX "Could not start watchdog\n");
267 return -EIO; 362 return -EIO;
268 } 363 }
@@ -275,18 +370,18 @@ static int pcwd_stop(void)
275 int stat_reg; 370 int stat_reg;
276 371
277 /* Stop the timer */ 372 /* Stop the timer */
278 del_timer(&timer); 373 del_timer(&pcwd_private.timer);
279 374
280 /* Disable the board */ 375 /* Disable the board */
281 if (revision == PCWD_REVISION_C) { 376 if (pcwd_private.revision == PCWD_REVISION_C) {
282 spin_lock(&io_lock); 377 spin_lock(&pcwd_private.io_lock);
283 outb_p(0xA5, current_readport + 3); 378 outb_p(0xA5, pcwd_private.io_addr + 3);
284 udelay(ISA_COMMAND_TIMEOUT); 379 udelay(ISA_COMMAND_TIMEOUT);
285 outb_p(0xA5, current_readport + 3); 380 outb_p(0xA5, pcwd_private.io_addr + 3);
286 udelay(ISA_COMMAND_TIMEOUT); 381 udelay(ISA_COMMAND_TIMEOUT);
287 stat_reg = inb_p(current_readport + 2); 382 stat_reg = inb_p(pcwd_private.io_addr + 2);
288 spin_unlock(&io_lock); 383 spin_unlock(&pcwd_private.io_lock);
289 if ((stat_reg & 0x10) == 0) { 384 if ((stat_reg & WD_WDIS) == 0) {
290 printk(KERN_INFO PFX "Could not stop watchdog\n"); 385 printk(KERN_INFO PFX "Could not stop watchdog\n");
291 return -EIO; 386 return -EIO;
292 } 387 }
@@ -297,7 +392,7 @@ static int pcwd_stop(void)
297static int pcwd_keepalive(void) 392static int pcwd_keepalive(void)
298{ 393{
299 /* user land ping */ 394 /* user land ping */
300 next_heartbeat = jiffies + (heartbeat * HZ); 395 pcwd_private.next_heartbeat = jiffies + (heartbeat * HZ);
301 return 0; 396 return 0;
302} 397}
303 398
@@ -315,23 +410,23 @@ static int pcwd_get_status(int *status)
315 int card_status; 410 int card_status;
316 411
317 *status=0; 412 *status=0;
318 spin_lock(&io_lock); 413 spin_lock(&pcwd_private.io_lock);
319 if (revision == PCWD_REVISION_A) 414 if (pcwd_private.revision == PCWD_REVISION_A)
320 /* Rev A cards return status information from 415 /* Rev A cards return status information from
321 * the base register, which is used for the 416 * the base register, which is used for the
322 * temperature in other cards. */ 417 * temperature in other cards. */
323 card_status = inb(current_readport); 418 card_status = inb(pcwd_private.io_addr);
324 else { 419 else {
325 /* Rev C cards return card status in the base 420 /* Rev C cards return card status in the base
326 * address + 1 register. And use different bits 421 * address + 1 register. And use different bits
327 * to indicate a card initiated reset, and an 422 * to indicate a card initiated reset, and an
328 * over-temperature condition. And the reboot 423 * over-temperature condition. And the reboot
329 * status can be reset. */ 424 * status can be reset. */
330 card_status = inb(current_readport + 1); 425 card_status = inb(pcwd_private.io_addr + 1);
331 } 426 }
332 spin_unlock(&io_lock); 427 spin_unlock(&pcwd_private.io_lock);
333 428
334 if (revision == PCWD_REVISION_A) { 429 if (pcwd_private.revision == PCWD_REVISION_A) {
335 if (card_status & WD_WDRST) 430 if (card_status & WD_WDRST)
336 *status |= WDIOF_CARDRESET; 431 *status |= WDIOF_CARDRESET;
337 432
@@ -360,10 +455,10 @@ static int pcwd_get_status(int *status)
360 455
361static int pcwd_clear_status(void) 456static int pcwd_clear_status(void)
362{ 457{
363 if (revision == PCWD_REVISION_C) { 458 if (pcwd_private.revision == PCWD_REVISION_C) {
364 spin_lock(&io_lock); 459 spin_lock(&pcwd_private.io_lock);
365 outb_p(0x00, current_readport + 1); /* clear reset status */ 460 outb_p(0x00, pcwd_private.io_addr + 1); /* clear reset status */
366 spin_unlock(&io_lock); 461 spin_unlock(&pcwd_private.io_lock);
367 } 462 }
368 return 0; 463 return 0;
369} 464}
@@ -371,20 +466,20 @@ static int pcwd_clear_status(void)
371static int pcwd_get_temperature(int *temperature) 466static int pcwd_get_temperature(int *temperature)
372{ 467{
373 /* check that port 0 gives temperature info and no command results */ 468 /* check that port 0 gives temperature info and no command results */
374 if (command_mode) 469 if (pcwd_private.command_mode)
375 return -1; 470 return -1;
376 471
377 *temperature = 0; 472 *temperature = 0;
378 if (!supports_temp) 473 if (!pcwd_private.supports_temp)
379 return -ENODEV; 474 return -ENODEV;
380 475
381 /* 476 /*
382 * Convert celsius to fahrenheit, since this was 477 * Convert celsius to fahrenheit, since this was
383 * the decided 'standard' for this return value. 478 * the decided 'standard' for this return value.
384 */ 479 */
385 spin_lock(&io_lock); 480 spin_lock(&pcwd_private.io_lock);
386 *temperature = ((inb(current_readport)) * 9 / 5) + 32; 481 *temperature = ((inb(pcwd_private.io_addr)) * 9 / 5) + 32;
387 spin_unlock(&io_lock); 482 spin_unlock(&pcwd_private.io_lock);
388 483
389 return 0; 484 return 0;
390} 485}
@@ -425,7 +520,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
425 return put_user(status, argp); 520 return put_user(status, argp);
426 521
427 case WDIOC_GETBOOTSTATUS: 522 case WDIOC_GETBOOTSTATUS:
428 return put_user(initial_status, argp); 523 return put_user(pcwd_private.boot_status, argp);
429 524
430 case WDIOC_GETTEMP: 525 case WDIOC_GETTEMP:
431 if (pcwd_get_temperature(&temperature)) 526 if (pcwd_get_temperature(&temperature))
@@ -434,7 +529,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
434 return put_user(temperature, argp); 529 return put_user(temperature, argp);
435 530
436 case WDIOC_SETOPTIONS: 531 case WDIOC_SETOPTIONS:
437 if (revision == PCWD_REVISION_C) 532 if (pcwd_private.revision == PCWD_REVISION_C)
438 { 533 {
439 if(copy_from_user(&rv, argp, sizeof(int))) 534 if(copy_from_user(&rv, argp, sizeof(int)))
440 return -EFAULT; 535 return -EFAULT;
@@ -550,7 +645,7 @@ static ssize_t pcwd_temp_read(struct file *file, char __user *buf, size_t count,
550 645
551static int pcwd_temp_open(struct inode *inode, struct file *file) 646static int pcwd_temp_open(struct inode *inode, struct file *file)
552{ 647{
553 if (!supports_temp) 648 if (!pcwd_private.supports_temp)
554 return -ENODEV; 649 return -ENODEV;
555 650
556 return nonseekable_open(inode, file); 651 return nonseekable_open(inode, file);
@@ -616,68 +711,24 @@ static struct notifier_block pcwd_notifier = {
616 * Init & exit routines 711 * Init & exit routines
617 */ 712 */
618 713
619static inline void get_support(void)
620{
621 if (inb(current_readport) != 0xF0)
622 supports_temp = 1;
623}
624
625static inline int get_revision(void) 714static inline int get_revision(void)
626{ 715{
627 int r = PCWD_REVISION_C; 716 int r = PCWD_REVISION_C;
628 717
629 spin_lock(&io_lock); 718 spin_lock(&pcwd_private.io_lock);
630 /* REV A cards use only 2 io ports; test 719 /* REV A cards use only 2 io ports; test
631 * presumes a floating bus reads as 0xff. */ 720 * presumes a floating bus reads as 0xff. */
632 if ((inb(current_readport + 2) == 0xFF) || 721 if ((inb(pcwd_private.io_addr + 2) == 0xFF) ||
633 (inb(current_readport + 3) == 0xFF)) 722 (inb(pcwd_private.io_addr + 3) == 0xFF))
634 r=PCWD_REVISION_A; 723 r=PCWD_REVISION_A;
635 spin_unlock(&io_lock); 724 spin_unlock(&pcwd_private.io_lock);
636 725
637 return r; 726 return r;
638} 727}
639 728
640static inline char *get_firmware(void)
641{
642 int one, ten, hund, minor;
643 char *ret;
644
645 ret = kmalloc(6, GFP_KERNEL);
646 if(ret == NULL)
647 return NULL;
648
649 if (set_command_mode()) {
650 one = send_isa_command(CMD_ISA_VERSION_INTEGER);
651 ten = send_isa_command(CMD_ISA_VERSION_TENTH);
652 hund = send_isa_command(CMD_ISA_VERSION_HUNDRETH);
653 minor = send_isa_command(CMD_ISA_VERSION_MINOR);
654 sprintf(ret, "%c.%c%c%c", one, ten, hund, minor);
655 }
656 else
657 sprintf(ret, "ERROR");
658
659 unset_command_mode();
660 return(ret);
661}
662
663static inline int get_option_switches(void)
664{
665 int rv=0;
666
667 if (set_command_mode()) {
668 /* Get switch settings */
669 rv = send_isa_command(CMD_ISA_SWITCH_SETTINGS);
670 }
671
672 unset_command_mode();
673 return(rv);
674}
675
676static int __devinit pcwatchdog_init(int base_addr) 729static int __devinit pcwatchdog_init(int base_addr)
677{ 730{
678 int ret; 731 int ret;
679 char *firmware;
680 int option_switches;
681 732
682 cards_found++; 733 cards_found++;
683 if (cards_found == 1) 734 if (cards_found == 1)
@@ -692,104 +743,66 @@ static int __devinit pcwatchdog_init(int base_addr)
692 printk(KERN_ERR PFX "No I/O-Address for card detected\n"); 743 printk(KERN_ERR PFX "No I/O-Address for card detected\n");
693 return -ENODEV; 744 return -ENODEV;
694 } 745 }
695 current_readport = base_addr; 746 pcwd_private.io_addr = base_addr;
696 747
697 /* Check card's revision */ 748 /* Check card's revision */
698 revision = get_revision(); 749 pcwd_private.revision = get_revision();
699 750
700 if (!request_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4, "PCWD")) { 751 if (!request_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4, "PCWD")) {
701 printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", 752 printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
702 current_readport); 753 pcwd_private.io_addr);
703 current_readport = 0x0000; 754 pcwd_private.io_addr = 0x0000;
704 return -EIO; 755 return -EIO;
705 } 756 }
706 757
707 /* Initial variables */ 758 /* Initial variables */
708 supports_temp = 0; 759 pcwd_private.supports_temp = 0;
709 temp_panic = 0; 760 temp_panic = 0;
710 initial_status = 0x0000; 761 pcwd_private.boot_status = 0x0000;
711 762
712 /* get the boot_status */ 763 /* get the boot_status */
713 pcwd_get_status(&initial_status); 764 pcwd_get_status(&pcwd_private.boot_status);
714 765
715 /* clear the "card caused reboot" flag */ 766 /* clear the "card caused reboot" flag */
716 pcwd_clear_status(); 767 pcwd_clear_status();
717 768
718 init_timer(&timer); 769 init_timer(&pcwd_private.timer);
719 timer.function = pcwd_timer_ping; 770 pcwd_private.timer.function = pcwd_timer_ping;
720 timer.data = 0; 771 pcwd_private.timer.data = 0;
721 772
722 /* Disable the board */ 773 /* Disable the board */
723 pcwd_stop(); 774 pcwd_stop();
724 775
725 /* Check whether or not the card supports the temperature device */ 776 /* Check whether or not the card supports the temperature device */
726 get_support(); 777 pcwd_check_temperature_support();
727
728 /* Get some extra info from the hardware (in command/debug/diag mode) */
729 if (revision == PCWD_REVISION_A)
730 printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", current_readport);
731 else if (revision == PCWD_REVISION_C) {
732 firmware = get_firmware();
733 printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n",
734 current_readport, firmware);
735 kfree(firmware);
736 option_switches = get_option_switches();
737 printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n",
738 option_switches,
739 ((option_switches & 0x10) ? "ON" : "OFF"),
740 ((option_switches & 0x08) ? "ON" : "OFF"));
741
742 /* Reprogram internal heartbeat to 2 seconds */
743 if (set_command_mode()) {
744 send_isa_command(CMD_ISA_DELAY_TIME_2SECS);
745 unset_command_mode();
746 }
747 } else {
748 /* Should NEVER happen, unless get_revision() fails. */
749 printk(KERN_INFO PFX "Unable to get revision\n");
750 release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4);
751 current_readport = 0x0000;
752 return -1;
753 }
754 778
755 if (supports_temp) 779 /* Show info about the card itself */
756 printk(KERN_INFO PFX "Temperature Option Detected\n"); 780 pcwd_show_card_info();
757
758 if (initial_status & WDIOF_CARDRESET)
759 printk(KERN_INFO PFX "Previous reboot was caused by the card\n");
760
761 if (initial_status & WDIOF_OVERHEAT) {
762 printk(KERN_EMERG PFX "Card senses a CPU Overheat. Panicking!\n");
763 printk(KERN_EMERG PFX "CPU Overheat\n");
764 }
765
766 if (initial_status == 0)
767 printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n");
768 781
769 /* Check that the heartbeat value is within it's range ; if not reset to the default */ 782 /* Check that the heartbeat value is within it's range ; if not reset to the default */
770 if (pcwd_set_heartbeat(heartbeat)) { 783 if (pcwd_set_heartbeat(heartbeat)) {
771 pcwd_set_heartbeat(WATCHDOG_HEARTBEAT); 784 pcwd_set_heartbeat(WATCHDOG_HEARTBEAT);
772 printk(KERN_INFO PFX "heartbeat value must be 2<=heartbeat<=7200, using %d\n", 785 printk(KERN_INFO PFX "heartbeat value must be 2<=heartbeat<=7200, using %d\n",
773 WATCHDOG_HEARTBEAT); 786 WATCHDOG_HEARTBEAT);
774 } 787 }
775 788
776 ret = register_reboot_notifier(&pcwd_notifier); 789 ret = register_reboot_notifier(&pcwd_notifier);
777 if (ret) { 790 if (ret) {
778 printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", 791 printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
779 ret); 792 ret);
780 release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); 793 release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
781 current_readport = 0x0000; 794 pcwd_private.io_addr = 0x0000;
782 return ret; 795 return ret;
783 } 796 }
784 797
785 if (supports_temp) { 798 if (pcwd_private.supports_temp) {
786 ret = misc_register(&temp_miscdev); 799 ret = misc_register(&temp_miscdev);
787 if (ret) { 800 if (ret) {
788 printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", 801 printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
789 TEMP_MINOR, ret); 802 TEMP_MINOR, ret);
790 unregister_reboot_notifier(&pcwd_notifier); 803 unregister_reboot_notifier(&pcwd_notifier);
791 release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); 804 release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
792 current_readport = 0x0000; 805 pcwd_private.io_addr = 0x0000;
793 return ret; 806 return ret;
794 } 807 }
795 } 808 }
@@ -798,11 +811,11 @@ static int __devinit pcwatchdog_init(int base_addr)
798 if (ret) { 811 if (ret) {
799 printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", 812 printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
800 WATCHDOG_MINOR, ret); 813 WATCHDOG_MINOR, ret);
801 if (supports_temp) 814 if (pcwd_private.supports_temp)
802 misc_deregister(&temp_miscdev); 815 misc_deregister(&temp_miscdev);
803 unregister_reboot_notifier(&pcwd_notifier); 816 unregister_reboot_notifier(&pcwd_notifier);
804 release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); 817 release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
805 current_readport = 0x0000; 818 pcwd_private.io_addr = 0x0000;
806 return ret; 819 return ret;
807 } 820 }
808 821
@@ -820,11 +833,12 @@ static void __devexit pcwatchdog_exit(void)
820 833
821 /* Deregister */ 834 /* Deregister */
822 misc_deregister(&pcwd_miscdev); 835 misc_deregister(&pcwd_miscdev);
823 if (supports_temp) 836 if (pcwd_private.supports_temp)
824 misc_deregister(&temp_miscdev); 837 misc_deregister(&temp_miscdev);
825 unregister_reboot_notifier(&pcwd_notifier); 838 unregister_reboot_notifier(&pcwd_notifier);
826 release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); 839 release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
827 current_readport = 0x0000; 840 pcwd_private.io_addr = 0x0000;
841 cards_found--;
828} 842}
829 843
830/* 844/*
@@ -887,7 +901,7 @@ static int __init pcwd_init_module(void)
887{ 901{
888 int i, found = 0; 902 int i, found = 0;
889 903
890 spin_lock_init(&io_lock); 904 spin_lock_init(&pcwd_private.io_lock);
891 905
892 for (i = 0; pcwd_ioports[i] != 0; i++) { 906 for (i = 0; pcwd_ioports[i] != 0; i++) {
893 if (pcwd_checkcard(pcwd_ioports[i])) { 907 if (pcwd_checkcard(pcwd_ioports[i])) {
@@ -906,7 +920,7 @@ static int __init pcwd_init_module(void)
906 920
907static void __exit pcwd_cleanup_module(void) 921static void __exit pcwd_cleanup_module(void)
908{ 922{
909 if (current_readport) 923 if (pcwd_private.io_addr)
910 pcwatchdog_exit(); 924 pcwatchdog_exit();
911 return; 925 return;
912} 926}
diff --git a/drivers/char/watchdog/sa1100_wdt.c b/drivers/char/watchdog/sa1100_wdt.c
index b474ea52d6e8..522a9370db94 100644
--- a/drivers/char/watchdog/sa1100_wdt.c
+++ b/drivers/char/watchdog/sa1100_wdt.c
@@ -93,23 +93,25 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file,
93{ 93{
94 int ret = -ENOIOCTLCMD; 94 int ret = -ENOIOCTLCMD;
95 int time; 95 int time;
96 void __user *argp = (void __user *)arg;
97 int __user *p = argp;
96 98
97 switch (cmd) { 99 switch (cmd) {
98 case WDIOC_GETSUPPORT: 100 case WDIOC_GETSUPPORT:
99 ret = copy_to_user((struct watchdog_info __user *)arg, &ident, 101 ret = copy_to_user(argp, &ident,
100 sizeof(ident)) ? -EFAULT : 0; 102 sizeof(ident)) ? -EFAULT : 0;
101 break; 103 break;
102 104
103 case WDIOC_GETSTATUS: 105 case WDIOC_GETSTATUS:
104 ret = put_user(0, (int __user *)arg); 106 ret = put_user(0, p);
105 break; 107 break;
106 108
107 case WDIOC_GETBOOTSTATUS: 109 case WDIOC_GETBOOTSTATUS:
108 ret = put_user(boot_status, (int __user *)arg); 110 ret = put_user(boot_status, p);
109 break; 111 break;
110 112
111 case WDIOC_SETTIMEOUT: 113 case WDIOC_SETTIMEOUT:
112 ret = get_user(time, (int __user *)arg); 114 ret = get_user(time, p);
113 if (ret) 115 if (ret)
114 break; 116 break;
115 117
@@ -123,7 +125,7 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file,
123 /*fall through*/ 125 /*fall through*/
124 126
125 case WDIOC_GETTIMEOUT: 127 case WDIOC_GETTIMEOUT:
126 ret = put_user(pre_margin / OSCR_FREQ, (int __user *)arg); 128 ret = put_user(pre_margin / OSCR_FREQ, p);
127 break; 129 break;
128 130
129 case WDIOC_KEEPALIVE: 131 case WDIOC_KEEPALIVE:
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 7a511479ae29..9582de1c9cad 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -35,8 +35,8 @@
35 * level driver of CPUFreq support, and its spinlock. This lock 35 * level driver of CPUFreq support, and its spinlock. This lock
36 * also protects the cpufreq_cpu_data array. 36 * also protects the cpufreq_cpu_data array.
37 */ 37 */
38static struct cpufreq_driver *cpufreq_driver; 38static struct cpufreq_driver *cpufreq_driver;
39static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS]; 39static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS];
40static DEFINE_SPINLOCK(cpufreq_driver_lock); 40static DEFINE_SPINLOCK(cpufreq_driver_lock);
41 41
42/* internal prototypes */ 42/* internal prototypes */
@@ -50,15 +50,15 @@ static void handle_update(void *data);
50 * changes to devices when the CPU clock speed changes. 50 * changes to devices when the CPU clock speed changes.
51 * The mutex locks both lists. 51 * The mutex locks both lists.
52 */ 52 */
53static struct notifier_block *cpufreq_policy_notifier_list; 53static struct notifier_block *cpufreq_policy_notifier_list;
54static struct notifier_block *cpufreq_transition_notifier_list; 54static struct notifier_block *cpufreq_transition_notifier_list;
55static DECLARE_RWSEM (cpufreq_notifier_rwsem); 55static DECLARE_RWSEM (cpufreq_notifier_rwsem);
56 56
57 57
58static LIST_HEAD(cpufreq_governor_list); 58static LIST_HEAD(cpufreq_governor_list);
59static DEFINE_MUTEX (cpufreq_governor_mutex); 59static DEFINE_MUTEX (cpufreq_governor_mutex);
60 60
61struct cpufreq_policy * cpufreq_cpu_get(unsigned int cpu) 61struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
62{ 62{
63 struct cpufreq_policy *data; 63 struct cpufreq_policy *data;
64 unsigned long flags; 64 unsigned long flags;
@@ -85,20 +85,19 @@ struct cpufreq_policy * cpufreq_cpu_get(unsigned int cpu)
85 if (!kobject_get(&data->kobj)) 85 if (!kobject_get(&data->kobj))
86 goto err_out_put_module; 86 goto err_out_put_module;
87 87
88
89 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 88 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
90
91 return data; 89 return data;
92 90
93 err_out_put_module: 91err_out_put_module:
94 module_put(cpufreq_driver->owner); 92 module_put(cpufreq_driver->owner);
95 err_out_unlock: 93err_out_unlock:
96 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 94 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
97 err_out: 95err_out:
98 return NULL; 96 return NULL;
99} 97}
100EXPORT_SYMBOL_GPL(cpufreq_cpu_get); 98EXPORT_SYMBOL_GPL(cpufreq_cpu_get);
101 99
100
102void cpufreq_cpu_put(struct cpufreq_policy *data) 101void cpufreq_cpu_put(struct cpufreq_policy *data)
103{ 102{
104 kobject_put(&data->kobj); 103 kobject_put(&data->kobj);
@@ -229,44 +228,53 @@ static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) {
229 228
230 229
231/** 230/**
232 * cpufreq_notify_transition - call notifier chain and adjust_jiffies on frequency transition 231 * cpufreq_notify_transition - call notifier chain and adjust_jiffies
232 * on frequency transition.
233 * 233 *
234 * This function calls the transition notifiers and the "adjust_jiffies" function. It is called 234 * This function calls the transition notifiers and the "adjust_jiffies"
235 * twice on all CPU frequency changes that have external effects. 235 * function. It is called twice on all CPU frequency changes that have
236 * external effects.
236 */ 237 */
237void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) 238void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
238{ 239{
240 struct cpufreq_policy *policy;
241
239 BUG_ON(irqs_disabled()); 242 BUG_ON(irqs_disabled());
240 243
241 freqs->flags = cpufreq_driver->flags; 244 freqs->flags = cpufreq_driver->flags;
242 dprintk("notification %u of frequency transition to %u kHz\n", state, freqs->new); 245 dprintk("notification %u of frequency transition to %u kHz\n",
246 state, freqs->new);
243 247
244 down_read(&cpufreq_notifier_rwsem); 248 down_read(&cpufreq_notifier_rwsem);
249
250 policy = cpufreq_cpu_data[freqs->cpu];
245 switch (state) { 251 switch (state) {
252
246 case CPUFREQ_PRECHANGE: 253 case CPUFREQ_PRECHANGE:
247 /* detect if the driver reported a value as "old frequency" which 254 /* detect if the driver reported a value as "old frequency"
248 * is not equal to what the cpufreq core thinks is "old frequency". 255 * which is not equal to what the cpufreq core thinks is
256 * "old frequency".
249 */ 257 */
250 if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { 258 if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
251 if ((likely(cpufreq_cpu_data[freqs->cpu])) && 259 if ((policy) && (policy->cpu == freqs->cpu) &&
252 (likely(cpufreq_cpu_data[freqs->cpu]->cpu == freqs->cpu)) && 260 (policy->cur) && (policy->cur != freqs->old)) {
253 (likely(cpufreq_cpu_data[freqs->cpu]->cur)) && 261 dprintk(KERN_WARNING "Warning: CPU frequency is"
254 (unlikely(freqs->old != cpufreq_cpu_data[freqs->cpu]->cur))) 262 " %u, cpufreq assumed %u kHz.\n",
255 { 263 freqs->old, policy->cur);
256 dprintk(KERN_WARNING "Warning: CPU frequency is %u, " 264 freqs->old = policy->cur;
257 "cpufreq assumed %u kHz.\n", freqs->old, cpufreq_cpu_data[freqs->cpu]->cur);
258 freqs->old = cpufreq_cpu_data[freqs->cpu]->cur;
259 } 265 }
260 } 266 }
261 notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_PRECHANGE, freqs); 267 notifier_call_chain(&cpufreq_transition_notifier_list,
268 CPUFREQ_PRECHANGE, freqs);
262 adjust_jiffies(CPUFREQ_PRECHANGE, freqs); 269 adjust_jiffies(CPUFREQ_PRECHANGE, freqs);
263 break; 270 break;
271
264 case CPUFREQ_POSTCHANGE: 272 case CPUFREQ_POSTCHANGE:
265 adjust_jiffies(CPUFREQ_POSTCHANGE, freqs); 273 adjust_jiffies(CPUFREQ_POSTCHANGE, freqs);
266 notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_POSTCHANGE, freqs); 274 notifier_call_chain(&cpufreq_transition_notifier_list,
267 if ((likely(cpufreq_cpu_data[freqs->cpu])) && 275 CPUFREQ_POSTCHANGE, freqs);
268 (likely(cpufreq_cpu_data[freqs->cpu]->cpu == freqs->cpu))) 276 if (likely(policy) && likely(policy->cpu == freqs->cpu))
269 cpufreq_cpu_data[freqs->cpu]->cur = freqs->new; 277 policy->cur = freqs->new;
270 break; 278 break;
271 } 279 }
272 up_read(&cpufreq_notifier_rwsem); 280 up_read(&cpufreq_notifier_rwsem);
@@ -308,7 +316,7 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy,
308 return 0; 316 return 0;
309 } 317 }
310 } 318 }
311 out: 319out:
312 mutex_unlock(&cpufreq_governor_mutex); 320 mutex_unlock(&cpufreq_governor_mutex);
313 } 321 }
314 return -EINVAL; 322 return -EINVAL;
@@ -415,7 +423,6 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy,
415 return -EINVAL; 423 return -EINVAL;
416 424
417 ret = cpufreq_set_policy(&new_policy); 425 ret = cpufreq_set_policy(&new_policy);
418
419 return ret ? ret : count; 426 return ret ? ret : count;
420} 427}
421 428
@@ -446,7 +453,7 @@ static ssize_t show_scaling_available_governors (struct cpufreq_policy * policy,
446 goto out; 453 goto out;
447 i += scnprintf(&buf[i], CPUFREQ_NAME_LEN, "%s ", t->name); 454 i += scnprintf(&buf[i], CPUFREQ_NAME_LEN, "%s ", t->name);
448 } 455 }
449 out: 456out:
450 i += sprintf(&buf[i], "\n"); 457 i += sprintf(&buf[i], "\n");
451 return i; 458 return i;
452} 459}
@@ -789,7 +796,6 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev)
789 kfree(data); 796 kfree(data);
790 797
791 cpufreq_debug_enable_ratelimit(); 798 cpufreq_debug_enable_ratelimit();
792
793 return 0; 799 return 0;
794} 800}
795 801
@@ -870,8 +876,7 @@ unsigned int cpufreq_get(unsigned int cpu)
870 876
871 ret = cpufreq_driver->get(cpu); 877 ret = cpufreq_driver->get(cpu);
872 878
873 if (ret && policy->cur && !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) 879 if (ret && policy->cur && !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
874 {
875 /* verify no discrepancy between actual and saved value exists */ 880 /* verify no discrepancy between actual and saved value exists */
876 if (unlikely(ret != policy->cur)) { 881 if (unlikely(ret != policy->cur)) {
877 cpufreq_out_of_sync(cpu, policy->cur, ret); 882 cpufreq_out_of_sync(cpu, policy->cur, ret);
@@ -881,7 +886,7 @@ unsigned int cpufreq_get(unsigned int cpu)
881 886
882 mutex_unlock(&policy->lock); 887 mutex_unlock(&policy->lock);
883 888
884 out: 889out:
885 cpufreq_cpu_put(policy); 890 cpufreq_cpu_put(policy);
886 891
887 return (ret); 892 return (ret);
@@ -962,7 +967,7 @@ static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg)
962 cpu_policy->cur = cur_freq; 967 cpu_policy->cur = cur_freq;
963 } 968 }
964 969
965 out: 970out:
966 cpufreq_cpu_put(cpu_policy); 971 cpufreq_cpu_put(cpu_policy);
967 return 0; 972 return 0;
968} 973}
@@ -1169,7 +1174,6 @@ int cpufreq_driver_target(struct cpufreq_policy *policy,
1169 mutex_unlock(&policy->lock); 1174 mutex_unlock(&policy->lock);
1170 1175
1171 cpufreq_cpu_put(policy); 1176 cpufreq_cpu_put(policy);
1172
1173 return ret; 1177 return ret;
1174} 1178}
1175EXPORT_SYMBOL_GPL(cpufreq_driver_target); 1179EXPORT_SYMBOL_GPL(cpufreq_driver_target);
@@ -1208,7 +1212,6 @@ int cpufreq_governor(unsigned int cpu, unsigned int event)
1208 mutex_unlock(&policy->lock); 1212 mutex_unlock(&policy->lock);
1209 1213
1210 cpufreq_cpu_put(policy); 1214 cpufreq_cpu_put(policy);
1211
1212 return ret; 1215 return ret;
1213} 1216}
1214EXPORT_SYMBOL_GPL(cpufreq_governor); 1217EXPORT_SYMBOL_GPL(cpufreq_governor);
@@ -1232,7 +1235,6 @@ int cpufreq_register_governor(struct cpufreq_governor *governor)
1232 list_add(&governor->governor_list, &cpufreq_governor_list); 1235 list_add(&governor->governor_list, &cpufreq_governor_list);
1233 1236
1234 mutex_unlock(&cpufreq_governor_mutex); 1237 mutex_unlock(&cpufreq_governor_mutex);
1235
1236 return 0; 1238 return 0;
1237} 1239}
1238EXPORT_SYMBOL_GPL(cpufreq_register_governor); 1240EXPORT_SYMBOL_GPL(cpufreq_register_governor);
@@ -1277,7 +1279,6 @@ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
1277 mutex_unlock(&cpu_policy->lock); 1279 mutex_unlock(&cpu_policy->lock);
1278 1280
1279 cpufreq_cpu_put(cpu_policy); 1281 cpufreq_cpu_put(cpu_policy);
1280
1281 return 0; 1282 return 0;
1282} 1283}
1283EXPORT_SYMBOL(cpufreq_get_policy); 1284EXPORT_SYMBOL(cpufreq_get_policy);
@@ -1291,9 +1292,7 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli
1291 dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, 1292 dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu,
1292 policy->min, policy->max); 1293 policy->min, policy->max);
1293 1294
1294 memcpy(&policy->cpuinfo, 1295 memcpy(&policy->cpuinfo, &data->cpuinfo, sizeof(struct cpufreq_cpuinfo));
1295 &data->cpuinfo,
1296 sizeof(struct cpufreq_cpuinfo));
1297 1296
1298 /* verify the cpu speed can be set within this limit */ 1297 /* verify the cpu speed can be set within this limit */
1299 ret = cpufreq_driver->verify(policy); 1298 ret = cpufreq_driver->verify(policy);
@@ -1324,8 +1323,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli
1324 1323
1325 up_read(&cpufreq_notifier_rwsem); 1324 up_read(&cpufreq_notifier_rwsem);
1326 1325
1327 data->min = policy->min; 1326 data->min = policy->min;
1328 data->max = policy->max; 1327 data->max = policy->max;
1329 1328
1330 dprintk("new min and max freqs are %u - %u kHz\n", data->min, data->max); 1329 dprintk("new min and max freqs are %u - %u kHz\n", data->min, data->max);
1331 1330
@@ -1362,7 +1361,7 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli
1362 __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); 1361 __cpufreq_governor(data, CPUFREQ_GOV_LIMITS);
1363 } 1362 }
1364 1363
1365 error_out: 1364error_out:
1366 cpufreq_debug_enable_ratelimit(); 1365 cpufreq_debug_enable_ratelimit();
1367 return ret; 1366 return ret;
1368} 1367}
@@ -1421,9 +1420,7 @@ int cpufreq_update_policy(unsigned int cpu)
1421 mutex_lock(&data->lock); 1420 mutex_lock(&data->lock);
1422 1421
1423 dprintk("updating policy for CPU %u\n", cpu); 1422 dprintk("updating policy for CPU %u\n", cpu);
1424 memcpy(&policy, 1423 memcpy(&policy, data, sizeof(struct cpufreq_policy));
1425 data,
1426 sizeof(struct cpufreq_policy));
1427 policy.min = data->user_policy.min; 1424 policy.min = data->user_policy.min;
1428 policy.max = data->user_policy.max; 1425 policy.max = data->user_policy.max;
1429 policy.policy = data->user_policy.policy; 1426 policy.policy = data->user_policy.policy;
@@ -1433,8 +1430,13 @@ int cpufreq_update_policy(unsigned int cpu)
1433 -> ask driver for current freq and notify governors about a change */ 1430 -> ask driver for current freq and notify governors about a change */
1434 if (cpufreq_driver->get) { 1431 if (cpufreq_driver->get) {
1435 policy.cur = cpufreq_driver->get(cpu); 1432 policy.cur = cpufreq_driver->get(cpu);
1436 if (data->cur != policy.cur) 1433 if (!data->cur) {
1437 cpufreq_out_of_sync(cpu, data->cur, policy.cur); 1434 dprintk("Driver did not initialize current freq");
1435 data->cur = policy.cur;
1436 } else {
1437 if (data->cur != policy.cur)
1438 cpufreq_out_of_sync(cpu, data->cur, policy.cur);
1439 }
1438 } 1440 }
1439 1441
1440 ret = __cpufreq_set_policy(data, &policy); 1442 ret = __cpufreq_set_policy(data, &policy);
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index 64819aa7cac4..0c08c58252be 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -348,10 +348,10 @@ aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t
348 break; 348 break;
349 349
350 case 32: 350 case 32:
351 E_KEY[4] = le32_to_cpu(in_key[4]); 351 E_KEY[4] = le32_to_cpu(key[4]);
352 E_KEY[5] = le32_to_cpu(in_key[5]); 352 E_KEY[5] = le32_to_cpu(key[5]);
353 E_KEY[6] = le32_to_cpu(in_key[6]); 353 E_KEY[6] = le32_to_cpu(key[6]);
354 t = E_KEY[7] = le32_to_cpu(in_key[7]); 354 t = E_KEY[7] = le32_to_cpu(key[7]);
355 for (i = 0; i < 7; ++i) 355 for (i = 0; i < 7; ++i)
356 loop8 (i); 356 loop8 (i);
357 break; 357 break;
diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c
index 5c8943509cc1..66d03f242d3c 100644
--- a/drivers/fc4/fc.c
+++ b/drivers/fc4/fc.c
@@ -1053,7 +1053,7 @@ static int fc_do_els(fc_channel *fc, unsigned int alpa, void *data, int len)
1053 int i; 1053 int i;
1054 1054
1055 fcmd = &_fcmd; 1055 fcmd = &_fcmd;
1056 memset(fcmd, 0, sizeof(fcmd)); 1056 memset(fcmd, 0, sizeof(fcp_cmnd));
1057 FCD(("PLOGI SID %d DID %d\n", fc->sid, alpa)) 1057 FCD(("PLOGI SID %d DID %d\n", fc->sid, alpa))
1058 fch = &fcmd->fch; 1058 fch = &fcmd->fch;
1059 FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, alpa); 1059 FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, alpa);
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index e87d52c59940..d7a9401600bb 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -1186,7 +1186,8 @@ static int __init sm_it87_init(void)
1186 1186
1187static void __exit sm_it87_exit(void) 1187static void __exit sm_it87_exit(void)
1188{ 1188{
1189 i2c_isa_del_driver(&it87_isa_driver); 1189 if (isa_address)
1190 i2c_isa_del_driver(&it87_isa_driver);
1190 i2c_del_driver(&it87_driver); 1191 i2c_del_driver(&it87_driver);
1191} 1192}
1192 1193
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c
index 3eb08f004c0f..271e9cb9532c 100644
--- a/drivers/hwmon/vt8231.c
+++ b/drivers/hwmon/vt8231.c
@@ -437,12 +437,12 @@ static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
437 show_temp, NULL, offset - 1); \ 437 show_temp, NULL, offset - 1); \
438static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ 438static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
439 show_temp_max, set_temp_max, offset - 1); \ 439 show_temp_max, set_temp_max, offset - 1); \
440static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ 440static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO | S_IWUSR, \
441 show_temp_min, set_temp_min, offset - 1) 441 show_temp_min, set_temp_min, offset - 1)
442 442
443static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp0, NULL); 443static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp0, NULL);
444static DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp0_max, set_temp0_max); 444static DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp0_max, set_temp0_max);
445static DEVICE_ATTR(temp1_min, S_IRUGO | S_IWUSR, show_temp0_min, set_temp0_min); 445static DEVICE_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR, show_temp0_min, set_temp0_min);
446 446
447define_temperature_sysfs(2); 447define_temperature_sysfs(2);
448define_temperature_sysfs(3); 448define_temperature_sysfs(3);
@@ -451,7 +451,7 @@ define_temperature_sysfs(5);
451define_temperature_sysfs(6); 451define_temperature_sysfs(6);
452 452
453#define CFG_INFO_TEMP(id) { &sensor_dev_attr_temp##id##_input.dev_attr, \ 453#define CFG_INFO_TEMP(id) { &sensor_dev_attr_temp##id##_input.dev_attr, \
454 &sensor_dev_attr_temp##id##_min.dev_attr, \ 454 &sensor_dev_attr_temp##id##_max_hyst.dev_attr, \
455 &sensor_dev_attr_temp##id##_max.dev_attr } 455 &sensor_dev_attr_temp##id##_max.dev_attr }
456#define CFG_INFO_VOLT(id) { &sensor_dev_attr_in##id##_input.dev_attr, \ 456#define CFG_INFO_VOLT(id) { &sensor_dev_attr_in##id##_input.dev_attr, \
457 &sensor_dev_attr_in##id##_min.dev_attr, \ 457 &sensor_dev_attr_in##id##_min.dev_attr, \
@@ -464,7 +464,7 @@ struct str_device_attr_table {
464}; 464};
465 465
466static struct str_device_attr_table cfg_info_temp[] = { 466static struct str_device_attr_table cfg_info_temp[] = {
467 { &dev_attr_temp1_input, &dev_attr_temp1_min, &dev_attr_temp1_max }, 467 { &dev_attr_temp1_input, &dev_attr_temp1_max_hyst, &dev_attr_temp1_max },
468 CFG_INFO_TEMP(2), 468 CFG_INFO_TEMP(2),
469 CFG_INFO_TEMP(3), 469 CFG_INFO_TEMP(3),
470 CFG_INFO_TEMP(4), 470 CFG_INFO_TEMP(4),
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index 557114872f3c..64c1f8af5bb2 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -95,11 +95,16 @@ MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
95 (0x39))) 95 (0x39)))
96 96
97#define W83781D_REG_CONFIG 0x40 97#define W83781D_REG_CONFIG 0x40
98
99/* Interrupt status (W83781D, AS99127F) */
98#define W83781D_REG_ALARM1 0x41 100#define W83781D_REG_ALARM1 0x41
99#define W83781D_REG_ALARM2 0x42 101#define W83781D_REG_ALARM2 0x42
100#define W83781D_REG_ALARM3 0x450 /* not on W83781D */
101 102
102#define W83781D_REG_IRQ 0x4C 103/* Real-time status (W83782D, W83783S, W83627HF) */
104#define W83782D_REG_ALARM1 0x459
105#define W83782D_REG_ALARM2 0x45A
106#define W83782D_REG_ALARM3 0x45B
107
103#define W83781D_REG_BEEP_CONFIG 0x4D 108#define W83781D_REG_BEEP_CONFIG 0x4D
104#define W83781D_REG_BEEP_INTS1 0x56 109#define W83781D_REG_BEEP_INTS1 0x56
105#define W83781D_REG_BEEP_INTS2 0x57 110#define W83781D_REG_BEEP_INTS2 0x57
@@ -1513,15 +1518,6 @@ w83781d_init_client(struct i2c_client *client)
1513 W83781D_REG_TEMP3_CONFIG, tmp & 0xfe); 1518 W83781D_REG_TEMP3_CONFIG, tmp & 0xfe);
1514 } 1519 }
1515 } 1520 }
1516
1517 if (type != w83781d) {
1518 /* enable comparator mode for temp2 and temp3 so
1519 alarm indication will work correctly */
1520 i = w83781d_read_value(client, W83781D_REG_IRQ);
1521 if (!(i & 0x40))
1522 w83781d_write_value(client, W83781D_REG_IRQ,
1523 i | 0x40);
1524 }
1525 } 1521 }
1526 1522
1527 /* Start monitoring */ 1523 /* Start monitoring */
@@ -1612,14 +1608,25 @@ static struct w83781d_data *w83781d_update_device(struct device *dev)
1612 data->fan_div[1] |= (i >> 4) & 0x04; 1608 data->fan_div[1] |= (i >> 4) & 0x04;
1613 data->fan_div[2] |= (i >> 5) & 0x04; 1609 data->fan_div[2] |= (i >> 5) & 0x04;
1614 } 1610 }
1615 data->alarms =
1616 w83781d_read_value(client,
1617 W83781D_REG_ALARM1) +
1618 (w83781d_read_value(client, W83781D_REG_ALARM2) << 8);
1619 if ((data->type == w83782d) || (data->type == w83627hf)) { 1611 if ((data->type == w83782d) || (data->type == w83627hf)) {
1620 data->alarms |= 1612 data->alarms = w83781d_read_value(client,
1621 w83781d_read_value(client, 1613 W83782D_REG_ALARM1)
1622 W83781D_REG_ALARM3) << 16; 1614 | (w83781d_read_value(client,
1615 W83782D_REG_ALARM2) << 8)
1616 | (w83781d_read_value(client,
1617 W83782D_REG_ALARM3) << 16);
1618 } else if (data->type == w83783s) {
1619 data->alarms = w83781d_read_value(client,
1620 W83782D_REG_ALARM1)
1621 | (w83781d_read_value(client,
1622 W83782D_REG_ALARM2) << 8);
1623 } else {
1624 /* No real-time status registers, fall back to
1625 interrupt status registers */
1626 data->alarms = w83781d_read_value(client,
1627 W83781D_REG_ALARM1)
1628 | (w83781d_read_value(client,
1629 W83781D_REG_ALARM2) << 8);
1623 } 1630 }
1624 i = w83781d_read_value(client, W83781D_REG_BEEP_INTS2); 1631 i = w83781d_read_value(client, W83781D_REG_BEEP_INTS2);
1625 data->beep_enable = i >> 7; 1632 data->beep_enable = i >> 7;
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
index 9f2ffef4d812..4344ae6b1fcb 100644
--- a/drivers/i2c/busses/i2c-isa.c
+++ b/drivers/i2c/busses/i2c-isa.c
@@ -72,16 +72,6 @@ static ssize_t show_adapter_name(struct device *dev,
72} 72}
73static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); 73static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL);
74 74
75static int i2c_isa_device_probe(struct device *dev)
76{
77 return -ENODEV;
78}
79
80static int i2c_isa_device_remove(struct device *dev)
81{
82 return 0;
83}
84
85 75
86/* We implement an interface which resembles i2c_{add,del}_driver, 76/* We implement an interface which resembles i2c_{add,del}_driver,
87 but for i2c-isa drivers. We don't have to remember and handle lists 77 but for i2c-isa drivers. We don't have to remember and handle lists
@@ -93,8 +83,6 @@ int i2c_isa_add_driver(struct i2c_driver *driver)
93 83
94 /* Add the driver to the list of i2c drivers in the driver core */ 84 /* Add the driver to the list of i2c drivers in the driver core */
95 driver->driver.bus = &i2c_bus_type; 85 driver->driver.bus = &i2c_bus_type;
96 driver->driver.probe = i2c_isa_device_probe;
97 driver->driver.remove = i2c_isa_device_remove;
98 res = driver_register(&driver->driver); 86 res = driver_register(&driver->driver);
99 if (res) 87 if (res)
100 return res; 88 return res;
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 9834dce4e20f..0606bd2f6020 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -34,6 +34,7 @@
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/timer.h> 35#include <linux/timer.h>
36#include <linux/mm.h> 36#include <linux/mm.h>
37#include <linux/sched.h>
37#include <linux/interrupt.h> 38#include <linux/interrupt.h>
38#include <linux/major.h> 39#include <linux/major.h>
39#include <linux/errno.h> 40#include <linux/errno.h>
@@ -314,6 +315,8 @@ static void ide_pio_datablock(ide_drive_t *drive, struct request *rq,
314 if (rq->bio) /* fs request */ 315 if (rq->bio) /* fs request */
315 rq->errors = 0; 316 rq->errors = 0;
316 317
318 touch_softlockup_watchdog();
319
317 switch (drive->hwif->data_phase) { 320 switch (drive->hwif->data_phase) {
318 case TASKFILE_MULTI_IN: 321 case TASKFILE_MULTI_IN:
319 case TASKFILE_MULTI_OUT: 322 case TASKFILE_MULTI_OUT:
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 2b286e865163..43b96e298363 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -13,11 +13,6 @@
13 * License along with this program; if not, write the Free Software 13 * License along with this program; if not, write the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
15 * 15 *
16 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
17 * Mountain View, CA 94043, or:
18 *
19 * http://www.sgi.com
20 *
21 * For further information regarding this notice, see: 16 * For further information regarding this notice, see:
22 * 17 *
23 * http://oss.sgi.com/projects/GenInfo/NoticeExplan 18 * http://oss.sgi.com/projects/GenInfo/NoticeExplan
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 18d7eda38851..c2c776fbda01 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -2082,9 +2082,7 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
2082 2082
2083 SBP2_DEBUG("sbp2_check_sbp2_response"); 2083 SBP2_DEBUG("sbp2_check_sbp2_response");
2084 2084
2085 switch (SCpnt->cmnd[0]) { 2085 if (SCpnt->cmnd[0] == INQUIRY && (SCpnt->cmnd[1] & 3) == 0) {
2086
2087 case INQUIRY:
2088 /* 2086 /*
2089 * Make sure data length is ok. Minimum length is 36 bytes 2087 * Make sure data length is ok. Minimum length is 36 bytes
2090 */ 2088 */
@@ -2097,13 +2095,7 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
2097 */ 2095 */
2098 scsi_buf[2] |= 2; 2096 scsi_buf[2] |= 2;
2099 scsi_buf[3] = (scsi_buf[3] & 0xf0) | 2; 2097 scsi_buf[3] = (scsi_buf[3] & 0xf0) | 2;
2100
2101 break;
2102
2103 default:
2104 break;
2105 } 2098 }
2106 return;
2107} 2099}
2108 2100
2109/* 2101/*
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index d393b504bf26..c82f47a66e48 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -665,7 +665,15 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
665 struct ib_wc mad_wc; 665 struct ib_wc mad_wc;
666 struct ib_send_wr *send_wr = &mad_send_wr->send_wr; 666 struct ib_send_wr *send_wr = &mad_send_wr->send_wr;
667 667
668 if (!smi_handle_dr_smp_send(smp, device->node_type, port_num)) { 668 /*
669 * Directed route handling starts if the initial LID routed part of
670 * a request or the ending LID routed part of a response is empty.
671 * If we are at the start of the LID routed part, don't update the
672 * hop_ptr or hop_cnt. See section 14.2.2, Vol 1 IB spec.
673 */
674 if ((ib_get_smp_direction(smp) ? smp->dr_dlid : smp->dr_slid) ==
675 IB_LID_PERMISSIVE &&
676 !smi_handle_dr_smp_send(smp, device->node_type, port_num)) {
669 ret = -EINVAL; 677 ret = -EINVAL;
670 printk(KERN_ERR PFX "Invalid directed route\n"); 678 printk(KERN_ERR PFX "Invalid directed route\n");
671 goto out; 679 goto out;
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c
index f9b9b93dc501..2825615ce81c 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -1029,25 +1029,6 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev *dev,
1029 MTHCA_GET(size, outbox, QUERY_DEV_LIM_UAR_ENTRY_SZ_OFFSET); 1029 MTHCA_GET(size, outbox, QUERY_DEV_LIM_UAR_ENTRY_SZ_OFFSET);
1030 dev_lim->uar_scratch_entry_sz = size; 1030 dev_lim->uar_scratch_entry_sz = size;
1031 1031
1032 mthca_dbg(dev, "Max QPs: %d, reserved QPs: %d, entry size: %d\n",
1033 dev_lim->max_qps, dev_lim->reserved_qps, dev_lim->qpc_entry_sz);
1034 mthca_dbg(dev, "Max SRQs: %d, reserved SRQs: %d, entry size: %d\n",
1035 dev_lim->max_srqs, dev_lim->reserved_srqs, dev_lim->srq_entry_sz);
1036 mthca_dbg(dev, "Max CQs: %d, reserved CQs: %d, entry size: %d\n",
1037 dev_lim->max_cqs, dev_lim->reserved_cqs, dev_lim->cqc_entry_sz);
1038 mthca_dbg(dev, "Max EQs: %d, reserved EQs: %d, entry size: %d\n",
1039 dev_lim->max_eqs, dev_lim->reserved_eqs, dev_lim->eqc_entry_sz);
1040 mthca_dbg(dev, "reserved MPTs: %d, reserved MTTs: %d\n",
1041 dev_lim->reserved_mrws, dev_lim->reserved_mtts);
1042 mthca_dbg(dev, "Max PDs: %d, reserved PDs: %d, reserved UARs: %d\n",
1043 dev_lim->max_pds, dev_lim->reserved_pds, dev_lim->reserved_uars);
1044 mthca_dbg(dev, "Max QP/MCG: %d, reserved MGMs: %d\n",
1045 dev_lim->max_pds, dev_lim->reserved_mgms);
1046 mthca_dbg(dev, "Max CQEs: %d, max WQEs: %d, max SRQ WQEs: %d\n",
1047 dev_lim->max_cq_sz, dev_lim->max_qp_sz, dev_lim->max_srq_sz);
1048
1049 mthca_dbg(dev, "Flags: %08x\n", dev_lim->flags);
1050
1051 if (mthca_is_memfree(dev)) { 1032 if (mthca_is_memfree(dev)) {
1052 MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SRQ_SZ_OFFSET); 1033 MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SRQ_SZ_OFFSET);
1053 dev_lim->max_srq_sz = 1 << field; 1034 dev_lim->max_srq_sz = 1 << field;
@@ -1093,6 +1074,25 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev *dev,
1093 dev_lim->mpt_entry_sz = MTHCA_MPT_ENTRY_SIZE; 1074 dev_lim->mpt_entry_sz = MTHCA_MPT_ENTRY_SIZE;
1094 } 1075 }
1095 1076
1077 mthca_dbg(dev, "Max QPs: %d, reserved QPs: %d, entry size: %d\n",
1078 dev_lim->max_qps, dev_lim->reserved_qps, dev_lim->qpc_entry_sz);
1079 mthca_dbg(dev, "Max SRQs: %d, reserved SRQs: %d, entry size: %d\n",
1080 dev_lim->max_srqs, dev_lim->reserved_srqs, dev_lim->srq_entry_sz);
1081 mthca_dbg(dev, "Max CQs: %d, reserved CQs: %d, entry size: %d\n",
1082 dev_lim->max_cqs, dev_lim->reserved_cqs, dev_lim->cqc_entry_sz);
1083 mthca_dbg(dev, "Max EQs: %d, reserved EQs: %d, entry size: %d\n",
1084 dev_lim->max_eqs, dev_lim->reserved_eqs, dev_lim->eqc_entry_sz);
1085 mthca_dbg(dev, "reserved MPTs: %d, reserved MTTs: %d\n",
1086 dev_lim->reserved_mrws, dev_lim->reserved_mtts);
1087 mthca_dbg(dev, "Max PDs: %d, reserved PDs: %d, reserved UARs: %d\n",
1088 dev_lim->max_pds, dev_lim->reserved_pds, dev_lim->reserved_uars);
1089 mthca_dbg(dev, "Max QP/MCG: %d, reserved MGMs: %d\n",
1090 dev_lim->max_pds, dev_lim->reserved_mgms);
1091 mthca_dbg(dev, "Max CQEs: %d, max WQEs: %d, max SRQ WQEs: %d\n",
1092 dev_lim->max_cq_sz, dev_lim->max_qp_sz, dev_lim->max_srq_sz);
1093
1094 mthca_dbg(dev, "Flags: %08x\n", dev_lim->flags);
1095
1096out: 1096out:
1097 mthca_free_mailbox(dev, mailbox); 1097 mthca_free_mailbox(dev, mailbox);
1098 return err; 1098 return err;
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
index 2a165fd06e57..e481037288d6 100644
--- a/drivers/infiniband/hw/mthca/mthca_dev.h
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h
@@ -53,8 +53,8 @@
53 53
54#define DRV_NAME "ib_mthca" 54#define DRV_NAME "ib_mthca"
55#define PFX DRV_NAME ": " 55#define PFX DRV_NAME ": "
56#define DRV_VERSION "0.06" 56#define DRV_VERSION "0.07"
57#define DRV_RELDATE "June 23, 2005" 57#define DRV_RELDATE "February 13, 2006"
58 58
59enum { 59enum {
60 MTHCA_FLAG_DDR_HIDDEN = 1 << 1, 60 MTHCA_FLAG_DDR_HIDDEN = 1 << 1,
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index e0a5412b7e68..2f85a9a831b1 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -78,6 +78,7 @@ enum {
78 IPOIB_FLAG_SUBINTERFACE = 4, 78 IPOIB_FLAG_SUBINTERFACE = 4,
79 IPOIB_MCAST_RUN = 5, 79 IPOIB_MCAST_RUN = 5,
80 IPOIB_STOP_REAPER = 6, 80 IPOIB_STOP_REAPER = 6,
81 IPOIB_MCAST_STARTED = 7,
81 82
82 IPOIB_MAX_BACKOFF_SECONDS = 16, 83 IPOIB_MAX_BACKOFF_SECONDS = 16,
83 84
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index ccaa0c387076..a2408d7ec598 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -533,8 +533,10 @@ void ipoib_mcast_join_task(void *dev_ptr)
533 } 533 }
534 534
535 if (!priv->broadcast) { 535 if (!priv->broadcast) {
536 priv->broadcast = ipoib_mcast_alloc(dev, 1); 536 struct ipoib_mcast *broadcast;
537 if (!priv->broadcast) { 537
538 broadcast = ipoib_mcast_alloc(dev, 1);
539 if (!broadcast) {
538 ipoib_warn(priv, "failed to allocate broadcast group\n"); 540 ipoib_warn(priv, "failed to allocate broadcast group\n");
539 mutex_lock(&mcast_mutex); 541 mutex_lock(&mcast_mutex);
540 if (test_bit(IPOIB_MCAST_RUN, &priv->flags)) 542 if (test_bit(IPOIB_MCAST_RUN, &priv->flags))
@@ -544,10 +546,11 @@ void ipoib_mcast_join_task(void *dev_ptr)
544 return; 546 return;
545 } 547 }
546 548
547 memcpy(priv->broadcast->mcmember.mgid.raw, priv->dev->broadcast + 4, 549 spin_lock_irq(&priv->lock);
550 memcpy(broadcast->mcmember.mgid.raw, priv->dev->broadcast + 4,
548 sizeof (union ib_gid)); 551 sizeof (union ib_gid));
552 priv->broadcast = broadcast;
549 553
550 spin_lock_irq(&priv->lock);
551 __ipoib_mcast_add(dev, priv->broadcast); 554 __ipoib_mcast_add(dev, priv->broadcast);
552 spin_unlock_irq(&priv->lock); 555 spin_unlock_irq(&priv->lock);
553 } 556 }
@@ -601,6 +604,10 @@ int ipoib_mcast_start_thread(struct net_device *dev)
601 queue_work(ipoib_workqueue, &priv->mcast_task); 604 queue_work(ipoib_workqueue, &priv->mcast_task);
602 mutex_unlock(&mcast_mutex); 605 mutex_unlock(&mcast_mutex);
603 606
607 spin_lock_irq(&priv->lock);
608 set_bit(IPOIB_MCAST_STARTED, &priv->flags);
609 spin_unlock_irq(&priv->lock);
610
604 return 0; 611 return 0;
605} 612}
606 613
@@ -611,6 +618,10 @@ int ipoib_mcast_stop_thread(struct net_device *dev, int flush)
611 618
612 ipoib_dbg_mcast(priv, "stopping multicast thread\n"); 619 ipoib_dbg_mcast(priv, "stopping multicast thread\n");
613 620
621 spin_lock_irq(&priv->lock);
622 clear_bit(IPOIB_MCAST_STARTED, &priv->flags);
623 spin_unlock_irq(&priv->lock);
624
614 mutex_lock(&mcast_mutex); 625 mutex_lock(&mcast_mutex);
615 clear_bit(IPOIB_MCAST_RUN, &priv->flags); 626 clear_bit(IPOIB_MCAST_RUN, &priv->flags);
616 cancel_delayed_work(&priv->mcast_task); 627 cancel_delayed_work(&priv->mcast_task);
@@ -693,6 +704,14 @@ void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid,
693 */ 704 */
694 spin_lock(&priv->lock); 705 spin_lock(&priv->lock);
695 706
707 if (!test_bit(IPOIB_MCAST_STARTED, &priv->flags) ||
708 !priv->broadcast ||
709 !test_bit(IPOIB_MCAST_FLAG_ATTACHED, &priv->broadcast->flags)) {
710 ++priv->stats.tx_dropped;
711 dev_kfree_skb_any(skb);
712 goto unlock;
713 }
714
696 mcast = __ipoib_mcast_find(dev, mgid); 715 mcast = __ipoib_mcast_find(dev, mgid);
697 if (!mcast) { 716 if (!mcast) {
698 /* Let's create a new send only group now */ 717 /* Let's create a new send only group now */
@@ -754,6 +773,7 @@ out:
754 ipoib_send(dev, skb, mcast->ah, IB_MULTICAST_QPN); 773 ipoib_send(dev, skb, mcast->ah, IB_MULTICAST_QPN);
755 } 774 }
756 775
776unlock:
757 spin_unlock(&priv->lock); 777 spin_unlock(&priv->lock);
758} 778}
759 779
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index 6e0afbb22383..2708167ba175 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -11,7 +11,6 @@ obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o
11obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o 11obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o
12obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o 12obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o
13obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o 13obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o
14obj-$(CONFIG_KEYBOARD_98KBD) += 98kbd.o
15obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o 14obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o
16obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o 15obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o
17obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o 16obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 184c4129470d..415c49178985 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -7,7 +7,6 @@
7obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o 7obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
8obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o 8obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
9obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o 9obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
10obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o
11obj-$(CONFIG_INPUT_UINPUT) += uinput.o 10obj-$(CONFIG_INPUT_UINPUT) += uinput.o
12obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o 11obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
13obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o 12obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index d448bb5e4869..3a6ae85cd69c 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -19,6 +19,7 @@
19#include <linux/input.h> 19#include <linux/input.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/interrupt.h>
22#include <asm/hardware.h> 23#include <asm/hardware.h>
23 24
24MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); 25MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index c88520d3d13c..40333d61093c 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -232,6 +232,7 @@ static struct ps2pp_info *get_model_info(unsigned char model)
232 { 88, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 232 { 88, PS2PP_KIND_WHEEL, PS2PP_WHEEL },
233 { 96, 0, 0 }, 233 { 96, 0, 0 },
234 { 97, PS2PP_KIND_TP3, PS2PP_WHEEL | PS2PP_HWHEEL }, 234 { 97, PS2PP_KIND_TP3, PS2PP_WHEEL | PS2PP_HWHEEL },
235 { 99, PS2PP_KIND_WHEEL, PS2PP_WHEEL },
235 { 100, PS2PP_KIND_MX, /* MX510 */ 236 { 100, PS2PP_KIND_MX, /* MX510 */
236 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | 237 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
237 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, 238 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN },
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
index b4898d8a68e2..6d9ec9ab1b90 100644
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -68,15 +68,19 @@ struct trackpoint_attr_data {
68 size_t field_offset; 68 size_t field_offset;
69 unsigned char command; 69 unsigned char command;
70 unsigned char mask; 70 unsigned char mask;
71 unsigned char inverted;
71}; 72};
72 73
73static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf) 74static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf)
74{ 75{
75 struct trackpoint_data *tp = psmouse->private; 76 struct trackpoint_data *tp = psmouse->private;
76 struct trackpoint_attr_data *attr = data; 77 struct trackpoint_attr_data *attr = data;
77 unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); 78 unsigned char value = *(unsigned char *)((char *)tp + attr->field_offset);
79
80 if (attr->inverted)
81 value = !value;
78 82
79 return sprintf(buf, "%u\n", *field); 83 return sprintf(buf, "%u\n", value);
80} 84}
81 85
82static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data, 86static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data,
@@ -120,6 +124,9 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
120 if (*rest || value > 1) 124 if (*rest || value > 1)
121 return -EINVAL; 125 return -EINVAL;
122 126
127 if (attr->inverted)
128 value = !value;
129
123 if (*field != value) { 130 if (*field != value) {
124 *field = value; 131 *field = value;
125 trackpoint_toggle_bit(&psmouse->ps2dev, attr->command, attr->mask); 132 trackpoint_toggle_bit(&psmouse->ps2dev, attr->command, attr->mask);
@@ -129,11 +136,12 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
129} 136}
130 137
131 138
132#define TRACKPOINT_BIT_ATTR(_name, _command, _mask) \ 139#define TRACKPOINT_BIT_ATTR(_name, _command, _mask, _inv) \
133 static struct trackpoint_attr_data trackpoint_attr_##_name = { \ 140 static struct trackpoint_attr_data trackpoint_attr_##_name = { \
134 .field_offset = offsetof(struct trackpoint_data, _name), \ 141 .field_offset = offsetof(struct trackpoint_data, _name), \
135 .command = _command, \ 142 .command = _command, \
136 .mask = _mask, \ 143 .mask = _mask, \
144 .inverted = _inv, \
137 }; \ 145 }; \
138 PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \ 146 PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \
139 &trackpoint_attr_##_name, \ 147 &trackpoint_attr_##_name, \
@@ -150,9 +158,9 @@ TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH);
150TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME); 158TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME);
151TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV); 159TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV);
152 160
153TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON); 161TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0);
154TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK); 162TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK, 0);
155TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV); 163TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV, 1);
156 164
157static struct attribute *trackpoint_attrs[] = { 165static struct attribute *trackpoint_attrs[] = {
158 &psmouse_attr_sensitivity.dattr.attr, 166 &psmouse_attr_sensitivity.dattr.attr,
diff --git a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h
index 9857d8b6ad66..050298b1a09d 100644
--- a/drivers/input/mouse/trackpoint.h
+++ b/drivers/input/mouse/trackpoint.h
@@ -78,7 +78,7 @@
78 78
79#define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */ 79#define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */
80#define TP_MASK_MB 0x01 80#define TP_MASK_MB 0x01
81#define TP_TOGGLE_EXT_DEV 0x23 /* Toggle external device */ 81#define TP_TOGGLE_EXT_DEV 0x23 /* Disable external device */
82#define TP_MASK_EXT_DEV 0x02 82#define TP_MASK_EXT_DEV 0x02
83#define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */ 83#define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */
84#define TP_MASK_DRIFT 0x80 84#define TP_MASK_DRIFT 0x80
@@ -125,7 +125,7 @@
125#define TP_DEF_MB 0x00 125#define TP_DEF_MB 0x00
126#define TP_DEF_PTSON 0x00 126#define TP_DEF_PTSON 0x00
127#define TP_DEF_SKIPBACK 0x00 127#define TP_DEF_SKIPBACK 0x00
128#define TP_DEF_EXT_DEV 0x01 128#define TP_DEF_EXT_DEV 0x00 /* 0 means enabled */
129 129
130#define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd)) 130#define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd))
131 131
diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile
index 678a8599f9ff..4155197867a3 100644
--- a/drivers/input/serio/Makefile
+++ b/drivers/input/serio/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_SERIO_RPCKBD) += rpckbd.o
13obj-$(CONFIG_SERIO_SA1111) += sa1111ps2.o 13obj-$(CONFIG_SERIO_SA1111) += sa1111ps2.o
14obj-$(CONFIG_SERIO_AMBAKMI) += ambakmi.o 14obj-$(CONFIG_SERIO_AMBAKMI) += ambakmi.o
15obj-$(CONFIG_SERIO_Q40KBD) += q40kbd.o 15obj-$(CONFIG_SERIO_Q40KBD) += q40kbd.o
16obj-$(CONFIG_SERIO_98KBD) += 98kbd-io.o
17obj-$(CONFIG_SERIO_GSCPS2) += gscps2.o 16obj-$(CONFIG_SERIO_GSCPS2) += gscps2.o
18obj-$(CONFIG_HP_SDC) += hp_sdc.o 17obj-$(CONFIG_HP_SDC) += hp_sdc.o
19obj-$(CONFIG_HIL_MLC) += hp_sdc_mlc.o hil_mlc.o 18obj-$(CONFIG_HIL_MLC) += hp_sdc_mlc.o hil_mlc.o
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index b45a45ca7cc9..8c12a974b411 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -48,10 +48,13 @@
48 48
49#define TS_POLL_PERIOD msecs_to_jiffies(10) 49#define TS_POLL_PERIOD msecs_to_jiffies(10)
50 50
51/* this driver doesn't aim at the peak continuous sample rate */
52#define SAMPLE_BITS (8 /*cmd*/ + 16 /*sample*/ + 2 /* before, after */)
53
51struct ts_event { 54struct ts_event {
52 /* For portability, we can't read 12 bit values using SPI (which 55 /* For portability, we can't read 12 bit values using SPI (which
53 * would make the controller deliver them as native byteorder u16 56 * would make the controller deliver them as native byteorder u16
54 * with msbs zeroed). Instead, we read them as two 8-byte values, 57 * with msbs zeroed). Instead, we read them as two 8-bit values,
55 * which need byteswapping then range adjustment. 58 * which need byteswapping then range adjustment.
56 */ 59 */
57 __be16 x; 60 __be16 x;
@@ -60,7 +63,7 @@ struct ts_event {
60}; 63};
61 64
62struct ads7846 { 65struct ads7846 {
63 struct input_dev input; 66 struct input_dev *input;
64 char phys[32]; 67 char phys[32];
65 68
66 struct spi_device *spi; 69 struct spi_device *spi;
@@ -68,6 +71,7 @@ struct ads7846 {
68 u16 vref_delay_usecs; 71 u16 vref_delay_usecs;
69 u16 x_plate_ohms; 72 u16 x_plate_ohms;
70 73
74 u8 read_x, read_y, read_z1, read_z2;
71 struct ts_event tc; 75 struct ts_event tc;
72 76
73 struct spi_transfer xfer[8]; 77 struct spi_transfer xfer[8];
@@ -117,10 +121,10 @@ struct ads7846 {
117#define READ_12BIT_DFR(x) (ADS_START | ADS_A2A1A0_d_ ## x \ 121#define READ_12BIT_DFR(x) (ADS_START | ADS_A2A1A0_d_ ## x \
118 | ADS_12_BIT | ADS_DFR) 122 | ADS_12_BIT | ADS_DFR)
119 123
120static const u8 read_y = READ_12BIT_DFR(y) | ADS_PD10_ADC_ON; 124#define READ_Y (READ_12BIT_DFR(y) | ADS_PD10_ADC_ON)
121static const u8 read_z1 = READ_12BIT_DFR(z1) | ADS_PD10_ADC_ON; 125#define READ_Z1 (READ_12BIT_DFR(z1) | ADS_PD10_ADC_ON)
122static const u8 read_z2 = READ_12BIT_DFR(z2) | ADS_PD10_ADC_ON; 126#define READ_Z2 (READ_12BIT_DFR(z2) | ADS_PD10_ADC_ON)
123static const u8 read_x = READ_12BIT_DFR(x) | ADS_PD10_PDOWN; /* LAST */ 127#define READ_X (READ_12BIT_DFR(x) | ADS_PD10_PDOWN) /* LAST */
124 128
125/* single-ended samples need to first power up reference voltage; 129/* single-ended samples need to first power up reference voltage;
126 * we leave both ADC and VREF powered 130 * we leave both ADC and VREF powered
@@ -128,8 +132,8 @@ static const u8 read_x = READ_12BIT_DFR(x) | ADS_PD10_PDOWN; /* LAST */
128#define READ_12BIT_SER(x) (ADS_START | ADS_A2A1A0_ ## x \ 132#define READ_12BIT_SER(x) (ADS_START | ADS_A2A1A0_ ## x \
129 | ADS_12_BIT | ADS_SER) 133 | ADS_12_BIT | ADS_SER)
130 134
131static const u8 ref_on = READ_12BIT_DFR(x) | ADS_PD10_ALL_ON; 135#define REF_ON (READ_12BIT_DFR(x) | ADS_PD10_ALL_ON)
132static const u8 ref_off = READ_12BIT_DFR(y) | ADS_PD10_PDOWN; 136#define REF_OFF (READ_12BIT_DFR(y) | ADS_PD10_PDOWN)
133 137
134/*--------------------------------------------------------------------------*/ 138/*--------------------------------------------------------------------------*/
135 139
@@ -138,7 +142,9 @@ static const u8 ref_off = READ_12BIT_DFR(y) | ADS_PD10_PDOWN;
138 */ 142 */
139 143
140struct ser_req { 144struct ser_req {
145 u8 ref_on;
141 u8 command; 146 u8 command;
147 u8 ref_off;
142 u16 scratch; 148 u16 scratch;
143 __be16 sample; 149 __be16 sample;
144 struct spi_message msg; 150 struct spi_message msg;
@@ -152,7 +158,7 @@ static int ads7846_read12_ser(struct device *dev, unsigned command)
152 struct ser_req *req = kzalloc(sizeof *req, SLAB_KERNEL); 158 struct ser_req *req = kzalloc(sizeof *req, SLAB_KERNEL);
153 int status; 159 int status;
154 int sample; 160 int sample;
155 int i; 161 int i;
156 162
157 if (!req) 163 if (!req)
158 return -ENOMEM; 164 return -ENOMEM;
@@ -160,7 +166,8 @@ static int ads7846_read12_ser(struct device *dev, unsigned command)
160 INIT_LIST_HEAD(&req->msg.transfers); 166 INIT_LIST_HEAD(&req->msg.transfers);
161 167
162 /* activate reference, so it has time to settle; */ 168 /* activate reference, so it has time to settle; */
163 req->xfer[0].tx_buf = &ref_on; 169 req->ref_on = REF_ON;
170 req->xfer[0].tx_buf = &req->ref_on;
164 req->xfer[0].len = 1; 171 req->xfer[0].len = 1;
165 req->xfer[1].rx_buf = &req->scratch; 172 req->xfer[1].rx_buf = &req->scratch;
166 req->xfer[1].len = 2; 173 req->xfer[1].len = 2;
@@ -182,7 +189,8 @@ static int ads7846_read12_ser(struct device *dev, unsigned command)
182 /* REVISIT: take a few more samples, and compare ... */ 189 /* REVISIT: take a few more samples, and compare ... */
183 190
184 /* turn off reference */ 191 /* turn off reference */
185 req->xfer[4].tx_buf = &ref_off; 192 req->ref_off = REF_OFF;
193 req->xfer[4].tx_buf = &req->ref_off;
186 req->xfer[4].len = 1; 194 req->xfer[4].len = 1;
187 req->xfer[5].rx_buf = &req->scratch; 195 req->xfer[5].rx_buf = &req->scratch;
188 req->xfer[5].len = 2; 196 req->xfer[5].len = 2;
@@ -236,11 +244,12 @@ SHOW(vbatt)
236 244
237static void ads7846_rx(void *ads) 245static void ads7846_rx(void *ads)
238{ 246{
239 struct ads7846 *ts = ads; 247 struct ads7846 *ts = ads;
240 unsigned Rt; 248 struct input_dev *input_dev = ts->input;
241 unsigned sync = 0; 249 unsigned Rt;
242 u16 x, y, z1, z2; 250 unsigned sync = 0;
243 unsigned long flags; 251 u16 x, y, z1, z2;
252 unsigned long flags;
244 253
245 /* adjust: 12 bit samples (left aligned), built from 254 /* adjust: 12 bit samples (left aligned), built from
246 * two 8 bit values writen msb-first. 255 * two 8 bit values writen msb-first.
@@ -276,21 +285,21 @@ static void ads7846_rx(void *ads)
276 * won't notice that, even if nPENIRQ never fires ... 285 * won't notice that, even if nPENIRQ never fires ...
277 */ 286 */
278 if (!ts->pendown && Rt != 0) { 287 if (!ts->pendown && Rt != 0) {
279 input_report_key(&ts->input, BTN_TOUCH, 1); 288 input_report_key(input_dev, BTN_TOUCH, 1);
280 sync = 1; 289 sync = 1;
281 } else if (ts->pendown && Rt == 0) { 290 } else if (ts->pendown && Rt == 0) {
282 input_report_key(&ts->input, BTN_TOUCH, 0); 291 input_report_key(input_dev, BTN_TOUCH, 0);
283 sync = 1; 292 sync = 1;
284 } 293 }
285 294
286 if (Rt) { 295 if (Rt) {
287 input_report_abs(&ts->input, ABS_X, x); 296 input_report_abs(input_dev, ABS_X, x);
288 input_report_abs(&ts->input, ABS_Y, y); 297 input_report_abs(input_dev, ABS_Y, y);
289 input_report_abs(&ts->input, ABS_PRESSURE, Rt); 298 input_report_abs(input_dev, ABS_PRESSURE, Rt);
290 sync = 1; 299 sync = 1;
291 } 300 }
292 if (sync) 301 if (sync)
293 input_sync(&ts->input); 302 input_sync(input_dev);
294 303
295#ifdef VERBOSE 304#ifdef VERBOSE
296 if (Rt || ts->pendown) 305 if (Rt || ts->pendown)
@@ -396,9 +405,10 @@ static int ads7846_resume(struct spi_device *spi)
396static int __devinit ads7846_probe(struct spi_device *spi) 405static int __devinit ads7846_probe(struct spi_device *spi)
397{ 406{
398 struct ads7846 *ts; 407 struct ads7846 *ts;
408 struct input_dev *input_dev;
399 struct ads7846_platform_data *pdata = spi->dev.platform_data; 409 struct ads7846_platform_data *pdata = spi->dev.platform_data;
400 struct spi_transfer *x; 410 struct spi_transfer *x;
401 int i; 411 int err;
402 412
403 if (!spi->irq) { 413 if (!spi->irq) {
404 dev_dbg(&spi->dev, "no IRQ?\n"); 414 dev_dbg(&spi->dev, "no IRQ?\n");
@@ -411,9 +421,9 @@ static int __devinit ads7846_probe(struct spi_device *spi)
411 } 421 }
412 422
413 /* don't exceed max specified sample rate */ 423 /* don't exceed max specified sample rate */
414 if (spi->max_speed_hz > (125000 * 16)) { 424 if (spi->max_speed_hz > (125000 * SAMPLE_BITS)) {
415 dev_dbg(&spi->dev, "f(sample) %d KHz?\n", 425 dev_dbg(&spi->dev, "f(sample) %d KHz?\n",
416 (spi->max_speed_hz/16)/1000); 426 (spi->max_speed_hz/SAMPLE_BITS)/1000);
417 return -EINVAL; 427 return -EINVAL;
418 } 428 }
419 429
@@ -423,13 +433,18 @@ static int __devinit ads7846_probe(struct spi_device *spi)
423 * to discard the four garbage LSBs. 433 * to discard the four garbage LSBs.
424 */ 434 */
425 435
426 if (!(ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL))) 436 ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL);
427 return -ENOMEM; 437 input_dev = input_allocate_device();
438 if (!ts || !input_dev) {
439 err = -ENOMEM;
440 goto err_free_mem;
441 }
428 442
429 dev_set_drvdata(&spi->dev, ts); 443 dev_set_drvdata(&spi->dev, ts);
444 spi->dev.power.power_state = PMSG_ON;
430 445
431 ts->spi = spi; 446 ts->spi = spi;
432 spi->dev.power.power_state = PMSG_ON; 447 ts->input = input_dev;
433 448
434 init_timer(&ts->timer); 449 init_timer(&ts->timer);
435 ts->timer.data = (unsigned long) ts; 450 ts->timer.data = (unsigned long) ts;
@@ -439,70 +454,80 @@ static int __devinit ads7846_probe(struct spi_device *spi)
439 ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100; 454 ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100;
440 ts->x_plate_ohms = pdata->x_plate_ohms ? : 400; 455 ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
441 456
442 init_input_dev(&ts->input); 457 snprintf(ts->phys, sizeof(ts->phys), "%s/input0", spi->dev.bus_id);
443 458
444 ts->input.dev = &spi->dev; 459 input_dev->name = "ADS784x Touchscreen";
445 ts->input.name = "ADS784x Touchscreen"; 460 input_dev->phys = ts->phys;
446 snprintf(ts->phys, sizeof ts->phys, "%s/input0", spi->dev.bus_id); 461 input_dev->cdev.dev = &spi->dev;
447 ts->input.phys = ts->phys;
448 462
449 ts->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 463 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
450 ts->input.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 464 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
451 input_set_abs_params(&ts->input, ABS_X, 465 input_set_abs_params(input_dev, ABS_X,
452 pdata->x_min ? : 0, 466 pdata->x_min ? : 0,
453 pdata->x_max ? : MAX_12BIT, 467 pdata->x_max ? : MAX_12BIT,
454 0, 0); 468 0, 0);
455 input_set_abs_params(&ts->input, ABS_Y, 469 input_set_abs_params(input_dev, ABS_Y,
456 pdata->y_min ? : 0, 470 pdata->y_min ? : 0,
457 pdata->y_max ? : MAX_12BIT, 471 pdata->y_max ? : MAX_12BIT,
458 0, 0); 472 0, 0);
459 input_set_abs_params(&ts->input, ABS_PRESSURE, 473 input_set_abs_params(input_dev, ABS_PRESSURE,
460 pdata->pressure_min, pdata->pressure_max, 0, 0); 474 pdata->pressure_min, pdata->pressure_max, 0, 0);
461 475
462 input_register_device(&ts->input);
463
464 /* set up the transfers to read touchscreen state; this assumes we 476 /* set up the transfers to read touchscreen state; this assumes we
465 * use formula #2 for pressure, not #3. 477 * use formula #2 for pressure, not #3.
466 */ 478 */
479 INIT_LIST_HEAD(&ts->msg.transfers);
467 x = ts->xfer; 480 x = ts->xfer;
468 481
469 /* y- still on; turn on only y+ (and ADC) */ 482 /* y- still on; turn on only y+ (and ADC) */
470 x->tx_buf = &read_y; 483 ts->read_y = READ_Y;
484 x->tx_buf = &ts->read_y;
471 x->len = 1; 485 x->len = 1;
486 spi_message_add_tail(x, &ts->msg);
487
472 x++; 488 x++;
473 x->rx_buf = &ts->tc.y; 489 x->rx_buf = &ts->tc.y;
474 x->len = 2; 490 x->len = 2;
475 x++; 491 spi_message_add_tail(x, &ts->msg);
476 492
477 /* turn y+ off, x- on; we'll use formula #2 */ 493 /* turn y+ off, x- on; we'll use formula #2 */
478 if (ts->model == 7846) { 494 if (ts->model == 7846) {
479 x->tx_buf = &read_z1; 495 x++;
496 ts->read_z1 = READ_Z1;
497 x->tx_buf = &ts->read_z1;
480 x->len = 1; 498 x->len = 1;
499 spi_message_add_tail(x, &ts->msg);
500
481 x++; 501 x++;
482 x->rx_buf = &ts->tc.z1; 502 x->rx_buf = &ts->tc.z1;
483 x->len = 2; 503 x->len = 2;
484 x++; 504 spi_message_add_tail(x, &ts->msg);
485 505
486 x->tx_buf = &read_z2; 506 x++;
507 ts->read_z2 = READ_Z2;
508 x->tx_buf = &ts->read_z2;
487 x->len = 1; 509 x->len = 1;
510 spi_message_add_tail(x, &ts->msg);
511
488 x++; 512 x++;
489 x->rx_buf = &ts->tc.z2; 513 x->rx_buf = &ts->tc.z2;
490 x->len = 2; 514 x->len = 2;
491 x++; 515 spi_message_add_tail(x, &ts->msg);
492 } 516 }
493 517
494 /* turn y- off, x+ on, then leave in lowpower */ 518 /* turn y- off, x+ on, then leave in lowpower */
495 x->tx_buf = &read_x; 519 x++;
520 ts->read_x = READ_X;
521 x->tx_buf = &ts->read_x;
496 x->len = 1; 522 x->len = 1;
523 spi_message_add_tail(x, &ts->msg);
524
497 x++; 525 x++;
498 x->rx_buf = &ts->tc.x; 526 x->rx_buf = &ts->tc.x;
499 x->len = 2; 527 x->len = 2;
500 x++; 528 CS_CHANGE(*x);
501 529 spi_message_add_tail(x, &ts->msg);
502 CS_CHANGE(x[-1]);
503 530
504 for (i = 0; i < x - ts->xfer; i++)
505 spi_message_add_tail(&ts->xfer[i], &ts->msg);
506 ts->msg.complete = ads7846_rx; 531 ts->msg.complete = ads7846_rx;
507 ts->msg.context = ts; 532 ts->msg.context = ts;
508 533
@@ -510,9 +535,8 @@ static int __devinit ads7846_probe(struct spi_device *spi)
510 SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING, 535 SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING,
511 spi->dev.bus_id, ts)) { 536 spi->dev.bus_id, ts)) {
512 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); 537 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
513 input_unregister_device(&ts->input); 538 err = -EBUSY;
514 kfree(ts); 539 goto err_free_mem;
515 return -EBUSY;
516 } 540 }
517 541
518 dev_info(&spi->dev, "touchscreen, irq %d\n", spi->irq); 542 dev_info(&spi->dev, "touchscreen, irq %d\n", spi->irq);
@@ -534,7 +558,18 @@ static int __devinit ads7846_probe(struct spi_device *spi)
534 device_create_file(&spi->dev, &dev_attr_vbatt); 558 device_create_file(&spi->dev, &dev_attr_vbatt);
535 device_create_file(&spi->dev, &dev_attr_vaux); 559 device_create_file(&spi->dev, &dev_attr_vaux);
536 560
561 err = input_register_device(input_dev);
562 if (err)
563 goto err_free_irq;
564
537 return 0; 565 return 0;
566
567 err_free_irq:
568 free_irq(spi->irq, ts);
569 err_free_mem:
570 input_free_device(input_dev);
571 kfree(ts);
572 return err;
538} 573}
539 574
540static int __devexit ads7846_remove(struct spi_device *spi) 575static int __devexit ads7846_remove(struct spi_device *spi)
@@ -554,7 +589,7 @@ static int __devexit ads7846_remove(struct spi_device *spi)
554 device_remove_file(&spi->dev, &dev_attr_vbatt); 589 device_remove_file(&spi->dev, &dev_attr_vbatt);
555 device_remove_file(&spi->dev, &dev_attr_vaux); 590 device_remove_file(&spi->dev, &dev_attr_vaux);
556 591
557 input_unregister_device(&ts->input); 592 input_unregister_device(ts->input);
558 kfree(ts); 593 kfree(ts);
559 594
560 dev_dbg(&spi->dev, "unregistered touchscreen\n"); 595 dev_dbg(&spi->dev, "unregistered touchscreen\n");
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index f190a99604f0..393633681f49 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -2359,8 +2359,8 @@ isdn_tty_at_cout(char *msg, modem_info * info)
2359 2359
2360 /* use queue instead of direct, if online and */ 2360 /* use queue instead of direct, if online and */
2361 /* data is in queue or buffer is full */ 2361 /* data is in queue or buffer is full */
2362 if ((info->online && tty_buffer_request_room(tty, l) < l) || 2362 if (info->online && ((tty_buffer_request_room(tty, l) < l) ||
2363 (!skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) { 2363 !skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) {
2364 skb = alloc_skb(l, GFP_ATOMIC); 2364 skb = alloc_skb(l, GFP_ATOMIC);
2365 if (!skb) { 2365 if (!skb) {
2366 spin_unlock_irqrestore(&info->readlock, flags); 2366 spin_unlock_irqrestore(&info->readlock, flags);
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index 3a32c59494f2..24e51d5e97fc 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -151,6 +151,7 @@ struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id,
151 kfree(buf); 151 kfree(buf);
152 return NULL; 152 return NULL;
153} 153}
154EXPORT_SYMBOL_GPL(smu_sat_get_sdb_partition);
154 155
155/* refresh the cache */ 156/* refresh the cache */
156static int wf_sat_read_cache(struct wf_sat *sat) 157static int wf_sat_read_cache(struct wf_sat *sat)
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 9a2c7605d49c..642a61b6d0a4 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -452,8 +452,7 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
452 } else if (func == MPI_FUNCTION_EVENT_ACK) { 452 } else if (func == MPI_FUNCTION_EVENT_ACK) {
453 dprintk((MYIOC_s_INFO_FMT "mpt_base_reply, EventAck reply received\n", 453 dprintk((MYIOC_s_INFO_FMT "mpt_base_reply, EventAck reply received\n",
454 ioc->name)); 454 ioc->name));
455 } else if (func == MPI_FUNCTION_CONFIG || 455 } else if (func == MPI_FUNCTION_CONFIG) {
456 func == MPI_FUNCTION_TOOLBOX) {
457 CONFIGPARMS *pCfg; 456 CONFIGPARMS *pCfg;
458 unsigned long flags; 457 unsigned long flags;
459 458
@@ -5327,115 +5326,6 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
5327} 5326}
5328 5327
5329/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5328/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5330/**
5331 * mpt_toolbox - Generic function to issue toolbox message
5332 * @ioc - Pointer to an adapter structure
5333 * @cfg - Pointer to a toolbox structure. Struct contains
5334 * action, page address, direction, physical address
5335 * and pointer to a configuration page header
5336 * Page header is updated.
5337 *
5338 * Returns 0 for success
5339 * -EPERM if not allowed due to ISR context
5340 * -EAGAIN if no msg frames currently available
5341 * -EFAULT for non-successful reply or no reply (timeout)
5342 */
5343int
5344mpt_toolbox(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
5345{
5346 ToolboxIstwiReadWriteRequest_t *pReq;
5347 MPT_FRAME_HDR *mf;
5348 struct pci_dev *pdev;
5349 unsigned long flags;
5350 int rc;
5351 u32 flagsLength;
5352 int in_isr;
5353
5354 /* Prevent calling wait_event() (below), if caller happens
5355 * to be in ISR context, because that is fatal!
5356 */
5357 in_isr = in_interrupt();
5358 if (in_isr) {
5359 dcprintk((MYIOC_s_WARN_FMT "toobox request not allowed in ISR context!\n",
5360 ioc->name));
5361 return -EPERM;
5362 }
5363
5364 /* Get and Populate a free Frame
5365 */
5366 if ((mf = mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) {
5367 dcprintk((MYIOC_s_WARN_FMT "mpt_toolbox: no msg frames!\n",
5368 ioc->name));
5369 return -EAGAIN;
5370 }
5371 pReq = (ToolboxIstwiReadWriteRequest_t *)mf;
5372 pReq->Tool = pCfg->action;
5373 pReq->Reserved = 0;
5374 pReq->ChainOffset = 0;
5375 pReq->Function = MPI_FUNCTION_TOOLBOX;
5376 pReq->Reserved1 = 0;
5377 pReq->Reserved2 = 0;
5378 pReq->MsgFlags = 0;
5379 pReq->Flags = pCfg->dir;
5380 pReq->BusNum = 0;
5381 pReq->Reserved3 = 0;
5382 pReq->NumAddressBytes = 0x01;
5383 pReq->Reserved4 = 0;
5384 pReq->DataLength = cpu_to_le16(0x04);
5385 pdev = ioc->pcidev;
5386 if (pdev->devfn & 1)
5387 pReq->DeviceAddr = 0xB2;
5388 else
5389 pReq->DeviceAddr = 0xB0;
5390 pReq->Addr1 = 0;
5391 pReq->Addr2 = 0;
5392 pReq->Addr3 = 0;
5393 pReq->Reserved5 = 0;
5394
5395 /* Add a SGE to the config request.
5396 */
5397
5398 flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ | 4;
5399
5400 mpt_add_sge((char *)&pReq->SGL, flagsLength, pCfg->physAddr);
5401
5402 dcprintk((MYIOC_s_INFO_FMT "Sending Toolbox request, Tool=%x\n",
5403 ioc->name, pReq->Tool));
5404
5405 /* Append pCfg pointer to end of mf
5406 */
5407 *((void **) (((u8 *) mf) + (ioc->req_sz - sizeof(void *)))) = (void *) pCfg;
5408
5409 /* Initalize the timer
5410 */
5411 init_timer(&pCfg->timer);
5412 pCfg->timer.data = (unsigned long) ioc;
5413 pCfg->timer.function = mpt_timer_expired;
5414 pCfg->wait_done = 0;
5415
5416 /* Set the timer; ensure 10 second minimum */
5417 if (pCfg->timeout < 10)
5418 pCfg->timer.expires = jiffies + HZ*10;
5419 else
5420 pCfg->timer.expires = jiffies + HZ*pCfg->timeout;
5421
5422 /* Add to end of Q, set timer and then issue this command */
5423 spin_lock_irqsave(&ioc->FreeQlock, flags);
5424 list_add_tail(&pCfg->linkage, &ioc->configQ);
5425 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
5426
5427 add_timer(&pCfg->timer);
5428 mpt_put_msg_frame(mpt_base_index, ioc, mf);
5429 wait_event(mpt_waitq, pCfg->wait_done);
5430
5431 /* mf has been freed - do not access */
5432
5433 rc = pCfg->status;
5434
5435 return rc;
5436}
5437
5438/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5439/* 5329/*
5440 * mpt_timer_expired - Call back for timer process. 5330 * mpt_timer_expired - Call back for timer process.
5441 * Used only internal config functionality. 5331 * Used only internal config functionality.
@@ -6142,7 +6032,7 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
6142 if (ioc->events && (ioc->eventTypes & ( 1 << event))) { 6032 if (ioc->events && (ioc->eventTypes & ( 1 << event))) {
6143 int idx; 6033 int idx;
6144 6034
6145 idx = ioc->eventContext % ioc->eventLogSize; 6035 idx = ioc->eventContext % MPTCTL_EVENT_LOG_SIZE;
6146 6036
6147 ioc->events[idx].event = event; 6037 ioc->events[idx].event = event;
6148 ioc->events[idx].eventContext = ioc->eventContext; 6038 ioc->events[idx].eventContext = ioc->eventContext;
@@ -6540,7 +6430,6 @@ EXPORT_SYMBOL(mpt_lan_index);
6540EXPORT_SYMBOL(mpt_stm_index); 6430EXPORT_SYMBOL(mpt_stm_index);
6541EXPORT_SYMBOL(mpt_HardResetHandler); 6431EXPORT_SYMBOL(mpt_HardResetHandler);
6542EXPORT_SYMBOL(mpt_config); 6432EXPORT_SYMBOL(mpt_config);
6543EXPORT_SYMBOL(mpt_toolbox);
6544EXPORT_SYMBOL(mpt_findImVolumes); 6433EXPORT_SYMBOL(mpt_findImVolumes);
6545EXPORT_SYMBOL(mpt_read_ioc_pg_3); 6434EXPORT_SYMBOL(mpt_read_ioc_pg_3);
6546EXPORT_SYMBOL(mpt_alloc_fw_memory); 6435EXPORT_SYMBOL(mpt_alloc_fw_memory);
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index ea2649ecad1f..723d54300953 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -616,6 +616,7 @@ typedef struct _MPT_ADAPTER
616 * increments by 32 bytes 616 * increments by 32 bytes
617 */ 617 */
618 int errata_flag_1064; 618 int errata_flag_1064;
619 int aen_event_read_flag; /* flag to indicate event log was read*/
619 u8 FirstWhoInit; 620 u8 FirstWhoInit;
620 u8 upload_fw; /* If set, do a fw upload */ 621 u8 upload_fw; /* If set, do a fw upload */
621 u8 reload_fw; /* Force a FW Reload on next reset */ 622 u8 reload_fw; /* Force a FW Reload on next reset */
@@ -1026,7 +1027,6 @@ extern u32 mpt_GetIocState(MPT_ADAPTER *ioc, int cooked);
1026extern void mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buf, int *size, int len, int showlan); 1027extern void mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buf, int *size, int len, int showlan);
1027extern int mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag); 1028extern int mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag);
1028extern int mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *cfg); 1029extern int mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *cfg);
1029extern int mpt_toolbox(MPT_ADAPTER *ioc, CONFIGPARMS *cfg);
1030extern void mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size); 1030extern void mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size);
1031extern void mpt_free_fw_memory(MPT_ADAPTER *ioc); 1031extern void mpt_free_fw_memory(MPT_ADAPTER *ioc);
1032extern int mpt_findImVolumes(MPT_ADAPTER *ioc); 1032extern int mpt_findImVolumes(MPT_ADAPTER *ioc);
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index bdf709987982..9b64e07400da 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -136,6 +136,12 @@ static void mptctl_free_tm_flags(MPT_ADAPTER *ioc);
136 */ 136 */
137static int mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase); 137static int mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase);
138 138
139/*
140 * Event Handler function
141 */
142static int mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
143struct fasync_struct *async_queue=NULL;
144
139/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 145/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
140/* 146/*
141 * Scatter gather list (SGL) sizes and limits... 147 * Scatter gather list (SGL) sizes and limits...
@@ -385,18 +391,18 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
385 } 391 }
386 392
387 /* Now wait for the command to complete */ 393 /* Now wait for the command to complete */
388 ii = wait_event_interruptible_timeout(mptctl_wait, 394 ii = wait_event_timeout(mptctl_wait,
389 ioctl->wait_done == 1, 395 ioctl->wait_done == 1,
390 HZ*5 /* 5 second timeout */); 396 HZ*5 /* 5 second timeout */);
391 397
392 if(ii <=0 && (ioctl->wait_done != 1 )) { 398 if(ii <=0 && (ioctl->wait_done != 1 )) {
399 mpt_free_msg_frame(hd->ioc, mf);
393 ioctl->wait_done = 0; 400 ioctl->wait_done = 0;
394 retval = -1; /* return failure */ 401 retval = -1; /* return failure */
395 } 402 }
396 403
397mptctl_bus_reset_done: 404mptctl_bus_reset_done:
398 405
399 mpt_free_msg_frame(hd->ioc, mf);
400 mptctl_free_tm_flags(ioctl->ioc); 406 mptctl_free_tm_flags(ioctl->ioc);
401 return retval; 407 return retval;
402} 408}
@@ -472,6 +478,69 @@ mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
472} 478}
473 479
474/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 480/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
481/* ASYNC Event Notification Support */
482static int
483mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
484{
485 u8 event;
486
487 event = le32_to_cpu(pEvReply->Event) & 0xFF;
488
489 dctlprintk(("%s() called\n", __FUNCTION__));
490 if(async_queue == NULL)
491 return 1;
492
493 /* Raise SIGIO for persistent events.
494 * TODO - this define is not in MPI spec yet,
495 * but they plan to set it to 0x21
496 */
497 if (event == 0x21 ) {
498 ioc->aen_event_read_flag=1;
499 dctlprintk(("Raised SIGIO to application\n"));
500 devtprintk(("Raised SIGIO to application\n"));
501 kill_fasync(&async_queue, SIGIO, POLL_IN);
502 return 1;
503 }
504
505 /* This flag is set after SIGIO was raised, and
506 * remains set until the application has read
507 * the event log via ioctl=MPTEVENTREPORT
508 */
509 if(ioc->aen_event_read_flag)
510 return 1;
511
512 /* Signal only for the events that are
513 * requested for by the application
514 */
515 if (ioc->events && (ioc->eventTypes & ( 1 << event))) {
516 ioc->aen_event_read_flag=1;
517 dctlprintk(("Raised SIGIO to application\n"));
518 devtprintk(("Raised SIGIO to application\n"));
519 kill_fasync(&async_queue, SIGIO, POLL_IN);
520 }
521 return 1;
522}
523
524static int
525mptctl_fasync(int fd, struct file *filep, int mode)
526{
527 MPT_ADAPTER *ioc;
528
529 list_for_each_entry(ioc, &ioc_list, list)
530 ioc->aen_event_read_flag=0;
531
532 dctlprintk(("%s() called\n", __FUNCTION__));
533 return fasync_helper(fd, filep, mode, &async_queue);
534}
535
536static int
537mptctl_release(struct inode *inode, struct file *filep)
538{
539 dctlprintk(("%s() called\n", __FUNCTION__));
540 return fasync_helper(-1, filep, 0, &async_queue);
541}
542
543/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
475/* 544/*
476 * MPT ioctl handler 545 * MPT ioctl handler
477 * cmd - specify the particular IOCTL command to be issued 546 * cmd - specify the particular IOCTL command to be issued
@@ -674,22 +743,23 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
674 u16 iocstat; 743 u16 iocstat;
675 pFWDownloadReply_t ReplyMsg = NULL; 744 pFWDownloadReply_t ReplyMsg = NULL;
676 745
677 dctlprintk((KERN_INFO "mptctl_do_fwdl called. mptctl_id = %xh.\n", mptctl_id)); 746 dctlprintk(("mptctl_do_fwdl called. mptctl_id = %xh.\n", mptctl_id));
678 747
679 dctlprintk((KERN_INFO "DbG: kfwdl.bufp = %p\n", ufwbuf)); 748 dctlprintk(("DbG: kfwdl.bufp = %p\n", ufwbuf));
680 dctlprintk((KERN_INFO "DbG: kfwdl.fwlen = %d\n", (int)fwlen)); 749 dctlprintk(("DbG: kfwdl.fwlen = %d\n", (int)fwlen));
681 dctlprintk((KERN_INFO "DbG: kfwdl.ioc = %04xh\n", ioc)); 750 dctlprintk(("DbG: kfwdl.ioc = %04xh\n", ioc));
682 751
683 if ((ioc = mpt_verify_adapter(ioc, &iocp)) < 0) { 752 if (mpt_verify_adapter(ioc, &iocp) < 0) {
684 dctlprintk(("%s@%d::_ioctl_fwdl - ioc%d not found!\n", 753 dctlprintk(("ioctl_fwdl - ioc%d not found!\n",
685 __FILE__, __LINE__, ioc)); 754 ioc));
686 return -ENODEV; /* (-6) No such device or address */ 755 return -ENODEV; /* (-6) No such device or address */
687 } 756 } else {
688 757
689 /* Valid device. Get a message frame and construct the FW download message. 758 /* Valid device. Get a message frame and construct the FW download message.
690 */ 759 */
691 if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) 760 if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL)
692 return -EAGAIN; 761 return -EAGAIN;
762 }
693 dlmsg = (FWDownload_t*) mf; 763 dlmsg = (FWDownload_t*) mf;
694 ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL; 764 ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL;
695 sgOut = (char *) (ptsge + 1); 765 sgOut = (char *) (ptsge + 1);
@@ -702,7 +772,11 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
702 dlmsg->ChainOffset = 0; 772 dlmsg->ChainOffset = 0;
703 dlmsg->Function = MPI_FUNCTION_FW_DOWNLOAD; 773 dlmsg->Function = MPI_FUNCTION_FW_DOWNLOAD;
704 dlmsg->Reserved1[0] = dlmsg->Reserved1[1] = dlmsg->Reserved1[2] = 0; 774 dlmsg->Reserved1[0] = dlmsg->Reserved1[1] = dlmsg->Reserved1[2] = 0;
705 dlmsg->MsgFlags = 0; 775 if (iocp->facts.MsgVersion >= MPI_VERSION_01_05)
776 dlmsg->MsgFlags = MPI_FW_DOWNLOAD_MSGFLGS_LAST_SEGMENT;
777 else
778 dlmsg->MsgFlags = 0;
779
706 780
707 /* Set up the Transaction SGE. 781 /* Set up the Transaction SGE.
708 */ 782 */
@@ -754,7 +828,7 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
754 goto fwdl_out; 828 goto fwdl_out;
755 } 829 }
756 830
757 dctlprintk((KERN_INFO "DbG: sgl buffer = %p, sgfrags = %d\n", sgl, numfrags)); 831 dctlprintk(("DbG: sgl buffer = %p, sgfrags = %d\n", sgl, numfrags));
758 832
759 /* 833 /*
760 * Parse SG list, copying sgl itself, 834 * Parse SG list, copying sgl itself,
@@ -803,11 +877,11 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
803 /* 877 /*
804 * Finally, perform firmware download. 878 * Finally, perform firmware download.
805 */ 879 */
806 iocp->ioctl->wait_done = 0; 880 ReplyMsg = NULL;
807 mpt_put_msg_frame(mptctl_id, iocp, mf); 881 mpt_put_msg_frame(mptctl_id, iocp, mf);
808 882
809 /* Now wait for the command to complete */ 883 /* Now wait for the command to complete */
810 ret = wait_event_interruptible_timeout(mptctl_wait, 884 ret = wait_event_timeout(mptctl_wait,
811 iocp->ioctl->wait_done == 1, 885 iocp->ioctl->wait_done == 1,
812 HZ*60); 886 HZ*60);
813 887
@@ -1145,7 +1219,9 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1145 /* Fill in the data and return the structure to the calling 1219 /* Fill in the data and return the structure to the calling
1146 * program 1220 * program
1147 */ 1221 */
1148 if (ioc->bus_type == FC) 1222 if (ioc->bus_type == SAS)
1223 karg->adapterType = MPT_IOCTL_INTERFACE_SAS;
1224 else if (ioc->bus_type == FC)
1149 karg->adapterType = MPT_IOCTL_INTERFACE_FC; 1225 karg->adapterType = MPT_IOCTL_INTERFACE_FC;
1150 else 1226 else
1151 karg->adapterType = MPT_IOCTL_INTERFACE_SCSI; 1227 karg->adapterType = MPT_IOCTL_INTERFACE_SCSI;
@@ -1170,12 +1246,11 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1170 karg->pciInfo.u.bits.deviceNumber = PCI_SLOT( pdev->devfn ); 1246 karg->pciInfo.u.bits.deviceNumber = PCI_SLOT( pdev->devfn );
1171 karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn ); 1247 karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn );
1172 } else if (cim_rev == 2) { 1248 } else if (cim_rev == 2) {
1173 /* Get the PCI bus, device, function and segment ID numbers 1249 /* Get the PCI bus, device, function and segment ID numbers
1174 for the IOC */ 1250 for the IOC */
1175 karg->pciInfo.u.bits.busNumber = pdev->bus->number; 1251 karg->pciInfo.u.bits.busNumber = pdev->bus->number;
1176 karg->pciInfo.u.bits.deviceNumber = PCI_SLOT( pdev->devfn ); 1252 karg->pciInfo.u.bits.deviceNumber = PCI_SLOT( pdev->devfn );
1177 karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn ); 1253 karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn );
1178 karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn );
1179 karg->pciInfo.segmentID = pci_domain_nr(pdev->bus); 1254 karg->pciInfo.segmentID = pci_domain_nr(pdev->bus);
1180 } 1255 }
1181 1256
@@ -1500,7 +1575,7 @@ mptctl_eventquery (unsigned long arg)
1500 return -ENODEV; 1575 return -ENODEV;
1501 } 1576 }
1502 1577
1503 karg.eventEntries = ioc->eventLogSize; 1578 karg.eventEntries = MPTCTL_EVENT_LOG_SIZE;
1504 karg.eventTypes = ioc->eventTypes; 1579 karg.eventTypes = ioc->eventTypes;
1505 1580
1506 /* Copy the data from kernel memory to user memory 1581 /* Copy the data from kernel memory to user memory
@@ -1550,7 +1625,6 @@ mptctl_eventenable (unsigned long arg)
1550 memset(ioc->events, 0, sz); 1625 memset(ioc->events, 0, sz);
1551 ioc->alloc_total += sz; 1626 ioc->alloc_total += sz;
1552 1627
1553 ioc->eventLogSize = MPTCTL_EVENT_LOG_SIZE;
1554 ioc->eventContext = 0; 1628 ioc->eventContext = 0;
1555 } 1629 }
1556 1630
@@ -1590,7 +1664,7 @@ mptctl_eventreport (unsigned long arg)
1590 maxEvents = numBytes/sizeof(MPT_IOCTL_EVENTS); 1664 maxEvents = numBytes/sizeof(MPT_IOCTL_EVENTS);
1591 1665
1592 1666
1593 max = ioc->eventLogSize < maxEvents ? ioc->eventLogSize : maxEvents; 1667 max = MPTCTL_EVENT_LOG_SIZE < maxEvents ? MPTCTL_EVENT_LOG_SIZE : maxEvents;
1594 1668
1595 /* If fewer than 1 event is requested, there must have 1669 /* If fewer than 1 event is requested, there must have
1596 * been some type of error. 1670 * been some type of error.
@@ -1598,6 +1672,9 @@ mptctl_eventreport (unsigned long arg)
1598 if ((max < 1) || !ioc->events) 1672 if ((max < 1) || !ioc->events)
1599 return -ENODATA; 1673 return -ENODATA;
1600 1674
1675 /* reset this flag so SIGIO can restart */
1676 ioc->aen_event_read_flag=0;
1677
1601 /* Copy the data from kernel memory to user memory 1678 /* Copy the data from kernel memory to user memory
1602 */ 1679 */
1603 numBytes = max * sizeof(MPT_IOCTL_EVENTS); 1680 numBytes = max * sizeof(MPT_IOCTL_EVENTS);
@@ -1817,6 +1894,8 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1817 case MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR: 1894 case MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR:
1818 case MPI_FUNCTION_FW_DOWNLOAD: 1895 case MPI_FUNCTION_FW_DOWNLOAD:
1819 case MPI_FUNCTION_FC_PRIMITIVE_SEND: 1896 case MPI_FUNCTION_FC_PRIMITIVE_SEND:
1897 case MPI_FUNCTION_TOOLBOX:
1898 case MPI_FUNCTION_SAS_IO_UNIT_CONTROL:
1820 break; 1899 break;
1821 1900
1822 case MPI_FUNCTION_SCSI_IO_REQUEST: 1901 case MPI_FUNCTION_SCSI_IO_REQUEST:
@@ -1837,7 +1916,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1837 goto done_free_mem; 1916 goto done_free_mem;
1838 } 1917 }
1839 1918
1840 pScsiReq->MsgFlags = mpt_msg_flags(); 1919 pScsiReq->MsgFlags &= ~MPI_SCSIIO_MSGFLGS_SENSE_WIDTH;
1920 pScsiReq->MsgFlags |= mpt_msg_flags();
1921
1841 1922
1842 /* verify that app has not requested 1923 /* verify that app has not requested
1843 * more sense data than driver 1924 * more sense data than driver
@@ -1888,6 +1969,25 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1888 } 1969 }
1889 break; 1970 break;
1890 1971
1972 case MPI_FUNCTION_SMP_PASSTHROUGH:
1973 /* Check mf->PassthruFlags to determine if
1974 * transfer is ImmediateMode or not.
1975 * Immediate mode returns data in the ReplyFrame.
1976 * Else, we are sending request and response data
1977 * in two SGLs at the end of the mf.
1978 */
1979 break;
1980
1981 case MPI_FUNCTION_SATA_PASSTHROUGH:
1982 if (!ioc->sh) {
1983 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
1984 "SCSI driver is not loaded. \n",
1985 __FILE__, __LINE__);
1986 rc = -EFAULT;
1987 goto done_free_mem;
1988 }
1989 break;
1990
1891 case MPI_FUNCTION_RAID_ACTION: 1991 case MPI_FUNCTION_RAID_ACTION:
1892 /* Just add a SGE 1992 /* Just add a SGE
1893 */ 1993 */
@@ -1900,7 +2000,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1900 int scsidir = MPI_SCSIIO_CONTROL_READ; 2000 int scsidir = MPI_SCSIIO_CONTROL_READ;
1901 int dataSize; 2001 int dataSize;
1902 2002
1903 pScsiReq->MsgFlags = mpt_msg_flags(); 2003 pScsiReq->MsgFlags &= ~MPI_SCSIIO_MSGFLGS_SENSE_WIDTH;
2004 pScsiReq->MsgFlags |= mpt_msg_flags();
2005
1904 2006
1905 /* verify that app has not requested 2007 /* verify that app has not requested
1906 * more sense data than driver 2008 * more sense data than driver
@@ -2130,7 +2232,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2130 2232
2131 /* Now wait for the command to complete */ 2233 /* Now wait for the command to complete */
2132 timeout = (karg.timeout > 0) ? karg.timeout : MPT_IOCTL_DEFAULT_TIMEOUT; 2234 timeout = (karg.timeout > 0) ? karg.timeout : MPT_IOCTL_DEFAULT_TIMEOUT;
2133 timeout = wait_event_interruptible_timeout(mptctl_wait, 2235 timeout = wait_event_timeout(mptctl_wait,
2134 ioc->ioctl->wait_done == 1, 2236 ioc->ioctl->wait_done == 1,
2135 HZ*timeout); 2237 HZ*timeout);
2136 2238
@@ -2246,13 +2348,16 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2246 hp_host_info_t __user *uarg = (void __user *) arg; 2348 hp_host_info_t __user *uarg = (void __user *) arg;
2247 MPT_ADAPTER *ioc; 2349 MPT_ADAPTER *ioc;
2248 struct pci_dev *pdev; 2350 struct pci_dev *pdev;
2249 char *pbuf; 2351 char *pbuf=NULL;
2250 dma_addr_t buf_dma; 2352 dma_addr_t buf_dma;
2251 hp_host_info_t karg; 2353 hp_host_info_t karg;
2252 CONFIGPARMS cfg; 2354 CONFIGPARMS cfg;
2253 ConfigPageHeader_t hdr; 2355 ConfigPageHeader_t hdr;
2254 int iocnum; 2356 int iocnum;
2255 int rc, cim_rev; 2357 int rc, cim_rev;
2358 ToolboxIstwiReadWriteRequest_t *IstwiRWRequest;
2359 MPT_FRAME_HDR *mf = NULL;
2360 MPIHeader_t *mpi_hdr;
2256 2361
2257 dctlprintk((": mptctl_hp_hostinfo called.\n")); 2362 dctlprintk((": mptctl_hp_hostinfo called.\n"));
2258 /* Reset long to int. Should affect IA64 and SPARC only 2363 /* Reset long to int. Should affect IA64 and SPARC only
@@ -2370,7 +2475,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2370 2475
2371 karg.base_io_addr = pci_resource_start(pdev, 0); 2476 karg.base_io_addr = pci_resource_start(pdev, 0);
2372 2477
2373 if (ioc->bus_type == FC) 2478 if ((ioc->bus_type == SAS) || (ioc->bus_type == FC))
2374 karg.bus_phys_width = HP_BUS_WIDTH_UNK; 2479 karg.bus_phys_width = HP_BUS_WIDTH_UNK;
2375 else 2480 else
2376 karg.bus_phys_width = HP_BUS_WIDTH_16; 2481 karg.bus_phys_width = HP_BUS_WIDTH_16;
@@ -2388,20 +2493,67 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2388 } 2493 }
2389 } 2494 }
2390 2495
2391 cfg.pageAddr = 0; 2496 /*
2392 cfg.action = MPI_TOOLBOX_ISTWI_READ_WRITE_TOOL; 2497 * Gather ISTWI(Industry Standard Two Wire Interface) Data
2393 cfg.dir = MPI_TB_ISTWI_FLAGS_READ; 2498 */
2394 cfg.timeout = 10; 2499 if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) {
2500 dfailprintk((MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
2501 ioc->name,__FUNCTION__));
2502 goto out;
2503 }
2504
2505 IstwiRWRequest = (ToolboxIstwiReadWriteRequest_t *)mf;
2506 mpi_hdr = (MPIHeader_t *) mf;
2507 memset(IstwiRWRequest,0,sizeof(ToolboxIstwiReadWriteRequest_t));
2508 IstwiRWRequest->Function = MPI_FUNCTION_TOOLBOX;
2509 IstwiRWRequest->Tool = MPI_TOOLBOX_ISTWI_READ_WRITE_TOOL;
2510 IstwiRWRequest->MsgContext = mpi_hdr->MsgContext;
2511 IstwiRWRequest->Flags = MPI_TB_ISTWI_FLAGS_READ;
2512 IstwiRWRequest->NumAddressBytes = 0x01;
2513 IstwiRWRequest->DataLength = cpu_to_le16(0x04);
2514 if (pdev->devfn & 1)
2515 IstwiRWRequest->DeviceAddr = 0xB2;
2516 else
2517 IstwiRWRequest->DeviceAddr = 0xB0;
2518
2395 pbuf = pci_alloc_consistent(ioc->pcidev, 4, &buf_dma); 2519 pbuf = pci_alloc_consistent(ioc->pcidev, 4, &buf_dma);
2396 if (pbuf) { 2520 if (!pbuf)
2397 cfg.physAddr = buf_dma; 2521 goto out;
2398 if ((mpt_toolbox(ioc, &cfg)) == 0) { 2522 mpt_add_sge((char *)&IstwiRWRequest->SGL,
2399 karg.rsvd = *(u32 *)pbuf; 2523 (MPT_SGE_FLAGS_SSIMPLE_READ|4), buf_dma);
2400 } 2524
2401 pci_free_consistent(ioc->pcidev, 4, pbuf, buf_dma); 2525 ioc->ioctl->wait_done = 0;
2402 pbuf = NULL; 2526 mpt_put_msg_frame(mptctl_id, ioc, mf);
2527
2528 rc = wait_event_timeout(mptctl_wait,
2529 ioc->ioctl->wait_done == 1,
2530 HZ*MPT_IOCTL_DEFAULT_TIMEOUT /* 10 sec */);
2531
2532 if(rc <=0 && (ioc->ioctl->wait_done != 1 )) {
2533 /*
2534 * Now we need to reset the board
2535 */
2536 mpt_free_msg_frame(ioc, mf);
2537 mptctl_timeout_expired(ioc->ioctl);
2538 goto out;
2403 } 2539 }
2404 2540
2541 /*
2542 *ISTWI Data Definition
2543 * pbuf[0] = FW_VERSION = 0x4
2544 * pbuf[1] = Bay Count = 6 or 4 or 2, depending on
2545 * the config, you should be seeing one out of these three values
2546 * pbuf[2] = Drive Installed Map = bit pattern depend on which
2547 * bays have drives in them
2548 * pbuf[3] = Checksum (0x100 = (byte0 + byte2 + byte3)
2549 */
2550 if (ioc->ioctl->status & MPT_IOCTL_STATUS_RF_VALID)
2551 karg.rsvd = *(u32 *)pbuf;
2552
2553 out:
2554 if (pbuf)
2555 pci_free_consistent(ioc->pcidev, 4, pbuf, buf_dma);
2556
2405 /* Copy the data from kernel memory to user memory 2557 /* Copy the data from kernel memory to user memory
2406 */ 2558 */
2407 if (copy_to_user((char __user *)arg, &karg, sizeof(hp_host_info_t))) { 2559 if (copy_to_user((char __user *)arg, &karg, sizeof(hp_host_info_t))) {
@@ -2459,7 +2611,7 @@ mptctl_hp_targetinfo(unsigned long arg)
2459 2611
2460 /* There is nothing to do for FCP parts. 2612 /* There is nothing to do for FCP parts.
2461 */ 2613 */
2462 if (ioc->bus_type == FC) 2614 if ((ioc->bus_type == SAS) || (ioc->bus_type == FC))
2463 return 0; 2615 return 0;
2464 2616
2465 if ((ioc->spi_data.sdp0length == 0) || (ioc->sh == NULL)) 2617 if ((ioc->spi_data.sdp0length == 0) || (ioc->sh == NULL))
@@ -2569,6 +2721,8 @@ mptctl_hp_targetinfo(unsigned long arg)
2569static struct file_operations mptctl_fops = { 2721static struct file_operations mptctl_fops = {
2570 .owner = THIS_MODULE, 2722 .owner = THIS_MODULE,
2571 .llseek = no_llseek, 2723 .llseek = no_llseek,
2724 .release = mptctl_release,
2725 .fasync = mptctl_fasync,
2572 .unlocked_ioctl = mptctl_ioctl, 2726 .unlocked_ioctl = mptctl_ioctl,
2573#ifdef CONFIG_COMPAT 2727#ifdef CONFIG_COMPAT
2574 .compat_ioctl = compat_mpctl_ioctl, 2728 .compat_ioctl = compat_mpctl_ioctl,
@@ -2813,6 +2967,11 @@ static int __init mptctl_init(void)
2813 /* FIXME! */ 2967 /* FIXME! */
2814 } 2968 }
2815 2969
2970 if (mpt_event_register(mptctl_id, mptctl_event_process) == 0) {
2971 devtprintk((KERN_INFO MYNAM
2972 ": Registered for IOC event notifications\n"));
2973 }
2974
2816 return 0; 2975 return 0;
2817 2976
2818out_fail: 2977out_fail:
diff --git a/drivers/message/fusion/mptctl.h b/drivers/message/fusion/mptctl.h
index 518996e03481..a2f8a97992e6 100644
--- a/drivers/message/fusion/mptctl.h
+++ b/drivers/message/fusion/mptctl.h
@@ -169,8 +169,10 @@ struct mpt_ioctl_pci_info2 {
169 * Read only. 169 * Read only.
170 * Data starts at offset 0xC 170 * Data starts at offset 0xC
171 */ 171 */
172#define MPT_IOCTL_INTERFACE_FC (0x01)
173#define MPT_IOCTL_INTERFACE_SCSI (0x00) 172#define MPT_IOCTL_INTERFACE_SCSI (0x00)
173#define MPT_IOCTL_INTERFACE_FC (0x01)
174#define MPT_IOCTL_INTERFACE_FC_IP (0x02)
175#define MPT_IOCTL_INTERFACE_SAS (0x03)
174#define MPT_IOCTL_VERSION_LENGTH (32) 176#define MPT_IOCTL_VERSION_LENGTH (32)
175 177
176struct mpt_ioctl_iocinfo { 178struct mpt_ioctl_iocinfo {
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 05789e505464..4fee6befc93d 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2489,7 +2489,7 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR
2489 int idx; 2489 int idx;
2490 MPT_ADAPTER *ioc = hd->ioc; 2490 MPT_ADAPTER *ioc = hd->ioc;
2491 2491
2492 idx = ioc->eventContext % ioc->eventLogSize; 2492 idx = ioc->eventContext % MPTCTL_EVENT_LOG_SIZE;
2493 ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE; 2493 ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE;
2494 ioc->events[idx].eventContext = ioc->eventContext; 2494 ioc->events[idx].eventContext = ioc->eventContext;
2495 2495
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c
index 37ee7f8dc82f..9fef29d978b5 100644
--- a/drivers/mmc/mmci.c
+++ b/drivers/mmc/mmci.c
@@ -97,6 +97,13 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
97 if (data->flags & MMC_DATA_READ) { 97 if (data->flags & MMC_DATA_READ) {
98 datactrl |= MCI_DPSM_DIRECTION; 98 datactrl |= MCI_DPSM_DIRECTION;
99 irqmask = MCI_RXFIFOHALFFULLMASK; 99 irqmask = MCI_RXFIFOHALFFULLMASK;
100
101 /*
102 * If we have less than a FIFOSIZE of bytes to transfer,
103 * trigger a PIO interrupt as soon as any data is available.
104 */
105 if (host->size < MCI_FIFOSIZE)
106 irqmask |= MCI_RXDATAAVLBLMASK;
100 } else { 107 } else {
101 /* 108 /*
102 * We don't actually need to include "FIFO empty" here 109 * We don't actually need to include "FIFO empty" here
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 69c04945591f..ded2c33f5b85 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -1019,8 +1019,8 @@ static void __xipram xip_udelay(struct map_info *map, struct flchip *chip,
1019#define XIP_INVAL_CACHED_RANGE(map, from, size) \ 1019#define XIP_INVAL_CACHED_RANGE(map, from, size) \
1020 INVALIDATE_CACHED_RANGE(map, from, size) 1020 INVALIDATE_CACHED_RANGE(map, from, size)
1021 1021
1022#define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec) \ 1022#define INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr, adr, len, usec) \
1023 UDELAY(map, chip, adr, usec) 1023 UDELAY(map, chip, cmd_adr, usec)
1024 1024
1025/* 1025/*
1026 * Extra notes: 1026 * Extra notes:
@@ -1052,7 +1052,7 @@ do { \
1052 spin_lock(chip->mutex); \ 1052 spin_lock(chip->mutex); \
1053} while (0) 1053} while (0)
1054 1054
1055#define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec) \ 1055#define INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr, adr, len, usec) \
1056do { \ 1056do { \
1057 spin_unlock(chip->mutex); \ 1057 spin_unlock(chip->mutex); \
1058 INVALIDATE_CACHED_RANGE(map, adr, len); \ 1058 INVALIDATE_CACHED_RANGE(map, adr, len); \
@@ -1284,7 +1284,7 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip,
1284 map_write(map, datum, adr); 1284 map_write(map, datum, adr);
1285 chip->state = mode; 1285 chip->state = mode;
1286 1286
1287 INVALIDATE_CACHE_UDELAY(map, chip, 1287 INVALIDATE_CACHE_UDELAY(map, chip, adr,
1288 adr, map_bankwidth(map), 1288 adr, map_bankwidth(map),
1289 chip->word_write_time); 1289 chip->word_write_time);
1290 1290
@@ -1572,8 +1572,8 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
1572 map_write(map, CMD(0xd0), cmd_adr); 1572 map_write(map, CMD(0xd0), cmd_adr);
1573 chip->state = FL_WRITING; 1573 chip->state = FL_WRITING;
1574 1574
1575 INVALIDATE_CACHE_UDELAY(map, chip, 1575 INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr,
1576 cmd_adr, len, 1576 adr, len,
1577 chip->buffer_write_time); 1577 chip->buffer_write_time);
1578 1578
1579 timeo = jiffies + (HZ/2); 1579 timeo = jiffies + (HZ/2);
@@ -1744,7 +1744,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,
1744 chip->state = FL_ERASING; 1744 chip->state = FL_ERASING;
1745 chip->erase_suspended = 0; 1745 chip->erase_suspended = 0;
1746 1746
1747 INVALIDATE_CACHE_UDELAY(map, chip, 1747 INVALIDATE_CACHE_UDELAY(map, chip, adr,
1748 adr, len, 1748 adr, len,
1749 chip->erase_time*1000/2); 1749 chip->erase_time*1000/2);
1750 1750
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 47c72a63dfe1..e45a8f959719 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2020,8 +2020,8 @@ config SIS190
2020 will be called sis190. This is recommended. 2020 will be called sis190. This is recommended.
2021 2021
2022config SKGE 2022config SKGE
2023 tristate "New SysKonnect GigaEthernet support (EXPERIMENTAL)" 2023 tristate "New SysKonnect GigaEthernet support"
2024 depends on PCI && EXPERIMENTAL 2024 depends on PCI
2025 select CRC32 2025 select CRC32
2026 ---help--- 2026 ---help---
2027 This driver support the Marvell Yukon or SysKonnect SK-98xx/SK-95xx 2027 This driver support the Marvell Yukon or SysKonnect SK-98xx/SK-95xx
@@ -2082,7 +2082,6 @@ config SK98LIN
2082 - Allied Telesyn AT-2971SX Gigabit Ethernet Adapter 2082 - Allied Telesyn AT-2971SX Gigabit Ethernet Adapter
2083 - Allied Telesyn AT-2971T Gigabit Ethernet Adapter 2083 - Allied Telesyn AT-2971T Gigabit Ethernet Adapter
2084 - Belkin Gigabit Desktop Card 10/100/1000Base-T Adapter, Copper RJ-45 2084 - Belkin Gigabit Desktop Card 10/100/1000Base-T Adapter, Copper RJ-45
2085 - DGE-530T Gigabit Ethernet Adapter
2086 - EG1032 v2 Instant Gigabit Network Adapter 2085 - EG1032 v2 Instant Gigabit Network Adapter
2087 - EG1064 v2 Instant Gigabit Network Adapter 2086 - EG1064 v2 Instant Gigabit Network Adapter
2088 - Marvell 88E8001 Gigabit LOM Ethernet Adapter (Abit) 2087 - Marvell 88E8001 Gigabit LOM Ethernet Adapter (Abit)
diff --git a/drivers/net/appletalk/cops.h b/drivers/net/appletalk/cops.h
index c68ba9c2ef46..fd2750b269c8 100644
--- a/drivers/net/appletalk/cops.h
+++ b/drivers/net/appletalk/cops.h
@@ -51,7 +51,7 @@
51struct ltfirmware 51struct ltfirmware
52{ 52{
53 unsigned int length; 53 unsigned int length;
54 unsigned char * data; 54 const unsigned char *data;
55}; 55};
56 56
57#define DAYNA 1 57#define DAYNA 1
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index e0f51afec778..bcf9f17daf0d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1581,6 +1581,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1581 printk(KERN_INFO DRV_NAME 1581 printk(KERN_INFO DRV_NAME
1582 ": %s: %s not enslaved\n", 1582 ": %s: %s not enslaved\n",
1583 bond_dev->name, slave_dev->name); 1583 bond_dev->name, slave_dev->name);
1584 write_unlock_bh(&bond->lock);
1584 return -EINVAL; 1585 return -EINVAL;
1585 } 1586 }
1586 1587
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index fa176ffb4ad5..8936058a3cce 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -108,6 +108,7 @@ static void irda_usb_close(struct irda_usb_cb *self);
108static void speed_bulk_callback(struct urb *urb, struct pt_regs *regs); 108static void speed_bulk_callback(struct urb *urb, struct pt_regs *regs);
109static void write_bulk_callback(struct urb *urb, struct pt_regs *regs); 109static void write_bulk_callback(struct urb *urb, struct pt_regs *regs);
110static void irda_usb_receive(struct urb *urb, struct pt_regs *regs); 110static void irda_usb_receive(struct urb *urb, struct pt_regs *regs);
111static void irda_usb_rx_defer_expired(unsigned long data);
111static int irda_usb_net_open(struct net_device *dev); 112static int irda_usb_net_open(struct net_device *dev);
112static int irda_usb_net_close(struct net_device *dev); 113static int irda_usb_net_close(struct net_device *dev);
113static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 114static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -677,6 +678,12 @@ static void irda_usb_net_timeout(struct net_device *netdev)
677 * on the interrupt pipe and hang the Rx URB only when an interrupt is 678 * on the interrupt pipe and hang the Rx URB only when an interrupt is
678 * received. 679 * received.
679 * Jean II 680 * Jean II
681 *
682 * Note : don't read the above as what we are currently doing, but as
683 * something we could do with KC dongle. Also don't forget that the
684 * interrupt pipe is not part of the original standard, so this would
685 * need to be optional...
686 * Jean II
680 */ 687 */
681 688
682/*------------------------------------------------------------------*/ 689/*------------------------------------------------------------------*/
@@ -704,10 +711,8 @@ static void irda_usb_submit(struct irda_usb_cb *self, struct sk_buff *skb, struc
704 /* Reinitialize URB */ 711 /* Reinitialize URB */
705 usb_fill_bulk_urb(urb, self->usbdev, 712 usb_fill_bulk_urb(urb, self->usbdev,
706 usb_rcvbulkpipe(self->usbdev, self->bulk_in_ep), 713 usb_rcvbulkpipe(self->usbdev, self->bulk_in_ep),
707 skb->data, skb->truesize, 714 skb->data, IRDA_SKB_MAX_MTU,
708 irda_usb_receive, skb); 715 irda_usb_receive, skb);
709 /* Note : unlink *must* be synchronous because of the code in
710 * irda_usb_net_close() -> free the skb - Jean II */
711 urb->status = 0; 716 urb->status = 0;
712 717
713 /* Can be called from irda_usb_receive (irq handler) -> GFP_ATOMIC */ 718 /* Can be called from irda_usb_receive (irq handler) -> GFP_ATOMIC */
@@ -734,6 +739,7 @@ static void irda_usb_receive(struct urb *urb, struct pt_regs *regs)
734 struct irda_skb_cb *cb; 739 struct irda_skb_cb *cb;
735 struct sk_buff *newskb; 740 struct sk_buff *newskb;
736 struct sk_buff *dataskb; 741 struct sk_buff *dataskb;
742 struct urb *next_urb;
737 int docopy; 743 int docopy;
738 744
739 IRDA_DEBUG(2, "%s(), len=%d\n", __FUNCTION__, urb->actual_length); 745 IRDA_DEBUG(2, "%s(), len=%d\n", __FUNCTION__, urb->actual_length);
@@ -755,20 +761,37 @@ static void irda_usb_receive(struct urb *urb, struct pt_regs *regs)
755 if (urb->status != 0) { 761 if (urb->status != 0) {
756 switch (urb->status) { 762 switch (urb->status) {
757 case -EILSEQ: 763 case -EILSEQ:
758 self->stats.rx_errors++;
759 self->stats.rx_crc_errors++; 764 self->stats.rx_crc_errors++;
760 break; 765 /* Also precursor to a hot-unplug on UHCI. */
766 /* Fallthrough... */
761 case -ECONNRESET: /* -104 */ 767 case -ECONNRESET: /* -104 */
762 IRDA_DEBUG(0, "%s(), Connection Reset (-104), transfer_flags 0x%04X \n", __FUNCTION__, urb->transfer_flags); 768 /* Random error, if I remember correctly */
763 /* uhci_cleanup_unlink() is going to kill the Rx 769 /* uhci_cleanup_unlink() is going to kill the Rx
764 * URB just after we return. No problem, at this 770 * URB just after we return. No problem, at this
765 * point the URB will be idle ;-) - Jean II */ 771 * point the URB will be idle ;-) - Jean II */
766 break; 772 case -ESHUTDOWN: /* -108 */
773 /* That's usually a hot-unplug. Submit will fail... */
774 case -ETIMEDOUT: /* -110 */
775 /* Usually precursor to a hot-unplug on OHCI. */
767 default: 776 default:
768 IRDA_DEBUG(0, "%s(), RX status %d,transfer_flags 0x%04X \n", __FUNCTION__, urb->status, urb->transfer_flags); 777 self->stats.rx_errors++;
778 IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X \n", __FUNCTION__, urb->status, urb->transfer_flags);
769 break; 779 break;
770 } 780 }
771 goto done; 781 /* If we received an error, we don't want to resubmit the
782 * Rx URB straight away but to give the USB layer a little
783 * bit of breathing room.
784 * We are in the USB thread context, therefore there is a
785 * danger of recursion (new URB we submit fails, we come
786 * back here).
787 * With recent USB stack (2.6.15+), I'm seeing that on
788 * hot unplug of the dongle...
789 * Lowest effective timer is 10ms...
790 * Jean II */
791 self->rx_defer_timer.function = &irda_usb_rx_defer_expired;
792 self->rx_defer_timer.data = (unsigned long) urb;
793 mod_timer(&self->rx_defer_timer, jiffies + (10 * HZ / 1000));
794 return;
772 } 795 }
773 796
774 /* Check for empty frames */ 797 /* Check for empty frames */
@@ -845,13 +868,45 @@ done:
845 * idle slot.... 868 * idle slot....
846 * Jean II */ 869 * Jean II */
847 /* Note : with this scheme, we could submit the idle URB before 870 /* Note : with this scheme, we could submit the idle URB before
848 * processing the Rx URB. Another time... Jean II */ 871 * processing the Rx URB. I don't think it would buy us anything as
872 * we are running in the USB thread context. Jean II */
873 next_urb = self->idle_rx_urb;
849 874
850 /* Submit the idle URB to replace the URB we've just received */
851 irda_usb_submit(self, skb, self->idle_rx_urb);
852 /* Recycle Rx URB : Now, the idle URB is the present one */ 875 /* Recycle Rx URB : Now, the idle URB is the present one */
853 urb->context = NULL; 876 urb->context = NULL;
854 self->idle_rx_urb = urb; 877 self->idle_rx_urb = urb;
878
879 /* Submit the idle URB to replace the URB we've just received.
880 * Do it last to avoid race conditions... Jean II */
881 irda_usb_submit(self, skb, next_urb);
882}
883
884/*------------------------------------------------------------------*/
885/*
886 * In case of errors, we want the USB layer to have time to recover.
887 * Now, it is time to resubmit ouur Rx URB...
888 */
889static void irda_usb_rx_defer_expired(unsigned long data)
890{
891 struct urb *urb = (struct urb *) data;
892 struct sk_buff *skb = (struct sk_buff *) urb->context;
893 struct irda_usb_cb *self;
894 struct irda_skb_cb *cb;
895 struct urb *next_urb;
896
897 IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
898
899 /* Find ourselves */
900 cb = (struct irda_skb_cb *) skb->cb;
901 IRDA_ASSERT(cb != NULL, return;);
902 self = (struct irda_usb_cb *) cb->context;
903 IRDA_ASSERT(self != NULL, return;);
904
905 /* Same stuff as when Rx is done, see above... */
906 next_urb = self->idle_rx_urb;
907 urb->context = NULL;
908 self->idle_rx_urb = urb;
909 irda_usb_submit(self, skb, next_urb);
855} 910}
856 911
857/*------------------------------------------------------------------*/ 912/*------------------------------------------------------------------*/
@@ -990,6 +1045,9 @@ static int irda_usb_net_close(struct net_device *netdev)
990 /* Stop network Tx queue */ 1045 /* Stop network Tx queue */
991 netif_stop_queue(netdev); 1046 netif_stop_queue(netdev);
992 1047
1048 /* Kill defered Rx URB */
1049 del_timer(&self->rx_defer_timer);
1050
993 /* Deallocate all the Rx path buffers (URBs and skb) */ 1051 /* Deallocate all the Rx path buffers (URBs and skb) */
994 for (i = 0; i < IU_MAX_RX_URBS; i++) { 1052 for (i = 0; i < IU_MAX_RX_URBS; i++) {
995 struct urb *urb = self->rx_urb[i]; 1053 struct urb *urb = self->rx_urb[i];
@@ -1365,6 +1423,7 @@ static int irda_usb_probe(struct usb_interface *intf,
1365 self = net->priv; 1423 self = net->priv;
1366 self->netdev = net; 1424 self->netdev = net;
1367 spin_lock_init(&self->lock); 1425 spin_lock_init(&self->lock);
1426 init_timer(&self->rx_defer_timer);
1368 1427
1369 /* Create all of the needed urbs */ 1428 /* Create all of the needed urbs */
1370 for (i = 0; i < IU_MAX_RX_URBS; i++) { 1429 for (i = 0; i < IU_MAX_RX_URBS; i++) {
@@ -1498,6 +1557,9 @@ static void irda_usb_disconnect(struct usb_interface *intf)
1498 * This will stop/desactivate the Tx path. - Jean II */ 1557 * This will stop/desactivate the Tx path. - Jean II */
1499 self->present = 0; 1558 self->present = 0;
1500 1559
1560 /* Kill defered Rx URB */
1561 del_timer(&self->rx_defer_timer);
1562
1501 /* We need to have irq enabled to unlink the URBs. That's OK, 1563 /* We need to have irq enabled to unlink the URBs. That's OK,
1502 * at this point the Tx path is gone - Jean II */ 1564 * at this point the Tx path is gone - Jean II */
1503 spin_unlock_irqrestore(&self->lock, flags); 1565 spin_unlock_irqrestore(&self->lock, flags);
@@ -1507,11 +1569,11 @@ static void irda_usb_disconnect(struct usb_interface *intf)
1507 /* Accept no more transmissions */ 1569 /* Accept no more transmissions */
1508 /*netif_device_detach(self->netdev);*/ 1570 /*netif_device_detach(self->netdev);*/
1509 netif_stop_queue(self->netdev); 1571 netif_stop_queue(self->netdev);
1510 /* Stop all the receive URBs */ 1572 /* Stop all the receive URBs. Must be synchronous. */
1511 for (i = 0; i < IU_MAX_RX_URBS; i++) 1573 for (i = 0; i < IU_MAX_RX_URBS; i++)
1512 usb_kill_urb(self->rx_urb[i]); 1574 usb_kill_urb(self->rx_urb[i]);
1513 /* Cancel Tx and speed URB. 1575 /* Cancel Tx and speed URB.
1514 * Toggle flags to make sure it's synchronous. */ 1576 * Make sure it's synchronous to avoid races. */
1515 usb_kill_urb(self->tx_urb); 1577 usb_kill_urb(self->tx_urb);
1516 usb_kill_urb(self->speed_urb); 1578 usb_kill_urb(self->speed_urb);
1517 } 1579 }
diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h
index bd8f66542322..4026af42dd47 100644
--- a/drivers/net/irda/irda-usb.h
+++ b/drivers/net/irda/irda-usb.h
@@ -136,8 +136,6 @@ struct irda_usb_cb {
136 __u16 bulk_out_mtu; /* Max Tx packet size in bytes */ 136 __u16 bulk_out_mtu; /* Max Tx packet size in bytes */
137 __u8 bulk_int_ep; /* Interrupt Endpoint assignments */ 137 __u8 bulk_int_ep; /* Interrupt Endpoint assignments */
138 138
139 wait_queue_head_t wait_q; /* for timeouts */
140
141 struct urb *rx_urb[IU_MAX_RX_URBS]; /* URBs used to receive data frames */ 139 struct urb *rx_urb[IU_MAX_RX_URBS]; /* URBs used to receive data frames */
142 struct urb *idle_rx_urb; /* Pointer to idle URB in Rx path */ 140 struct urb *idle_rx_urb; /* Pointer to idle URB in Rx path */
143 struct urb *tx_urb; /* URB used to send data frames */ 141 struct urb *tx_urb; /* URB used to send data frames */
@@ -147,17 +145,18 @@ struct irda_usb_cb {
147 struct net_device_stats stats; 145 struct net_device_stats stats;
148 struct irlap_cb *irlap; /* The link layer we are binded to */ 146 struct irlap_cb *irlap; /* The link layer we are binded to */
149 struct qos_info qos; 147 struct qos_info qos;
150 hashbin_t *tx_list; /* Queued transmit skb's */
151 char *speed_buff; /* Buffer for speed changes */ 148 char *speed_buff; /* Buffer for speed changes */
152 149
153 struct timeval stamp; 150 struct timeval stamp;
154 struct timeval now; 151 struct timeval now;
155 152
156 spinlock_t lock; /* For serializing operations */ 153 spinlock_t lock; /* For serializing Tx operations */
157 154
158 __u16 xbofs; /* Current xbofs setting */ 155 __u16 xbofs; /* Current xbofs setting */
159 __s16 new_xbofs; /* xbofs we need to set */ 156 __s16 new_xbofs; /* xbofs we need to set */
160 __u32 speed; /* Current speed */ 157 __u32 speed; /* Current speed */
161 __s32 new_speed; /* speed we need to set */ 158 __s32 new_speed; /* speed we need to set */
159
160 struct timer_list rx_defer_timer; /* Wait for Rx error to clear */
162}; 161};
163 162
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index b420182eec4b..ed4bc91638d2 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -1791,6 +1791,8 @@ static int __devinit sis190_init_one(struct pci_dev *pdev,
1791 goto out; 1791 goto out;
1792 } 1792 }
1793 1793
1794 pci_set_drvdata(pdev, dev);
1795
1794 tp = netdev_priv(dev); 1796 tp = netdev_priv(dev);
1795 ioaddr = tp->mmio_addr; 1797 ioaddr = tp->mmio_addr;
1796 1798
@@ -1827,8 +1829,6 @@ static int __devinit sis190_init_one(struct pci_dev *pdev,
1827 if (rc < 0) 1829 if (rc < 0)
1828 goto err_remove_mii; 1830 goto err_remove_mii;
1829 1831
1830 pci_set_drvdata(pdev, dev);
1831
1832 net_probe(tp, KERN_INFO "%s: %s at %p (IRQ: %d), " 1832 net_probe(tp, KERN_INFO "%s: %s at %p (IRQ: %d), "
1833 "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", 1833 "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n",
1834 pci_name(pdev), sis_chip_info[ent->driver_data].name, 1834 pci_name(pdev), sis_chip_info[ent->driver_data].name,
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index bf55a4cfb3d2..67fb19b8fde9 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -1697,6 +1697,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1697 skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_SET); 1697 skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_SET);
1698 skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_CLR); 1698 skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_CLR);
1699 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON | GMC_RST_CLR); 1699 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON | GMC_RST_CLR);
1700
1700 if (skge->autoneg == AUTONEG_DISABLE) { 1701 if (skge->autoneg == AUTONEG_DISABLE) {
1701 reg = GM_GPCR_AU_ALL_DIS; 1702 reg = GM_GPCR_AU_ALL_DIS;
1702 gma_write16(hw, port, GM_GP_CTRL, 1703 gma_write16(hw, port, GM_GP_CTRL,
@@ -1704,16 +1705,23 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1704 1705
1705 switch (skge->speed) { 1706 switch (skge->speed) {
1706 case SPEED_1000: 1707 case SPEED_1000:
1708 reg &= ~GM_GPCR_SPEED_100;
1707 reg |= GM_GPCR_SPEED_1000; 1709 reg |= GM_GPCR_SPEED_1000;
1708 /* fallthru */ 1710 break;
1709 case SPEED_100: 1711 case SPEED_100:
1712 reg &= ~GM_GPCR_SPEED_1000;
1710 reg |= GM_GPCR_SPEED_100; 1713 reg |= GM_GPCR_SPEED_100;
1714 break;
1715 case SPEED_10:
1716 reg &= ~(GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100);
1717 break;
1711 } 1718 }
1712 1719
1713 if (skge->duplex == DUPLEX_FULL) 1720 if (skge->duplex == DUPLEX_FULL)
1714 reg |= GM_GPCR_DUP_FULL; 1721 reg |= GM_GPCR_DUP_FULL;
1715 } else 1722 } else
1716 reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL; 1723 reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL;
1724
1717 switch (skge->flow_control) { 1725 switch (skge->flow_control) {
1718 case FLOW_MODE_NONE: 1726 case FLOW_MODE_NONE:
1719 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); 1727 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index cae2edf23004..bfeba5b9cd7a 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -520,10 +520,16 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
520 520
521 switch (sky2->speed) { 521 switch (sky2->speed) {
522 case SPEED_1000: 522 case SPEED_1000:
523 reg &= ~GM_GPCR_SPEED_100;
523 reg |= GM_GPCR_SPEED_1000; 524 reg |= GM_GPCR_SPEED_1000;
524 /* fallthru */ 525 break;
525 case SPEED_100: 526 case SPEED_100:
527 reg &= ~GM_GPCR_SPEED_1000;
526 reg |= GM_GPCR_SPEED_100; 528 reg |= GM_GPCR_SPEED_100;
529 break;
530 case SPEED_10:
531 reg &= ~(GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100);
532 break;
527 } 533 }
528 534
529 if (sky2->duplex == DUPLEX_FULL) 535 if (sky2->duplex == DUPLEX_FULL)
@@ -1446,6 +1452,29 @@ static void sky2_link_up(struct sky2_port *sky2)
1446 sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), GMAC_DEF_MSK); 1452 sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), GMAC_DEF_MSK);
1447 1453
1448 reg = gma_read16(hw, port, GM_GP_CTRL); 1454 reg = gma_read16(hw, port, GM_GP_CTRL);
1455 if (sky2->autoneg == AUTONEG_DISABLE) {
1456 reg |= GM_GPCR_AU_ALL_DIS;
1457
1458 /* Is write/read necessary? Copied from sky2_mac_init */
1459 gma_write16(hw, port, GM_GP_CTRL, reg);
1460 gma_read16(hw, port, GM_GP_CTRL);
1461
1462 switch (sky2->speed) {
1463 case SPEED_1000:
1464 reg &= ~GM_GPCR_SPEED_100;
1465 reg |= GM_GPCR_SPEED_1000;
1466 break;
1467 case SPEED_100:
1468 reg &= ~GM_GPCR_SPEED_1000;
1469 reg |= GM_GPCR_SPEED_100;
1470 break;
1471 case SPEED_10:
1472 reg &= ~(GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100);
1473 break;
1474 }
1475 } else
1476 reg &= ~GM_GPCR_AU_ALL_DIS;
1477
1449 if (sky2->duplex == DUPLEX_FULL || sky2->autoneg == AUTONEG_ENABLE) 1478 if (sky2->duplex == DUPLEX_FULL || sky2->autoneg == AUTONEG_ENABLE)
1450 reg |= GM_GPCR_DUP_FULL; 1479 reg |= GM_GPCR_DUP_FULL;
1451 1480
diff --git a/drivers/net/tokenring/smctr.h b/drivers/net/tokenring/smctr.h
index b306c7e4c793..88dfa2e01d6e 100644
--- a/drivers/net/tokenring/smctr.h
+++ b/drivers/net/tokenring/smctr.h
@@ -1042,7 +1042,7 @@ typedef struct net_local {
1042 __u16 functional_address[2]; 1042 __u16 functional_address[2];
1043 __u16 bitwise_group_address[2]; 1043 __u16 bitwise_group_address[2];
1044 1044
1045 __u8 *ptr_ucode; 1045 const __u8 *ptr_ucode;
1046 1046
1047 __u8 cleanup; 1047 __u8 cleanup;
1048 1048
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/atmel.c b/drivers/net/wireless/atmel.c
index 98a76f10a0f7..dfc24016ba81 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -1872,7 +1872,7 @@ static int atmel_set_encodeext(struct net_device *dev,
1872 struct atmel_private *priv = netdev_priv(dev); 1872 struct atmel_private *priv = netdev_priv(dev);
1873 struct iw_point *encoding = &wrqu->encoding; 1873 struct iw_point *encoding = &wrqu->encoding;
1874 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1874 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1875 int idx, key_len; 1875 int idx, key_len, alg = ext->alg, set_key = 1;
1876 1876
1877 /* Determine and validate the key index */ 1877 /* Determine and validate the key index */
1878 idx = encoding->flags & IW_ENCODE_INDEX; 1878 idx = encoding->flags & IW_ENCODE_INDEX;
@@ -1883,39 +1883,42 @@ static int atmel_set_encodeext(struct net_device *dev,
1883 } else 1883 } else
1884 idx = priv->default_key; 1884 idx = priv->default_key;
1885 1885
1886 if ((encoding->flags & IW_ENCODE_DISABLED) || 1886 if (encoding->flags & IW_ENCODE_DISABLED)
1887 ext->alg == IW_ENCODE_ALG_NONE) { 1887 alg = IW_ENCODE_ALG_NONE;
1888 priv->wep_is_on = 0;
1889 priv->encryption_level = 0;
1890 priv->pairwise_cipher_suite = CIPHER_SUITE_NONE;
1891 }
1892 1888
1893 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) 1889 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
1894 priv->default_key = idx; 1890 priv->default_key = idx;
1891 set_key = ext->key_len > 0 ? 1 : 0;
1892 }
1895 1893
1896 /* Set the requested key */ 1894 if (set_key) {
1897 switch (ext->alg) { 1895 /* Set the requested key first */
1898 case IW_ENCODE_ALG_NONE: 1896 switch (alg) {
1899 break; 1897 case IW_ENCODE_ALG_NONE:
1900 case IW_ENCODE_ALG_WEP: 1898 priv->wep_is_on = 0;
1901 if (ext->key_len > 5) { 1899 priv->encryption_level = 0;
1902 priv->wep_key_len[idx] = 13; 1900 priv->pairwise_cipher_suite = CIPHER_SUITE_NONE;
1903 priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; 1901 break;
1904 priv->encryption_level = 2; 1902 case IW_ENCODE_ALG_WEP:
1905 } else if (ext->key_len > 0) { 1903 if (ext->key_len > 5) {
1906 priv->wep_key_len[idx] = 5; 1904 priv->wep_key_len[idx] = 13;
1907 priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; 1905 priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128;
1908 priv->encryption_level = 1; 1906 priv->encryption_level = 2;
1909 } else { 1907 } else if (ext->key_len > 0) {
1908 priv->wep_key_len[idx] = 5;
1909 priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64;
1910 priv->encryption_level = 1;
1911 } else {
1912 return -EINVAL;
1913 }
1914 priv->wep_is_on = 1;
1915 memset(priv->wep_keys[idx], 0, 13);
1916 key_len = min ((int)ext->key_len, priv->wep_key_len[idx]);
1917 memcpy(priv->wep_keys[idx], ext->key, key_len);
1918 break;
1919 default:
1910 return -EINVAL; 1920 return -EINVAL;
1911 } 1921 }
1912 priv->wep_is_on = 1;
1913 memset(priv->wep_keys[idx], 0, 13);
1914 key_len = min ((int)ext->key_len, priv->wep_key_len[idx]);
1915 memcpy(priv->wep_keys[idx], ext->key, key_len);
1916 break;
1917 default:
1918 return -EINVAL;
1919 } 1922 }
1920 1923
1921 return -EINPROGRESS; 1924 return -EINPROGRESS;
@@ -3061,17 +3064,26 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
3061 } 3064 }
3062 3065
3063 if (status == C80211_MGMT_SC_Success && priv->wep_is_on) { 3066 if (status == C80211_MGMT_SC_Success && priv->wep_is_on) {
3067 int should_associate = 0;
3064 /* WEP */ 3068 /* WEP */
3065 if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) 3069 if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum)
3066 return; 3070 return;
3067 3071
3068 if (trans_seq_no == 0x0002 && 3072 if (system == C80211_MGMT_AAN_OPENSYSTEM) {
3069 auth->el_id == C80211_MGMT_ElementID_ChallengeText) { 3073 if (trans_seq_no == 0x0002) {
3070 send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); 3074 should_associate = 1;
3071 return; 3075 }
3076 } else if (system == C80211_MGMT_AAN_SHAREDKEY) {
3077 if (trans_seq_no == 0x0002 &&
3078 auth->el_id == C80211_MGMT_ElementID_ChallengeText) {
3079 send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len);
3080 return;
3081 } else if (trans_seq_no == 0x0004) {
3082 should_associate = 1;
3083 }
3072 } 3084 }
3073 3085
3074 if (trans_seq_no == 0x0004) { 3086 if (should_associate) {
3075 if(priv->station_was_associated) { 3087 if(priv->station_was_associated) {
3076 atmel_enter_state(priv, STATION_STATE_REASSOCIATING); 3088 atmel_enter_state(priv, STATION_STATE_REASSOCIATING);
3077 send_association_request(priv, 1); 3089 send_association_request(priv, 1);
@@ -3084,11 +3096,13 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
3084 } 3096 }
3085 } 3097 }
3086 3098
3087 if (status == C80211_MGMT_SC_AuthAlgNotSupported) { 3099 if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) {
3088 /* Do opensystem first, then try sharedkey */ 3100 /* Do opensystem first, then try sharedkey */
3089 if (system == C80211_MGMT_AAN_OPENSYSTEM) { 3101 if (system == WLAN_AUTH_OPEN) {
3090 priv->CurrentAuthentTransactionSeqNum = 0x001; 3102 priv->CurrentAuthentTransactionSeqNum = 0x001;
3091 send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); 3103 priv->exclude_unencrypted = 1;
3104 send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0);
3105 return;
3092 } else if (priv->connect_to_any_BSS) { 3106 } else if (priv->connect_to_any_BSS) {
3093 int bss_index; 3107 int bss_index;
3094 3108
@@ -3439,10 +3453,13 @@ static void atmel_management_timer(u_long a)
3439 priv->AuthenticationRequestRetryCnt = 0; 3453 priv->AuthenticationRequestRetryCnt = 0;
3440 restart_search(priv); 3454 restart_search(priv);
3441 } else { 3455 } else {
3456 int auth = C80211_MGMT_AAN_OPENSYSTEM;
3442 priv->AuthenticationRequestRetryCnt++; 3457 priv->AuthenticationRequestRetryCnt++;
3443 priv->CurrentAuthentTransactionSeqNum = 0x0001; 3458 priv->CurrentAuthentTransactionSeqNum = 0x0001;
3444 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3459 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
3445 send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0); 3460 if (priv->wep_is_on && priv->exclude_unencrypted)
3461 auth = C80211_MGMT_AAN_SHAREDKEY;
3462 send_authentication_request(priv, auth, NULL, 0);
3446 } 3463 }
3447 break; 3464 break;
3448 3465
@@ -3541,12 +3558,15 @@ static void atmel_command_irq(struct atmel_private *priv)
3541 priv->station_was_associated = priv->station_is_associated; 3558 priv->station_was_associated = priv->station_is_associated;
3542 atmel_enter_state(priv, STATION_STATE_READY); 3559 atmel_enter_state(priv, STATION_STATE_READY);
3543 } else { 3560 } else {
3561 int auth = C80211_MGMT_AAN_OPENSYSTEM;
3544 priv->AuthenticationRequestRetryCnt = 0; 3562 priv->AuthenticationRequestRetryCnt = 0;
3545 atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); 3563 atmel_enter_state(priv, STATION_STATE_AUTHENTICATING);
3546 3564
3547 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); 3565 mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
3548 priv->CurrentAuthentTransactionSeqNum = 0x0001; 3566 priv->CurrentAuthentTransactionSeqNum = 0x0001;
3549 send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); 3567 if (priv->wep_is_on && priv->exclude_unencrypted)
3568 auth = C80211_MGMT_AAN_SHAREDKEY;
3569 send_authentication_request(priv, auth, NULL, 0);
3550 } 3570 }
3551 return; 3571 return;
3552 } 3572 }
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 14beab4bc91c..287676ad80df 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -4616,9 +4616,9 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4616 } 4616 }
4617 4617
4618 default: 4618 default:
4619 IPW_ERROR("Unknown notification: " 4619 IPW_DEBUG_NOTIF("Unknown notification: "
4620 "subtype=%d,flags=0x%2x,size=%d\n", 4620 "subtype=%d,flags=0x%2x,size=%d\n",
4621 notif->subtype, notif->flags, notif->size); 4621 notif->subtype, notif->flags, notif->size);
4622 } 4622 }
4623} 4623}
4624 4624
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 3c128b692bce..ec6f2a48895b 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -590,6 +590,7 @@ static struct pcmcia_device_id orinoco_cs_ids[] = {
590 PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9), 590 PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9),
591 PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26), 591 PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26),
592 PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b), 592 PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b),
593 PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2532W-B EliteConnect Wireless Adapter", 0xc4f8b18b, 0x196bd757),
593 PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2632W", 0xc4f8b18b, 0x474a1f2a), 594 PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2632W", 0xc4f8b18b, 0x474a1f2a),
594 PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e), 595 PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e),
595 PCMCIA_DEVICE_PROD_ID123("The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", 0xa5f472c2, 0x590eb502, 0xc9049a39), 596 PCMCIA_DEVICE_PROD_ID123("The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", 0xa5f472c2, 0x590eb502, 0xc9049a39),
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index cf373625fc70..98122f3a4bc2 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -950,16 +950,8 @@ wv_82593_cmd(struct net_device * dev,
950static inline int 950static inline int
951wv_diag(struct net_device * dev) 951wv_diag(struct net_device * dev)
952{ 952{
953 int ret = FALSE; 953 return(wv_82593_cmd(dev, "wv_diag(): diagnose",
954 954 OP0_DIAGNOSE, SR0_DIAGNOSE_PASSED));
955 if(wv_82593_cmd(dev, "wv_diag(): diagnose",
956 OP0_DIAGNOSE, SR0_DIAGNOSE_PASSED))
957 ret = TRUE;
958
959#ifdef DEBUG_CONFIG_ERRORS
960 printk(KERN_INFO "wavelan_cs: i82593 Self Test failed!\n");
961#endif
962 return(ret);
963} /* wv_diag */ 955} /* wv_diag */
964 956
965/*------------------------------------------------------------------*/ 957/*------------------------------------------------------------------*/
@@ -3604,8 +3596,8 @@ wv_82593_config(struct net_device * dev)
3604 cfblk.lin_prio = 0; /* conform to 802.3 backoff algoritm */ 3596 cfblk.lin_prio = 0; /* conform to 802.3 backoff algoritm */
3605 cfblk.exp_prio = 5; /* conform to 802.3 backoff algoritm */ 3597 cfblk.exp_prio = 5; /* conform to 802.3 backoff algoritm */
3606 cfblk.bof_met = 1; /* conform to 802.3 backoff algoritm */ 3598 cfblk.bof_met = 1; /* conform to 802.3 backoff algoritm */
3607 cfblk.ifrm_spc = 0x20; /* 32 bit times interframe spacing */ 3599 cfblk.ifrm_spc = 0x20 >> 4; /* 32 bit times interframe spacing */
3608 cfblk.slottim_low = 0x20; /* 32 bit times slot time */ 3600 cfblk.slottim_low = 0x20 >> 5; /* 32 bit times slot time */
3609 cfblk.slottim_hi = 0x0; 3601 cfblk.slottim_hi = 0x0;
3610 cfblk.max_retr = 15; 3602 cfblk.max_retr = 15;
3611 cfblk.prmisc = ((lp->promiscuous) ? TRUE: FALSE); /* Promiscuous mode */ 3603 cfblk.prmisc = ((lp->promiscuous) ? TRUE: FALSE); /* Promiscuous mode */
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index f46e8438e0d2..93f8a8fa8890 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -40,6 +40,8 @@
40#include <linux/string.h> 40#include <linux/string.h>
41#include <linux/pci.h> 41#include <linux/pci.h>
42#include <linux/reboot.h> 42#include <linux/reboot.h>
43#include <linux/proc_fs.h>
44#include <linux/seq_file.h>
43 45
44#include <asm/byteorder.h> 46#include <asm/byteorder.h>
45#include <asm/cache.h> /* for L1_CACHE_BYTES */ 47#include <asm/cache.h> /* for L1_CACHE_BYTES */
@@ -1019,62 +1021,33 @@ static struct hppa_dma_ops ccio_ops = {
1019}; 1021};
1020 1022
1021#ifdef CONFIG_PROC_FS 1023#ifdef CONFIG_PROC_FS
1022static int proc_append(char *src, int len, char **dst, off_t *offset, int *max) 1024static int ccio_proc_info(struct seq_file *m, void *p)
1023{
1024 if (len < *offset) {
1025 *offset -= len;
1026 return 0;
1027 }
1028 if (*offset > 0) {
1029 src += *offset;
1030 len -= *offset;
1031 *offset = 0;
1032 }
1033 if (len > *max) {
1034 len = *max;
1035 }
1036 memcpy(*dst, src, len);
1037 *dst += len;
1038 *max -= len;
1039 return (*max == 0);
1040}
1041
1042static int ccio_proc_info(char *buf, char **start, off_t offset, int count,
1043 int *eof, void *data)
1044{ 1025{
1045 int max = count; 1026 int len = 0;
1046 char tmp[80]; /* width of an ANSI-standard terminal */
1047 struct ioc *ioc = ioc_list; 1027 struct ioc *ioc = ioc_list;
1048 1028
1049 while (ioc != NULL) { 1029 while (ioc != NULL) {
1050 unsigned int total_pages = ioc->res_size << 3; 1030 unsigned int total_pages = ioc->res_size << 3;
1051 unsigned long avg = 0, min, max; 1031 unsigned long avg = 0, min, max;
1052 int j, len; 1032 int j;
1053 1033
1054 len = sprintf(tmp, "%s\n", ioc->name); 1034 len += seq_printf(m, "%s\n", ioc->name);
1055 if (proc_append(tmp, len, &buf, &offset, &count))
1056 break;
1057 1035
1058 len = sprintf(tmp, "Cujo 2.0 bug : %s\n", 1036 len += seq_printf(m, "Cujo 2.0 bug : %s\n",
1059 (ioc->cujo20_bug ? "yes" : "no")); 1037 (ioc->cujo20_bug ? "yes" : "no"));
1060 if (proc_append(tmp, len, &buf, &offset, &count))
1061 break;
1062 1038
1063 len = sprintf(tmp, "IO PDIR size : %d bytes (%d entries)\n", 1039 len += seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n",
1064 total_pages * 8, total_pages); 1040 total_pages * 8, total_pages);
1065 if (proc_append(tmp, len, &buf, &offset, &count)) 1041
1066 break;
1067#ifdef CCIO_MAP_STATS 1042#ifdef CCIO_MAP_STATS
1068 len = sprintf(tmp, "IO PDIR entries : %ld free %ld used (%d%%)\n", 1043 len += seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n",
1069 total_pages - ioc->used_pages, ioc->used_pages, 1044 total_pages - ioc->used_pages, ioc->used_pages,
1070 (int)(ioc->used_pages * 100 / total_pages)); 1045 (int)(ioc->used_pages * 100 / total_pages));
1071 if (proc_append(tmp, len, &buf, &offset, &count))
1072 break;
1073#endif 1046#endif
1074 len = sprintf(tmp, "Resource bitmap : %d bytes (%d pages)\n", 1047
1075 ioc->res_size, total_pages); 1048 len += seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n",
1076 if (proc_append(tmp, len, &buf, &offset, &count)) 1049 ioc->res_size, total_pages);
1077 break; 1050
1078#ifdef CCIO_SEARCH_TIME 1051#ifdef CCIO_SEARCH_TIME
1079 min = max = ioc->avg_search[0]; 1052 min = max = ioc->avg_search[0];
1080 for(j = 0; j < CCIO_SEARCH_SAMPLE; ++j) { 1053 for(j = 0; j < CCIO_SEARCH_SAMPLE; ++j) {
@@ -1085,70 +1058,83 @@ static int ccio_proc_info(char *buf, char **start, off_t offset, int count,
1085 min = ioc->avg_search[j]; 1058 min = ioc->avg_search[j];
1086 } 1059 }
1087 avg /= CCIO_SEARCH_SAMPLE; 1060 avg /= CCIO_SEARCH_SAMPLE;
1088 len = sprintf(tmp, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n", 1061 len += seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n",
1089 min, avg, max); 1062 min, avg, max);
1090 if (proc_append(tmp, len, &buf, &offset, &count))
1091 break;
1092#endif 1063#endif
1093#ifdef CCIO_MAP_STATS 1064#ifdef CCIO_MAP_STATS
1094 len = sprintf(tmp, "pci_map_single(): %8ld calls %8ld pages (avg %d/1000)\n", 1065 len += seq_printf(m, "pci_map_single(): %8ld calls %8ld pages (avg %d/1000)\n",
1095 ioc->msingle_calls, ioc->msingle_pages, 1066 ioc->msingle_calls, ioc->msingle_pages,
1096 (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls)); 1067 (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls));
1097 if (proc_append(tmp, len, &buf, &offset, &count))
1098 break;
1099
1100 1068
1101 /* KLUGE - unmap_sg calls unmap_single for each mapped page */ 1069 /* KLUGE - unmap_sg calls unmap_single for each mapped page */
1102 min = ioc->usingle_calls - ioc->usg_calls; 1070 min = ioc->usingle_calls - ioc->usg_calls;
1103 max = ioc->usingle_pages - ioc->usg_pages; 1071 max = ioc->usingle_pages - ioc->usg_pages;
1104 len = sprintf(tmp, "pci_unmap_single: %8ld calls %8ld pages (avg %d/1000)\n", 1072 len += seq_printf(m, "pci_unmap_single: %8ld calls %8ld pages (avg %d/1000)\n",
1105 min, max, (int)((max * 1000)/min)); 1073 min, max, (int)((max * 1000)/min));
1106 if (proc_append(tmp, len, &buf, &offset, &count))
1107 break;
1108 1074
1109 len = sprintf(tmp, "pci_map_sg() : %8ld calls %8ld pages (avg %d/1000)\n", 1075 len += seq_printf(m, "pci_map_sg() : %8ld calls %8ld pages (avg %d/1000)\n",
1110 ioc->msg_calls, ioc->msg_pages, 1076 ioc->msg_calls, ioc->msg_pages,
1111 (int)((ioc->msg_pages * 1000)/ioc->msg_calls)); 1077 (int)((ioc->msg_pages * 1000)/ioc->msg_calls));
1112 if (proc_append(tmp, len, &buf, &offset, &count)) 1078
1113 break; 1079 len += seq_printf(m, "pci_unmap_sg() : %8ld calls %8ld pages (avg %d/1000)\n\n\n",
1114 len = sprintf(tmp, "pci_unmap_sg() : %8ld calls %8ld pages (avg %d/1000)\n\n\n", 1080 ioc->usg_calls, ioc->usg_pages,
1115 ioc->usg_calls, ioc->usg_pages, 1081 (int)((ioc->usg_pages * 1000)/ioc->usg_calls));
1116 (int)((ioc->usg_pages * 1000)/ioc->usg_calls));
1117 if (proc_append(tmp, len, &buf, &offset, &count))
1118 break;
1119#endif /* CCIO_MAP_STATS */ 1082#endif /* CCIO_MAP_STATS */
1083
1120 ioc = ioc->next; 1084 ioc = ioc->next;
1121 } 1085 }
1122 1086
1123 if (count == 0) { 1087 return 0;
1124 *eof = 1; 1088}
1125 } 1089
1126 return (max - count); 1090static int ccio_proc_info_open(struct inode *inode, struct file *file)
1091{
1092 return single_open(file, &ccio_proc_info, NULL);
1127} 1093}
1128 1094
1129static int ccio_resource_map(char *buf, char **start, off_t offset, int len, 1095static struct file_operations ccio_proc_info_fops = {
1130 int *eof, void *data) 1096 .owner = THIS_MODULE,
1097 .open = ccio_proc_info_open,
1098 .read = seq_read,
1099 .llseek = seq_lseek,
1100 .release = single_release,
1101};
1102
1103static int ccio_proc_bitmap_info(struct seq_file *m, void *p)
1131{ 1104{
1105 int len = 0;
1132 struct ioc *ioc = ioc_list; 1106 struct ioc *ioc = ioc_list;
1133 1107
1134 buf[0] = '\0';
1135 while (ioc != NULL) { 1108 while (ioc != NULL) {
1136 u32 *res_ptr = (u32 *)ioc->res_map; 1109 u32 *res_ptr = (u32 *)ioc->res_map;
1137 int j; 1110 int j;
1138 1111
1139 for (j = 0; j < (ioc->res_size / sizeof(u32)); j++) { 1112 for (j = 0; j < (ioc->res_size / sizeof(u32)); j++) {
1140 if ((j & 7) == 0) 1113 if ((j & 7) == 0)
1141 strcat(buf,"\n "); 1114 len += seq_puts(m, "\n ");
1142 sprintf(buf, "%s %08x", buf, *res_ptr); 1115 len += seq_printf(m, "%08x", *res_ptr);
1143 res_ptr++; 1116 res_ptr++;
1144 } 1117 }
1145 strcat(buf, "\n\n"); 1118 len += seq_puts(m, "\n\n");
1146 ioc = ioc->next; 1119 ioc = ioc->next;
1147 break; /* XXX - remove me */ 1120 break; /* XXX - remove me */
1148 } 1121 }
1149 1122
1150 return strlen(buf); 1123 return 0;
1151} 1124}
1125
1126static int ccio_proc_bitmap_open(struct inode *inode, struct file *file)
1127{
1128 return single_open(file, &ccio_proc_bitmap_info, NULL);
1129}
1130
1131static struct file_operations ccio_proc_bitmap_fops = {
1132 .owner = THIS_MODULE,
1133 .open = ccio_proc_bitmap_open,
1134 .read = seq_read,
1135 .llseek = seq_lseek,
1136 .release = single_release,
1137};
1152#endif 1138#endif
1153 1139
1154/** 1140/**
@@ -1556,6 +1542,7 @@ static int ccio_probe(struct parisc_device *dev)
1556{ 1542{
1557 int i; 1543 int i;
1558 struct ioc *ioc, **ioc_p = &ioc_list; 1544 struct ioc *ioc, **ioc_p = &ioc_list;
1545 struct proc_dir_entry *info_entry, *bitmap_entry;
1559 1546
1560 ioc = kzalloc(sizeof(struct ioc), GFP_KERNEL); 1547 ioc = kzalloc(sizeof(struct ioc), GFP_KERNEL);
1561 if (ioc == NULL) { 1548 if (ioc == NULL) {
@@ -1583,13 +1570,14 @@ static int ccio_probe(struct parisc_device *dev)
1583 BUG_ON(dev->dev.platform_data == NULL); 1570 BUG_ON(dev->dev.platform_data == NULL);
1584 HBA_DATA(dev->dev.platform_data)->iommu = ioc; 1571 HBA_DATA(dev->dev.platform_data)->iommu = ioc;
1585 1572
1586
1587 if (ioc_count == 0) { 1573 if (ioc_count == 0) {
1588 /* FIXME: Create separate entries for each ioc */ 1574 info_entry = create_proc_entry(MODULE_NAME, 0, proc_runway_root);
1589 create_proc_read_entry(MODULE_NAME, S_IRWXU, proc_runway_root, 1575 if (info_entry)
1590 ccio_proc_info, NULL); 1576 info_entry->proc_fops = &ccio_proc_info_fops;
1591 create_proc_read_entry(MODULE_NAME"-bitmap", S_IRWXU, 1577
1592 proc_runway_root, ccio_resource_map, NULL); 1578 bitmap_entry = create_proc_entry(MODULE_NAME"-bitmap", 0, proc_runway_root);
1579 if (bitmap_entry)
1580 bitmap_entry->proc_fops = &ccio_proc_bitmap_fops;
1593 } 1581 }
1594 1582
1595 ioc_count++; 1583 ioc_count++;
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 52f265e97729..5d47c5965c51 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -37,6 +37,8 @@
37#include <asm/hardware.h> /* for register_parisc_driver() stuff */ 37#include <asm/hardware.h> /* for register_parisc_driver() stuff */
38 38
39#include <linux/proc_fs.h> 39#include <linux/proc_fs.h>
40#include <linux/seq_file.h>
41
40#include <asm/runway.h> /* for proc_runway_root */ 42#include <asm/runway.h> /* for proc_runway_root */
41#include <asm/pdc.h> /* for PDC_MODEL_* */ 43#include <asm/pdc.h> /* for PDC_MODEL_* */
42#include <asm/pdcpat.h> /* for is_pdc_pat() */ 44#include <asm/pdcpat.h> /* for is_pdc_pat() */
@@ -1892,46 +1894,43 @@ sba_common_init(struct sba_device *sba_dev)
1892} 1894}
1893 1895
1894#ifdef CONFIG_PROC_FS 1896#ifdef CONFIG_PROC_FS
1895static int sba_proc_info(char *buf, char **start, off_t offset, int len) 1897static int sba_proc_info(struct seq_file *m, void *p)
1896{ 1898{
1897 struct sba_device *sba_dev = sba_list; 1899 struct sba_device *sba_dev = sba_list;
1898 struct ioc *ioc = &sba_dev->ioc[0]; /* FIXME: Multi-IOC support! */ 1900 struct ioc *ioc = &sba_dev->ioc[0]; /* FIXME: Multi-IOC support! */
1899 int total_pages = (int) (ioc->res_size << 3); /* 8 bits per byte */ 1901 int total_pages = (int) (ioc->res_size << 3); /* 8 bits per byte */
1900 unsigned long i;
1901#ifdef SBA_COLLECT_STATS 1902#ifdef SBA_COLLECT_STATS
1902 unsigned long avg = 0, min, max; 1903 unsigned long avg = 0, min, max;
1903#endif 1904#endif
1905 int i, len = 0;
1904 1906
1905 sprintf(buf, "%s rev %d.%d\n", 1907 len += seq_printf(m, "%s rev %d.%d\n",
1906 sba_dev->name, 1908 sba_dev->name,
1907 (sba_dev->hw_rev & 0x7) + 1, 1909 (sba_dev->hw_rev & 0x7) + 1,
1908 (sba_dev->hw_rev & 0x18) >> 3 1910 (sba_dev->hw_rev & 0x18) >> 3
1909 ); 1911 );
1910 sprintf(buf, "%sIO PDIR size : %d bytes (%d entries)\n", 1912 len += seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n",
1911 buf,
1912 (int) ((ioc->res_size << 3) * sizeof(u64)), /* 8 bits/byte */ 1913 (int) ((ioc->res_size << 3) * sizeof(u64)), /* 8 bits/byte */
1913 total_pages); 1914 total_pages);
1914 1915
1915 sprintf(buf, "%sResource bitmap : %d bytes (%d pages)\n", 1916 len += seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n",
1916 buf, ioc->res_size, ioc->res_size << 3); /* 8 bits per byte */ 1917 ioc->res_size, ioc->res_size << 3); /* 8 bits per byte */
1917 1918
1918 sprintf(buf, "%sLMMIO_BASE/MASK/ROUTE %08x %08x %08x\n", 1919 len += seq_printf(m, "LMMIO_BASE/MASK/ROUTE %08x %08x %08x\n",
1919 buf,
1920 READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_BASE), 1920 READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_BASE),
1921 READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_MASK), 1921 READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_MASK),
1922 READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_ROUTE) 1922 READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_ROUTE)
1923 ); 1923 );
1924 1924
1925 for (i=0; i<4; i++) 1925 for (i=0; i<4; i++)
1926 sprintf(buf, "%sDIR%ld_BASE/MASK/ROUTE %08x %08x %08x\n", 1926 len += seq_printf(m, "DIR%d_BASE/MASK/ROUTE %08x %08x %08x\n", i,
1927 buf, i,
1928 READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_BASE + i*0x18), 1927 READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_BASE + i*0x18),
1929 READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_MASK + i*0x18), 1928 READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_MASK + i*0x18),
1930 READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_ROUTE + i*0x18) 1929 READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_ROUTE + i*0x18)
1931 ); 1930 );
1932 1931
1933#ifdef SBA_COLLECT_STATS 1932#ifdef SBA_COLLECT_STATS
1934 sprintf(buf, "%sIO PDIR entries : %ld free %ld used (%d%%)\n", buf, 1933 len += seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n",
1935 total_pages - ioc->used_pages, ioc->used_pages, 1934 total_pages - ioc->used_pages, ioc->used_pages,
1936 (int) (ioc->used_pages * 100 / total_pages)); 1935 (int) (ioc->used_pages * 100 / total_pages));
1937 1936
@@ -1942,53 +1941,76 @@ static int sba_proc_info(char *buf, char **start, off_t offset, int len)
1942 if (ioc->avg_search[i] < min) min = ioc->avg_search[i]; 1941 if (ioc->avg_search[i] < min) min = ioc->avg_search[i];
1943 } 1942 }
1944 avg /= SBA_SEARCH_SAMPLE; 1943 avg /= SBA_SEARCH_SAMPLE;
1945 sprintf(buf, "%s Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n", 1944 len += seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n",
1946 buf, min, avg, max); 1945 min, avg, max);
1947 1946
1948 sprintf(buf, "%spci_map_single(): %12ld calls %12ld pages (avg %d/1000)\n", 1947 len += seq_printf(m, "pci_map_single(): %12ld calls %12ld pages (avg %d/1000)\n",
1949 buf, ioc->msingle_calls, ioc->msingle_pages, 1948 ioc->msingle_calls, ioc->msingle_pages,
1950 (int) ((ioc->msingle_pages * 1000)/ioc->msingle_calls)); 1949 (int) ((ioc->msingle_pages * 1000)/ioc->msingle_calls));
1951 1950
1952 /* KLUGE - unmap_sg calls unmap_single for each mapped page */ 1951 /* KLUGE - unmap_sg calls unmap_single for each mapped page */
1953 min = ioc->usingle_calls; 1952 min = ioc->usingle_calls;
1954 max = ioc->usingle_pages - ioc->usg_pages; 1953 max = ioc->usingle_pages - ioc->usg_pages;
1955 sprintf(buf, "%spci_unmap_single: %12ld calls %12ld pages (avg %d/1000)\n", 1954 len += seq_printf(m, "pci_unmap_single: %12ld calls %12ld pages (avg %d/1000)\n",
1956 buf, min, max, 1955 min, max, (int) ((max * 1000)/min));
1957 (int) ((max * 1000)/min));
1958 1956
1959 sprintf(buf, "%spci_map_sg() : %12ld calls %12ld pages (avg %d/1000)\n", 1957 len += seq_printf(m, "pci_map_sg() : %12ld calls %12ld pages (avg %d/1000)\n",
1960 buf, ioc->msg_calls, ioc->msg_pages, 1958 ioc->msg_calls, ioc->msg_pages,
1961 (int) ((ioc->msg_pages * 1000)/ioc->msg_calls)); 1959 (int) ((ioc->msg_pages * 1000)/ioc->msg_calls));
1962 1960
1963 sprintf(buf, "%spci_unmap_sg() : %12ld calls %12ld pages (avg %d/1000)\n", 1961 len += seq_printf(m, "pci_unmap_sg() : %12ld calls %12ld pages (avg %d/1000)\n",
1964 buf, ioc->usg_calls, ioc->usg_pages, 1962 ioc->usg_calls, ioc->usg_pages,
1965 (int) ((ioc->usg_pages * 1000)/ioc->usg_calls)); 1963 (int) ((ioc->usg_pages * 1000)/ioc->usg_calls));
1966#endif 1964#endif
1967 1965
1968 return strlen(buf); 1966 return 0;
1969} 1967}
1970 1968
1971#if 0
1972/* XXX too much output - exceeds 4k limit and needs to be re-written */
1973static int 1969static int
1974sba_resource_map(char *buf, char **start, off_t offset, int len) 1970sba_proc_open(struct inode *i, struct file *f)
1971{
1972 return single_open(f, &sba_proc_info, NULL);
1973}
1974
1975static struct file_operations sba_proc_fops = {
1976 .owner = THIS_MODULE,
1977 .open = sba_proc_open,
1978 .read = seq_read,
1979 .llseek = seq_lseek,
1980 .release = single_release,
1981};
1982
1983static int
1984sba_proc_bitmap_info(struct seq_file *m, void *p)
1975{ 1985{
1976 struct sba_device *sba_dev = sba_list; 1986 struct sba_device *sba_dev = sba_list;
1977 struct ioc *ioc = &sba_dev->ioc[0]; /* FIXME: Mutli-IOC suppoer! */ 1987 struct ioc *ioc = &sba_dev->ioc[0]; /* FIXME: Multi-IOC support! */
1978 unsigned int *res_ptr = (unsigned int *)ioc->res_map; 1988 unsigned int *res_ptr = (unsigned int *)ioc->res_map;
1979 int i; 1989 int i, len = 0;
1980 1990
1981 buf[0] = '\0'; 1991 for (i = 0; i < (ioc->res_size/sizeof(unsigned int)); ++i, ++res_ptr) {
1982 for(i = 0; i < (ioc->res_size / sizeof(unsigned int)); ++i, ++res_ptr) {
1983 if ((i & 7) == 0) 1992 if ((i & 7) == 0)
1984 strcat(buf,"\n "); 1993 len += seq_printf(m, "\n ");
1985 sprintf(buf, "%s %08x", buf, *res_ptr); 1994 len += seq_printf(m, " %08x", *res_ptr);
1986 } 1995 }
1987 strcat(buf, "\n"); 1996 len += seq_printf(m, "\n");
1988 1997
1989 return strlen(buf); 1998 return 0;
1990} 1999}
1991#endif /* 0 */ 2000
2001static int
2002sba_proc_bitmap_open(struct inode *i, struct file *f)
2003{
2004 return single_open(f, &sba_proc_bitmap_info, NULL);
2005}
2006
2007static struct file_operations sba_proc_bitmap_fops = {
2008 .owner = THIS_MODULE,
2009 .open = sba_proc_bitmap_open,
2010 .read = seq_read,
2011 .llseek = seq_lseek,
2012 .release = single_release,
2013};
1992#endif /* CONFIG_PROC_FS */ 2014#endif /* CONFIG_PROC_FS */
1993 2015
1994static struct parisc_device_id sba_tbl[] = { 2016static struct parisc_device_id sba_tbl[] = {
@@ -2021,6 +2043,7 @@ sba_driver_callback(struct parisc_device *dev)
2021 int i; 2043 int i;
2022 char *version; 2044 char *version;
2023 void __iomem *sba_addr = ioremap(dev->hpa.start, SBA_FUNC_SIZE); 2045 void __iomem *sba_addr = ioremap(dev->hpa.start, SBA_FUNC_SIZE);
2046 struct proc_dir_entry *info_entry, *bitmap_entry, *root;
2024 2047
2025 sba_dump_ranges(sba_addr); 2048 sba_dump_ranges(sba_addr);
2026 2049
@@ -2088,19 +2111,27 @@ sba_driver_callback(struct parisc_device *dev)
2088 hppa_dma_ops = &sba_ops; 2111 hppa_dma_ops = &sba_ops;
2089 2112
2090#ifdef CONFIG_PROC_FS 2113#ifdef CONFIG_PROC_FS
2091 if (IS_ASTRO(&dev->id)) { 2114 switch (dev->id.hversion) {
2092 create_proc_info_entry("Astro", 0, proc_runway_root, sba_proc_info); 2115 case PLUTO_MCKINLEY_PORT:
2093 } else if (IS_IKE(&dev->id)) { 2116 root = proc_mckinley_root;
2094 create_proc_info_entry("Ike", 0, proc_runway_root, sba_proc_info); 2117 break;
2095 } else if (IS_PLUTO(&dev->id)) { 2118 case ASTRO_RUNWAY_PORT:
2096 create_proc_info_entry("Pluto", 0, proc_mckinley_root, sba_proc_info); 2119 case IKE_MERCED_PORT:
2097 } else { 2120 default:
2098 create_proc_info_entry("Reo", 0, proc_runway_root, sba_proc_info); 2121 root = proc_runway_root;
2122 break;
2099 } 2123 }
2100#if 0 2124
2101 create_proc_info_entry("bitmap", 0, proc_runway_root, sba_resource_map); 2125 info_entry = create_proc_entry("sba_iommu", 0, root);
2102#endif 2126 bitmap_entry = create_proc_entry("sba_iommu-bitmap", 0, root);
2127
2128 if (info_entry)
2129 info_entry->proc_fops = &sba_proc_fops;
2130
2131 if (bitmap_entry)
2132 bitmap_entry->proc_fops = &sba_proc_bitmap_fops;
2103#endif 2133#endif
2134
2104 parisc_vmerge_boundary = IOVP_SIZE; 2135 parisc_vmerge_boundary = IOVP_SIZE;
2105 parisc_vmerge_max_size = IOVP_SIZE * BITS_PER_LONG; 2136 parisc_vmerge_max_size = IOVP_SIZE * BITS_PER_LONG;
2106 parisc_has_iommu(); 2137 parisc_has_iommu();
diff --git a/drivers/s390/block/Kconfig b/drivers/s390/block/Kconfig
index 6912399d0937..6f50cc9323d9 100644
--- a/drivers/s390/block/Kconfig
+++ b/drivers/s390/block/Kconfig
@@ -55,21 +55,13 @@ config DASD_DIAG
55 Disks under VM. If you are not running under VM or unsure what it is, 55 Disks under VM. If you are not running under VM or unsure what it is,
56 say "N". 56 say "N".
57 57
58config DASD_EER
59 tristate "Extended error reporting (EER)"
60 depends on DASD
61 help
62 This driver provides a character device interface to the
63 DASD extended error reporting. This is only needed if you want to
64 use applications written for the EER facility.
65
66config DASD_CMB 58config DASD_CMB
67 tristate "Compatibility interface for DASD channel measurement blocks" 59 tristate "Compatibility interface for DASD channel measurement blocks"
68 depends on DASD 60 depends on DASD
69 help 61 help
70 This driver provides an additional interface to the channel 62 This driver provides an additional interface to the channel measurement
71 measurement facility, which is normally accessed though sysfs, with 63 facility, which is normally accessed though sysfs, with a set of
72 a set of ioctl functions specific to the dasd driver. 64 ioctl functions specific to the dasd driver.
73 This is only needed if you want to use applications written for 65 This is only needed if you want to use applications written for
74 linux-2.4 dasd channel measurement facility interface. 66 linux-2.4 dasd channel measurement facility interface.
75 67
diff --git a/drivers/s390/block/Makefile b/drivers/s390/block/Makefile
index 0c0d871e8f51..58c6780134f7 100644
--- a/drivers/s390/block/Makefile
+++ b/drivers/s390/block/Makefile
@@ -5,7 +5,6 @@
5dasd_eckd_mod-objs := dasd_eckd.o dasd_3990_erp.o dasd_9343_erp.o 5dasd_eckd_mod-objs := dasd_eckd.o dasd_3990_erp.o dasd_9343_erp.o
6dasd_fba_mod-objs := dasd_fba.o dasd_3370_erp.o dasd_9336_erp.o 6dasd_fba_mod-objs := dasd_fba.o dasd_3370_erp.o dasd_9336_erp.o
7dasd_diag_mod-objs := dasd_diag.o 7dasd_diag_mod-objs := dasd_diag.o
8dasd_eer_mod-objs := dasd_eer.o
9dasd_mod-objs := dasd.o dasd_ioctl.o dasd_proc.o dasd_devmap.o \ 8dasd_mod-objs := dasd.o dasd_ioctl.o dasd_proc.o dasd_devmap.o \
10 dasd_genhd.o dasd_erp.o 9 dasd_genhd.o dasd_erp.o
11 10
@@ -14,6 +13,5 @@ obj-$(CONFIG_DASD_DIAG) += dasd_diag_mod.o
14obj-$(CONFIG_DASD_ECKD) += dasd_eckd_mod.o 13obj-$(CONFIG_DASD_ECKD) += dasd_eckd_mod.o
15obj-$(CONFIG_DASD_FBA) += dasd_fba_mod.o 14obj-$(CONFIG_DASD_FBA) += dasd_fba_mod.o
16obj-$(CONFIG_DASD_CMB) += dasd_cmb.o 15obj-$(CONFIG_DASD_CMB) += dasd_cmb.o
17obj-$(CONFIG_DASD_EER) += dasd_eer.o
18obj-$(CONFIG_BLK_DEV_XPRAM) += xpram.o 16obj-$(CONFIG_BLK_DEV_XPRAM) += xpram.o
19obj-$(CONFIG_DCSSBLK) += dcssblk.o 17obj-$(CONFIG_DCSSBLK) += dcssblk.o
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 08c88fcd8963..af1d5b404cee 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -18,7 +18,6 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/buffer_head.h> 19#include <linux/buffer_head.h>
20#include <linux/hdreg.h> 20#include <linux/hdreg.h>
21#include <linux/notifier.h>
22 21
23#include <asm/ccwdev.h> 22#include <asm/ccwdev.h>
24#include <asm/ebcdic.h> 23#include <asm/ebcdic.h>
@@ -58,7 +57,6 @@ static void dasd_int_handler(struct ccw_device *, unsigned long, struct irb *);
58static void dasd_flush_ccw_queue(struct dasd_device *, int); 57static void dasd_flush_ccw_queue(struct dasd_device *, int);
59static void dasd_tasklet(struct dasd_device *); 58static void dasd_tasklet(struct dasd_device *);
60static void do_kick_device(void *data); 59static void do_kick_device(void *data);
61static void dasd_disable_eer(struct dasd_device *device);
62 60
63/* 61/*
64 * SECTION: Operations on the device structure. 62 * SECTION: Operations on the device structure.
@@ -153,10 +151,13 @@ dasd_state_new_to_known(struct dasd_device *device)
153static inline void 151static inline void
154dasd_state_known_to_new(struct dasd_device * device) 152dasd_state_known_to_new(struct dasd_device * device)
155{ 153{
156 /* disable extended error reporting for this device */
157 dasd_disable_eer(device);
158 /* Forget the discipline information. */ 154 /* Forget the discipline information. */
155 if (device->discipline)
156 module_put(device->discipline->owner);
159 device->discipline = NULL; 157 device->discipline = NULL;
158 if (device->base_discipline)
159 module_put(device->base_discipline->owner);
160 device->base_discipline = NULL;
160 device->state = DASD_STATE_NEW; 161 device->state = DASD_STATE_NEW;
161 162
162 dasd_free_queue(device); 163 dasd_free_queue(device);
@@ -871,9 +872,6 @@ dasd_handle_state_change_pending(struct dasd_device *device)
871 struct dasd_ccw_req *cqr; 872 struct dasd_ccw_req *cqr;
872 struct list_head *l, *n; 873 struct list_head *l, *n;
873 874
874 /* first of all call extended error reporting */
875 dasd_write_eer_trigger(DASD_EER_STATECHANGE, device, NULL);
876
877 device->stopped &= ~DASD_STOPPED_PENDING; 875 device->stopped &= ~DASD_STOPPED_PENDING;
878 876
879 /* restart all 'running' IO on queue */ 877 /* restart all 'running' IO on queue */
@@ -1093,19 +1091,6 @@ restart:
1093 } 1091 }
1094 goto restart; 1092 goto restart;
1095 } 1093 }
1096
1097 /* first of all call extended error reporting */
1098 if (device->eer && cqr->status == DASD_CQR_FAILED) {
1099 dasd_write_eer_trigger(DASD_EER_FATALERROR,
1100 device, cqr);
1101
1102 /* restart request */
1103 cqr->status = DASD_CQR_QUEUED;
1104 cqr->retries = 255;
1105 device->stopped |= DASD_STOPPED_QUIESCE;
1106 goto restart;
1107 }
1108
1109 /* Process finished ERP request. */ 1094 /* Process finished ERP request. */
1110 if (cqr->refers) { 1095 if (cqr->refers) {
1111 __dasd_process_erp(device, cqr); 1096 __dasd_process_erp(device, cqr);
@@ -1243,8 +1228,7 @@ __dasd_start_head(struct dasd_device * device)
1243 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list); 1228 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list);
1244 /* check FAILFAST */ 1229 /* check FAILFAST */
1245 if (device->stopped & ~DASD_STOPPED_PENDING && 1230 if (device->stopped & ~DASD_STOPPED_PENDING &&
1246 test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags) && 1231 test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags)) {
1247 (!device->eer)) {
1248 cqr->status = DASD_CQR_FAILED; 1232 cqr->status = DASD_CQR_FAILED;
1249 dasd_schedule_bh(device); 1233 dasd_schedule_bh(device);
1250 } 1234 }
@@ -1880,9 +1864,10 @@ dasd_generic_remove (struct ccw_device *cdev)
1880 */ 1864 */
1881int 1865int
1882dasd_generic_set_online (struct ccw_device *cdev, 1866dasd_generic_set_online (struct ccw_device *cdev,
1883 struct dasd_discipline *discipline) 1867 struct dasd_discipline *base_discipline)
1884 1868
1885{ 1869{
1870 struct dasd_discipline *discipline;
1886 struct dasd_device *device; 1871 struct dasd_device *device;
1887 int rc; 1872 int rc;
1888 1873
@@ -1890,6 +1875,7 @@ dasd_generic_set_online (struct ccw_device *cdev,
1890 if (IS_ERR(device)) 1875 if (IS_ERR(device))
1891 return PTR_ERR(device); 1876 return PTR_ERR(device);
1892 1877
1878 discipline = base_discipline;
1893 if (device->features & DASD_FEATURE_USEDIAG) { 1879 if (device->features & DASD_FEATURE_USEDIAG) {
1894 if (!dasd_diag_discipline_pointer) { 1880 if (!dasd_diag_discipline_pointer) {
1895 printk (KERN_WARNING 1881 printk (KERN_WARNING
@@ -1901,6 +1887,16 @@ dasd_generic_set_online (struct ccw_device *cdev,
1901 } 1887 }
1902 discipline = dasd_diag_discipline_pointer; 1888 discipline = dasd_diag_discipline_pointer;
1903 } 1889 }
1890 if (!try_module_get(base_discipline->owner)) {
1891 dasd_delete_device(device);
1892 return -EINVAL;
1893 }
1894 if (!try_module_get(discipline->owner)) {
1895 module_put(base_discipline->owner);
1896 dasd_delete_device(device);
1897 return -EINVAL;
1898 }
1899 device->base_discipline = base_discipline;
1904 device->discipline = discipline; 1900 device->discipline = discipline;
1905 1901
1906 rc = discipline->check_device(device); 1902 rc = discipline->check_device(device);
@@ -1909,6 +1905,8 @@ dasd_generic_set_online (struct ccw_device *cdev,
1909 "dasd_generic couldn't online device %s " 1905 "dasd_generic couldn't online device %s "
1910 "with discipline %s rc=%i\n", 1906 "with discipline %s rc=%i\n",
1911 cdev->dev.bus_id, discipline->name, rc); 1907 cdev->dev.bus_id, discipline->name, rc);
1908 module_put(discipline->owner);
1909 module_put(base_discipline->owner);
1912 dasd_delete_device(device); 1910 dasd_delete_device(device);
1913 return rc; 1911 return rc;
1914 } 1912 }
@@ -1986,9 +1984,6 @@ dasd_generic_notify(struct ccw_device *cdev, int event)
1986 switch (event) { 1984 switch (event) {
1987 case CIO_GONE: 1985 case CIO_GONE:
1988 case CIO_NO_PATH: 1986 case CIO_NO_PATH:
1989 /* first of all call extended error reporting */
1990 dasd_write_eer_trigger(DASD_EER_NOPATH, device, NULL);
1991
1992 if (device->state < DASD_STATE_BASIC) 1987 if (device->state < DASD_STATE_BASIC)
1993 break; 1988 break;
1994 /* Device is active. We want to keep it. */ 1989 /* Device is active. We want to keep it. */
@@ -2046,51 +2041,6 @@ dasd_generic_auto_online (struct ccw_driver *dasd_discipline_driver)
2046 put_driver(drv); 2041 put_driver(drv);
2047} 2042}
2048 2043
2049/*
2050 * notifications for extended error reports
2051 */
2052static struct notifier_block *dasd_eer_chain;
2053
2054int
2055dasd_register_eer_notifier(struct notifier_block *nb)
2056{
2057 return notifier_chain_register(&dasd_eer_chain, nb);
2058}
2059
2060int
2061dasd_unregister_eer_notifier(struct notifier_block *nb)
2062{
2063 return notifier_chain_unregister(&dasd_eer_chain, nb);
2064}
2065
2066/*
2067 * Notify the registered error reporting module of a problem
2068 */
2069void
2070dasd_write_eer_trigger(unsigned int id, struct dasd_device *device,
2071 struct dasd_ccw_req *cqr)
2072{
2073 if (device->eer) {
2074 struct dasd_eer_trigger temp;
2075 temp.id = id;
2076 temp.device = device;
2077 temp.cqr = cqr;
2078 notifier_call_chain(&dasd_eer_chain, DASD_EER_TRIGGER,
2079 (void *)&temp);
2080 }
2081}
2082
2083/*
2084 * Tell the registered error reporting module to disable error reporting for
2085 * a given device and to cleanup any private data structures on that device.
2086 */
2087static void
2088dasd_disable_eer(struct dasd_device *device)
2089{
2090 notifier_call_chain(&dasd_eer_chain, DASD_EER_DISABLE, (void *)device);
2091}
2092
2093
2094static int __init 2044static int __init
2095dasd_init(void) 2045dasd_init(void)
2096{ 2046{
@@ -2172,11 +2122,6 @@ EXPORT_SYMBOL_GPL(dasd_generic_set_online);
2172EXPORT_SYMBOL_GPL(dasd_generic_set_offline); 2122EXPORT_SYMBOL_GPL(dasd_generic_set_offline);
2173EXPORT_SYMBOL_GPL(dasd_generic_auto_online); 2123EXPORT_SYMBOL_GPL(dasd_generic_auto_online);
2174 2124
2175EXPORT_SYMBOL(dasd_register_eer_notifier);
2176EXPORT_SYMBOL(dasd_unregister_eer_notifier);
2177EXPORT_SYMBOL(dasd_write_eer_trigger);
2178
2179
2180/* 2125/*
2181 * Overrides for Emacs so that we follow Linus's tabbing style. 2126 * Overrides for Emacs so that we follow Linus's tabbing style.
2182 * Emacs will notice this stuff at the end of the file and automatically 2127 * Emacs will notice this stuff at the end of the file and automatically
diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c
index c811380b9079..4ee0f934e325 100644
--- a/drivers/s390/block/dasd_3990_erp.c
+++ b/drivers/s390/block/dasd_3990_erp.c
@@ -1108,9 +1108,6 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense)
1108 case 0x0B: 1108 case 0x0B:
1109 DEV_MESSAGE(KERN_WARNING, device, "%s", 1109 DEV_MESSAGE(KERN_WARNING, device, "%s",
1110 "FORMAT F - Volume is suspended duplex"); 1110 "FORMAT F - Volume is suspended duplex");
1111 /* call extended error reporting (EER) */
1112 dasd_write_eer_trigger(DASD_EER_PPRCSUSPEND, device,
1113 erp->refers);
1114 break; 1111 break;
1115 case 0x0C: 1112 case 0x0C:
1116 DEV_MESSAGE(KERN_WARNING, device, "%s", 1113 DEV_MESSAGE(KERN_WARNING, device, "%s",
diff --git a/drivers/s390/block/dasd_eckd.h b/drivers/s390/block/dasd_eckd.h
index e15dd7978050..bc3823d35223 100644
--- a/drivers/s390/block/dasd_eckd.h
+++ b/drivers/s390/block/dasd_eckd.h
@@ -29,7 +29,6 @@
29#define DASD_ECKD_CCW_PSF 0x27 29#define DASD_ECKD_CCW_PSF 0x27
30#define DASD_ECKD_CCW_RSSD 0x3e 30#define DASD_ECKD_CCW_RSSD 0x3e
31#define DASD_ECKD_CCW_LOCATE_RECORD 0x47 31#define DASD_ECKD_CCW_LOCATE_RECORD 0x47
32#define DASD_ECKD_CCW_SNSS 0x54
33#define DASD_ECKD_CCW_DEFINE_EXTENT 0x63 32#define DASD_ECKD_CCW_DEFINE_EXTENT 0x63
34#define DASD_ECKD_CCW_WRITE_MT 0x85 33#define DASD_ECKD_CCW_WRITE_MT 0x85
35#define DASD_ECKD_CCW_READ_MT 0x86 34#define DASD_ECKD_CCW_READ_MT 0x86
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
deleted file mode 100644
index f70cd7716b24..000000000000
--- a/drivers/s390/block/dasd_eer.c
+++ /dev/null
@@ -1,1090 +0,0 @@
1/*
2 * character device driver for extended error reporting
3 *
4 *
5 * Copyright (C) 2005 IBM Corporation
6 * extended error reporting for DASD ECKD devices
7 * Author(s): Stefan Weinhuber <wein@de.ibm.com>
8 *
9 */
10
11#include <linux/init.h>
12#include <linux/fs.h>
13#include <linux/kernel.h>
14#include <linux/miscdevice.h>
15#include <linux/module.h>
16#include <linux/moduleparam.h>
17#include <linux/device.h>
18#include <linux/workqueue.h>
19#include <linux/poll.h>
20#include <linux/notifier.h>
21
22#include <asm/uaccess.h>
23#include <asm/semaphore.h>
24#include <asm/atomic.h>
25#include <asm/ebcdic.h>
26
27#include "dasd_int.h"
28#include "dasd_eckd.h"
29
30
31MODULE_LICENSE("GPL");
32
33MODULE_AUTHOR("Stefan Weinhuber <wein@de.ibm.com>");
34MODULE_DESCRIPTION("DASD extended error reporting module");
35
36
37#ifdef PRINTK_HEADER
38#undef PRINTK_HEADER
39#endif /* PRINTK_HEADER */
40#define PRINTK_HEADER "dasd(eer):"
41
42
43
44
45
46/*****************************************************************************/
47/* the internal buffer */
48/*****************************************************************************/
49
50/*
51 * The internal buffer is meant to store obaque blobs of data, so it doesn't
52 * know of higher level concepts like triggers.
53 * It consists of a number of pages that are used as a ringbuffer. Each data
54 * blob is stored in a simple record that consists of an integer, which
55 * contains the size of the following data, and the data bytes themselfes.
56 *
57 * To allow for multiple independent readers we create one internal buffer
58 * each time the device is opened and destroy the buffer when the file is
59 * closed again.
60 *
61 * One record can be written to a buffer by using the functions
62 * - dasd_eer_start_record (one time per record to write the size to the buffer
63 * and reserve the space for the data)
64 * - dasd_eer_write_buffer (one or more times per record to write the data)
65 * The data can be written in several steps but you will have to compute
66 * the total size up front for the invocation of dasd_eer_start_record.
67 * If the ringbuffer is full, dasd_eer_start_record will remove the required
68 * number of old records.
69 *
70 * A record is typically read in two steps, first read the integer that
71 * specifies the size of the following data, then read the data.
72 * Both can be done by
73 * - dasd_eer_read_buffer
74 *
75 * For all mentioned functions you need to get the bufferlock first and keep it
76 * until a complete record is written or read.
77 */
78
79
80/*
81 * Alle information necessary to keep track of an internal buffer is kept in
82 * a struct eerbuffer. The buffer specific to a file pointer is strored in
83 * the private_data field of that file. To be able to write data to all
84 * existing buffers, each buffer is also added to the bufferlist.
85 * If the user doesn't want to read a complete record in one go, we have to
86 * keep track of the rest of the record. residual stores the number of bytes
87 * that are still to deliver. If the rest of the record is invalidated between
88 * two reads then residual will be set to -1 so that the next read will fail.
89 * All entries in the eerbuffer structure are protected with the bufferlock.
90 * To avoid races between writing to a buffer on the one side and creating
91 * and destroying buffers on the other side, the bufferlock must also be used
92 * to protect the bufferlist.
93 */
94
95struct eerbuffer {
96 struct list_head list;
97 char **buffer;
98 int buffersize;
99 int buffer_page_count;
100 int head;
101 int tail;
102 int residual;
103};
104
105LIST_HEAD(bufferlist);
106
107static spinlock_t bufferlock = SPIN_LOCK_UNLOCKED;
108
109DECLARE_WAIT_QUEUE_HEAD(dasd_eer_read_wait_queue);
110
111/*
112 * How many free bytes are available on the buffer.
113 * needs to be called with bufferlock held
114 */
115static int
116dasd_eer_get_free_bytes(struct eerbuffer *eerb)
117{
118 if (eerb->head < eerb->tail) {
119 return eerb->tail - eerb->head - 1;
120 } else
121 return eerb->buffersize - eerb->head + eerb->tail -1;
122}
123
124/*
125 * How many bytes of buffer space are used.
126 * needs to be called with bufferlock held
127 */
128static int
129dasd_eer_get_filled_bytes(struct eerbuffer *eerb)
130{
131
132 if (eerb->head >= eerb->tail) {
133 return eerb->head - eerb->tail;
134 } else
135 return eerb->buffersize - eerb->tail + eerb->head;
136}
137
138/*
139 * The dasd_eer_write_buffer function just copies count bytes of data
140 * to the buffer. Make sure to call dasd_eer_start_record first, to
141 * make sure that enough free space is available.
142 * needs to be called with bufferlock held
143 */
144static void
145dasd_eer_write_buffer(struct eerbuffer *eerb, int count, char *data)
146{
147
148 unsigned long headindex,localhead;
149 unsigned long rest, len;
150 char *nextdata;
151
152 nextdata = data;
153 rest = count;
154 while (rest > 0) {
155 headindex = eerb->head / PAGE_SIZE;
156 localhead = eerb->head % PAGE_SIZE;
157 len = min(rest, (PAGE_SIZE - localhead));
158 memcpy(eerb->buffer[headindex]+localhead, nextdata, len);
159 nextdata += len;
160 rest -= len;
161 eerb->head += len;
162 if ( eerb->head == eerb->buffersize )
163 eerb->head = 0; /* wrap around */
164 if (eerb->head > eerb->buffersize) {
165 MESSAGE(KERN_ERR, "%s", "runaway buffer head.");
166 BUG();
167 }
168 }
169}
170
171/*
172 * needs to be called with bufferlock held
173 */
174static int
175dasd_eer_read_buffer(struct eerbuffer *eerb, int count, char *data)
176{
177
178 unsigned long tailindex,localtail;
179 unsigned long rest, len, finalcount;
180 char *nextdata;
181
182 finalcount = min(count, dasd_eer_get_filled_bytes(eerb));
183 nextdata = data;
184 rest = finalcount;
185 while (rest > 0) {
186 tailindex = eerb->tail / PAGE_SIZE;
187 localtail = eerb->tail % PAGE_SIZE;
188 len = min(rest, (PAGE_SIZE - localtail));
189 memcpy(nextdata, eerb->buffer[tailindex]+localtail, len);
190 nextdata += len;
191 rest -= len;
192 eerb->tail += len;
193 if ( eerb->tail == eerb->buffersize )
194 eerb->tail = 0; /* wrap around */
195 if (eerb->tail > eerb->buffersize) {
196 MESSAGE(KERN_ERR, "%s", "runaway buffer tail.");
197 BUG();
198 }
199 }
200 return finalcount;
201}
202
203/*
204 * Whenever you want to write a blob of data to the internal buffer you
205 * have to start by using this function first. It will write the number
206 * of bytes that will be written to the buffer. If necessary it will remove
207 * old records to make room for the new one.
208 * needs to be called with bufferlock held
209 */
210static int
211dasd_eer_start_record(struct eerbuffer *eerb, int count)
212{
213 int tailcount;
214 if (count + sizeof(count) > eerb->buffersize)
215 return -ENOMEM;
216 while (dasd_eer_get_free_bytes(eerb) < count + sizeof(count)) {
217 if (eerb->residual > 0) {
218 eerb->tail += eerb->residual;
219 if (eerb->tail >= eerb->buffersize)
220 eerb->tail -= eerb->buffersize;
221 eerb->residual = -1;
222 }
223 dasd_eer_read_buffer(eerb, sizeof(tailcount),
224 (char*)(&tailcount));
225 eerb->tail += tailcount;
226 if (eerb->tail >= eerb->buffersize)
227 eerb->tail -= eerb->buffersize;
228 }
229 dasd_eer_write_buffer(eerb, sizeof(count), (char*)(&count));
230
231 return 0;
232};
233
234/*
235 * release pages that are not used anymore
236 */
237static void
238dasd_eer_free_buffer_pages(char **buf, int no_pages)
239{
240 int i;
241
242 for (i = 0; i < no_pages; ++i) {
243 free_page((unsigned long)buf[i]);
244 }
245}
246
247/*
248 * allocate a new set of memory pages
249 */
250static int
251dasd_eer_allocate_buffer_pages(char **buf, int no_pages)
252{
253 int i;
254
255 for (i = 0; i < no_pages; ++i) {
256 buf[i] = (char *) get_zeroed_page(GFP_KERNEL);
257 if (!buf[i]) {
258 dasd_eer_free_buffer_pages(buf, i);
259 return -ENOMEM;
260 }
261 }
262 return 0;
263}
264
265/*
266 * empty the buffer by resetting head and tail
267 * In case there is a half read data blob in the buffer, we set residual
268 * to -1 to indicate that the remainder of the blob is lost.
269 */
270static void
271dasd_eer_purge_buffer(struct eerbuffer *eerb)
272{
273 unsigned long flags;
274
275 spin_lock_irqsave(&bufferlock, flags);
276 if (eerb->residual > 0)
277 eerb->residual = -1;
278 eerb->tail=0;
279 eerb->head=0;
280 spin_unlock_irqrestore(&bufferlock, flags);
281}
282
283/*
284 * set the size of the buffer, newsize is the new number of pages to be used
285 * we don't try to copy any data back an forth, so any resize will also purge
286 * the buffer
287 */
288static int
289dasd_eer_resize_buffer(struct eerbuffer *eerb, int newsize)
290{
291 int i, oldcount, reuse;
292 char **new;
293 char **old;
294 unsigned long flags;
295
296 if (newsize < 1)
297 return -EINVAL;
298 if (eerb->buffer_page_count == newsize) {
299 /* documented behaviour is that any successfull invocation
300 * will purge all records */
301 dasd_eer_purge_buffer(eerb);
302 return 0;
303 }
304 new = kmalloc(newsize*sizeof(char*), GFP_KERNEL);
305 if (!new)
306 return -ENOMEM;
307
308 reuse=min(eerb->buffer_page_count, newsize);
309 for (i = 0; i < reuse; ++i) {
310 new[i] = eerb->buffer[i];
311 }
312 if (eerb->buffer_page_count < newsize) {
313 if (dasd_eer_allocate_buffer_pages(
314 &new[eerb->buffer_page_count],
315 newsize - eerb->buffer_page_count)) {
316 kfree(new);
317 return -ENOMEM;
318 }
319 }
320
321 spin_lock_irqsave(&bufferlock, flags);
322 old = eerb->buffer;
323 eerb->buffer = new;
324 if (eerb->residual > 0)
325 eerb->residual = -1;
326 eerb->tail = 0;
327 eerb->head = 0;
328 oldcount = eerb->buffer_page_count;
329 eerb->buffer_page_count = newsize;
330 spin_unlock_irqrestore(&bufferlock, flags);
331
332 if (oldcount > newsize) {
333 for (i = newsize; i < oldcount; ++i) {
334 free_page((unsigned long)old[i]);
335 }
336 }
337 kfree(old);
338
339 return 0;
340}
341
342
343/*****************************************************************************/
344/* The extended error reporting functionality */
345/*****************************************************************************/
346
347/*
348 * When a DASD device driver wants to report an error, it calls the
349 * function dasd_eer_write_trigger (via a notifier mechanism) and gives the
350 * respective trigger ID as parameter.
351 * Currently there are four kinds of triggers:
352 *
353 * DASD_EER_FATALERROR: all kinds of unrecoverable I/O problems
354 * DASD_EER_PPRCSUSPEND: PPRC was suspended
355 * DASD_EER_NOPATH: There is no path to the device left.
356 * DASD_EER_STATECHANGE: The state of the device has changed.
357 *
358 * For the first three triggers all required information can be supplied by
359 * the caller. For these triggers a record is written by the function
360 * dasd_eer_write_standard_trigger.
361 *
362 * When dasd_eer_write_trigger is called to write a DASD_EER_STATECHANGE
363 * trigger, we have to gather the necessary sense data first. We cannot queue
364 * the necessary SNSS (sense subsystem status) request immediatly, since we
365 * are likely to run in a deadlock situation. Instead, we schedule a
366 * work_struct that calls the function dasd_eer_sense_subsystem_status to
367 * create and start an SNSS request asynchronously.
368 *
369 * To avoid memory allocations at runtime, the necessary memory is allocated
370 * when the extended error reporting is enabled for a device (by
371 * dasd_eer_probe). There is one private eer data structure for each eer
372 * enabled DASD device. It contains memory for the work_struct, one SNSS cqr
373 * and a flags field that is used to coordinate the use of the cqr. The call
374 * to write a state change trigger can come in at any time, so we have one flag
375 * CQR_IN_USE that protects the cqr itself. When this flag indicates that the
376 * cqr is currently in use, dasd_eer_sense_subsystem_status cannot start a
377 * second request but sets the SNSS_REQUESTED flag instead.
378 *
379 * When the request is finished, the callback function dasd_eer_SNSS_cb
380 * is called. This function will invoke the function
381 * dasd_eer_write_SNSS_trigger to finally write the trigger. It will also
382 * check the SNSS_REQUESTED flag and if it is set it will call
383 * dasd_eer_sense_subsystem_status again.
384 *
385 * To avoid race conditions during the handling of the lock, the flags must
386 * be protected by the snsslock.
387 */
388
389struct dasd_eer_private {
390 struct dasd_ccw_req *cqr;
391 unsigned long flags;
392 struct work_struct worker;
393};
394
395static void dasd_eer_destroy(struct dasd_device *device,
396 struct dasd_eer_private *eer);
397static int
398dasd_eer_write_trigger(struct dasd_eer_trigger *trigger);
399static void dasd_eer_sense_subsystem_status(void *data);
400static int dasd_eer_notify(struct notifier_block *self,
401 unsigned long action, void *data);
402
403struct workqueue_struct *dasd_eer_workqueue;
404
405#define SNSS_DATA_SIZE 44
406static spinlock_t snsslock = SPIN_LOCK_UNLOCKED;
407
408#define DASD_EER_BUSID_SIZE 10
409struct dasd_eer_header {
410 __u32 total_size;
411 __u32 trigger;
412 __u64 tv_sec;
413 __u64 tv_usec;
414 char busid[DASD_EER_BUSID_SIZE];
415} __attribute__ ((packed));
416
417static struct notifier_block dasd_eer_nb = {
418 .notifier_call = dasd_eer_notify,
419};
420
421/*
422 * flags for use with dasd_eer_private
423 */
424#define CQR_IN_USE 0
425#define SNSS_REQUESTED 1
426
427/*
428 * This function checks if extended error reporting is available for a given
429 * dasd_device. If yes, then it creates and returns a struct dasd_eer,
430 * otherwise it returns an -EPERM error pointer.
431 */
432struct dasd_eer_private *
433dasd_eer_probe(struct dasd_device *device)
434{
435 struct dasd_eer_private *private;
436
437 if (!(device && device->discipline
438 && !strcmp(device->discipline->name, "ECKD"))) {
439 return ERR_PTR(-EPERM);
440 }
441 /* allocate the private data structure */
442 private = (struct dasd_eer_private *)kmalloc(
443 sizeof(struct dasd_eer_private), GFP_KERNEL);
444 if (!private) {
445 return ERR_PTR(-ENOMEM);
446 }
447 INIT_WORK(&private->worker, dasd_eer_sense_subsystem_status,
448 (void *)device);
449 private->cqr = dasd_kmalloc_request("ECKD",
450 1 /* SNSS */ ,
451 SNSS_DATA_SIZE ,
452 device);
453 if (!private->cqr) {
454 kfree(private);
455 return ERR_PTR(-ENOMEM);
456 }
457 private->flags = 0;
458 return private;
459};
460
461/*
462 * If our private SNSS request is queued, remove it from the
463 * dasd ccw queue so we can free the requests memory.
464 */
465static void
466dasd_eer_dequeue_SNSS_request(struct dasd_device *device,
467 struct dasd_eer_private *eer)
468{
469 struct list_head *lst, *nxt;
470 struct dasd_ccw_req *cqr, *erpcqr;
471 dasd_erp_fn_t erp_fn;
472
473 spin_lock_irq(get_ccwdev_lock(device->cdev));
474 list_for_each_safe(lst, nxt, &device->ccw_queue) {
475 cqr = list_entry(lst, struct dasd_ccw_req, list);
476 /* we are looking for two kinds or requests */
477 /* first kind: our SNSS request: */
478 if (cqr == eer->cqr) {
479 if (cqr->status == DASD_CQR_IN_IO)
480 device->discipline->term_IO(cqr);
481 list_del(&cqr->list);
482 break;
483 }
484 /* second kind: ERP requests for our SNSS request */
485 if (cqr->refers) {
486 /* If this erp request chain ends in our cqr, then */
487 /* cal the erp_postaction to clean it up */
488 erpcqr = cqr;
489 while (erpcqr->refers) {
490 erpcqr = erpcqr->refers;
491 }
492 if (erpcqr == eer->cqr) {
493 erp_fn = device->discipline->erp_postaction(
494 cqr);
495 erp_fn(cqr);
496 }
497 continue;
498 }
499 }
500 spin_unlock_irq(get_ccwdev_lock(device->cdev));
501}
502
503/*
504 * This function dismantles a struct dasd_eer that was created by
505 * dasd_eer_probe. Since we want to free our private data structure,
506 * we must make sure that the memory is not in use anymore.
507 * We have to flush the work queue and remove a possible SNSS request
508 * from the dasd queue.
509 */
510static void
511dasd_eer_destroy(struct dasd_device *device, struct dasd_eer_private *eer)
512{
513 flush_workqueue(dasd_eer_workqueue);
514 dasd_eer_dequeue_SNSS_request(device, eer);
515 dasd_kfree_request(eer->cqr, device);
516 kfree(eer);
517};
518
519/*
520 * enable the extended error reporting for a particular device
521 */
522static int
523dasd_eer_enable_on_device(struct dasd_device *device)
524{
525 void *eer;
526 if (!device)
527 return -ENODEV;
528 if (device->eer)
529 return 0;
530 if (!try_module_get(THIS_MODULE)) {
531 return -EINVAL;
532 }
533 eer = (void *)dasd_eer_probe(device);
534 if (IS_ERR(eer)) {
535 module_put(THIS_MODULE);
536 return PTR_ERR(eer);
537 }
538 device->eer = eer;
539 return 0;
540}
541
542/*
543 * enable the extended error reporting for a particular device
544 */
545static int
546dasd_eer_disable_on_device(struct dasd_device *device)
547{
548 struct dasd_eer_private *eer = device->eer;
549
550 if (!device)
551 return -ENODEV;
552 if (!device->eer)
553 return 0;
554 device->eer = NULL;
555 dasd_eer_destroy(device,eer);
556 module_put(THIS_MODULE);
557
558 return 0;
559}
560
561/*
562 * Set extended error reporting (eer)
563 * Note: This will be registered as a DASD ioctl, to be called on DASD devices.
564 */
565static int
566dasd_ioctl_set_eer(struct block_device *bdev, int no, long args)
567{
568 struct dasd_device *device;
569 int intval;
570
571 if (!capable(CAP_SYS_ADMIN))
572 return -EACCES;
573 if (bdev != bdev->bd_contains)
574 /* Error-reporting is not allowed for partitions */
575 return -EINVAL;
576 if (get_user(intval, (int __user *) args))
577 return -EFAULT;
578 device = bdev->bd_disk->private_data;
579 if (device == NULL)
580 return -ENODEV;
581
582 intval = (intval != 0);
583 DEV_MESSAGE (KERN_DEBUG, device,
584 "set eer on device to %d", intval);
585 if (intval)
586 return dasd_eer_enable_on_device(device);
587 else
588 return dasd_eer_disable_on_device(device);
589}
590
591/*
592 * Get value of extended error reporting.
593 * Note: This will be registered as a DASD ioctl, to be called on DASD devices.
594 */
595static int
596dasd_ioctl_get_eer(struct block_device *bdev, int no, long args)
597{
598 struct dasd_device *device;
599
600 device = bdev->bd_disk->private_data;
601 if (device == NULL)
602 return -ENODEV;
603 return put_user((device->eer != NULL), (int __user *) args);
604}
605
606/*
607 * The following function can be used for those triggers that have
608 * all necessary data available when the function is called.
609 * If the parameter cqr is not NULL, the chain of requests will be searched
610 * for valid sense data, and all valid sense data sets will be added to
611 * the triggers data.
612 */
613static int
614dasd_eer_write_standard_trigger(int trigger, struct dasd_device *device,
615 struct dasd_ccw_req *cqr)
616{
617 struct dasd_ccw_req *temp_cqr;
618 int data_size;
619 struct timeval tv;
620 struct dasd_eer_header header;
621 unsigned long flags;
622 struct eerbuffer *eerb;
623
624 /* go through cqr chain and count the valid sense data sets */
625 temp_cqr = cqr;
626 data_size = 0;
627 while (temp_cqr) {
628 if (temp_cqr->irb.esw.esw0.erw.cons)
629 data_size += 32;
630 temp_cqr = temp_cqr->refers;
631 }
632
633 header.total_size = sizeof(header) + data_size + 4; /* "EOR" */
634 header.trigger = trigger;
635 do_gettimeofday(&tv);
636 header.tv_sec = tv.tv_sec;
637 header.tv_usec = tv.tv_usec;
638 strncpy(header.busid, device->cdev->dev.bus_id, DASD_EER_BUSID_SIZE);
639
640 spin_lock_irqsave(&bufferlock, flags);
641 list_for_each_entry(eerb, &bufferlist, list) {
642 dasd_eer_start_record(eerb, header.total_size);
643 dasd_eer_write_buffer(eerb, sizeof(header), (char*)(&header));
644 temp_cqr = cqr;
645 while (temp_cqr) {
646 if (temp_cqr->irb.esw.esw0.erw.cons)
647 dasd_eer_write_buffer(eerb, 32, cqr->irb.ecw);
648 temp_cqr = temp_cqr->refers;
649 }
650 dasd_eer_write_buffer(eerb, 4,"EOR");
651 }
652 spin_unlock_irqrestore(&bufferlock, flags);
653
654 wake_up_interruptible(&dasd_eer_read_wait_queue);
655
656 return 0;
657}
658
659/*
660 * This function writes a DASD_EER_STATECHANGE trigger.
661 */
662static void
663dasd_eer_write_SNSS_trigger(struct dasd_device *device,
664 struct dasd_ccw_req *cqr)
665{
666 int data_size;
667 int snss_rc;
668 struct timeval tv;
669 struct dasd_eer_header header;
670 unsigned long flags;
671 struct eerbuffer *eerb;
672
673 snss_rc = (cqr->status == DASD_CQR_FAILED) ? -EIO : 0;
674 if (snss_rc)
675 data_size = 0;
676 else
677 data_size = SNSS_DATA_SIZE;
678
679 header.total_size = sizeof(header) + data_size + 4; /* "EOR" */
680 header.trigger = DASD_EER_STATECHANGE;
681 do_gettimeofday(&tv);
682 header.tv_sec = tv.tv_sec;
683 header.tv_usec = tv.tv_usec;
684 strncpy(header.busid, device->cdev->dev.bus_id, DASD_EER_BUSID_SIZE);
685
686 spin_lock_irqsave(&bufferlock, flags);
687 list_for_each_entry(eerb, &bufferlist, list) {
688 dasd_eer_start_record(eerb, header.total_size);
689 dasd_eer_write_buffer(eerb, sizeof(header),(char*)(&header));
690 if (!snss_rc)
691 dasd_eer_write_buffer(eerb, SNSS_DATA_SIZE, cqr->data);
692 dasd_eer_write_buffer(eerb, 4,"EOR");
693 }
694 spin_unlock_irqrestore(&bufferlock, flags);
695
696 wake_up_interruptible(&dasd_eer_read_wait_queue);
697}
698
699/*
700 * callback function for use with SNSS request
701 */
702static void
703dasd_eer_SNSS_cb(struct dasd_ccw_req *cqr, void *data)
704{
705 struct dasd_device *device;
706 struct dasd_eer_private *private;
707 unsigned long irqflags;
708
709 device = (struct dasd_device *)data;
710 private = (struct dasd_eer_private *)device->eer;
711 dasd_eer_write_SNSS_trigger(device, cqr);
712 spin_lock_irqsave(&snsslock, irqflags);
713 if(!test_and_clear_bit(SNSS_REQUESTED, &private->flags)) {
714 clear_bit(CQR_IN_USE, &private->flags);
715 spin_unlock_irqrestore(&snsslock, irqflags);
716 return;
717 };
718 clear_bit(CQR_IN_USE, &private->flags);
719 spin_unlock_irqrestore(&snsslock, irqflags);
720 dasd_eer_sense_subsystem_status(device);
721 return;
722}
723
724/*
725 * clean a used cqr before using it again
726 */
727static void
728dasd_eer_clean_SNSS_request(struct dasd_ccw_req *cqr)
729{
730 struct ccw1 *cpaddr = cqr->cpaddr;
731 void *data = cqr->data;
732
733 memset(cqr, 0, sizeof(struct dasd_ccw_req));
734 memset(cpaddr, 0, sizeof(struct ccw1));
735 memset(data, 0, SNSS_DATA_SIZE);
736 cqr->cpaddr = cpaddr;
737 cqr->data = data;
738 strncpy((char *) &cqr->magic, "ECKD", 4);
739 ASCEBC((char *) &cqr->magic, 4);
740 set_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
741}
742
743/*
744 * build and start an SNSS request
745 * This function is called from a work queue so we have to
746 * pass the dasd_device pointer as a void pointer.
747 */
748static void
749dasd_eer_sense_subsystem_status(void *data)
750{
751 struct dasd_device *device;
752 struct dasd_eer_private *private;
753 struct dasd_ccw_req *cqr;
754 struct ccw1 *ccw;
755 unsigned long irqflags;
756
757 device = (struct dasd_device *)data;
758 private = (struct dasd_eer_private *)device->eer;
759 if (!private) /* device not eer enabled any more */
760 return;
761 cqr = private->cqr;
762 spin_lock_irqsave(&snsslock, irqflags);
763 if(test_and_set_bit(CQR_IN_USE, &private->flags)) {
764 set_bit(SNSS_REQUESTED, &private->flags);
765 spin_unlock_irqrestore(&snsslock, irqflags);
766 return;
767 };
768 spin_unlock_irqrestore(&snsslock, irqflags);
769 dasd_eer_clean_SNSS_request(cqr);
770 cqr->device = device;
771 cqr->retries = 255;
772 cqr->expires = 10 * HZ;
773
774 ccw = cqr->cpaddr;
775 ccw->cmd_code = DASD_ECKD_CCW_SNSS;
776 ccw->count = SNSS_DATA_SIZE;
777 ccw->flags = 0;
778 ccw->cda = (__u32)(addr_t)cqr->data;
779
780 cqr->buildclk = get_clock();
781 cqr->status = DASD_CQR_FILLED;
782 cqr->callback = dasd_eer_SNSS_cb;
783 cqr->callback_data = (void *)device;
784 dasd_add_request_head(cqr);
785
786 return;
787}
788
789/*
790 * This function is called for all triggers. It calls the appropriate
791 * function that writes the actual trigger records.
792 */
793static int
794dasd_eer_write_trigger(struct dasd_eer_trigger *trigger)
795{
796 int rc;
797 struct dasd_eer_private *private = trigger->device->eer;
798
799 switch (trigger->id) {
800 case DASD_EER_FATALERROR:
801 case DASD_EER_PPRCSUSPEND:
802 rc = dasd_eer_write_standard_trigger(
803 trigger->id, trigger->device, trigger->cqr);
804 break;
805 case DASD_EER_NOPATH:
806 rc = dasd_eer_write_standard_trigger(
807 trigger->id, trigger->device, NULL);
808 break;
809 case DASD_EER_STATECHANGE:
810 if (queue_work(dasd_eer_workqueue, &private->worker)) {
811 rc=0;
812 } else {
813 /* If the work_struct was already queued, it can't
814 * be queued again. But this is OK since we don't
815 * need to have it queued twice.
816 */
817 rc = -EBUSY;
818 }
819 break;
820 default: /* unknown trigger, so we write it without any sense data */
821 rc = dasd_eer_write_standard_trigger(
822 trigger->id, trigger->device, NULL);
823 break;
824 }
825 return rc;
826}
827
828/*
829 * This function is registered with the dasd device driver and gets called
830 * for all dasd eer notifications.
831 */
832static int dasd_eer_notify(struct notifier_block *self,
833 unsigned long action, void *data)
834{
835 switch (action) {
836 case DASD_EER_DISABLE:
837 dasd_eer_disable_on_device((struct dasd_device *)data);
838 break;
839 case DASD_EER_TRIGGER:
840 dasd_eer_write_trigger((struct dasd_eer_trigger *)data);
841 break;
842 }
843 return NOTIFY_OK;
844}
845
846
847/*****************************************************************************/
848/* the device operations */
849/*****************************************************************************/
850
851/*
852 * On the one side we need a lock to access our internal buffer, on the
853 * other side a copy_to_user can sleep. So we need to copy the data we have
854 * to transfer in a readbuffer, which is protected by the readbuffer_mutex.
855 */
856static char readbuffer[PAGE_SIZE];
857DECLARE_MUTEX(readbuffer_mutex);
858
859
860static int
861dasd_eer_open(struct inode *inp, struct file *filp)
862{
863 struct eerbuffer *eerb;
864 unsigned long flags;
865
866 eerb = kmalloc(sizeof(struct eerbuffer), GFP_KERNEL);
867 eerb->head = 0;
868 eerb->tail = 0;
869 eerb->residual = 0;
870 eerb->buffer_page_count = 1;
871 eerb->buffersize = eerb->buffer_page_count * PAGE_SIZE;
872 eerb->buffer = kmalloc(eerb->buffer_page_count*sizeof(char*),
873 GFP_KERNEL);
874 if (!eerb->buffer)
875 return -ENOMEM;
876 if (dasd_eer_allocate_buffer_pages(eerb->buffer,
877 eerb->buffer_page_count)) {
878 kfree(eerb->buffer);
879 return -ENOMEM;
880 }
881 filp->private_data = eerb;
882 spin_lock_irqsave(&bufferlock, flags);
883 list_add(&eerb->list, &bufferlist);
884 spin_unlock_irqrestore(&bufferlock, flags);
885
886 return nonseekable_open(inp,filp);
887}
888
889static int
890dasd_eer_close(struct inode *inp, struct file *filp)
891{
892 struct eerbuffer *eerb;
893 unsigned long flags;
894
895 eerb = (struct eerbuffer *)filp->private_data;
896 spin_lock_irqsave(&bufferlock, flags);
897 list_del(&eerb->list);
898 spin_unlock_irqrestore(&bufferlock, flags);
899 dasd_eer_free_buffer_pages(eerb->buffer, eerb->buffer_page_count);
900 kfree(eerb->buffer);
901 kfree(eerb);
902
903 return 0;
904}
905
906static long
907dasd_eer_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
908{
909 int intval;
910 struct eerbuffer *eerb;
911
912 eerb = (struct eerbuffer *)filp->private_data;
913 switch (cmd) {
914 case DASD_EER_PURGE:
915 dasd_eer_purge_buffer(eerb);
916 return 0;
917 case DASD_EER_SETBUFSIZE:
918 if (get_user(intval, (int __user *)arg))
919 return -EFAULT;
920 return dasd_eer_resize_buffer(eerb, intval);
921 default:
922 return -ENOIOCTLCMD;
923 }
924}
925
926static ssize_t
927dasd_eer_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
928{
929 int tc,rc;
930 int tailcount,effective_count;
931 unsigned long flags;
932 struct eerbuffer *eerb;
933
934 eerb = (struct eerbuffer *)filp->private_data;
935 if(down_interruptible(&readbuffer_mutex))
936 return -ERESTARTSYS;
937
938 spin_lock_irqsave(&bufferlock, flags);
939
940 if (eerb->residual < 0) { /* the remainder of this record */
941 /* has been deleted */
942 eerb->residual = 0;
943 spin_unlock_irqrestore(&bufferlock, flags);
944 up(&readbuffer_mutex);
945 return -EIO;
946 } else if (eerb->residual > 0) {
947 /* OK we still have a second half of a record to deliver */
948 effective_count = min(eerb->residual, (int)count);
949 eerb->residual -= effective_count;
950 } else {
951 tc = 0;
952 while (!tc) {
953 tc = dasd_eer_read_buffer(eerb,
954 sizeof(tailcount), (char*)(&tailcount));
955 if (!tc) {
956 /* no data available */
957 spin_unlock_irqrestore(&bufferlock, flags);
958 up(&readbuffer_mutex);
959 if (filp->f_flags & O_NONBLOCK)
960 return -EAGAIN;
961 rc = wait_event_interruptible(
962 dasd_eer_read_wait_queue,
963 eerb->head != eerb->tail);
964 if (rc) {
965 return rc;
966 }
967 if(down_interruptible(&readbuffer_mutex))
968 return -ERESTARTSYS;
969 spin_lock_irqsave(&bufferlock, flags);
970 }
971 }
972 WARN_ON(tc != sizeof(tailcount));
973 effective_count = min(tailcount,(int)count);
974 eerb->residual = tailcount - effective_count;
975 }
976
977 tc = dasd_eer_read_buffer(eerb, effective_count, readbuffer);
978 WARN_ON(tc != effective_count);
979
980 spin_unlock_irqrestore(&bufferlock, flags);
981
982 if (copy_to_user(buf, readbuffer, effective_count)) {
983 up(&readbuffer_mutex);
984 return -EFAULT;
985 }
986
987 up(&readbuffer_mutex);
988 return effective_count;
989}
990
991static unsigned int
992dasd_eer_poll (struct file *filp, poll_table *ptable)
993{
994 unsigned int mask;
995 unsigned long flags;
996 struct eerbuffer *eerb;
997
998 eerb = (struct eerbuffer *)filp->private_data;
999 poll_wait(filp, &dasd_eer_read_wait_queue, ptable);
1000 spin_lock_irqsave(&bufferlock, flags);
1001 if (eerb->head != eerb->tail)
1002 mask = POLLIN | POLLRDNORM ;
1003 else
1004 mask = 0;
1005 spin_unlock_irqrestore(&bufferlock, flags);
1006 return mask;
1007}
1008
1009static struct file_operations dasd_eer_fops = {
1010 .open = &dasd_eer_open,
1011 .release = &dasd_eer_close,
1012 .unlocked_ioctl = &dasd_eer_ioctl,
1013 .compat_ioctl = &dasd_eer_ioctl,
1014 .read = &dasd_eer_read,
1015 .poll = &dasd_eer_poll,
1016 .owner = THIS_MODULE,
1017};
1018
1019static struct miscdevice dasd_eer_dev = {
1020 .minor = MISC_DYNAMIC_MINOR,
1021 .name = "dasd_eer",
1022 .fops = &dasd_eer_fops,
1023};
1024
1025
1026/*****************************************************************************/
1027/* Init and exit */
1028/*****************************************************************************/
1029
1030static int
1031__init dasd_eer_init(void)
1032{
1033 int rc;
1034
1035 dasd_eer_workqueue = create_singlethread_workqueue("dasd_eer");
1036 if (!dasd_eer_workqueue) {
1037 MESSAGE(KERN_ERR , "%s", "dasd_eer_init could not "
1038 "create workqueue \n");
1039 rc = -ENOMEM;
1040 goto out;
1041 }
1042
1043 rc = dasd_register_eer_notifier(&dasd_eer_nb);
1044 if (rc) {
1045 MESSAGE(KERN_ERR, "%s", "dasd_eer_init could not "
1046 "register error reporting");
1047 goto queue;
1048 }
1049
1050 dasd_ioctl_no_register(THIS_MODULE, BIODASDEERSET, dasd_ioctl_set_eer);
1051 dasd_ioctl_no_register(THIS_MODULE, BIODASDEERGET, dasd_ioctl_get_eer);
1052
1053 /* we don't need our own character device,
1054 * so we just register as misc device */
1055 rc = misc_register(&dasd_eer_dev);
1056 if (rc) {
1057 MESSAGE(KERN_ERR, "%s", "dasd_eer_init could not "
1058 "register misc device");
1059 goto unregister;
1060 }
1061
1062 return 0;
1063
1064unregister:
1065 dasd_unregister_eer_notifier(&dasd_eer_nb);
1066 dasd_ioctl_no_unregister(THIS_MODULE, BIODASDEERSET,
1067 dasd_ioctl_set_eer);
1068 dasd_ioctl_no_unregister(THIS_MODULE, BIODASDEERGET,
1069 dasd_ioctl_get_eer);
1070queue:
1071 destroy_workqueue(dasd_eer_workqueue);
1072out:
1073 return rc;
1074
1075}
1076module_init(dasd_eer_init);
1077
1078static void
1079__exit dasd_eer_exit(void)
1080{
1081 dasd_unregister_eer_notifier(&dasd_eer_nb);
1082 dasd_ioctl_no_unregister(THIS_MODULE, BIODASDEERSET,
1083 dasd_ioctl_set_eer);
1084 dasd_ioctl_no_unregister(THIS_MODULE, BIODASDEERGET,
1085 dasd_ioctl_get_eer);
1086 destroy_workqueue(dasd_eer_workqueue);
1087
1088 WARN_ON(misc_deregister(&dasd_eer_dev) != 0);
1089}
1090module_exit(dasd_eer_exit);
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index d1b08fa13fd2..0592354cc604 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -275,34 +275,6 @@ struct dasd_discipline {
275 275
276extern struct dasd_discipline *dasd_diag_discipline_pointer; 276extern struct dasd_discipline *dasd_diag_discipline_pointer;
277 277
278
279/*
280 * Notification numbers for extended error reporting notifications:
281 * The DASD_EER_DISABLE notification is sent before a dasd_device (and it's
282 * eer pointer) is freed. The error reporting module needs to do all necessary
283 * cleanup steps.
284 * The DASD_EER_TRIGGER notification sends the actual error reports (triggers).
285 */
286#define DASD_EER_DISABLE 0
287#define DASD_EER_TRIGGER 1
288
289/* Trigger IDs for extended error reporting DASD_EER_TRIGGER notification */
290#define DASD_EER_FATALERROR 1
291#define DASD_EER_NOPATH 2
292#define DASD_EER_STATECHANGE 3
293#define DASD_EER_PPRCSUSPEND 4
294
295/*
296 * The dasd_eer_trigger structure contains all data that we need to send
297 * along with an DASD_EER_TRIGGER notification.
298 */
299struct dasd_eer_trigger {
300 unsigned int id;
301 struct dasd_device *device;
302 struct dasd_ccw_req *cqr;
303};
304
305
306struct dasd_device { 278struct dasd_device {
307 /* Block device stuff. */ 279 /* Block device stuff. */
308 struct gendisk *gdp; 280 struct gendisk *gdp;
@@ -316,11 +288,9 @@ struct dasd_device {
316 unsigned long flags; /* per device flags */ 288 unsigned long flags; /* per device flags */
317 unsigned short features; /* copy of devmap-features (read-only!) */ 289 unsigned short features; /* copy of devmap-features (read-only!) */
318 290
319 /* extended error reporting stuff (eer) */
320 void *eer;
321
322 /* Device discipline stuff. */ 291 /* Device discipline stuff. */
323 struct dasd_discipline *discipline; 292 struct dasd_discipline *discipline;
293 struct dasd_discipline *base_discipline;
324 char *private; 294 char *private;
325 295
326 /* Device state and target state. */ 296 /* Device state and target state. */
@@ -519,12 +489,6 @@ int dasd_generic_set_online(struct ccw_device *, struct dasd_discipline *);
519int dasd_generic_set_offline (struct ccw_device *cdev); 489int dasd_generic_set_offline (struct ccw_device *cdev);
520int dasd_generic_notify(struct ccw_device *, int); 490int dasd_generic_notify(struct ccw_device *, int);
521void dasd_generic_auto_online (struct ccw_driver *); 491void dasd_generic_auto_online (struct ccw_driver *);
522int dasd_register_eer_notifier(struct notifier_block *);
523int dasd_unregister_eer_notifier(struct notifier_block *);
524void dasd_write_eer_trigger(unsigned int , struct dasd_device *,
525 struct dasd_ccw_req *);
526
527
528 492
529/* externals in dasd_devmap.c */ 493/* externals in dasd_devmap.c */
530extern int dasd_max_devindex; 494extern int dasd_max_devindex;
diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c
index ceb0e474fde4..4138564402b8 100644
--- a/drivers/s390/char/sclp.c
+++ b/drivers/s390/char/sclp.c
@@ -85,11 +85,10 @@ static volatile enum sclp_mask_state_t {
85/* Maximum retry counts */ 85/* Maximum retry counts */
86#define SCLP_INIT_RETRY 3 86#define SCLP_INIT_RETRY 3
87#define SCLP_MASK_RETRY 3 87#define SCLP_MASK_RETRY 3
88#define SCLP_REQUEST_RETRY 3
89 88
90/* Timeout intervals in seconds.*/ 89/* Timeout intervals in seconds.*/
91#define SCLP_BUSY_INTERVAL 2 90#define SCLP_BUSY_INTERVAL 10
92#define SCLP_RETRY_INTERVAL 5 91#define SCLP_RETRY_INTERVAL 15
93 92
94static void sclp_process_queue(void); 93static void sclp_process_queue(void);
95static int sclp_init_mask(int calculate); 94static int sclp_init_mask(int calculate);
@@ -153,11 +152,9 @@ __sclp_start_request(struct sclp_req *req)
153 if (sclp_running_state != sclp_running_state_idle) 152 if (sclp_running_state != sclp_running_state_idle)
154 return 0; 153 return 0;
155 del_timer(&sclp_request_timer); 154 del_timer(&sclp_request_timer);
156 if (req->start_count <= SCLP_REQUEST_RETRY) { 155 rc = service_call(req->command, req->sccb);
157 rc = service_call(req->command, req->sccb); 156 req->start_count++;
158 req->start_count++; 157
159 } else
160 rc = -EIO;
161 if (rc == 0) { 158 if (rc == 0) {
162 /* Sucessfully started request */ 159 /* Sucessfully started request */
163 req->status = SCLP_REQ_RUNNING; 160 req->status = SCLP_REQ_RUNNING;
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 92be75d99a56..8cf9905d484b 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -232,7 +232,7 @@ s390_subchannel_remove_chpid(struct device *dev, void *data)
232 return 0; 232 return 0;
233 233
234 mask = 0x80 >> j; 234 mask = 0x80 >> j;
235 spin_lock(&sch->lock); 235 spin_lock_irq(&sch->lock);
236 236
237 stsch(sch->schid, &schib); 237 stsch(sch->schid, &schib);
238 if (!schib.pmcw.dnv) 238 if (!schib.pmcw.dnv)
@@ -281,10 +281,10 @@ s390_subchannel_remove_chpid(struct device *dev, void *data)
281 if (sch->driver && sch->driver->verify) 281 if (sch->driver && sch->driver->verify)
282 sch->driver->verify(&sch->dev); 282 sch->driver->verify(&sch->dev);
283out_unlock: 283out_unlock:
284 spin_unlock(&sch->lock); 284 spin_unlock_irq(&sch->lock);
285 return 0; 285 return 0;
286out_unreg: 286out_unreg:
287 spin_unlock(&sch->lock); 287 spin_unlock_irq(&sch->lock);
288 sch->lpm = 0; 288 sch->lpm = 0;
289 if (css_enqueue_subchannel_slow(sch->schid)) { 289 if (css_enqueue_subchannel_slow(sch->schid)) {
290 css_clear_subchannel_slow_list(); 290 css_clear_subchannel_slow_list();
@@ -652,7 +652,7 @@ __chp_add(struct subchannel_id schid, void *data)
652 if (!sch) 652 if (!sch)
653 /* Check if the subchannel is now available. */ 653 /* Check if the subchannel is now available. */
654 return __chp_add_new_sch(schid); 654 return __chp_add_new_sch(schid);
655 spin_lock(&sch->lock); 655 spin_lock_irq(&sch->lock);
656 for (i=0; i<8; i++) 656 for (i=0; i<8; i++)
657 if (sch->schib.pmcw.chpid[i] == chp->id) { 657 if (sch->schib.pmcw.chpid[i] == chp->id) {
658 if (stsch(sch->schid, &sch->schib) != 0) { 658 if (stsch(sch->schid, &sch->schib) != 0) {
@@ -674,7 +674,7 @@ __chp_add(struct subchannel_id schid, void *data)
674 if (sch->driver && sch->driver->verify) 674 if (sch->driver && sch->driver->verify)
675 sch->driver->verify(&sch->dev); 675 sch->driver->verify(&sch->dev);
676 676
677 spin_unlock(&sch->lock); 677 spin_unlock_irq(&sch->lock);
678 put_device(&sch->dev); 678 put_device(&sch->dev);
679 return 0; 679 return 0;
680} 680}
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 062fb100d94c..afc4e88551ad 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -359,7 +359,7 @@ ccw_device_set_online(struct ccw_device *cdev)
359 else 359 else
360 pr_debug("ccw_device_offline returned %d, device %s\n", 360 pr_debug("ccw_device_offline returned %d, device %s\n",
361 ret, cdev->dev.bus_id); 361 ret, cdev->dev.bus_id);
362 return (ret = 0) ? -ENODEV : ret; 362 return (ret == 0) ? -ENODEV : ret;
363} 363}
364 364
365static ssize_t 365static ssize_t
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c
index d2a5b04d7cba..85b1020a1fcc 100644
--- a/drivers/s390/cio/device_pgid.c
+++ b/drivers/s390/cio/device_pgid.c
@@ -405,7 +405,7 @@ __ccw_device_disband_start(struct ccw_device *cdev)
405 cdev->private->iretry = 5; 405 cdev->private->iretry = 5;
406 cdev->private->imask >>= 1; 406 cdev->private->imask >>= 1;
407 } 407 }
408 ccw_device_verify_done(cdev, (sch->lpm != 0) ? 0 : -ENODEV); 408 ccw_device_disband_done(cdev, (sch->lpm != 0) ? 0 : -ENODEV);
409} 409}
410 410
411/* 411/*
diff --git a/drivers/s390/cio/device_status.c b/drivers/s390/cio/device_status.c
index dad4dd9887c9..6c762b43f921 100644
--- a/drivers/s390/cio/device_status.c
+++ b/drivers/s390/cio/device_status.c
@@ -317,7 +317,6 @@ ccw_device_do_sense(struct ccw_device *cdev, struct irb *irb)
317 /* 317 /*
318 * We have ending status but no sense information. Do a basic sense. 318 * We have ending status but no sense information. Do a basic sense.
319 */ 319 */
320 sch = to_subchannel(cdev->dev.parent);
321 sch->sense_ccw.cmd_code = CCW_CMD_BASIC_SENSE; 320 sch->sense_ccw.cmd_code = CCW_CMD_BASIC_SENSE;
322 sch->sense_ccw.cda = (__u32) __pa(cdev->private->irb.ecw); 321 sch->sense_ccw.cda = (__u32) __pa(cdev->private->irb.ecw);
323 sch->sense_ccw.count = SENSE_MAX_COUNT; 322 sch->sense_ccw.count = SENSE_MAX_COUNT;
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index 45ce032772f4..9ed37dc9a1b0 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -165,8 +165,13 @@ qdio_do_eqbs(struct qdio_q *q, unsigned char *state,
165 q_no = q->q_no; 165 q_no = q->q_no;
166 if(!q->is_input_q) 166 if(!q->is_input_q)
167 q_no += irq->no_input_qs; 167 q_no += irq->no_input_qs;
168again:
168 ccq = do_eqbs(irq->sch_token, state, q_no, start, cnt); 169 ccq = do_eqbs(irq->sch_token, state, q_no, start, cnt);
169 rc = qdio_check_ccq(q, ccq); 170 rc = qdio_check_ccq(q, ccq);
171 if (rc == 1) {
172 QDIO_DBF_TEXT5(1,trace,"eqAGAIN");
173 goto again;
174 }
170 if (rc < 0) { 175 if (rc < 0) {
171 QDIO_DBF_TEXT2(1,trace,"eqberr"); 176 QDIO_DBF_TEXT2(1,trace,"eqberr");
172 sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt, *cnt, ccq, q_no); 177 sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt, *cnt, ccq, q_no);
@@ -195,8 +200,13 @@ qdio_do_sqbs(struct qdio_q *q, unsigned char state,
195 q_no = q->q_no; 200 q_no = q->q_no;
196 if(!q->is_input_q) 201 if(!q->is_input_q)
197 q_no += irq->no_input_qs; 202 q_no += irq->no_input_qs;
203again:
198 ccq = do_sqbs(irq->sch_token, state, q_no, start, cnt); 204 ccq = do_sqbs(irq->sch_token, state, q_no, start, cnt);
199 rc = qdio_check_ccq(q, ccq); 205 rc = qdio_check_ccq(q, ccq);
206 if (rc == 1) {
207 QDIO_DBF_TEXT5(1,trace,"sqAGAIN");
208 goto again;
209 }
200 if (rc < 0) { 210 if (rc < 0) {
201 QDIO_DBF_TEXT3(1,trace,"sqberr"); 211 QDIO_DBF_TEXT3(1,trace,"sqberr");
202 sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt,*cnt,ccq,q_no); 212 sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt,*cnt,ccq,q_no);
@@ -1187,8 +1197,7 @@ tiqdio_is_inbound_q_done(struct qdio_q *q)
1187 1197
1188 if (!no_used) 1198 if (!no_used)
1189 return 1; 1199 return 1;
1190 1200 if (!q->siga_sync && !irq->is_qebsm)
1191 if (!q->siga_sync)
1192 /* we'll check for more primed buffers in qeth_stop_polling */ 1201 /* we'll check for more primed buffers in qeth_stop_polling */
1193 return 0; 1202 return 0;
1194 if (irq->is_qebsm) { 1203 if (irq->is_qebsm) {
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 6229ba4995ad..9cf88d7201d3 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -98,9 +98,9 @@ lcs_register_debug_facility(void)
98 return -ENOMEM; 98 return -ENOMEM;
99 } 99 }
100 debug_register_view(lcs_dbf_setup, &debug_hex_ascii_view); 100 debug_register_view(lcs_dbf_setup, &debug_hex_ascii_view);
101 debug_set_level(lcs_dbf_setup, 4); 101 debug_set_level(lcs_dbf_setup, 2);
102 debug_register_view(lcs_dbf_trace, &debug_hex_ascii_view); 102 debug_register_view(lcs_dbf_trace, &debug_hex_ascii_view);
103 debug_set_level(lcs_dbf_trace, 4); 103 debug_set_level(lcs_dbf_trace, 2);
104 return 0; 104 return 0;
105} 105}
106 106
@@ -1292,9 +1292,8 @@ lcs_set_multicast_list(struct net_device *dev)
1292 LCS_DBF_TEXT(4, trace, "setmulti"); 1292 LCS_DBF_TEXT(4, trace, "setmulti");
1293 card = (struct lcs_card *) dev->priv; 1293 card = (struct lcs_card *) dev->priv;
1294 1294
1295 if (!lcs_set_thread_start_bit(card, LCS_SET_MC_THREAD)) { 1295 if (!lcs_set_thread_start_bit(card, LCS_SET_MC_THREAD))
1296 schedule_work(&card->kernel_thread_starter); 1296 schedule_work(&card->kernel_thread_starter);
1297 }
1298} 1297}
1299 1298
1300#endif /* CONFIG_IP_MULTICAST */ 1299#endif /* CONFIG_IP_MULTICAST */
@@ -1459,6 +1458,8 @@ lcs_txbuffer_cb(struct lcs_channel *channel, struct lcs_buffer *buffer)
1459 lcs_release_buffer(channel, buffer); 1458 lcs_release_buffer(channel, buffer);
1460 card = (struct lcs_card *) 1459 card = (struct lcs_card *)
1461 ((char *) channel - offsetof(struct lcs_card, write)); 1460 ((char *) channel - offsetof(struct lcs_card, write));
1461 if (netif_queue_stopped(card->dev))
1462 netif_wake_queue(card->dev);
1462 spin_lock(&card->lock); 1463 spin_lock(&card->lock);
1463 card->tx_emitted--; 1464 card->tx_emitted--;
1464 if (card->tx_emitted <= 0 && card->tx_buffer != NULL) 1465 if (card->tx_emitted <= 0 && card->tx_buffer != NULL)
@@ -1478,6 +1479,7 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb,
1478 struct net_device *dev) 1479 struct net_device *dev)
1479{ 1480{
1480 struct lcs_header *header; 1481 struct lcs_header *header;
1482 int rc = 0;
1481 1483
1482 LCS_DBF_TEXT(5, trace, "hardxmit"); 1484 LCS_DBF_TEXT(5, trace, "hardxmit");
1483 if (skb == NULL) { 1485 if (skb == NULL) {
@@ -1492,10 +1494,8 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb,
1492 card->stats.tx_carrier_errors++; 1494 card->stats.tx_carrier_errors++;
1493 return 0; 1495 return 0;
1494 } 1496 }
1495 if (netif_queue_stopped(dev) ) { 1497 netif_stop_queue(card->dev);
1496 card->stats.tx_dropped++; 1498 spin_lock(&card->lock);
1497 return -EBUSY;
1498 }
1499 if (card->tx_buffer != NULL && 1499 if (card->tx_buffer != NULL &&
1500 card->tx_buffer->count + sizeof(struct lcs_header) + 1500 card->tx_buffer->count + sizeof(struct lcs_header) +
1501 skb->len + sizeof(u16) > LCS_IOBUFFERSIZE) 1501 skb->len + sizeof(u16) > LCS_IOBUFFERSIZE)
@@ -1506,7 +1506,8 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb,
1506 card->tx_buffer = lcs_get_buffer(&card->write); 1506 card->tx_buffer = lcs_get_buffer(&card->write);
1507 if (card->tx_buffer == NULL) { 1507 if (card->tx_buffer == NULL) {
1508 card->stats.tx_dropped++; 1508 card->stats.tx_dropped++;
1509 return -EBUSY; 1509 rc = -EBUSY;
1510 goto out;
1510 } 1511 }
1511 card->tx_buffer->callback = lcs_txbuffer_cb; 1512 card->tx_buffer->callback = lcs_txbuffer_cb;
1512 card->tx_buffer->count = 0; 1513 card->tx_buffer->count = 0;
@@ -1518,13 +1519,18 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb,
1518 header->type = card->lan_type; 1519 header->type = card->lan_type;
1519 header->slot = card->portno; 1520 header->slot = card->portno;
1520 memcpy(header + 1, skb->data, skb->len); 1521 memcpy(header + 1, skb->data, skb->len);
1522 spin_unlock(&card->lock);
1521 card->stats.tx_bytes += skb->len; 1523 card->stats.tx_bytes += skb->len;
1522 card->stats.tx_packets++; 1524 card->stats.tx_packets++;
1523 dev_kfree_skb(skb); 1525 dev_kfree_skb(skb);
1524 if (card->tx_emitted <= 0) 1526 netif_wake_queue(card->dev);
1527 spin_lock(&card->lock);
1528 if (card->tx_emitted <= 0 && card->tx_buffer != NULL)
1525 /* If this is the first tx buffer emit it immediately. */ 1529 /* If this is the first tx buffer emit it immediately. */
1526 __lcs_emit_txbuffer(card); 1530 __lcs_emit_txbuffer(card);
1527 return 0; 1531out:
1532 spin_unlock(&card->lock);
1533 return rc;
1528} 1534}
1529 1535
1530static int 1536static int
@@ -1535,9 +1541,7 @@ lcs_start_xmit(struct sk_buff *skb, struct net_device *dev)
1535 1541
1536 LCS_DBF_TEXT(5, trace, "pktxmit"); 1542 LCS_DBF_TEXT(5, trace, "pktxmit");
1537 card = (struct lcs_card *) dev->priv; 1543 card = (struct lcs_card *) dev->priv;
1538 spin_lock(&card->lock);
1539 rc = __lcs_start_xmit(card, skb, dev); 1544 rc = __lcs_start_xmit(card, skb, dev);
1540 spin_unlock(&card->lock);
1541 return rc; 1545 return rc;
1542} 1546}
1543 1547
@@ -2319,7 +2323,6 @@ __init lcs_init_module(void)
2319 PRINT_ERR("Initialization failed\n"); 2323 PRINT_ERR("Initialization failed\n");
2320 return rc; 2324 return rc;
2321 } 2325 }
2322
2323 return 0; 2326 return 0;
2324} 2327}
2325 2328
diff --git a/drivers/s390/net/lcs.h b/drivers/s390/net/lcs.h
index 08e60ad43916..2fad5e40c2e4 100644
--- a/drivers/s390/net/lcs.h
+++ b/drivers/s390/net/lcs.h
@@ -95,7 +95,7 @@ do { \
95 */ 95 */
96#define LCS_ILLEGAL_OFFSET 0xffff 96#define LCS_ILLEGAL_OFFSET 0xffff
97#define LCS_IOBUFFERSIZE 0x5000 97#define LCS_IOBUFFERSIZE 0x5000
98#define LCS_NUM_BUFFS 8 /* needs to be power of 2 */ 98#define LCS_NUM_BUFFS 32 /* needs to be power of 2 */
99#define LCS_MAC_LENGTH 6 99#define LCS_MAC_LENGTH 6
100#define LCS_INVALID_PORT_NO -1 100#define LCS_INVALID_PORT_NO -1
101#define LCS_LANCMD_TIMEOUT_DEFAULT 5 101#define LCS_LANCMD_TIMEOUT_DEFAULT 5
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
index 9a064d4727ad..4df0fcd7b10b 100644
--- a/drivers/s390/net/qeth.h
+++ b/drivers/s390/net/qeth.h
@@ -1076,16 +1076,6 @@ qeth_get_qdio_q_format(struct qeth_card *card)
1076} 1076}
1077 1077
1078static inline int 1078static inline int
1079qeth_isdigit(char * buf)
1080{
1081 while (*buf) {
1082 if (!isdigit(*buf++))
1083 return 0;
1084 }
1085 return 1;
1086}
1087
1088static inline int
1089qeth_isxdigit(char * buf) 1079qeth_isxdigit(char * buf)
1090{ 1080{
1091 while (*buf) { 1081 while (*buf) {
@@ -1104,33 +1094,17 @@ qeth_ipaddr4_to_string(const __u8 *addr, char *buf)
1104static inline int 1094static inline int
1105qeth_string_to_ipaddr4(const char *buf, __u8 *addr) 1095qeth_string_to_ipaddr4(const char *buf, __u8 *addr)
1106{ 1096{
1107 const char *start, *end; 1097 int count = 0, rc = 0;
1108 char abuf[4]; 1098 int in[4];
1109 char *tmp; 1099
1110 int len; 1100 rc = sscanf(buf, "%d.%d.%d.%d%n",
1111 int i; 1101 &in[0], &in[1], &in[2], &in[3], &count);
1112 1102 if (rc != 4 || count)
1113 start = buf; 1103 return -EINVAL;
1114 for (i = 0; i < 4; i++) { 1104 for (count = 0; count < 4; count++) {
1115 if (i == 3) { 1105 if (in[count] > 255)
1116 end = strchr(start,0xa);
1117 if (end)
1118 len = end - start;
1119 else
1120 len = strlen(start);
1121 }
1122 else {
1123 end = strchr(start, '.');
1124 len = end - start;
1125 }
1126 if ((len <= 0) || (len > 3))
1127 return -EINVAL;
1128 memset(abuf, 0, 4);
1129 strncpy(abuf, start, len);
1130 if (!qeth_isdigit(abuf))
1131 return -EINVAL; 1106 return -EINVAL;
1132 addr[i] = simple_strtoul(abuf, &tmp, 10); 1107 addr[count] = in[count];
1133 start = end + 1;
1134 } 1108 }
1135 return 0; 1109 return 0;
1136} 1110}
@@ -1149,36 +1123,44 @@ qeth_ipaddr6_to_string(const __u8 *addr, char *buf)
1149static inline int 1123static inline int
1150qeth_string_to_ipaddr6(const char *buf, __u8 *addr) 1124qeth_string_to_ipaddr6(const char *buf, __u8 *addr)
1151{ 1125{
1152 const char *start, *end; 1126 char *end, *start;
1153 u16 *tmp_addr; 1127 __u16 *in;
1154 char abuf[5]; 1128 char num[5];
1155 char *tmp; 1129 int num2, cnt, out, found, save_cnt;
1156 int len; 1130 unsigned short in_tmp[8] = {0, };
1157 int i; 1131
1158 1132 cnt = out = found = save_cnt = num2 = 0;
1159 tmp_addr = (u16 *)addr; 1133 end = start = (char *) buf;
1160 start = buf; 1134 in = (__u16 *) addr;
1161 for (i = 0; i < 8; i++) { 1135 memset(in, 0, 16);
1162 if (i == 7) { 1136 while (end) {
1163 end = strchr(start,0xa); 1137 end = strchr(end,':');
1164 if (end) 1138 if (end == NULL) {
1165 len = end - start; 1139 end = (char *)buf + (strlen(buf));
1166 else 1140 out = 1;
1167 len = strlen(start); 1141 }
1168 } 1142 if ((end - start)) {
1169 else { 1143 memset(num, 0, 5);
1170 end = strchr(start, ':'); 1144 memcpy(num, start, end - start);
1171 len = end - start; 1145 if (!qeth_isxdigit(num))
1146 return -EINVAL;
1147 sscanf(start, "%x", &num2);
1148 if (found)
1149 in_tmp[save_cnt++] = num2;
1150 else
1151 in[cnt++] = num2;
1152 if (out)
1153 break;
1154 } else {
1155 if (found)
1156 return -EINVAL;
1157 found = 1;
1172 } 1158 }
1173 if ((len <= 0) || (len > 4)) 1159 start = ++end;
1174 return -EINVAL; 1160 }
1175 memset(abuf, 0, 5); 1161 cnt = 7;
1176 strncpy(abuf, start, len); 1162 while (save_cnt)
1177 if (!qeth_isxdigit(abuf)) 1163 in[cnt--] = in_tmp[--save_cnt];
1178 return -EINVAL;
1179 tmp_addr[i] = simple_strtoul(abuf, &tmp, 16);
1180 start = end + 1;
1181 }
1182 return 0; 1164 return 0;
1183} 1165}
1184 1166
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c
index b02313127780..82cb4af2f0e7 100644
--- a/drivers/s390/net/qeth_eddp.c
+++ b/drivers/s390/net/qeth_eddp.c
@@ -59,8 +59,7 @@ qeth_eddp_free_context(struct qeth_eddp_context *ctx)
59 for (i = 0; i < ctx->num_pages; ++i) 59 for (i = 0; i < ctx->num_pages; ++i)
60 free_page((unsigned long)ctx->pages[i]); 60 free_page((unsigned long)ctx->pages[i]);
61 kfree(ctx->pages); 61 kfree(ctx->pages);
62 if (ctx->elements != NULL) 62 kfree(ctx->elements);
63 kfree(ctx->elements);
64 kfree(ctx); 63 kfree(ctx);
65} 64}
66 65
@@ -413,6 +412,13 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
413 412
414 QETH_DBF_TEXT(trace, 5, "eddpftcp"); 413 QETH_DBF_TEXT(trace, 5, "eddpftcp");
415 eddp->skb_offset = sizeof(struct qeth_hdr) + eddp->nhl + eddp->thl; 414 eddp->skb_offset = sizeof(struct qeth_hdr) + eddp->nhl + eddp->thl;
415 if (eddp->qh.hdr.l2.id == QETH_HEADER_TYPE_LAYER2) {
416 eddp->skb_offset += sizeof(struct ethhdr);
417#ifdef CONFIG_QETH_VLAN
418 if (eddp->mac.h_proto == __constant_htons(ETH_P_8021Q))
419 eddp->skb_offset += VLAN_HLEN;
420#endif /* CONFIG_QETH_VLAN */
421 }
416 tcph = eddp->skb->h.th; 422 tcph = eddp->skb->h.th;
417 while (eddp->skb_offset < eddp->skb->len) { 423 while (eddp->skb_offset < eddp->skb->len) {
418 data_len = min((int)skb_shinfo(eddp->skb)->tso_size, 424 data_len = min((int)skb_shinfo(eddp->skb)->tso_size,
@@ -483,6 +489,7 @@ qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
483 return -ENOMEM; 489 return -ENOMEM;
484 } 490 }
485 if (qhdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2) { 491 if (qhdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2) {
492 skb->mac.raw = (skb->data) + sizeof(struct qeth_hdr);
486 memcpy(&eddp->mac, eth_hdr(skb), ETH_HLEN); 493 memcpy(&eddp->mac, eth_hdr(skb), ETH_HLEN);
487#ifdef CONFIG_QETH_VLAN 494#ifdef CONFIG_QETH_VLAN
488 if (eddp->mac.h_proto == __constant_htons(ETH_P_8021Q)) { 495 if (eddp->mac.h_proto == __constant_htons(ETH_P_8021Q)) {
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 410abeada6c4..dba7f7f02e79 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -516,7 +516,8 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode)
516 QETH_DBF_TEXT(setup, 3, "setoffl"); 516 QETH_DBF_TEXT(setup, 3, "setoffl");
517 QETH_DBF_HEX(setup, 3, &card, sizeof(void *)); 517 QETH_DBF_HEX(setup, 3, &card, sizeof(void *));
518 518
519 netif_carrier_off(card->dev); 519 if (card->dev && netif_carrier_ok(card->dev))
520 netif_carrier_off(card->dev);
520 recover_flag = card->state; 521 recover_flag = card->state;
521 if (qeth_stop_card(card, recovery_mode) == -ERESTARTSYS){ 522 if (qeth_stop_card(card, recovery_mode) == -ERESTARTSYS){
522 PRINT_WARN("Stopping card %s interrupted by user!\n", 523 PRINT_WARN("Stopping card %s interrupted by user!\n",
@@ -1679,6 +1680,7 @@ qeth_cmd_timeout(unsigned long data)
1679 spin_unlock_irqrestore(&reply->card->lock, flags); 1680 spin_unlock_irqrestore(&reply->card->lock, flags);
1680} 1681}
1681 1682
1683
1682static struct qeth_ipa_cmd * 1684static struct qeth_ipa_cmd *
1683qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) 1685qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob)
1684{ 1686{
@@ -1699,7 +1701,8 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob)
1699 QETH_CARD_IFNAME(card), 1701 QETH_CARD_IFNAME(card),
1700 card->info.chpid); 1702 card->info.chpid);
1701 card->lan_online = 0; 1703 card->lan_online = 0;
1702 netif_carrier_off(card->dev); 1704 if (card->dev && netif_carrier_ok(card->dev))
1705 netif_carrier_off(card->dev);
1703 return NULL; 1706 return NULL;
1704 case IPA_CMD_STARTLAN: 1707 case IPA_CMD_STARTLAN:
1705 PRINT_INFO("Link reestablished on %s " 1708 PRINT_INFO("Link reestablished on %s "
@@ -5562,7 +5565,7 @@ qeth_set_multicast_list(struct net_device *dev)
5562 if (card->info.type == QETH_CARD_TYPE_OSN) 5565 if (card->info.type == QETH_CARD_TYPE_OSN)
5563 return ; 5566 return ;
5564 5567
5565 QETH_DBF_TEXT(trace,3,"setmulti"); 5568 QETH_DBF_TEXT(trace, 3, "setmulti");
5566 qeth_delete_mc_addresses(card); 5569 qeth_delete_mc_addresses(card);
5567 if (card->options.layer2) { 5570 if (card->options.layer2) {
5568 qeth_layer2_add_multicast(card); 5571 qeth_layer2_add_multicast(card);
@@ -5579,7 +5582,6 @@ out:
5579 return; 5582 return;
5580 if (qeth_set_thread_start_bit(card, QETH_SET_PROMISC_MODE_THREAD)==0) 5583 if (qeth_set_thread_start_bit(card, QETH_SET_PROMISC_MODE_THREAD)==0)
5581 schedule_work(&card->kernel_thread_starter); 5584 schedule_work(&card->kernel_thread_starter);
5582
5583} 5585}
5584 5586
5585static int 5587static int
@@ -7452,6 +7454,7 @@ qeth_softsetup_card(struct qeth_card *card)
7452 card->lan_online = 1; 7454 card->lan_online = 1;
7453 if (card->info.type==QETH_CARD_TYPE_OSN) 7455 if (card->info.type==QETH_CARD_TYPE_OSN)
7454 goto out; 7456 goto out;
7457 qeth_set_large_send(card, card->options.large_send);
7455 if (card->options.layer2) { 7458 if (card->options.layer2) {
7456 card->dev->features |= 7459 card->dev->features |=
7457 NETIF_F_HW_VLAN_FILTER | 7460 NETIF_F_HW_VLAN_FILTER |
@@ -7468,12 +7471,6 @@ qeth_softsetup_card(struct qeth_card *card)
7468#endif 7471#endif
7469 goto out; 7472 goto out;
7470 } 7473 }
7471 if ((card->options.large_send == QETH_LARGE_SEND_EDDP) ||
7472 (card->options.large_send == QETH_LARGE_SEND_TSO))
7473 card->dev->features |= NETIF_F_TSO | NETIF_F_SG;
7474 else
7475 card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG);
7476
7477 if ((rc = qeth_setadapter_parms(card))) 7474 if ((rc = qeth_setadapter_parms(card)))
7478 QETH_DBF_TEXT_(setup, 2, "2err%d", rc); 7475 QETH_DBF_TEXT_(setup, 2, "2err%d", rc);
7479 if ((rc = qeth_start_ipassists(card))) 7476 if ((rc = qeth_start_ipassists(card)))
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 4d7d47cf2394..a5f2ba9a8fdb 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -710,10 +710,9 @@ static inline void
710_zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level, 710_zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level,
711 struct zfcp_adapter *adapter, 711 struct zfcp_adapter *adapter,
712 struct scsi_cmnd *scsi_cmnd, 712 struct scsi_cmnd *scsi_cmnd,
713 struct zfcp_fsf_req *new_fsf_req) 713 struct zfcp_fsf_req *fsf_req,
714 struct zfcp_fsf_req *old_fsf_req)
714{ 715{
715 struct zfcp_fsf_req *fsf_req =
716 (struct zfcp_fsf_req *)scsi_cmnd->host_scribble;
717 struct zfcp_scsi_dbf_record *rec = &adapter->scsi_dbf_buf; 716 struct zfcp_scsi_dbf_record *rec = &adapter->scsi_dbf_buf;
718 struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; 717 struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec;
719 unsigned long flags; 718 unsigned long flags;
@@ -727,19 +726,20 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level,
727 if (offset == 0) { 726 if (offset == 0) {
728 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); 727 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
729 strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE); 728 strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE);
730 if (scsi_cmnd->device) { 729 if (scsi_cmnd != NULL) {
731 rec->scsi_id = scsi_cmnd->device->id; 730 if (scsi_cmnd->device) {
732 rec->scsi_lun = scsi_cmnd->device->lun; 731 rec->scsi_id = scsi_cmnd->device->id;
732 rec->scsi_lun = scsi_cmnd->device->lun;
733 }
734 rec->scsi_result = scsi_cmnd->result;
735 rec->scsi_cmnd = (unsigned long)scsi_cmnd;
736 rec->scsi_serial = scsi_cmnd->serial_number;
737 memcpy(rec->scsi_opcode, &scsi_cmnd->cmnd,
738 min((int)scsi_cmnd->cmd_len,
739 ZFCP_DBF_SCSI_OPCODE));
740 rec->scsi_retries = scsi_cmnd->retries;
741 rec->scsi_allowed = scsi_cmnd->allowed;
733 } 742 }
734 rec->scsi_result = scsi_cmnd->result;
735 rec->scsi_cmnd = (unsigned long)scsi_cmnd;
736 rec->scsi_serial = scsi_cmnd->serial_number;
737 memcpy(rec->scsi_opcode,
738 &scsi_cmnd->cmnd,
739 min((int)scsi_cmnd->cmd_len,
740 ZFCP_DBF_SCSI_OPCODE));
741 rec->scsi_retries = scsi_cmnd->retries;
742 rec->scsi_allowed = scsi_cmnd->allowed;
743 if (fsf_req != NULL) { 743 if (fsf_req != NULL) {
744 fcp_rsp = (struct fcp_rsp_iu *) 744 fcp_rsp = (struct fcp_rsp_iu *)
745 &(fsf_req->qtcb->bottom.io.fcp_rsp); 745 &(fsf_req->qtcb->bottom.io.fcp_rsp);
@@ -772,15 +772,8 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level,
772 rec->fsf_seqno = fsf_req->seq_no; 772 rec->fsf_seqno = fsf_req->seq_no;
773 rec->fsf_issued = fsf_req->issued; 773 rec->fsf_issued = fsf_req->issued;
774 } 774 }
775 if (new_fsf_req != NULL) { 775 rec->type.old_fsf_reqid =
776 rec->type.new_fsf_req.fsf_reqid = 776 (unsigned long) old_fsf_req;
777 (unsigned long)
778 new_fsf_req;
779 rec->type.new_fsf_req.fsf_seqno =
780 new_fsf_req->seq_no;
781 rec->type.new_fsf_req.fsf_issued =
782 new_fsf_req->issued;
783 }
784 } else { 777 } else {
785 strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE); 778 strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE);
786 dump->total_size = buflen; 779 dump->total_size = buflen;
@@ -801,19 +794,21 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level,
801inline void 794inline void
802zfcp_scsi_dbf_event_result(const char *tag, int level, 795zfcp_scsi_dbf_event_result(const char *tag, int level,
803 struct zfcp_adapter *adapter, 796 struct zfcp_adapter *adapter,
804 struct scsi_cmnd *scsi_cmnd) 797 struct scsi_cmnd *scsi_cmnd,
798 struct zfcp_fsf_req *fsf_req)
805{ 799{
806 _zfcp_scsi_dbf_event_common("rslt", 800 _zfcp_scsi_dbf_event_common("rslt", tag, level,
807 tag, level, adapter, scsi_cmnd, NULL); 801 adapter, scsi_cmnd, fsf_req, NULL);
808} 802}
809 803
810inline void 804inline void
811zfcp_scsi_dbf_event_abort(const char *tag, struct zfcp_adapter *adapter, 805zfcp_scsi_dbf_event_abort(const char *tag, struct zfcp_adapter *adapter,
812 struct scsi_cmnd *scsi_cmnd, 806 struct scsi_cmnd *scsi_cmnd,
813 struct zfcp_fsf_req *new_fsf_req) 807 struct zfcp_fsf_req *new_fsf_req,
808 struct zfcp_fsf_req *old_fsf_req)
814{ 809{
815 _zfcp_scsi_dbf_event_common("abrt", 810 _zfcp_scsi_dbf_event_common("abrt", tag, 1,
816 tag, 1, adapter, scsi_cmnd, new_fsf_req); 811 adapter, scsi_cmnd, new_fsf_req, old_fsf_req);
817} 812}
818 813
819inline void 814inline void
@@ -823,7 +818,7 @@ zfcp_scsi_dbf_event_devreset(const char *tag, u8 flag, struct zfcp_unit *unit,
823 struct zfcp_adapter *adapter = unit->port->adapter; 818 struct zfcp_adapter *adapter = unit->port->adapter;
824 819
825 _zfcp_scsi_dbf_event_common(flag == FCP_TARGET_RESET ? "trst" : "lrst", 820 _zfcp_scsi_dbf_event_common(flag == FCP_TARGET_RESET ? "trst" : "lrst",
826 tag, 1, adapter, scsi_cmnd, NULL); 821 tag, 1, adapter, scsi_cmnd, NULL, NULL);
827} 822}
828 823
829static int 824static int
@@ -856,6 +851,10 @@ zfcp_scsi_dbf_view_format(debug_info_t * id, struct debug_view *view,
856 rec->scsi_retries); 851 rec->scsi_retries);
857 len += zfcp_dbf_view(out_buf + len, "scsi_allowed", "0x%02x", 852 len += zfcp_dbf_view(out_buf + len, "scsi_allowed", "0x%02x",
858 rec->scsi_allowed); 853 rec->scsi_allowed);
854 if (strncmp(rec->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0) {
855 len += zfcp_dbf_view(out_buf + len, "old_fsf_reqid", "0x%0Lx",
856 rec->type.old_fsf_reqid);
857 }
859 len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx", 858 len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx",
860 rec->fsf_reqid); 859 rec->fsf_reqid);
861 len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", 860 len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x",
@@ -883,21 +882,6 @@ zfcp_scsi_dbf_view_format(debug_info_t * id, struct debug_view *view,
883 min((int)rec->type.fcp.sns_info_len, 882 min((int)rec->type.fcp.sns_info_len,
884 ZFCP_DBF_SCSI_FCP_SNS_INFO), 0, 883 ZFCP_DBF_SCSI_FCP_SNS_INFO), 0,
885 rec->type.fcp.sns_info_len); 884 rec->type.fcp.sns_info_len);
886 } else if (strncmp(rec->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0) {
887 len += zfcp_dbf_view(out_buf + len, "fsf_reqid_abort", "0x%0Lx",
888 rec->type.new_fsf_req.fsf_reqid);
889 len += zfcp_dbf_view(out_buf + len, "fsf_seqno_abort", "0x%08x",
890 rec->type.new_fsf_req.fsf_seqno);
891 len += zfcp_dbf_stck(out_buf + len, "fsf_issued",
892 rec->type.new_fsf_req.fsf_issued);
893 } else if ((strncmp(rec->tag, "trst", ZFCP_DBF_TAG_SIZE) == 0) ||
894 (strncmp(rec->tag, "lrst", ZFCP_DBF_TAG_SIZE) == 0)) {
895 len += zfcp_dbf_view(out_buf + len, "fsf_reqid_reset", "0x%0Lx",
896 rec->type.new_fsf_req.fsf_reqid);
897 len += zfcp_dbf_view(out_buf + len, "fsf_seqno_reset", "0x%08x",
898 rec->type.new_fsf_req.fsf_seqno);
899 len += zfcp_dbf_stck(out_buf + len, "fsf_issued",
900 rec->type.new_fsf_req.fsf_issued);
901 } 885 }
902 886
903 len += sprintf(out_buf + len, "\n"); 887 len += sprintf(out_buf + len, "\n");
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index e260d19fa717..7f551d66f47f 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -152,11 +152,6 @@ typedef u32 scsi_lun_t;
152#define ZFCP_EXCHANGE_CONFIG_DATA_FIRST_SLEEP 100 152#define ZFCP_EXCHANGE_CONFIG_DATA_FIRST_SLEEP 100
153#define ZFCP_EXCHANGE_CONFIG_DATA_RETRIES 7 153#define ZFCP_EXCHANGE_CONFIG_DATA_RETRIES 7
154 154
155/* Retry 5 times every 2 second, then every minute */
156#define ZFCP_EXCHANGE_PORT_DATA_SHORT_RETRIES 5
157#define ZFCP_EXCHANGE_PORT_DATA_SHORT_SLEEP 200
158#define ZFCP_EXCHANGE_PORT_DATA_LONG_SLEEP 6000
159
160/* timeout value for "default timer" for fsf requests */ 155/* timeout value for "default timer" for fsf requests */
161#define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ); 156#define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ);
162 157
@@ -429,11 +424,7 @@ struct zfcp_scsi_dbf_record {
429 u32 fsf_seqno; 424 u32 fsf_seqno;
430 u64 fsf_issued; 425 u64 fsf_issued;
431 union { 426 union {
432 struct { 427 u64 old_fsf_reqid;
433 u64 fsf_reqid;
434 u32 fsf_seqno;
435 u64 fsf_issued;
436 } new_fsf_req;
437 struct { 428 struct {
438 u8 rsp_validity; 429 u8 rsp_validity;
439 u8 rsp_scsi_status; 430 u8 rsp_scsi_status;
@@ -915,8 +906,6 @@ struct zfcp_adapter {
915 wwn_t peer_wwnn; /* P2P peer WWNN */ 906 wwn_t peer_wwnn; /* P2P peer WWNN */
916 wwn_t peer_wwpn; /* P2P peer WWPN */ 907 wwn_t peer_wwpn; /* P2P peer WWPN */
917 u32 peer_d_id; /* P2P peer D_ID */ 908 u32 peer_d_id; /* P2P peer D_ID */
918 wwn_t physical_wwpn; /* WWPN of physical port */
919 u32 physical_s_id; /* local FC port ID */
920 struct ccw_device *ccw_device; /* S/390 ccw device */ 909 struct ccw_device *ccw_device; /* S/390 ccw device */
921 u8 fc_service_class; 910 u8 fc_service_class;
922 u32 hydra_version; /* Hydra version */ 911 u32 hydra_version; /* Hydra version */
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index da947e662031..e3c4bdd29a60 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -2246,15 +2246,6 @@ zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *erp_action)
2246{ 2246{
2247 int retval; 2247 int retval;
2248 2248
2249 if ((atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED,
2250 &erp_action->adapter->status)) &&
2251 (erp_action->adapter->adapter_features &
2252 FSF_FEATURE_HBAAPI_MANAGEMENT)) {
2253 zfcp_erp_adapter_strategy_open_fsf_xport(erp_action);
2254 atomic_set(&erp_action->adapter->erp_counter, 0);
2255 return ZFCP_ERP_FAILED;
2256 }
2257
2258 retval = zfcp_erp_adapter_strategy_open_fsf_xconfig(erp_action); 2249 retval = zfcp_erp_adapter_strategy_open_fsf_xconfig(erp_action);
2259 if (retval == ZFCP_ERP_FAILED) 2250 if (retval == ZFCP_ERP_FAILED)
2260 return ZFCP_ERP_FAILED; 2251 return ZFCP_ERP_FAILED;
@@ -2266,13 +2257,6 @@ zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *erp_action)
2266 return zfcp_erp_adapter_strategy_open_fsf_statusread(erp_action); 2257 return zfcp_erp_adapter_strategy_open_fsf_statusread(erp_action);
2267} 2258}
2268 2259
2269/*
2270 * function:
2271 *
2272 * purpose:
2273 *
2274 * returns:
2275 */
2276static int 2260static int
2277zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action) 2261zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
2278{ 2262{
@@ -2350,48 +2334,40 @@ static int
2350zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action) 2334zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action)
2351{ 2335{
2352 int ret; 2336 int ret;
2353 int retries; 2337 struct zfcp_adapter *adapter;
2354 int sleep;
2355 struct zfcp_adapter *adapter = erp_action->adapter;
2356 2338
2339 adapter = erp_action->adapter;
2357 atomic_clear_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status); 2340 atomic_clear_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status);
2358 2341
2359 retries = 0; 2342 write_lock(&adapter->erp_lock);
2360 do { 2343 zfcp_erp_action_to_running(erp_action);
2361 write_lock(&adapter->erp_lock); 2344 write_unlock(&adapter->erp_lock);
2362 zfcp_erp_action_to_running(erp_action);
2363 write_unlock(&adapter->erp_lock);
2364 zfcp_erp_timeout_init(erp_action);
2365 ret = zfcp_fsf_exchange_port_data(erp_action, adapter, NULL);
2366 if (ret == -EOPNOTSUPP) {
2367 debug_text_event(adapter->erp_dbf, 3, "a_xport_notsupp");
2368 return ZFCP_ERP_SUCCEEDED;
2369 } else if (ret) {
2370 debug_text_event(adapter->erp_dbf, 3, "a_xport_failed");
2371 return ZFCP_ERP_FAILED;
2372 }
2373 debug_text_event(adapter->erp_dbf, 6, "a_xport_ok");
2374 2345
2375 down(&adapter->erp_ready_sem); 2346 zfcp_erp_timeout_init(erp_action);
2376 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { 2347 ret = zfcp_fsf_exchange_port_data(erp_action, adapter, NULL);
2377 ZFCP_LOG_INFO("error: exchange of port data " 2348 if (ret == -EOPNOTSUPP) {
2378 "for adapter %s timed out\n", 2349 debug_text_event(adapter->erp_dbf, 3, "a_xport_notsupp");
2379 zfcp_get_busid_by_adapter(adapter)); 2350 return ZFCP_ERP_SUCCEEDED;
2380 break; 2351 } else if (ret) {
2381 } 2352 debug_text_event(adapter->erp_dbf, 3, "a_xport_failed");
2382 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, 2353 return ZFCP_ERP_FAILED;
2383 &adapter->status)) 2354 }
2384 break; 2355 debug_text_event(adapter->erp_dbf, 6, "a_xport_ok");
2385 2356
2386 if (retries < ZFCP_EXCHANGE_PORT_DATA_SHORT_RETRIES) { 2357 ret = ZFCP_ERP_SUCCEEDED;
2387 sleep = ZFCP_EXCHANGE_PORT_DATA_SHORT_SLEEP; 2358 down(&adapter->erp_ready_sem);
2388 retries++; 2359 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) {
2389 } else 2360 ZFCP_LOG_INFO("error: exchange port data timed out (adapter "
2390 sleep = ZFCP_EXCHANGE_PORT_DATA_LONG_SLEEP; 2361 "%s)\n", zfcp_get_busid_by_adapter(adapter));
2391 schedule_timeout(sleep); 2362 ret = ZFCP_ERP_FAILED;
2392 } while (1); 2363 }
2364 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status)) {
2365 ZFCP_LOG_INFO("error: exchange port data failed (adapter "
2366 "%s\n", zfcp_get_busid_by_adapter(adapter));
2367 ret = ZFCP_ERP_FAILED;
2368 }
2393 2369
2394 return ZFCP_ERP_SUCCEEDED; 2370 return ret;
2395} 2371}
2396 2372
2397/* 2373/*
@@ -3439,6 +3415,8 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
3439 "(adapter %s, wwpn=0x%016Lx)\n", 3415 "(adapter %s, wwpn=0x%016Lx)\n",
3440 zfcp_get_busid_by_port(port), 3416 zfcp_get_busid_by_port(port),
3441 port->wwpn); 3417 port->wwpn);
3418 else
3419 scsi_flush_work(adapter->scsi_host);
3442 } 3420 }
3443 zfcp_port_put(port); 3421 zfcp_port_put(port);
3444 break; 3422 break;
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index c1ba7cf1b496..700f5402a978 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -194,9 +194,10 @@ extern void zfcp_san_dbf_event_els_response(struct zfcp_fsf_req *);
194extern void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *); 194extern void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *);
195 195
196extern void zfcp_scsi_dbf_event_result(const char *, int, struct zfcp_adapter *, 196extern void zfcp_scsi_dbf_event_result(const char *, int, struct zfcp_adapter *,
197 struct scsi_cmnd *); 197 struct scsi_cmnd *,
198 struct zfcp_fsf_req *);
198extern void zfcp_scsi_dbf_event_abort(const char *, struct zfcp_adapter *, 199extern void zfcp_scsi_dbf_event_abort(const char *, struct zfcp_adapter *,
199 struct scsi_cmnd *, 200 struct scsi_cmnd *, struct zfcp_fsf_req *,
200 struct zfcp_fsf_req *); 201 struct zfcp_fsf_req *);
201extern void zfcp_scsi_dbf_event_devreset(const char *, u8, struct zfcp_unit *, 202extern void zfcp_scsi_dbf_event_devreset(const char *, u8, struct zfcp_unit *,
202 struct scsi_cmnd *); 203 struct scsi_cmnd *);
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 9f0cb3d820c0..662ec571d73b 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -388,6 +388,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
388 case FSF_PROT_LINK_DOWN: 388 case FSF_PROT_LINK_DOWN:
389 zfcp_fsf_link_down_info_eval(adapter, 389 zfcp_fsf_link_down_info_eval(adapter,
390 &prot_status_qual->link_down_info); 390 &prot_status_qual->link_down_info);
391 zfcp_erp_adapter_reopen(adapter, 0);
391 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 392 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
392 break; 393 break;
393 394
@@ -558,10 +559,8 @@ zfcp_fsf_link_down_info_eval(struct zfcp_adapter *adapter,
558 559
559 atomic_set_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, &adapter->status); 560 atomic_set_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, &adapter->status);
560 561
561 if (link_down == NULL) { 562 if (link_down == NULL)
562 zfcp_erp_adapter_reopen(adapter, 0); 563 goto out;
563 return;
564 }
565 564
566 switch (link_down->error_code) { 565 switch (link_down->error_code) {
567 case FSF_PSQ_LINK_NO_LIGHT: 566 case FSF_PSQ_LINK_NO_LIGHT:
@@ -643,16 +642,8 @@ zfcp_fsf_link_down_info_eval(struct zfcp_adapter *adapter,
643 link_down->explanation_code, 642 link_down->explanation_code,
644 link_down->vendor_specific_code); 643 link_down->vendor_specific_code);
645 644
646 switch (link_down->error_code) { 645 out:
647 case FSF_PSQ_LINK_NO_LIGHT: 646 zfcp_erp_adapter_failed(adapter);
648 case FSF_PSQ_LINK_WRAP_PLUG:
649 case FSF_PSQ_LINK_NO_FCP:
650 case FSF_PSQ_LINK_FIRMWARE_UPDATE:
651 zfcp_erp_adapter_reopen(adapter, 0);
652 break;
653 default:
654 zfcp_erp_adapter_failed(adapter);
655 }
656} 647}
657 648
658/* 649/*
@@ -2304,6 +2295,35 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action,
2304 return retval; 2295 return retval;
2305} 2296}
2306 2297
2298/**
2299 * zfcp_fsf_exchange_port_evaluate
2300 * @fsf_req: fsf_req which belongs to xchg port data request
2301 * @xchg_ok: specifies if xchg port data was incomplete or complete (0/1)
2302 */
2303static void
2304zfcp_fsf_exchange_port_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
2305{
2306 struct zfcp_adapter *adapter;
2307 struct fsf_qtcb *qtcb;
2308 struct fsf_qtcb_bottom_port *bottom, *data;
2309 struct Scsi_Host *shost;
2310
2311 adapter = fsf_req->adapter;
2312 qtcb = fsf_req->qtcb;
2313 bottom = &qtcb->bottom.port;
2314 shost = adapter->scsi_host;
2315
2316 data = (struct fsf_qtcb_bottom_port*) fsf_req->data;
2317 if (data)
2318 memcpy(data, bottom, sizeof(struct fsf_qtcb_bottom_port));
2319
2320 if (adapter->connection_features & FSF_FEATURE_NPIV_MODE)
2321 fc_host_permanent_port_name(shost) = bottom->wwpn;
2322 else
2323 fc_host_permanent_port_name(shost) = fc_host_port_name(shost);
2324 fc_host_maxframe_size(shost) = bottom->maximum_frame_size;
2325 fc_host_supported_speeds(shost) = bottom->supported_speed;
2326}
2307 2327
2308/** 2328/**
2309 * zfcp_fsf_exchange_port_data_handler - handler for exchange_port_data request 2329 * zfcp_fsf_exchange_port_data_handler - handler for exchange_port_data request
@@ -2312,38 +2332,26 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action,
2312static void 2332static void
2313zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *fsf_req) 2333zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *fsf_req)
2314{ 2334{
2315 struct zfcp_adapter *adapter = fsf_req->adapter; 2335 struct zfcp_adapter *adapter;
2316 struct Scsi_Host *shost = adapter->scsi_host; 2336 struct fsf_qtcb *qtcb;
2317 struct fsf_qtcb *qtcb = fsf_req->qtcb; 2337
2318 struct fsf_qtcb_bottom_port *bottom, *data; 2338 adapter = fsf_req->adapter;
2339 qtcb = fsf_req->qtcb;
2319 2340
2320 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) 2341 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)
2321 return; 2342 return;
2322 2343
2323 switch (qtcb->header.fsf_status) { 2344 switch (qtcb->header.fsf_status) {
2324 case FSF_GOOD: 2345 case FSF_GOOD:
2346 zfcp_fsf_exchange_port_evaluate(fsf_req, 1);
2325 atomic_set_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status); 2347 atomic_set_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status);
2326
2327 bottom = &qtcb->bottom.port;
2328 data = (struct fsf_qtcb_bottom_port*) fsf_req->data;
2329 if (data)
2330 memcpy(data, bottom, sizeof(struct fsf_qtcb_bottom_port));
2331 if (adapter->connection_features & FSF_FEATURE_NPIV_MODE)
2332 fc_host_permanent_port_name(shost) = bottom->wwpn;
2333 else
2334 fc_host_permanent_port_name(shost) =
2335 fc_host_port_name(shost);
2336 fc_host_maxframe_size(shost) = bottom->maximum_frame_size;
2337 fc_host_supported_speeds(shost) = bottom->supported_speed;
2338 break; 2348 break;
2339
2340 case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE: 2349 case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE:
2350 zfcp_fsf_exchange_port_evaluate(fsf_req, 0);
2341 atomic_set_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status); 2351 atomic_set_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status);
2342
2343 zfcp_fsf_link_down_info_eval(adapter, 2352 zfcp_fsf_link_down_info_eval(adapter,
2344 &qtcb->header.fsf_status_qual.link_down_info); 2353 &qtcb->header.fsf_status_qual.link_down_info);
2345 break; 2354 break;
2346
2347 default: 2355 default:
2348 debug_text_event(adapter->erp_dbf, 0, "xchg-port-ng"); 2356 debug_text_event(adapter->erp_dbf, 0, "xchg-port-ng");
2349 debug_event(adapter->erp_dbf, 0, 2357 debug_event(adapter->erp_dbf, 0,
@@ -4203,11 +4211,11 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
4203 ZFCP_LOG_DEBUG("scpnt->result =0x%x\n", scpnt->result); 4211 ZFCP_LOG_DEBUG("scpnt->result =0x%x\n", scpnt->result);
4204 4212
4205 if (scpnt->result != 0) 4213 if (scpnt->result != 0)
4206 zfcp_scsi_dbf_event_result("erro", 3, fsf_req->adapter, scpnt); 4214 zfcp_scsi_dbf_event_result("erro", 3, fsf_req->adapter, scpnt, fsf_req);
4207 else if (scpnt->retries > 0) 4215 else if (scpnt->retries > 0)
4208 zfcp_scsi_dbf_event_result("retr", 4, fsf_req->adapter, scpnt); 4216 zfcp_scsi_dbf_event_result("retr", 4, fsf_req->adapter, scpnt, fsf_req);
4209 else 4217 else
4210 zfcp_scsi_dbf_event_result("norm", 6, fsf_req->adapter, scpnt); 4218 zfcp_scsi_dbf_event_result("norm", 6, fsf_req->adapter, scpnt, fsf_req);
4211 4219
4212 /* cleanup pointer (need this especially for abort) */ 4220 /* cleanup pointer (need this especially for abort) */
4213 scpnt->host_scribble = NULL; 4221 scpnt->host_scribble = NULL;
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index e0803757c0fa..9f6b4d7a46f3 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -242,7 +242,7 @@ zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
242 if ((scpnt->device != NULL) && (scpnt->device->host != NULL)) 242 if ((scpnt->device != NULL) && (scpnt->device->host != NULL))
243 zfcp_scsi_dbf_event_result("fail", 4, 243 zfcp_scsi_dbf_event_result("fail", 4,
244 (struct zfcp_adapter*) scpnt->device->host->hostdata[0], 244 (struct zfcp_adapter*) scpnt->device->host->hostdata[0],
245 scpnt); 245 scpnt, NULL);
246 /* return directly */ 246 /* return directly */
247 scpnt->scsi_done(scpnt); 247 scpnt->scsi_done(scpnt);
248} 248}
@@ -446,7 +446,7 @@ zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
446 old_fsf_req = (struct zfcp_fsf_req *) scpnt->host_scribble; 446 old_fsf_req = (struct zfcp_fsf_req *) scpnt->host_scribble;
447 if (!old_fsf_req) { 447 if (!old_fsf_req) {
448 write_unlock_irqrestore(&adapter->abort_lock, flags); 448 write_unlock_irqrestore(&adapter->abort_lock, flags);
449 zfcp_scsi_dbf_event_abort("lte1", adapter, scpnt, new_fsf_req); 449 zfcp_scsi_dbf_event_abort("lte1", adapter, scpnt, NULL, NULL);
450 retval = SUCCESS; 450 retval = SUCCESS;
451 goto out; 451 goto out;
452 } 452 }
@@ -460,6 +460,8 @@ zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
460 adapter, unit, 0); 460 adapter, unit, 0);
461 if (!new_fsf_req) { 461 if (!new_fsf_req) {
462 ZFCP_LOG_INFO("error: initiation of Abort FCP Cmnd failed\n"); 462 ZFCP_LOG_INFO("error: initiation of Abort FCP Cmnd failed\n");
463 zfcp_scsi_dbf_event_abort("nres", adapter, scpnt, NULL,
464 old_fsf_req);
463 retval = FAILED; 465 retval = FAILED;
464 goto out; 466 goto out;
465 } 467 }
@@ -470,13 +472,16 @@ zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
470 472
471 /* status should be valid since signals were not permitted */ 473 /* status should be valid since signals were not permitted */
472 if (new_fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED) { 474 if (new_fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED) {
473 zfcp_scsi_dbf_event_abort("okay", adapter, scpnt, new_fsf_req); 475 zfcp_scsi_dbf_event_abort("okay", adapter, scpnt, new_fsf_req,
476 NULL);
474 retval = SUCCESS; 477 retval = SUCCESS;
475 } else if (new_fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED) { 478 } else if (new_fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED) {
476 zfcp_scsi_dbf_event_abort("lte2", adapter, scpnt, new_fsf_req); 479 zfcp_scsi_dbf_event_abort("lte2", adapter, scpnt, new_fsf_req,
480 NULL);
477 retval = SUCCESS; 481 retval = SUCCESS;
478 } else { 482 } else {
479 zfcp_scsi_dbf_event_abort("fail", adapter, scpnt, new_fsf_req); 483 zfcp_scsi_dbf_event_abort("fail", adapter, scpnt, new_fsf_req,
484 NULL);
480 retval = FAILED; 485 retval = FAILED;
481 } 486 }
482 zfcp_fsf_req_free(new_fsf_req); 487 zfcp_fsf_req_free(new_fsf_req);
diff --git a/drivers/s390/scsi/zfcp_sysfs_adapter.c b/drivers/s390/scsi/zfcp_sysfs_adapter.c
index dfc07370f412..b29ac25e07f3 100644
--- a/drivers/s390/scsi/zfcp_sysfs_adapter.c
+++ b/drivers/s390/scsi/zfcp_sysfs_adapter.c
@@ -55,8 +55,6 @@ ZFCP_DEFINE_ADAPTER_ATTR(status, "0x%08x\n", atomic_read(&adapter->status));
55ZFCP_DEFINE_ADAPTER_ATTR(peer_wwnn, "0x%016llx\n", adapter->peer_wwnn); 55ZFCP_DEFINE_ADAPTER_ATTR(peer_wwnn, "0x%016llx\n", adapter->peer_wwnn);
56ZFCP_DEFINE_ADAPTER_ATTR(peer_wwpn, "0x%016llx\n", adapter->peer_wwpn); 56ZFCP_DEFINE_ADAPTER_ATTR(peer_wwpn, "0x%016llx\n", adapter->peer_wwpn);
57ZFCP_DEFINE_ADAPTER_ATTR(peer_d_id, "0x%06x\n", adapter->peer_d_id); 57ZFCP_DEFINE_ADAPTER_ATTR(peer_d_id, "0x%06x\n", adapter->peer_d_id);
58ZFCP_DEFINE_ADAPTER_ATTR(physical_wwpn, "0x%016llx\n", adapter->physical_wwpn);
59ZFCP_DEFINE_ADAPTER_ATTR(physical_s_id, "0x%06x\n", adapter->physical_s_id);
60ZFCP_DEFINE_ADAPTER_ATTR(card_version, "0x%04x\n", adapter->hydra_version); 58ZFCP_DEFINE_ADAPTER_ATTR(card_version, "0x%04x\n", adapter->hydra_version);
61ZFCP_DEFINE_ADAPTER_ATTR(lic_version, "0x%08x\n", adapter->fsf_lic_version); 59ZFCP_DEFINE_ADAPTER_ATTR(lic_version, "0x%08x\n", adapter->fsf_lic_version);
62ZFCP_DEFINE_ADAPTER_ATTR(hardware_version, "0x%08x\n", 60ZFCP_DEFINE_ADAPTER_ATTR(hardware_version, "0x%08x\n",
@@ -241,8 +239,6 @@ static struct attribute *zfcp_adapter_attrs[] = {
241 &dev_attr_peer_wwnn.attr, 239 &dev_attr_peer_wwnn.attr,
242 &dev_attr_peer_wwpn.attr, 240 &dev_attr_peer_wwpn.attr,
243 &dev_attr_peer_d_id.attr, 241 &dev_attr_peer_d_id.attr,
244 &dev_attr_physical_wwpn.attr,
245 &dev_attr_physical_s_id.attr,
246 &dev_attr_card_version.attr, 242 &dev_attr_card_version.attr,
247 &dev_attr_lic_version.attr, 243 &dev_attr_lic_version.attr,
248 &dev_attr_status.attr, 244 &dev_attr_status.attr,
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 31c497542272..d9152d02088c 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -61,6 +61,7 @@
61 Add support for embedded firmware error strings. 61 Add support for embedded firmware error strings.
62 2.26.02.003 - Correctly handle single sgl's with use_sg=1. 62 2.26.02.003 - Correctly handle single sgl's with use_sg=1.
63 2.26.02.004 - Add support for 9550SX controllers. 63 2.26.02.004 - Add support for 9550SX controllers.
64 2.26.02.005 - Fix use_sg == 0 mapping on systems with 4GB or higher.
64*/ 65*/
65 66
66#include <linux/module.h> 67#include <linux/module.h>
@@ -84,7 +85,7 @@
84#include "3w-9xxx.h" 85#include "3w-9xxx.h"
85 86
86/* Globals */ 87/* Globals */
87#define TW_DRIVER_VERSION "2.26.02.004" 88#define TW_DRIVER_VERSION "2.26.02.005"
88static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT]; 89static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT];
89static unsigned int twa_device_extension_count; 90static unsigned int twa_device_extension_count;
90static int twa_major = -1; 91static int twa_major = -1;
@@ -1408,7 +1409,7 @@ static dma_addr_t twa_map_scsi_single_data(TW_Device_Extension *tw_dev, int requ
1408 dma_addr_t mapping; 1409 dma_addr_t mapping;
1409 struct scsi_cmnd *cmd = tw_dev->srb[request_id]; 1410 struct scsi_cmnd *cmd = tw_dev->srb[request_id];
1410 struct pci_dev *pdev = tw_dev->tw_pci_dev; 1411 struct pci_dev *pdev = tw_dev->tw_pci_dev;
1411 int retval = 0; 1412 dma_addr_t retval = 0;
1412 1413
1413 if (cmd->request_bufflen == 0) { 1414 if (cmd->request_bufflen == 0) {
1414 retval = 0; 1415 retval = 0;
@@ -1798,7 +1799,7 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
1798 int i, sg_count; 1799 int i, sg_count;
1799 struct scsi_cmnd *srb = NULL; 1800 struct scsi_cmnd *srb = NULL;
1800 struct scatterlist *sglist = NULL; 1801 struct scatterlist *sglist = NULL;
1801 u32 buffaddr = 0x0; 1802 dma_addr_t buffaddr = 0x0;
1802 int retval = 1; 1803 int retval = 1;
1803 1804
1804 if (tw_dev->srb[request_id]) { 1805 if (tw_dev->srb[request_id]) {
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 7139659dd952..a16f8ded8f1d 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -173,10 +173,10 @@ int aac_get_config_status(struct aac_dev *dev)
173 int status = 0; 173 int status = 0;
174 struct fib * fibptr; 174 struct fib * fibptr;
175 175
176 if (!(fibptr = fib_alloc(dev))) 176 if (!(fibptr = aac_fib_alloc(dev)))
177 return -ENOMEM; 177 return -ENOMEM;
178 178
179 fib_init(fibptr); 179 aac_fib_init(fibptr);
180 { 180 {
181 struct aac_get_config_status *dinfo; 181 struct aac_get_config_status *dinfo;
182 dinfo = (struct aac_get_config_status *) fib_data(fibptr); 182 dinfo = (struct aac_get_config_status *) fib_data(fibptr);
@@ -186,7 +186,7 @@ int aac_get_config_status(struct aac_dev *dev)
186 dinfo->count = cpu_to_le32(sizeof(((struct aac_get_config_status_resp *)NULL)->data)); 186 dinfo->count = cpu_to_le32(sizeof(((struct aac_get_config_status_resp *)NULL)->data));
187 } 187 }
188 188
189 status = fib_send(ContainerCommand, 189 status = aac_fib_send(ContainerCommand,
190 fibptr, 190 fibptr,
191 sizeof (struct aac_get_config_status), 191 sizeof (struct aac_get_config_status),
192 FsaNormal, 192 FsaNormal,
@@ -209,30 +209,30 @@ int aac_get_config_status(struct aac_dev *dev)
209 status = -EINVAL; 209 status = -EINVAL;
210 } 210 }
211 } 211 }
212 fib_complete(fibptr); 212 aac_fib_complete(fibptr);
213 /* Send a CT_COMMIT_CONFIG to enable discovery of devices */ 213 /* Send a CT_COMMIT_CONFIG to enable discovery of devices */
214 if (status >= 0) { 214 if (status >= 0) {
215 if (commit == 1) { 215 if (commit == 1) {
216 struct aac_commit_config * dinfo; 216 struct aac_commit_config * dinfo;
217 fib_init(fibptr); 217 aac_fib_init(fibptr);
218 dinfo = (struct aac_commit_config *) fib_data(fibptr); 218 dinfo = (struct aac_commit_config *) fib_data(fibptr);
219 219
220 dinfo->command = cpu_to_le32(VM_ContainerConfig); 220 dinfo->command = cpu_to_le32(VM_ContainerConfig);
221 dinfo->type = cpu_to_le32(CT_COMMIT_CONFIG); 221 dinfo->type = cpu_to_le32(CT_COMMIT_CONFIG);
222 222
223 status = fib_send(ContainerCommand, 223 status = aac_fib_send(ContainerCommand,
224 fibptr, 224 fibptr,
225 sizeof (struct aac_commit_config), 225 sizeof (struct aac_commit_config),
226 FsaNormal, 226 FsaNormal,
227 1, 1, 227 1, 1,
228 NULL, NULL); 228 NULL, NULL);
229 fib_complete(fibptr); 229 aac_fib_complete(fibptr);
230 } else if (commit == 0) { 230 } else if (commit == 0) {
231 printk(KERN_WARNING 231 printk(KERN_WARNING
232 "aac_get_config_status: Foreign device configurations are being ignored\n"); 232 "aac_get_config_status: Foreign device configurations are being ignored\n");
233 } 233 }
234 } 234 }
235 fib_free(fibptr); 235 aac_fib_free(fibptr);
236 return status; 236 return status;
237} 237}
238 238
@@ -255,15 +255,15 @@ int aac_get_containers(struct aac_dev *dev)
255 255
256 instance = dev->scsi_host_ptr->unique_id; 256 instance = dev->scsi_host_ptr->unique_id;
257 257
258 if (!(fibptr = fib_alloc(dev))) 258 if (!(fibptr = aac_fib_alloc(dev)))
259 return -ENOMEM; 259 return -ENOMEM;
260 260
261 fib_init(fibptr); 261 aac_fib_init(fibptr);
262 dinfo = (struct aac_get_container_count *) fib_data(fibptr); 262 dinfo = (struct aac_get_container_count *) fib_data(fibptr);
263 dinfo->command = cpu_to_le32(VM_ContainerConfig); 263 dinfo->command = cpu_to_le32(VM_ContainerConfig);
264 dinfo->type = cpu_to_le32(CT_GET_CONTAINER_COUNT); 264 dinfo->type = cpu_to_le32(CT_GET_CONTAINER_COUNT);
265 265
266 status = fib_send(ContainerCommand, 266 status = aac_fib_send(ContainerCommand,
267 fibptr, 267 fibptr,
268 sizeof (struct aac_get_container_count), 268 sizeof (struct aac_get_container_count),
269 FsaNormal, 269 FsaNormal,
@@ -272,7 +272,7 @@ int aac_get_containers(struct aac_dev *dev)
272 if (status >= 0) { 272 if (status >= 0) {
273 dresp = (struct aac_get_container_count_resp *)fib_data(fibptr); 273 dresp = (struct aac_get_container_count_resp *)fib_data(fibptr);
274 maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries); 274 maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries);
275 fib_complete(fibptr); 275 aac_fib_complete(fibptr);
276 } 276 }
277 277
278 if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS) 278 if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS)
@@ -280,7 +280,7 @@ int aac_get_containers(struct aac_dev *dev)
280 fsa_dev_ptr = (struct fsa_dev_info *) kmalloc( 280 fsa_dev_ptr = (struct fsa_dev_info *) kmalloc(
281 sizeof(*fsa_dev_ptr) * maximum_num_containers, GFP_KERNEL); 281 sizeof(*fsa_dev_ptr) * maximum_num_containers, GFP_KERNEL);
282 if (!fsa_dev_ptr) { 282 if (!fsa_dev_ptr) {
283 fib_free(fibptr); 283 aac_fib_free(fibptr);
284 return -ENOMEM; 284 return -ENOMEM;
285 } 285 }
286 memset(fsa_dev_ptr, 0, sizeof(*fsa_dev_ptr) * maximum_num_containers); 286 memset(fsa_dev_ptr, 0, sizeof(*fsa_dev_ptr) * maximum_num_containers);
@@ -294,14 +294,14 @@ int aac_get_containers(struct aac_dev *dev)
294 294
295 fsa_dev_ptr[index].devname[0] = '\0'; 295 fsa_dev_ptr[index].devname[0] = '\0';
296 296
297 fib_init(fibptr); 297 aac_fib_init(fibptr);
298 dinfo = (struct aac_query_mount *) fib_data(fibptr); 298 dinfo = (struct aac_query_mount *) fib_data(fibptr);
299 299
300 dinfo->command = cpu_to_le32(VM_NameServe); 300 dinfo->command = cpu_to_le32(VM_NameServe);
301 dinfo->count = cpu_to_le32(index); 301 dinfo->count = cpu_to_le32(index);
302 dinfo->type = cpu_to_le32(FT_FILESYS); 302 dinfo->type = cpu_to_le32(FT_FILESYS);
303 303
304 status = fib_send(ContainerCommand, 304 status = aac_fib_send(ContainerCommand,
305 fibptr, 305 fibptr,
306 sizeof (struct aac_query_mount), 306 sizeof (struct aac_query_mount),
307 FsaNormal, 307 FsaNormal,
@@ -319,7 +319,7 @@ int aac_get_containers(struct aac_dev *dev)
319 dinfo->count = cpu_to_le32(index); 319 dinfo->count = cpu_to_le32(index);
320 dinfo->type = cpu_to_le32(FT_FILESYS); 320 dinfo->type = cpu_to_le32(FT_FILESYS);
321 321
322 if (fib_send(ContainerCommand, 322 if (aac_fib_send(ContainerCommand,
323 fibptr, 323 fibptr,
324 sizeof(struct aac_query_mount), 324 sizeof(struct aac_query_mount),
325 FsaNormal, 325 FsaNormal,
@@ -347,7 +347,7 @@ int aac_get_containers(struct aac_dev *dev)
347 if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY) 347 if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY)
348 fsa_dev_ptr[index].ro = 1; 348 fsa_dev_ptr[index].ro = 1;
349 } 349 }
350 fib_complete(fibptr); 350 aac_fib_complete(fibptr);
351 /* 351 /*
352 * If there are no more containers, then stop asking. 352 * If there are no more containers, then stop asking.
353 */ 353 */
@@ -355,7 +355,7 @@ int aac_get_containers(struct aac_dev *dev)
355 break; 355 break;
356 } 356 }
357 } 357 }
358 fib_free(fibptr); 358 aac_fib_free(fibptr);
359 return status; 359 return status;
360} 360}
361 361
@@ -413,8 +413,8 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
413 413
414 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; 414 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
415 415
416 fib_complete(fibptr); 416 aac_fib_complete(fibptr);
417 fib_free(fibptr); 417 aac_fib_free(fibptr);
418 scsicmd->scsi_done(scsicmd); 418 scsicmd->scsi_done(scsicmd);
419} 419}
420 420
@@ -430,10 +430,10 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid)
430 430
431 dev = (struct aac_dev *)scsicmd->device->host->hostdata; 431 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
432 432
433 if (!(cmd_fibcontext = fib_alloc(dev))) 433 if (!(cmd_fibcontext = aac_fib_alloc(dev)))
434 return -ENOMEM; 434 return -ENOMEM;
435 435
436 fib_init(cmd_fibcontext); 436 aac_fib_init(cmd_fibcontext);
437 dinfo = (struct aac_get_name *) fib_data(cmd_fibcontext); 437 dinfo = (struct aac_get_name *) fib_data(cmd_fibcontext);
438 438
439 dinfo->command = cpu_to_le32(VM_ContainerConfig); 439 dinfo->command = cpu_to_le32(VM_ContainerConfig);
@@ -441,7 +441,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid)
441 dinfo->cid = cpu_to_le32(cid); 441 dinfo->cid = cpu_to_le32(cid);
442 dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data)); 442 dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data));
443 443
444 status = fib_send(ContainerCommand, 444 status = aac_fib_send(ContainerCommand,
445 cmd_fibcontext, 445 cmd_fibcontext,
446 sizeof (struct aac_get_name), 446 sizeof (struct aac_get_name),
447 FsaNormal, 447 FsaNormal,
@@ -455,14 +455,14 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid)
455 if (status == -EINPROGRESS) 455 if (status == -EINPROGRESS)
456 return 0; 456 return 0;
457 457
458 printk(KERN_WARNING "aac_get_container_name: fib_send failed with status: %d.\n", status); 458 printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status);
459 fib_complete(cmd_fibcontext); 459 aac_fib_complete(cmd_fibcontext);
460 fib_free(cmd_fibcontext); 460 aac_fib_free(cmd_fibcontext);
461 return -1; 461 return -1;
462} 462}
463 463
464/** 464/**
465 * probe_container - query a logical volume 465 * aac_probe_container - query a logical volume
466 * @dev: device to query 466 * @dev: device to query
467 * @cid: container identifier 467 * @cid: container identifier
468 * 468 *
@@ -470,7 +470,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid)
470 * is updated in the struct fsa_dev_info structure rather than returned. 470 * is updated in the struct fsa_dev_info structure rather than returned.
471 */ 471 */
472 472
473int probe_container(struct aac_dev *dev, int cid) 473int aac_probe_container(struct aac_dev *dev, int cid)
474{ 474{
475 struct fsa_dev_info *fsa_dev_ptr; 475 struct fsa_dev_info *fsa_dev_ptr;
476 int status; 476 int status;
@@ -482,10 +482,10 @@ int probe_container(struct aac_dev *dev, int cid)
482 fsa_dev_ptr = dev->fsa_dev; 482 fsa_dev_ptr = dev->fsa_dev;
483 instance = dev->scsi_host_ptr->unique_id; 483 instance = dev->scsi_host_ptr->unique_id;
484 484
485 if (!(fibptr = fib_alloc(dev))) 485 if (!(fibptr = aac_fib_alloc(dev)))
486 return -ENOMEM; 486 return -ENOMEM;
487 487
488 fib_init(fibptr); 488 aac_fib_init(fibptr);
489 489
490 dinfo = (struct aac_query_mount *)fib_data(fibptr); 490 dinfo = (struct aac_query_mount *)fib_data(fibptr);
491 491
@@ -493,14 +493,14 @@ int probe_container(struct aac_dev *dev, int cid)
493 dinfo->count = cpu_to_le32(cid); 493 dinfo->count = cpu_to_le32(cid);
494 dinfo->type = cpu_to_le32(FT_FILESYS); 494 dinfo->type = cpu_to_le32(FT_FILESYS);
495 495
496 status = fib_send(ContainerCommand, 496 status = aac_fib_send(ContainerCommand,
497 fibptr, 497 fibptr,
498 sizeof(struct aac_query_mount), 498 sizeof(struct aac_query_mount),
499 FsaNormal, 499 FsaNormal,
500 1, 1, 500 1, 1,
501 NULL, NULL); 501 NULL, NULL);
502 if (status < 0) { 502 if (status < 0) {
503 printk(KERN_WARNING "aacraid: probe_container query failed.\n"); 503 printk(KERN_WARNING "aacraid: aac_probe_container query failed.\n");
504 goto error; 504 goto error;
505 } 505 }
506 506
@@ -512,7 +512,7 @@ int probe_container(struct aac_dev *dev, int cid)
512 dinfo->count = cpu_to_le32(cid); 512 dinfo->count = cpu_to_le32(cid);
513 dinfo->type = cpu_to_le32(FT_FILESYS); 513 dinfo->type = cpu_to_le32(FT_FILESYS);
514 514
515 if (fib_send(ContainerCommand, 515 if (aac_fib_send(ContainerCommand,
516 fibptr, 516 fibptr,
517 sizeof(struct aac_query_mount), 517 sizeof(struct aac_query_mount),
518 FsaNormal, 518 FsaNormal,
@@ -535,8 +535,8 @@ int probe_container(struct aac_dev *dev, int cid)
535 } 535 }
536 536
537error: 537error:
538 fib_complete(fibptr); 538 aac_fib_complete(fibptr);
539 fib_free(fibptr); 539 aac_fib_free(fibptr);
540 540
541 return status; 541 return status;
542} 542}
@@ -700,14 +700,14 @@ int aac_get_adapter_info(struct aac_dev* dev)
700 struct aac_bus_info *command; 700 struct aac_bus_info *command;
701 struct aac_bus_info_response *bus_info; 701 struct aac_bus_info_response *bus_info;
702 702
703 if (!(fibptr = fib_alloc(dev))) 703 if (!(fibptr = aac_fib_alloc(dev)))
704 return -ENOMEM; 704 return -ENOMEM;
705 705
706 fib_init(fibptr); 706 aac_fib_init(fibptr);
707 info = (struct aac_adapter_info *) fib_data(fibptr); 707 info = (struct aac_adapter_info *) fib_data(fibptr);
708 memset(info,0,sizeof(*info)); 708 memset(info,0,sizeof(*info));
709 709
710 rcode = fib_send(RequestAdapterInfo, 710 rcode = aac_fib_send(RequestAdapterInfo,
711 fibptr, 711 fibptr,
712 sizeof(*info), 712 sizeof(*info),
713 FsaNormal, 713 FsaNormal,
@@ -716,8 +716,8 @@ int aac_get_adapter_info(struct aac_dev* dev)
716 NULL); 716 NULL);
717 717
718 if (rcode < 0) { 718 if (rcode < 0) {
719 fib_complete(fibptr); 719 aac_fib_complete(fibptr);
720 fib_free(fibptr); 720 aac_fib_free(fibptr);
721 return rcode; 721 return rcode;
722 } 722 }
723 memcpy(&dev->adapter_info, info, sizeof(*info)); 723 memcpy(&dev->adapter_info, info, sizeof(*info));
@@ -725,13 +725,13 @@ int aac_get_adapter_info(struct aac_dev* dev)
725 if (dev->adapter_info.options & AAC_OPT_SUPPLEMENT_ADAPTER_INFO) { 725 if (dev->adapter_info.options & AAC_OPT_SUPPLEMENT_ADAPTER_INFO) {
726 struct aac_supplement_adapter_info * info; 726 struct aac_supplement_adapter_info * info;
727 727
728 fib_init(fibptr); 728 aac_fib_init(fibptr);
729 729
730 info = (struct aac_supplement_adapter_info *) fib_data(fibptr); 730 info = (struct aac_supplement_adapter_info *) fib_data(fibptr);
731 731
732 memset(info,0,sizeof(*info)); 732 memset(info,0,sizeof(*info));
733 733
734 rcode = fib_send(RequestSupplementAdapterInfo, 734 rcode = aac_fib_send(RequestSupplementAdapterInfo,
735 fibptr, 735 fibptr,
736 sizeof(*info), 736 sizeof(*info),
737 FsaNormal, 737 FsaNormal,
@@ -748,7 +748,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
748 * GetBusInfo 748 * GetBusInfo
749 */ 749 */
750 750
751 fib_init(fibptr); 751 aac_fib_init(fibptr);
752 752
753 bus_info = (struct aac_bus_info_response *) fib_data(fibptr); 753 bus_info = (struct aac_bus_info_response *) fib_data(fibptr);
754 754
@@ -761,7 +761,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
761 command->MethodId = cpu_to_le32(1); 761 command->MethodId = cpu_to_le32(1);
762 command->CtlCmd = cpu_to_le32(GetBusInfo); 762 command->CtlCmd = cpu_to_le32(GetBusInfo);
763 763
764 rcode = fib_send(ContainerCommand, 764 rcode = aac_fib_send(ContainerCommand,
765 fibptr, 765 fibptr,
766 sizeof (*bus_info), 766 sizeof (*bus_info),
767 FsaNormal, 767 FsaNormal,
@@ -891,8 +891,8 @@ int aac_get_adapter_info(struct aac_dev* dev)
891 } 891 }
892 } 892 }
893 893
894 fib_complete(fibptr); 894 aac_fib_complete(fibptr);
895 fib_free(fibptr); 895 aac_fib_free(fibptr);
896 896
897 return rcode; 897 return rcode;
898} 898}
@@ -976,8 +976,8 @@ static void io_callback(void *context, struct fib * fibptr)
976 ? sizeof(scsicmd->sense_buffer) 976 ? sizeof(scsicmd->sense_buffer)
977 : sizeof(dev->fsa_dev[cid].sense_data)); 977 : sizeof(dev->fsa_dev[cid].sense_data));
978 } 978 }
979 fib_complete(fibptr); 979 aac_fib_complete(fibptr);
980 fib_free(fibptr); 980 aac_fib_free(fibptr);
981 981
982 scsicmd->scsi_done(scsicmd); 982 scsicmd->scsi_done(scsicmd);
983} 983}
@@ -1062,11 +1062,11 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1062 /* 1062 /*
1063 * Alocate and initialize a Fib 1063 * Alocate and initialize a Fib
1064 */ 1064 */
1065 if (!(cmd_fibcontext = fib_alloc(dev))) { 1065 if (!(cmd_fibcontext = aac_fib_alloc(dev))) {
1066 return -1; 1066 return -1;
1067 } 1067 }
1068 1068
1069 fib_init(cmd_fibcontext); 1069 aac_fib_init(cmd_fibcontext);
1070 1070
1071 if (dev->raw_io_interface) { 1071 if (dev->raw_io_interface) {
1072 struct aac_raw_io *readcmd; 1072 struct aac_raw_io *readcmd;
@@ -1086,7 +1086,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1086 /* 1086 /*
1087 * Now send the Fib to the adapter 1087 * Now send the Fib to the adapter
1088 */ 1088 */
1089 status = fib_send(ContainerRawIo, 1089 status = aac_fib_send(ContainerRawIo,
1090 cmd_fibcontext, 1090 cmd_fibcontext,
1091 fibsize, 1091 fibsize,
1092 FsaNormal, 1092 FsaNormal,
@@ -1112,7 +1112,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1112 /* 1112 /*
1113 * Now send the Fib to the adapter 1113 * Now send the Fib to the adapter
1114 */ 1114 */
1115 status = fib_send(ContainerCommand64, 1115 status = aac_fib_send(ContainerCommand64,
1116 cmd_fibcontext, 1116 cmd_fibcontext,
1117 fibsize, 1117 fibsize,
1118 FsaNormal, 1118 FsaNormal,
@@ -1136,7 +1136,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1136 /* 1136 /*
1137 * Now send the Fib to the adapter 1137 * Now send the Fib to the adapter
1138 */ 1138 */
1139 status = fib_send(ContainerCommand, 1139 status = aac_fib_send(ContainerCommand,
1140 cmd_fibcontext, 1140 cmd_fibcontext,
1141 fibsize, 1141 fibsize,
1142 FsaNormal, 1142 FsaNormal,
@@ -1153,14 +1153,14 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1153 if (status == -EINPROGRESS) 1153 if (status == -EINPROGRESS)
1154 return 0; 1154 return 0;
1155 1155
1156 printk(KERN_WARNING "aac_read: fib_send failed with status: %d.\n", status); 1156 printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status);
1157 /* 1157 /*
1158 * For some reason, the Fib didn't queue, return QUEUE_FULL 1158 * For some reason, the Fib didn't queue, return QUEUE_FULL
1159 */ 1159 */
1160 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; 1160 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL;
1161 scsicmd->scsi_done(scsicmd); 1161 scsicmd->scsi_done(scsicmd);
1162 fib_complete(cmd_fibcontext); 1162 aac_fib_complete(cmd_fibcontext);
1163 fib_free(cmd_fibcontext); 1163 aac_fib_free(cmd_fibcontext);
1164 return 0; 1164 return 0;
1165} 1165}
1166 1166
@@ -1228,12 +1228,12 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1228 /* 1228 /*
1229 * Allocate and initialize a Fib then setup a BlockWrite command 1229 * Allocate and initialize a Fib then setup a BlockWrite command
1230 */ 1230 */
1231 if (!(cmd_fibcontext = fib_alloc(dev))) { 1231 if (!(cmd_fibcontext = aac_fib_alloc(dev))) {
1232 scsicmd->result = DID_ERROR << 16; 1232 scsicmd->result = DID_ERROR << 16;
1233 scsicmd->scsi_done(scsicmd); 1233 scsicmd->scsi_done(scsicmd);
1234 return 0; 1234 return 0;
1235 } 1235 }
1236 fib_init(cmd_fibcontext); 1236 aac_fib_init(cmd_fibcontext);
1237 1237
1238 if (dev->raw_io_interface) { 1238 if (dev->raw_io_interface) {
1239 struct aac_raw_io *writecmd; 1239 struct aac_raw_io *writecmd;
@@ -1253,7 +1253,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1253 /* 1253 /*
1254 * Now send the Fib to the adapter 1254 * Now send the Fib to the adapter
1255 */ 1255 */
1256 status = fib_send(ContainerRawIo, 1256 status = aac_fib_send(ContainerRawIo,
1257 cmd_fibcontext, 1257 cmd_fibcontext,
1258 fibsize, 1258 fibsize,
1259 FsaNormal, 1259 FsaNormal,
@@ -1279,7 +1279,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1279 /* 1279 /*
1280 * Now send the Fib to the adapter 1280 * Now send the Fib to the adapter
1281 */ 1281 */
1282 status = fib_send(ContainerCommand64, 1282 status = aac_fib_send(ContainerCommand64,
1283 cmd_fibcontext, 1283 cmd_fibcontext,
1284 fibsize, 1284 fibsize,
1285 FsaNormal, 1285 FsaNormal,
@@ -1305,7 +1305,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1305 /* 1305 /*
1306 * Now send the Fib to the adapter 1306 * Now send the Fib to the adapter
1307 */ 1307 */
1308 status = fib_send(ContainerCommand, 1308 status = aac_fib_send(ContainerCommand,
1309 cmd_fibcontext, 1309 cmd_fibcontext,
1310 fibsize, 1310 fibsize,
1311 FsaNormal, 1311 FsaNormal,
@@ -1322,15 +1322,15 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1322 return 0; 1322 return 0;
1323 } 1323 }
1324 1324
1325 printk(KERN_WARNING "aac_write: fib_send failed with status: %d\n", status); 1325 printk(KERN_WARNING "aac_write: aac_fib_send failed with status: %d\n", status);
1326 /* 1326 /*
1327 * For some reason, the Fib didn't queue, return QUEUE_FULL 1327 * For some reason, the Fib didn't queue, return QUEUE_FULL
1328 */ 1328 */
1329 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; 1329 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL;
1330 scsicmd->scsi_done(scsicmd); 1330 scsicmd->scsi_done(scsicmd);
1331 1331
1332 fib_complete(cmd_fibcontext); 1332 aac_fib_complete(cmd_fibcontext);
1333 fib_free(cmd_fibcontext); 1333 aac_fib_free(cmd_fibcontext);
1334 return 0; 1334 return 0;
1335} 1335}
1336 1336
@@ -1369,8 +1369,8 @@ static void synchronize_callback(void *context, struct fib *fibptr)
1369 sizeof(cmd->sense_buffer))); 1369 sizeof(cmd->sense_buffer)));
1370 } 1370 }
1371 1371
1372 fib_complete(fibptr); 1372 aac_fib_complete(fibptr);
1373 fib_free(fibptr); 1373 aac_fib_free(fibptr);
1374 cmd->scsi_done(cmd); 1374 cmd->scsi_done(cmd);
1375} 1375}
1376 1376
@@ -1407,10 +1407,10 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid)
1407 * Allocate and initialize a Fib 1407 * Allocate and initialize a Fib
1408 */ 1408 */
1409 if (!(cmd_fibcontext = 1409 if (!(cmd_fibcontext =
1410 fib_alloc((struct aac_dev *)scsicmd->device->host->hostdata))) 1410 aac_fib_alloc((struct aac_dev *)scsicmd->device->host->hostdata)))
1411 return SCSI_MLQUEUE_HOST_BUSY; 1411 return SCSI_MLQUEUE_HOST_BUSY;
1412 1412
1413 fib_init(cmd_fibcontext); 1413 aac_fib_init(cmd_fibcontext);
1414 1414
1415 synchronizecmd = fib_data(cmd_fibcontext); 1415 synchronizecmd = fib_data(cmd_fibcontext);
1416 synchronizecmd->command = cpu_to_le32(VM_ContainerConfig); 1416 synchronizecmd->command = cpu_to_le32(VM_ContainerConfig);
@@ -1422,7 +1422,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid)
1422 /* 1422 /*
1423 * Now send the Fib to the adapter 1423 * Now send the Fib to the adapter
1424 */ 1424 */
1425 status = fib_send(ContainerCommand, 1425 status = aac_fib_send(ContainerCommand,
1426 cmd_fibcontext, 1426 cmd_fibcontext,
1427 sizeof(struct aac_synchronize), 1427 sizeof(struct aac_synchronize),
1428 FsaNormal, 1428 FsaNormal,
@@ -1437,9 +1437,9 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid)
1437 return 0; 1437 return 0;
1438 1438
1439 printk(KERN_WARNING 1439 printk(KERN_WARNING
1440 "aac_synchronize: fib_send failed with status: %d.\n", status); 1440 "aac_synchronize: aac_fib_send failed with status: %d.\n", status);
1441 fib_complete(cmd_fibcontext); 1441 aac_fib_complete(cmd_fibcontext);
1442 fib_free(cmd_fibcontext); 1442 aac_fib_free(cmd_fibcontext);
1443 return SCSI_MLQUEUE_HOST_BUSY; 1443 return SCSI_MLQUEUE_HOST_BUSY;
1444} 1444}
1445 1445
@@ -1465,7 +1465,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1465 * itself. 1465 * itself.
1466 */ 1466 */
1467 if (scmd_id(scsicmd) != host->this_id) { 1467 if (scmd_id(scsicmd) != host->this_id) {
1468 if ((scsicmd->device->channel == 0) ){ 1468 if ((scsicmd->device->channel == CONTAINER_CHANNEL)) {
1469 if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){ 1469 if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){
1470 scsicmd->result = DID_NO_CONNECT << 16; 1470 scsicmd->result = DID_NO_CONNECT << 16;
1471 scsicmd->scsi_done(scsicmd); 1471 scsicmd->scsi_done(scsicmd);
@@ -1488,7 +1488,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1488 case READ_CAPACITY: 1488 case READ_CAPACITY:
1489 case TEST_UNIT_READY: 1489 case TEST_UNIT_READY:
1490 spin_unlock_irq(host->host_lock); 1490 spin_unlock_irq(host->host_lock);
1491 probe_container(dev, cid); 1491 aac_probe_container(dev, cid);
1492 if ((fsa_dev_ptr[cid].valid & 1) == 0) 1492 if ((fsa_dev_ptr[cid].valid & 1) == 0)
1493 fsa_dev_ptr[cid].valid = 0; 1493 fsa_dev_ptr[cid].valid = 0;
1494 spin_lock_irq(host->host_lock); 1494 spin_lock_irq(host->host_lock);
@@ -1935,33 +1935,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
1935 case SRB_STATUS_ERROR_RECOVERY: 1935 case SRB_STATUS_ERROR_RECOVERY:
1936 case SRB_STATUS_PENDING: 1936 case SRB_STATUS_PENDING:
1937 case SRB_STATUS_SUCCESS: 1937 case SRB_STATUS_SUCCESS:
1938 if(scsicmd->cmnd[0] == INQUIRY ){ 1938 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
1939 u8 b;
1940 u8 b1;
1941 /* We can't expose disk devices because we can't tell whether they
1942 * are the raw container drives or stand alone drives. If they have
1943 * the removable bit set then we should expose them though.
1944 */
1945 b = (*(u8*)scsicmd->buffer)&0x1f;
1946 b1 = ((u8*)scsicmd->buffer)[1];
1947 if( b==TYPE_TAPE || b==TYPE_WORM || b==TYPE_ROM || b==TYPE_MOD|| b==TYPE_MEDIUM_CHANGER
1948 || (b==TYPE_DISK && (b1&0x80)) ){
1949 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
1950 /*
1951 * We will allow disk devices if in RAID/SCSI mode and
1952 * the channel is 2
1953 */
1954 } else if ((dev->raid_scsi_mode) &&
1955 (scmd_channel(scsicmd) == 2)) {
1956 scsicmd->result = DID_OK << 16 |
1957 COMMAND_COMPLETE << 8;
1958 } else {
1959 scsicmd->result = DID_NO_CONNECT << 16 |
1960 COMMAND_COMPLETE << 8;
1961 }
1962 } else {
1963 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
1964 }
1965 break; 1939 break;
1966 case SRB_STATUS_DATA_OVERRUN: 1940 case SRB_STATUS_DATA_OVERRUN:
1967 switch(scsicmd->cmnd[0]){ 1941 switch(scsicmd->cmnd[0]){
@@ -1981,28 +1955,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
1981 scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8; 1955 scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8;
1982 break; 1956 break;
1983 case INQUIRY: { 1957 case INQUIRY: {
1984 u8 b; 1958 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
1985 u8 b1;
1986 /* We can't expose disk devices because we can't tell whether they
1987 * are the raw container drives or stand alone drives
1988 */
1989 b = (*(u8*)scsicmd->buffer)&0x0f;
1990 b1 = ((u8*)scsicmd->buffer)[1];
1991 if( b==TYPE_TAPE || b==TYPE_WORM || b==TYPE_ROM || b==TYPE_MOD|| b==TYPE_MEDIUM_CHANGER
1992 || (b==TYPE_DISK && (b1&0x80)) ){
1993 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
1994 /*
1995 * We will allow disk devices if in RAID/SCSI mode and
1996 * the channel is 2
1997 */
1998 } else if ((dev->raid_scsi_mode) &&
1999 (scmd_channel(scsicmd) == 2)) {
2000 scsicmd->result = DID_OK << 16 |
2001 COMMAND_COMPLETE << 8;
2002 } else {
2003 scsicmd->result = DID_NO_CONNECT << 16 |
2004 COMMAND_COMPLETE << 8;
2005 }
2006 break; 1959 break;
2007 } 1960 }
2008 default: 1961 default:
@@ -2089,8 +2042,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
2089 */ 2042 */
2090 scsicmd->result |= le32_to_cpu(srbreply->scsi_status); 2043 scsicmd->result |= le32_to_cpu(srbreply->scsi_status);
2091 2044
2092 fib_complete(fibptr); 2045 aac_fib_complete(fibptr);
2093 fib_free(fibptr); 2046 aac_fib_free(fibptr);
2094 scsicmd->scsi_done(scsicmd); 2047 scsicmd->scsi_done(scsicmd);
2095} 2048}
2096 2049
@@ -2142,10 +2095,10 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
2142 /* 2095 /*
2143 * Allocate and initialize a Fib then setup a BlockWrite command 2096 * Allocate and initialize a Fib then setup a BlockWrite command
2144 */ 2097 */
2145 if (!(cmd_fibcontext = fib_alloc(dev))) { 2098 if (!(cmd_fibcontext = aac_fib_alloc(dev))) {
2146 return -1; 2099 return -1;
2147 } 2100 }
2148 fib_init(cmd_fibcontext); 2101 aac_fib_init(cmd_fibcontext);
2149 2102
2150 srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext); 2103 srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext);
2151 srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); 2104 srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi);
@@ -2179,7 +2132,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
2179 /* 2132 /*
2180 * Now send the Fib to the adapter 2133 * Now send the Fib to the adapter
2181 */ 2134 */
2182 status = fib_send(ScsiPortCommand64, cmd_fibcontext, 2135 status = aac_fib_send(ScsiPortCommand64, cmd_fibcontext,
2183 fibsize, FsaNormal, 0, 1, 2136 fibsize, FsaNormal, 0, 1,
2184 (fib_callback) aac_srb_callback, 2137 (fib_callback) aac_srb_callback,
2185 (void *) scsicmd); 2138 (void *) scsicmd);
@@ -2201,7 +2154,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
2201 /* 2154 /*
2202 * Now send the Fib to the adapter 2155 * Now send the Fib to the adapter
2203 */ 2156 */
2204 status = fib_send(ScsiPortCommand, cmd_fibcontext, fibsize, FsaNormal, 0, 1, 2157 status = aac_fib_send(ScsiPortCommand, cmd_fibcontext, fibsize, FsaNormal, 0, 1,
2205 (fib_callback) aac_srb_callback, (void *) scsicmd); 2158 (fib_callback) aac_srb_callback, (void *) scsicmd);
2206 } 2159 }
2207 /* 2160 /*
@@ -2211,9 +2164,9 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
2211 return 0; 2164 return 0;
2212 } 2165 }
2213 2166
2214 printk(KERN_WARNING "aac_srb: fib_send failed with status: %d\n", status); 2167 printk(KERN_WARNING "aac_srb: aac_fib_send failed with status: %d\n", status);
2215 fib_complete(cmd_fibcontext); 2168 aac_fib_complete(cmd_fibcontext);
2216 fib_free(cmd_fibcontext); 2169 aac_fib_free(cmd_fibcontext);
2217 2170
2218 return -1; 2171 return -1;
2219} 2172}
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 66dbb6d2c506..2d430b7e8cf4 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1774,16 +1774,16 @@ static inline u32 cap_to_cyls(sector_t capacity, u32 divisor)
1774struct scsi_cmnd; 1774struct scsi_cmnd;
1775 1775
1776const char *aac_driverinfo(struct Scsi_Host *); 1776const char *aac_driverinfo(struct Scsi_Host *);
1777struct fib *fib_alloc(struct aac_dev *dev); 1777struct fib *aac_fib_alloc(struct aac_dev *dev);
1778int fib_setup(struct aac_dev *dev); 1778int aac_fib_setup(struct aac_dev *dev);
1779void fib_map_free(struct aac_dev *dev); 1779void aac_fib_map_free(struct aac_dev *dev);
1780void fib_free(struct fib * context); 1780void aac_fib_free(struct fib * context);
1781void fib_init(struct fib * context); 1781void aac_fib_init(struct fib * context);
1782void aac_printf(struct aac_dev *dev, u32 val); 1782void aac_printf(struct aac_dev *dev, u32 val);
1783int fib_send(u16 command, struct fib * context, unsigned long size, int priority, int wait, int reply, fib_callback callback, void *ctxt); 1783int aac_fib_send(u16 command, struct fib * context, unsigned long size, int priority, int wait, int reply, fib_callback callback, void *ctxt);
1784int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry); 1784int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry);
1785void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum); 1785void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum);
1786int fib_complete(struct fib * context); 1786int aac_fib_complete(struct fib * context);
1787#define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data) 1787#define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data)
1788struct aac_dev *aac_init_adapter(struct aac_dev *dev); 1788struct aac_dev *aac_init_adapter(struct aac_dev *dev);
1789int aac_get_config_status(struct aac_dev *dev); 1789int aac_get_config_status(struct aac_dev *dev);
@@ -1799,11 +1799,11 @@ unsigned int aac_command_normal(struct aac_queue * q);
1799unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index); 1799unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index);
1800int aac_command_thread(struct aac_dev * dev); 1800int aac_command_thread(struct aac_dev * dev);
1801int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context *fibctx); 1801int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context *fibctx);
1802int fib_adapter_complete(struct fib * fibptr, unsigned short size); 1802int aac_fib_adapter_complete(struct fib * fibptr, unsigned short size);
1803struct aac_driver_ident* aac_get_driver_ident(int devtype); 1803struct aac_driver_ident* aac_get_driver_ident(int devtype);
1804int aac_get_adapter_info(struct aac_dev* dev); 1804int aac_get_adapter_info(struct aac_dev* dev);
1805int aac_send_shutdown(struct aac_dev *dev); 1805int aac_send_shutdown(struct aac_dev *dev);
1806int probe_container(struct aac_dev *dev, int cid); 1806int aac_probe_container(struct aac_dev *dev, int cid);
1807extern int numacb; 1807extern int numacb;
1808extern int acbsize; 1808extern int acbsize;
1809extern char aac_driver_version[]; 1809extern char aac_driver_version[];
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 4fe79cd7c957..47fefca72695 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -63,7 +63,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
63 unsigned size; 63 unsigned size;
64 int retval; 64 int retval;
65 65
66 fibptr = fib_alloc(dev); 66 fibptr = aac_fib_alloc(dev);
67 if(fibptr == NULL) { 67 if(fibptr == NULL) {
68 return -ENOMEM; 68 return -ENOMEM;
69 } 69 }
@@ -73,7 +73,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
73 * First copy in the header so that we can check the size field. 73 * First copy in the header so that we can check the size field.
74 */ 74 */
75 if (copy_from_user((void *)kfib, arg, sizeof(struct aac_fibhdr))) { 75 if (copy_from_user((void *)kfib, arg, sizeof(struct aac_fibhdr))) {
76 fib_free(fibptr); 76 aac_fib_free(fibptr);
77 return -EFAULT; 77 return -EFAULT;
78 } 78 }
79 /* 79 /*
@@ -110,13 +110,13 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
110 */ 110 */
111 kfib->header.XferState = 0; 111 kfib->header.XferState = 0;
112 } else { 112 } else {
113 retval = fib_send(le16_to_cpu(kfib->header.Command), fibptr, 113 retval = aac_fib_send(le16_to_cpu(kfib->header.Command), fibptr,
114 le16_to_cpu(kfib->header.Size) , FsaNormal, 114 le16_to_cpu(kfib->header.Size) , FsaNormal,
115 1, 1, NULL, NULL); 115 1, 1, NULL, NULL);
116 if (retval) { 116 if (retval) {
117 goto cleanup; 117 goto cleanup;
118 } 118 }
119 if (fib_complete(fibptr) != 0) { 119 if (aac_fib_complete(fibptr) != 0) {
120 retval = -EINVAL; 120 retval = -EINVAL;
121 goto cleanup; 121 goto cleanup;
122 } 122 }
@@ -138,7 +138,7 @@ cleanup:
138 fibptr->hw_fib_pa = hw_fib_pa; 138 fibptr->hw_fib_pa = hw_fib_pa;
139 fibptr->hw_fib = hw_fib; 139 fibptr->hw_fib = hw_fib;
140 } 140 }
141 fib_free(fibptr); 141 aac_fib_free(fibptr);
142 return retval; 142 return retval;
143} 143}
144 144
@@ -464,10 +464,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
464 /* 464 /*
465 * Allocate and initialize a Fib then setup a BlockWrite command 465 * Allocate and initialize a Fib then setup a BlockWrite command
466 */ 466 */
467 if (!(srbfib = fib_alloc(dev))) { 467 if (!(srbfib = aac_fib_alloc(dev))) {
468 return -ENOMEM; 468 return -ENOMEM;
469 } 469 }
470 fib_init(srbfib); 470 aac_fib_init(srbfib);
471 471
472 srbcmd = (struct aac_srb*) fib_data(srbfib); 472 srbcmd = (struct aac_srb*) fib_data(srbfib);
473 473
@@ -601,7 +601,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
601 601
602 srbcmd->count = cpu_to_le32(byte_count); 602 srbcmd->count = cpu_to_le32(byte_count);
603 psg->count = cpu_to_le32(sg_indx+1); 603 psg->count = cpu_to_le32(sg_indx+1);
604 status = fib_send(ScsiPortCommand64, srbfib, actual_fibsize, FsaNormal, 1, 1,NULL,NULL); 604 status = aac_fib_send(ScsiPortCommand64, srbfib, actual_fibsize, FsaNormal, 1, 1,NULL,NULL);
605 } else { 605 } else {
606 struct user_sgmap* upsg = &user_srbcmd->sg; 606 struct user_sgmap* upsg = &user_srbcmd->sg;
607 struct sgmap* psg = &srbcmd->sg; 607 struct sgmap* psg = &srbcmd->sg;
@@ -649,7 +649,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
649 } 649 }
650 srbcmd->count = cpu_to_le32(byte_count); 650 srbcmd->count = cpu_to_le32(byte_count);
651 psg->count = cpu_to_le32(sg_indx+1); 651 psg->count = cpu_to_le32(sg_indx+1);
652 status = fib_send(ScsiPortCommand, srbfib, actual_fibsize, FsaNormal, 1, 1, NULL, NULL); 652 status = aac_fib_send(ScsiPortCommand, srbfib, actual_fibsize, FsaNormal, 1, 1, NULL, NULL);
653 } 653 }
654 654
655 if (status != 0){ 655 if (status != 0){
@@ -684,8 +684,8 @@ cleanup:
684 for(i=0; i <= sg_indx; i++){ 684 for(i=0; i <= sg_indx; i++){
685 kfree(sg_list[i]); 685 kfree(sg_list[i]);
686 } 686 }
687 fib_complete(srbfib); 687 aac_fib_complete(srbfib);
688 fib_free(srbfib); 688 aac_fib_free(srbfib);
689 689
690 return rcode; 690 return rcode;
691} 691}
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 82821d331c07..1628d094943d 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -185,17 +185,17 @@ int aac_send_shutdown(struct aac_dev * dev)
185 struct aac_close *cmd; 185 struct aac_close *cmd;
186 int status; 186 int status;
187 187
188 fibctx = fib_alloc(dev); 188 fibctx = aac_fib_alloc(dev);
189 if (!fibctx) 189 if (!fibctx)
190 return -ENOMEM; 190 return -ENOMEM;
191 fib_init(fibctx); 191 aac_fib_init(fibctx);
192 192
193 cmd = (struct aac_close *) fib_data(fibctx); 193 cmd = (struct aac_close *) fib_data(fibctx);
194 194
195 cmd->command = cpu_to_le32(VM_CloseAll); 195 cmd->command = cpu_to_le32(VM_CloseAll);
196 cmd->cid = cpu_to_le32(0xffffffff); 196 cmd->cid = cpu_to_le32(0xffffffff);
197 197
198 status = fib_send(ContainerCommand, 198 status = aac_fib_send(ContainerCommand,
199 fibctx, 199 fibctx,
200 sizeof(struct aac_close), 200 sizeof(struct aac_close),
201 FsaNormal, 201 FsaNormal,
@@ -203,8 +203,8 @@ int aac_send_shutdown(struct aac_dev * dev)
203 NULL, NULL); 203 NULL, NULL);
204 204
205 if (status == 0) 205 if (status == 0)
206 fib_complete(fibctx); 206 aac_fib_complete(fibctx);
207 fib_free(fibctx); 207 aac_fib_free(fibctx);
208 return status; 208 return status;
209} 209}
210 210
@@ -427,7 +427,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
427 /* 427 /*
428 * Initialize the list of fibs 428 * Initialize the list of fibs
429 */ 429 */
430 if(fib_setup(dev)<0){ 430 if (aac_fib_setup(dev) < 0) {
431 kfree(dev->queues); 431 kfree(dev->queues);
432 return NULL; 432 return NULL;
433 } 433 }
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 014cc8d54a9f..609fd19b1844 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -67,27 +67,27 @@ static int fib_map_alloc(struct aac_dev *dev)
67} 67}
68 68
69/** 69/**
70 * fib_map_free - free the fib objects 70 * aac_fib_map_free - free the fib objects
71 * @dev: Adapter to free 71 * @dev: Adapter to free
72 * 72 *
73 * Free the PCI mappings and the memory allocated for FIB blocks 73 * Free the PCI mappings and the memory allocated for FIB blocks
74 * on this adapter. 74 * on this adapter.
75 */ 75 */
76 76
77void fib_map_free(struct aac_dev *dev) 77void aac_fib_map_free(struct aac_dev *dev)
78{ 78{
79 pci_free_consistent(dev->pdev, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB), dev->hw_fib_va, dev->hw_fib_pa); 79 pci_free_consistent(dev->pdev, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB), dev->hw_fib_va, dev->hw_fib_pa);
80} 80}
81 81
82/** 82/**
83 * fib_setup - setup the fibs 83 * aac_fib_setup - setup the fibs
84 * @dev: Adapter to set up 84 * @dev: Adapter to set up
85 * 85 *
86 * Allocate the PCI space for the fibs, map it and then intialise the 86 * Allocate the PCI space for the fibs, map it and then intialise the
87 * fib area, the unmapped fib data and also the free list 87 * fib area, the unmapped fib data and also the free list
88 */ 88 */
89 89
90int fib_setup(struct aac_dev * dev) 90int aac_fib_setup(struct aac_dev * dev)
91{ 91{
92 struct fib *fibptr; 92 struct fib *fibptr;
93 struct hw_fib *hw_fib_va; 93 struct hw_fib *hw_fib_va;
@@ -134,14 +134,14 @@ int fib_setup(struct aac_dev * dev)
134} 134}
135 135
136/** 136/**
137 * fib_alloc - allocate a fib 137 * aac_fib_alloc - allocate a fib
138 * @dev: Adapter to allocate the fib for 138 * @dev: Adapter to allocate the fib for
139 * 139 *
140 * Allocate a fib from the adapter fib pool. If the pool is empty we 140 * Allocate a fib from the adapter fib pool. If the pool is empty we
141 * return NULL. 141 * return NULL.
142 */ 142 */
143 143
144struct fib * fib_alloc(struct aac_dev *dev) 144struct fib *aac_fib_alloc(struct aac_dev *dev)
145{ 145{
146 struct fib * fibptr; 146 struct fib * fibptr;
147 unsigned long flags; 147 unsigned long flags;
@@ -170,14 +170,14 @@ struct fib * fib_alloc(struct aac_dev *dev)
170} 170}
171 171
172/** 172/**
173 * fib_free - free a fib 173 * aac_fib_free - free a fib
174 * @fibptr: fib to free up 174 * @fibptr: fib to free up
175 * 175 *
176 * Frees up a fib and places it on the appropriate queue 176 * Frees up a fib and places it on the appropriate queue
177 * (either free or timed out) 177 * (either free or timed out)
178 */ 178 */
179 179
180void fib_free(struct fib * fibptr) 180void aac_fib_free(struct fib *fibptr)
181{ 181{
182 unsigned long flags; 182 unsigned long flags;
183 183
@@ -188,7 +188,7 @@ void fib_free(struct fib * fibptr)
188 fibptr->dev->timeout_fib = fibptr; 188 fibptr->dev->timeout_fib = fibptr;
189 } else { 189 } else {
190 if (fibptr->hw_fib->header.XferState != 0) { 190 if (fibptr->hw_fib->header.XferState != 0) {
191 printk(KERN_WARNING "fib_free, XferState != 0, fibptr = 0x%p, XferState = 0x%x\n", 191 printk(KERN_WARNING "aac_fib_free, XferState != 0, fibptr = 0x%p, XferState = 0x%x\n",
192 (void*)fibptr, 192 (void*)fibptr,
193 le32_to_cpu(fibptr->hw_fib->header.XferState)); 193 le32_to_cpu(fibptr->hw_fib->header.XferState));
194 } 194 }
@@ -199,13 +199,13 @@ void fib_free(struct fib * fibptr)
199} 199}
200 200
201/** 201/**
202 * fib_init - initialise a fib 202 * aac_fib_init - initialise a fib
203 * @fibptr: The fib to initialize 203 * @fibptr: The fib to initialize
204 * 204 *
205 * Set up the generic fib fields ready for use 205 * Set up the generic fib fields ready for use
206 */ 206 */
207 207
208void fib_init(struct fib *fibptr) 208void aac_fib_init(struct fib *fibptr)
209{ 209{
210 struct hw_fib *hw_fib = fibptr->hw_fib; 210 struct hw_fib *hw_fib = fibptr->hw_fib;
211 211
@@ -362,7 +362,7 @@ static int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_f
362 */ 362 */
363 363
364/** 364/**
365 * fib_send - send a fib to the adapter 365 * aac_fib_send - send a fib to the adapter
366 * @command: Command to send 366 * @command: Command to send
367 * @fibptr: The fib 367 * @fibptr: The fib
368 * @size: Size of fib data area 368 * @size: Size of fib data area
@@ -378,7 +378,9 @@ static int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_f
378 * response FIB is received from the adapter. 378 * response FIB is received from the adapter.
379 */ 379 */
380 380
381int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority, int wait, int reply, fib_callback callback, void * callback_data) 381int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
382 int priority, int wait, int reply, fib_callback callback,
383 void *callback_data)
382{ 384{
383 struct aac_dev * dev = fibptr->dev; 385 struct aac_dev * dev = fibptr->dev;
384 struct hw_fib * hw_fib = fibptr->hw_fib; 386 struct hw_fib * hw_fib = fibptr->hw_fib;
@@ -493,7 +495,7 @@ int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority
493 q->numpending++; 495 q->numpending++;
494 *(q->headers.producer) = cpu_to_le32(index + 1); 496 *(q->headers.producer) = cpu_to_le32(index + 1);
495 spin_unlock_irqrestore(q->lock, qflags); 497 spin_unlock_irqrestore(q->lock, qflags);
496 dprintk((KERN_DEBUG "fib_send: inserting a queue entry at index %d.\n",index)); 498 dprintk((KERN_DEBUG "aac_fib_send: inserting a queue entry at index %d.\n",index));
497 if (!(nointr & aac_config.irq_mod)) 499 if (!(nointr & aac_config.irq_mod))
498 aac_adapter_notify(dev, AdapNormCmdQueue); 500 aac_adapter_notify(dev, AdapNormCmdQueue);
499 } 501 }
@@ -520,7 +522,7 @@ int fib_send(u16 command, struct fib * fibptr, unsigned long size, int priority
520 list_del(&fibptr->queue); 522 list_del(&fibptr->queue);
521 spin_unlock_irqrestore(q->lock, qflags); 523 spin_unlock_irqrestore(q->lock, qflags);
522 if (wait == -1) { 524 if (wait == -1) {
523 printk(KERN_ERR "aacraid: fib_send: first asynchronous command timed out.\n" 525 printk(KERN_ERR "aacraid: aac_fib_send: first asynchronous command timed out.\n"
524 "Usually a result of a PCI interrupt routing problem;\n" 526 "Usually a result of a PCI interrupt routing problem;\n"
525 "update mother board BIOS or consider utilizing one of\n" 527 "update mother board BIOS or consider utilizing one of\n"
526 "the SAFE mode kernel options (acpi, apic etc)\n"); 528 "the SAFE mode kernel options (acpi, apic etc)\n");
@@ -624,7 +626,7 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid)
624} 626}
625 627
626/** 628/**
627 * fib_adapter_complete - complete adapter issued fib 629 * aac_fib_adapter_complete - complete adapter issued fib
628 * @fibptr: fib to complete 630 * @fibptr: fib to complete
629 * @size: size of fib 631 * @size: size of fib
630 * 632 *
@@ -632,7 +634,7 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid)
632 * the adapter. 634 * the adapter.
633 */ 635 */
634 636
635int fib_adapter_complete(struct fib * fibptr, unsigned short size) 637int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
636{ 638{
637 struct hw_fib * hw_fib = fibptr->hw_fib; 639 struct hw_fib * hw_fib = fibptr->hw_fib;
638 struct aac_dev * dev = fibptr->dev; 640 struct aac_dev * dev = fibptr->dev;
@@ -683,20 +685,20 @@ int fib_adapter_complete(struct fib * fibptr, unsigned short size)
683 } 685 }
684 else 686 else
685 { 687 {
686 printk(KERN_WARNING "fib_adapter_complete: Unknown xferstate detected.\n"); 688 printk(KERN_WARNING "aac_fib_adapter_complete: Unknown xferstate detected.\n");
687 BUG(); 689 BUG();
688 } 690 }
689 return 0; 691 return 0;
690} 692}
691 693
692/** 694/**
693 * fib_complete - fib completion handler 695 * aac_fib_complete - fib completion handler
694 * @fib: FIB to complete 696 * @fib: FIB to complete
695 * 697 *
696 * Will do all necessary work to complete a FIB. 698 * Will do all necessary work to complete a FIB.
697 */ 699 */
698 700
699int fib_complete(struct fib * fibptr) 701int aac_fib_complete(struct fib *fibptr)
700{ 702{
701 struct hw_fib * hw_fib = fibptr->hw_fib; 703 struct hw_fib * hw_fib = fibptr->hw_fib;
702 704
@@ -995,14 +997,14 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
995 if (!dev || !dev->scsi_host_ptr) 997 if (!dev || !dev->scsi_host_ptr)
996 return; 998 return;
997 /* 999 /*
998 * force reload of disk info via probe_container 1000 * force reload of disk info via aac_probe_container
999 */ 1001 */
1000 if ((device_config_needed == CHANGE) 1002 if ((device_config_needed == CHANGE)
1001 && (dev->fsa_dev[container].valid == 1)) 1003 && (dev->fsa_dev[container].valid == 1))
1002 dev->fsa_dev[container].valid = 2; 1004 dev->fsa_dev[container].valid = 2;
1003 if ((device_config_needed == CHANGE) || 1005 if ((device_config_needed == CHANGE) ||
1004 (device_config_needed == ADD)) 1006 (device_config_needed == ADD))
1005 probe_container(dev, container); 1007 aac_probe_container(dev, container);
1006 device = scsi_device_lookup(dev->scsi_host_ptr, 1008 device = scsi_device_lookup(dev->scsi_host_ptr,
1007 CONTAINER_TO_CHANNEL(container), 1009 CONTAINER_TO_CHANNEL(container),
1008 CONTAINER_TO_ID(container), 1010 CONTAINER_TO_ID(container),
@@ -1104,7 +1106,7 @@ int aac_command_thread(struct aac_dev * dev)
1104 /* Handle Driver Notify Events */ 1106 /* Handle Driver Notify Events */
1105 aac_handle_aif(dev, fib); 1107 aac_handle_aif(dev, fib);
1106 *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); 1108 *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK);
1107 fib_adapter_complete(fib, (u16)sizeof(u32)); 1109 aac_fib_adapter_complete(fib, (u16)sizeof(u32));
1108 } else { 1110 } else {
1109 struct list_head *entry; 1111 struct list_head *entry;
1110 /* The u32 here is important and intended. We are using 1112 /* The u32 here is important and intended. We are using
@@ -1241,7 +1243,7 @@ int aac_command_thread(struct aac_dev * dev)
1241 * Set the status of this FIB 1243 * Set the status of this FIB
1242 */ 1244 */
1243 *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); 1245 *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK);
1244 fib_adapter_complete(fib, sizeof(u32)); 1246 aac_fib_adapter_complete(fib, sizeof(u32));
1245 spin_unlock_irqrestore(&dev->fib_lock, flagv); 1247 spin_unlock_irqrestore(&dev->fib_lock, flagv);
1246 /* Free up the remaining resources */ 1248 /* Free up the remaining resources */
1247 hw_fib_p = hw_fib_pool; 1249 hw_fib_p = hw_fib_pool;
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c
index 439948ef8251..f6bcb9486f85 100644
--- a/drivers/scsi/aacraid/dpcsup.c
+++ b/drivers/scsi/aacraid/dpcsup.c
@@ -206,7 +206,7 @@ unsigned int aac_command_normal(struct aac_queue *q)
206 * Set the status of this FIB 206 * Set the status of this FIB
207 */ 207 */
208 *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); 208 *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK);
209 fib_adapter_complete(fib, sizeof(u32)); 209 aac_fib_adapter_complete(fib, sizeof(u32));
210 spin_lock_irqsave(q->lock, flags); 210 spin_lock_irqsave(q->lock, flags);
211 } 211 }
212 } 212 }
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 0bf5f9a943e8..271617890562 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -385,17 +385,45 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev,
385 385
386static int aac_slave_configure(struct scsi_device *sdev) 386static int aac_slave_configure(struct scsi_device *sdev)
387{ 387{
388 struct Scsi_Host *host = sdev->host; 388 if (sdev_channel(sdev) == CONTAINER_CHANNEL) {
389 sdev->skip_ms_page_8 = 1;
390 sdev->skip_ms_page_3f = 1;
391 }
392 if ((sdev->type == TYPE_DISK) &&
393 (sdev_channel(sdev) != CONTAINER_CHANNEL)) {
394 struct aac_dev *aac = (struct aac_dev *)sdev->host->hostdata;
395 if (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2))
396 sdev->no_uld_attach = 1;
397 }
398 if (sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
399 (sdev_channel(sdev) == CONTAINER_CHANNEL)) {
400 struct scsi_device * dev;
401 struct Scsi_Host *host = sdev->host;
402 unsigned num_lsu = 0;
403 unsigned num_one = 0;
404 unsigned depth;
389 405
390 if (sdev->tagged_supported) 406 __shost_for_each_device(dev, host) {
391 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, 128); 407 if (dev->tagged_supported && (dev->type == TYPE_DISK) &&
392 else 408 (sdev_channel(dev) == CONTAINER_CHANNEL))
409 ++num_lsu;
410 else
411 ++num_one;
412 }
413 if (num_lsu == 0)
414 ++num_lsu;
415 depth = (host->can_queue - num_one) / num_lsu;
416 if (depth > 256)
417 depth = 256;
418 else if (depth < 2)
419 depth = 2;
420 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth);
421 if (!(((struct aac_dev *)host->hostdata)->adapter_info.options &
422 AAC_OPT_NEW_COMM))
423 blk_queue_max_segment_size(sdev->request_queue, 65536);
424 } else
393 scsi_adjust_queue_depth(sdev, 0, 1); 425 scsi_adjust_queue_depth(sdev, 0, 1);
394 426
395 if (!(((struct aac_dev *)host->hostdata)->adapter_info.options
396 & AAC_OPT_NEW_COMM))
397 blk_queue_max_segment_size(sdev->request_queue, 65536);
398
399 return 0; 427 return 0;
400} 428}
401 429
@@ -870,7 +898,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
870 898
871 /* 899 /*
872 * max channel will be the physical channels plus 1 virtual channel 900 * max channel will be the physical channels plus 1 virtual channel
873 * all containers are on the virtual channel 0 901 * all containers are on the virtual channel 0 (CONTAINER_CHANNEL)
874 * physical channels are address by their actual physical number+1 902 * physical channels are address by their actual physical number+1
875 */ 903 */
876 if (aac->nondasd_support == 1) 904 if (aac->nondasd_support == 1)
@@ -913,7 +941,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
913 aac_adapter_disable_int(aac); 941 aac_adapter_disable_int(aac);
914 free_irq(pdev->irq, aac); 942 free_irq(pdev->irq, aac);
915 out_unmap: 943 out_unmap:
916 fib_map_free(aac); 944 aac_fib_map_free(aac);
917 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys); 945 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys);
918 kfree(aac->queues); 946 kfree(aac->queues);
919 iounmap(aac->regs.sa); 947 iounmap(aac->regs.sa);
@@ -947,7 +975,7 @@ static void __devexit aac_remove_one(struct pci_dev *pdev)
947 975
948 aac_send_shutdown(aac); 976 aac_send_shutdown(aac);
949 aac_adapter_disable_int(aac); 977 aac_adapter_disable_int(aac);
950 fib_map_free(aac); 978 aac_fib_map_free(aac);
951 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, 979 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr,
952 aac->comm_phys); 980 aac->comm_phys);
953 kfree(aac->queues); 981 kfree(aac->queues);
diff --git a/drivers/scsi/esp.c b/drivers/scsi/esp.c
index f6900538be90..87a8c3d2072c 100644
--- a/drivers/scsi/esp.c
+++ b/drivers/scsi/esp.c
@@ -2068,14 +2068,12 @@ static int esp_reset(struct scsi_cmnd *SCptr)
2068{ 2068{
2069 struct esp *esp = (struct esp *) SCptr->device->host->hostdata; 2069 struct esp *esp = (struct esp *) SCptr->device->host->hostdata;
2070 2070
2071 spin_lock_irq(esp->ehost->host_lock);
2071 (void) esp_do_resetbus(esp); 2072 (void) esp_do_resetbus(esp);
2072
2073 spin_unlock_irq(esp->ehost->host_lock); 2073 spin_unlock_irq(esp->ehost->host_lock);
2074 2074
2075 wait_event(esp->reset_queue, (esp->resetting_bus == 0)); 2075 wait_event(esp->reset_queue, (esp->resetting_bus == 0));
2076 2076
2077 spin_lock_irq(esp->ehost->host_lock);
2078
2079 return SUCCESS; 2077 return SUCCESS;
2080} 2078}
2081 2079
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index bd3ffdf6c800..62e3cda859af 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -2816,7 +2816,7 @@ static int gdth_fill_cache_cmd(int hanum,Scsi_Cmnd *scp,ushort hdrive)
2816 } 2816 }
2817#endif 2817#endif
2818 2818
2819 } else { 2819 } else if (scp->request_bufflen) {
2820 scp->SCp.Status = GDTH_MAP_SINGLE; 2820 scp->SCp.Status = GDTH_MAP_SINGLE;
2821 scp->SCp.Message = (read_write == 1 ? 2821 scp->SCp.Message = (read_write == 1 ?
2822 PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); 2822 PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 27acf78cf8d8..2bba5e55d7bc 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -4236,35 +4236,6 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd)
4236} 4236}
4237 4237
4238/** 4238/**
4239 * ipr_save_ioafp_mode_select - Save adapters mode select data
4240 * @ioa_cfg: ioa config struct
4241 * @scsi_cmd: scsi command struct
4242 *
4243 * This function saves mode select data for the adapter to
4244 * use following an adapter reset.
4245 *
4246 * Return value:
4247 * 0 on success / SCSI_MLQUEUE_HOST_BUSY on failure
4248 **/
4249static int ipr_save_ioafp_mode_select(struct ipr_ioa_cfg *ioa_cfg,
4250 struct scsi_cmnd *scsi_cmd)
4251{
4252 if (!ioa_cfg->saved_mode_pages) {
4253 ioa_cfg->saved_mode_pages = kmalloc(sizeof(struct ipr_mode_pages),
4254 GFP_ATOMIC);
4255 if (!ioa_cfg->saved_mode_pages) {
4256 dev_err(&ioa_cfg->pdev->dev,
4257 "IOA mode select buffer allocation failed\n");
4258 return SCSI_MLQUEUE_HOST_BUSY;
4259 }
4260 }
4261
4262 memcpy(ioa_cfg->saved_mode_pages, scsi_cmd->buffer, scsi_cmd->cmnd[4]);
4263 ioa_cfg->saved_mode_page_len = scsi_cmd->cmnd[4];
4264 return 0;
4265}
4266
4267/**
4268 * ipr_queuecommand - Queue a mid-layer request 4239 * ipr_queuecommand - Queue a mid-layer request
4269 * @scsi_cmd: scsi command struct 4240 * @scsi_cmd: scsi command struct
4270 * @done: done function 4241 * @done: done function
@@ -4338,9 +4309,6 @@ static int ipr_queuecommand(struct scsi_cmnd *scsi_cmd,
4338 (!ipr_is_gscsi(res) || scsi_cmd->cmnd[0] == IPR_QUERY_RSRC_STATE)) 4309 (!ipr_is_gscsi(res) || scsi_cmd->cmnd[0] == IPR_QUERY_RSRC_STATE))
4339 ioarcb->cmd_pkt.request_type = IPR_RQTYPE_IOACMD; 4310 ioarcb->cmd_pkt.request_type = IPR_RQTYPE_IOACMD;
4340 4311
4341 if (ipr_is_ioa_resource(res) && scsi_cmd->cmnd[0] == MODE_SELECT)
4342 rc = ipr_save_ioafp_mode_select(ioa_cfg, scsi_cmd);
4343
4344 if (likely(rc == 0)) 4312 if (likely(rc == 0))
4345 rc = ipr_build_ioadl(ioa_cfg, ipr_cmd); 4313 rc = ipr_build_ioadl(ioa_cfg, ipr_cmd);
4346 4314
@@ -4829,17 +4797,11 @@ static int ipr_ioafp_mode_select_page28(struct ipr_cmnd *ipr_cmd)
4829 int length; 4797 int length;
4830 4798
4831 ENTER; 4799 ENTER;
4832 if (ioa_cfg->saved_mode_pages) { 4800 ipr_scsi_bus_speed_limit(ioa_cfg);
4833 memcpy(mode_pages, ioa_cfg->saved_mode_pages, 4801 ipr_check_term_power(ioa_cfg, mode_pages);
4834 ioa_cfg->saved_mode_page_len); 4802 ipr_modify_ioafp_mode_page_28(ioa_cfg, mode_pages);
4835 length = ioa_cfg->saved_mode_page_len; 4803 length = mode_pages->hdr.length + 1;
4836 } else { 4804 mode_pages->hdr.length = 0;
4837 ipr_scsi_bus_speed_limit(ioa_cfg);
4838 ipr_check_term_power(ioa_cfg, mode_pages);
4839 ipr_modify_ioafp_mode_page_28(ioa_cfg, mode_pages);
4840 length = mode_pages->hdr.length + 1;
4841 mode_pages->hdr.length = 0;
4842 }
4843 4805
4844 ipr_build_mode_select(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), 0x11, 4806 ipr_build_mode_select(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), 0x11,
4845 ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, mode_pages), 4807 ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, mode_pages),
@@ -5969,7 +5931,6 @@ static void ipr_free_mem(struct ipr_ioa_cfg *ioa_cfg)
5969 } 5931 }
5970 5932
5971 ipr_free_dump(ioa_cfg); 5933 ipr_free_dump(ioa_cfg);
5972 kfree(ioa_cfg->saved_mode_pages);
5973 kfree(ioa_cfg->trace); 5934 kfree(ioa_cfg->trace);
5974} 5935}
5975 5936
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
index b639332131f1..fd360bfe56dd 100644
--- a/drivers/scsi/ipr.h
+++ b/drivers/scsi/ipr.h
@@ -36,8 +36,8 @@
36/* 36/*
37 * Literals 37 * Literals
38 */ 38 */
39#define IPR_DRIVER_VERSION "2.1.1" 39#define IPR_DRIVER_VERSION "2.1.2"
40#define IPR_DRIVER_DATE "(November 15, 2005)" 40#define IPR_DRIVER_DATE "(February 8, 2006)"
41 41
42/* 42/*
43 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding 43 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding
@@ -1000,7 +1000,6 @@ struct ipr_ioa_cfg {
1000 struct Scsi_Host *host; 1000 struct Scsi_Host *host;
1001 struct pci_dev *pdev; 1001 struct pci_dev *pdev;
1002 struct ipr_sglist *ucode_sglist; 1002 struct ipr_sglist *ucode_sglist;
1003 struct ipr_mode_pages *saved_mode_pages;
1004 u8 saved_mode_page_len; 1003 u8 saved_mode_page_len;
1005 1004
1006 struct work_struct work_q; 1005 struct work_struct work_q;
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 780bfcc67096..ff79e68b347c 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -146,7 +146,7 @@ iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err)
146 spin_unlock_irqrestore(&session->lock, flags); 146 spin_unlock_irqrestore(&session->lock, flags);
147 set_bit(SUSPEND_BIT, &conn->suspend_tx); 147 set_bit(SUSPEND_BIT, &conn->suspend_tx);
148 set_bit(SUSPEND_BIT, &conn->suspend_rx); 148 set_bit(SUSPEND_BIT, &conn->suspend_rx);
149 iscsi_conn_error(iscsi_handle(conn), err); 149 iscsi_conn_error(conn->cls_conn, err);
150} 150}
151 151
152static inline int 152static inline int
@@ -244,12 +244,10 @@ iscsi_ctask_cleanup(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
244 if (sc->sc_data_direction == DMA_TO_DEVICE) { 244 if (sc->sc_data_direction == DMA_TO_DEVICE) {
245 struct iscsi_data_task *dtask, *n; 245 struct iscsi_data_task *dtask, *n;
246 /* WRITE: cleanup Data-Out's if any */ 246 /* WRITE: cleanup Data-Out's if any */
247 spin_lock(&conn->lock);
248 list_for_each_entry_safe(dtask, n, &ctask->dataqueue, item) { 247 list_for_each_entry_safe(dtask, n, &ctask->dataqueue, item) {
249 list_del(&dtask->item); 248 list_del(&dtask->item);
250 mempool_free(dtask, ctask->datapool); 249 mempool_free(dtask, ctask->datapool);
251 } 250 }
252 spin_unlock(&conn->lock);
253 } 251 }
254 ctask->xmstate = XMSTATE_IDLE; 252 ctask->xmstate = XMSTATE_IDLE;
255 ctask->r2t = NULL; 253 ctask->r2t = NULL;
@@ -689,7 +687,7 @@ iscsi_hdr_recv(struct iscsi_conn *conn)
689 break; 687 break;
690 688
691 if (!conn->in.datalen) { 689 if (!conn->in.datalen) {
692 rc = iscsi_recv_pdu(iscsi_handle(conn), hdr, 690 rc = iscsi_recv_pdu(conn->cls_conn, hdr,
693 NULL, 0); 691 NULL, 0);
694 if (conn->login_mtask != mtask) { 692 if (conn->login_mtask != mtask) {
695 spin_lock(&session->lock); 693 spin_lock(&session->lock);
@@ -737,7 +735,7 @@ iscsi_hdr_recv(struct iscsi_conn *conn)
737 if (!conn->in.datalen) { 735 if (!conn->in.datalen) {
738 struct iscsi_mgmt_task *mtask; 736 struct iscsi_mgmt_task *mtask;
739 737
740 rc = iscsi_recv_pdu(iscsi_handle(conn), hdr, 738 rc = iscsi_recv_pdu(conn->cls_conn, hdr,
741 NULL, 0); 739 NULL, 0);
742 mtask = (struct iscsi_mgmt_task *) 740 mtask = (struct iscsi_mgmt_task *)
743 session->mgmt_cmds[conn->in.itt - 741 session->mgmt_cmds[conn->in.itt -
@@ -761,7 +759,7 @@ iscsi_hdr_recv(struct iscsi_conn *conn)
761 rc = iscsi_check_assign_cmdsn(session, 759 rc = iscsi_check_assign_cmdsn(session,
762 (struct iscsi_nopin*)hdr); 760 (struct iscsi_nopin*)hdr);
763 if (!rc && hdr->ttt != ISCSI_RESERVED_TAG) 761 if (!rc && hdr->ttt != ISCSI_RESERVED_TAG)
764 rc = iscsi_recv_pdu(iscsi_handle(conn), 762 rc = iscsi_recv_pdu(conn->cls_conn,
765 hdr, NULL, 0); 763 hdr, NULL, 0);
766 } else 764 } else
767 rc = ISCSI_ERR_PROTO; 765 rc = ISCSI_ERR_PROTO;
@@ -1044,7 +1042,7 @@ iscsi_data_recv(struct iscsi_conn *conn)
1044 goto exit; 1042 goto exit;
1045 } 1043 }
1046 1044
1047 rc = iscsi_recv_pdu(iscsi_handle(conn), conn->in.hdr, 1045 rc = iscsi_recv_pdu(conn->cls_conn, conn->in.hdr,
1048 conn->data, conn->in.datalen); 1046 conn->data, conn->in.datalen);
1049 1047
1050 if (!rc && conn->datadgst_en && 1048 if (!rc && conn->datadgst_en &&
@@ -2428,19 +2426,20 @@ iscsi_pool_free(struct iscsi_queue *q, void **items)
2428} 2426}
2429 2427
2430static struct iscsi_cls_conn * 2428static struct iscsi_cls_conn *
2431iscsi_conn_create(struct Scsi_Host *shost, uint32_t conn_idx) 2429iscsi_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx)
2432{ 2430{
2431 struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
2433 struct iscsi_session *session = iscsi_hostdata(shost->hostdata); 2432 struct iscsi_session *session = iscsi_hostdata(shost->hostdata);
2434 struct iscsi_conn *conn; 2433 struct iscsi_conn *conn;
2435 struct iscsi_cls_conn *cls_conn; 2434 struct iscsi_cls_conn *cls_conn;
2436 2435
2437 cls_conn = iscsi_create_conn(hostdata_session(shost->hostdata), 2436 cls_conn = iscsi_create_conn(cls_session, conn_idx);
2438 conn_idx);
2439 if (!cls_conn) 2437 if (!cls_conn)
2440 return NULL; 2438 return NULL;
2441 conn = cls_conn->dd_data; 2439 conn = cls_conn->dd_data;
2440 memset(conn, 0, sizeof(*conn));
2442 2441
2443 memset(conn, 0, sizeof(struct iscsi_conn)); 2442 conn->cls_conn = cls_conn;
2444 conn->c_stage = ISCSI_CONN_INITIAL_STAGE; 2443 conn->c_stage = ISCSI_CONN_INITIAL_STAGE;
2445 conn->in_progress = IN_PROGRESS_WAIT_HEADER; 2444 conn->in_progress = IN_PROGRESS_WAIT_HEADER;
2446 conn->id = conn_idx; 2445 conn->id = conn_idx;
@@ -2452,8 +2451,6 @@ iscsi_conn_create(struct Scsi_Host *shost, uint32_t conn_idx)
2452 conn->data_size = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH; 2451 conn->data_size = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH;
2453 conn->max_recv_dlength = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH; 2452 conn->max_recv_dlength = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH;
2454 2453
2455 spin_lock_init(&conn->lock);
2456
2457 /* initialize general xmit PDU commands queue */ 2454 /* initialize general xmit PDU commands queue */
2458 conn->xmitqueue = kfifo_alloc(session->cmds_max * sizeof(void*), 2455 conn->xmitqueue = kfifo_alloc(session->cmds_max * sizeof(void*),
2459 GFP_KERNEL, NULL); 2456 GFP_KERNEL, NULL);
@@ -2625,11 +2622,13 @@ iscsi_conn_destroy(struct iscsi_cls_conn *cls_conn)
2625} 2622}
2626 2623
2627static int 2624static int
2628iscsi_conn_bind(iscsi_sessionh_t sessionh, iscsi_connh_t connh, 2625iscsi_conn_bind(struct iscsi_cls_session *cls_session,
2629 uint32_t transport_fd, int is_leading) 2626 struct iscsi_cls_conn *cls_conn, uint32_t transport_fd,
2627 int is_leading)
2630{ 2628{
2631 struct iscsi_session *session = iscsi_ptr(sessionh); 2629 struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
2632 struct iscsi_conn *tmp = ERR_PTR(-EEXIST), *conn = iscsi_ptr(connh); 2630 struct iscsi_session *session = iscsi_hostdata(shost->hostdata);
2631 struct iscsi_conn *tmp = ERR_PTR(-EEXIST), *conn = cls_conn->dd_data;
2633 struct sock *sk; 2632 struct sock *sk;
2634 struct socket *sock; 2633 struct socket *sock;
2635 int err; 2634 int err;
@@ -2703,9 +2702,9 @@ iscsi_conn_bind(iscsi_sessionh_t sessionh, iscsi_connh_t connh,
2703} 2702}
2704 2703
2705static int 2704static int
2706iscsi_conn_start(iscsi_connh_t connh) 2705iscsi_conn_start(struct iscsi_cls_conn *cls_conn)
2707{ 2706{
2708 struct iscsi_conn *conn = iscsi_ptr(connh); 2707 struct iscsi_conn *conn = cls_conn->dd_data;
2709 struct iscsi_session *session = conn->session; 2708 struct iscsi_session *session = conn->session;
2710 struct sock *sk; 2709 struct sock *sk;
2711 2710
@@ -2754,9 +2753,9 @@ iscsi_conn_start(iscsi_connh_t connh)
2754} 2753}
2755 2754
2756static void 2755static void
2757iscsi_conn_stop(iscsi_connh_t connh, int flag) 2756iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
2758{ 2757{
2759 struct iscsi_conn *conn = iscsi_ptr(connh); 2758 struct iscsi_conn *conn = cls_conn->dd_data;
2760 struct iscsi_session *session = conn->session; 2759 struct iscsi_session *session = conn->session;
2761 struct sock *sk; 2760 struct sock *sk;
2762 unsigned long flags; 2761 unsigned long flags;
@@ -3253,9 +3252,9 @@ static struct scsi_host_template iscsi_sht = {
3253 3252
3254static struct iscsi_transport iscsi_tcp_transport; 3253static struct iscsi_transport iscsi_tcp_transport;
3255 3254
3256static struct Scsi_Host * 3255static struct iscsi_cls_session *
3257iscsi_session_create(struct scsi_transport_template *scsit, 3256iscsi_session_create(struct scsi_transport_template *scsit,
3258 uint32_t initial_cmdsn) 3257 uint32_t initial_cmdsn, uint32_t *sid)
3259{ 3258{
3260 struct Scsi_Host *shost; 3259 struct Scsi_Host *shost;
3261 struct iscsi_session *session; 3260 struct iscsi_session *session;
@@ -3268,13 +3267,14 @@ iscsi_session_create(struct scsi_transport_template *scsit,
3268 session = iscsi_hostdata(shost->hostdata); 3267 session = iscsi_hostdata(shost->hostdata);
3269 memset(session, 0, sizeof(struct iscsi_session)); 3268 memset(session, 0, sizeof(struct iscsi_session));
3270 session->host = shost; 3269 session->host = shost;
3271 session->state = ISCSI_STATE_LOGGED_IN; 3270 session->state = ISCSI_STATE_FREE;
3272 session->mgmtpool_max = ISCSI_MGMT_CMDS_MAX; 3271 session->mgmtpool_max = ISCSI_MGMT_CMDS_MAX;
3273 session->cmds_max = ISCSI_XMIT_CMDS_MAX; 3272 session->cmds_max = ISCSI_XMIT_CMDS_MAX;
3274 session->cmdsn = initial_cmdsn; 3273 session->cmdsn = initial_cmdsn;
3275 session->exp_cmdsn = initial_cmdsn + 1; 3274 session->exp_cmdsn = initial_cmdsn + 1;
3276 session->max_cmdsn = initial_cmdsn + 1; 3275 session->max_cmdsn = initial_cmdsn + 1;
3277 session->max_r2t = 1; 3276 session->max_r2t = 1;
3277 *sid = shost->host_no;
3278 3278
3279 /* initialize SCSI PDU commands pool */ 3279 /* initialize SCSI PDU commands pool */
3280 if (iscsi_pool_init(&session->cmdpool, session->cmds_max, 3280 if (iscsi_pool_init(&session->cmdpool, session->cmds_max,
@@ -3311,22 +3311,24 @@ iscsi_session_create(struct scsi_transport_template *scsit,
3311 if (iscsi_r2tpool_alloc(session)) 3311 if (iscsi_r2tpool_alloc(session))
3312 goto r2tpool_alloc_fail; 3312 goto r2tpool_alloc_fail;
3313 3313
3314 return shost; 3314 return hostdata_session(shost->hostdata);
3315 3315
3316r2tpool_alloc_fail: 3316r2tpool_alloc_fail:
3317 for (cmd_i = 0; cmd_i < session->mgmtpool_max; cmd_i++) 3317 for (cmd_i = 0; cmd_i < session->mgmtpool_max; cmd_i++)
3318 kfree(session->mgmt_cmds[cmd_i]->data); 3318 kfree(session->mgmt_cmds[cmd_i]->data);
3319 iscsi_pool_free(&session->mgmtpool, (void**)session->mgmt_cmds);
3320immdata_alloc_fail: 3319immdata_alloc_fail:
3320 iscsi_pool_free(&session->mgmtpool, (void**)session->mgmt_cmds);
3321mgmtpool_alloc_fail: 3321mgmtpool_alloc_fail:
3322 iscsi_pool_free(&session->cmdpool, (void**)session->cmds); 3322 iscsi_pool_free(&session->cmdpool, (void**)session->cmds);
3323cmdpool_alloc_fail: 3323cmdpool_alloc_fail:
3324 iscsi_transport_destroy_session(shost);
3324 return NULL; 3325 return NULL;
3325} 3326}
3326 3327
3327static void 3328static void
3328iscsi_session_destroy(struct Scsi_Host *shost) 3329iscsi_session_destroy(struct iscsi_cls_session *cls_session)
3329{ 3330{
3331 struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
3330 struct iscsi_session *session = iscsi_hostdata(shost->hostdata); 3332 struct iscsi_session *session = iscsi_hostdata(shost->hostdata);
3331 int cmd_i; 3333 int cmd_i;
3332 struct iscsi_data_task *dtask, *n; 3334 struct iscsi_data_task *dtask, *n;
@@ -3350,10 +3352,10 @@ iscsi_session_destroy(struct Scsi_Host *shost)
3350} 3352}
3351 3353
3352static int 3354static int
3353iscsi_conn_set_param(iscsi_connh_t connh, enum iscsi_param param, 3355iscsi_conn_set_param(struct iscsi_cls_conn *cls_conn, enum iscsi_param param,
3354 uint32_t value) 3356 uint32_t value)
3355{ 3357{
3356 struct iscsi_conn *conn = iscsi_ptr(connh); 3358 struct iscsi_conn *conn = cls_conn->dd_data;
3357 struct iscsi_session *session = conn->session; 3359 struct iscsi_session *session = conn->session;
3358 3360
3359 spin_lock_bh(&session->lock); 3361 spin_lock_bh(&session->lock);
@@ -3495,9 +3497,10 @@ iscsi_conn_set_param(iscsi_connh_t connh, enum iscsi_param param,
3495} 3497}
3496 3498
3497static int 3499static int
3498iscsi_session_get_param(struct Scsi_Host *shost, 3500iscsi_session_get_param(struct iscsi_cls_session *cls_session,
3499 enum iscsi_param param, uint32_t *value) 3501 enum iscsi_param param, uint32_t *value)
3500{ 3502{
3503 struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
3501 struct iscsi_session *session = iscsi_hostdata(shost->hostdata); 3504 struct iscsi_session *session = iscsi_hostdata(shost->hostdata);
3502 3505
3503 switch(param) { 3506 switch(param) {
@@ -3539,9 +3542,10 @@ iscsi_session_get_param(struct Scsi_Host *shost,
3539} 3542}
3540 3543
3541static int 3544static int
3542iscsi_conn_get_param(void *data, enum iscsi_param param, uint32_t *value) 3545iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
3546 enum iscsi_param param, uint32_t *value)
3543{ 3547{
3544 struct iscsi_conn *conn = data; 3548 struct iscsi_conn *conn = cls_conn->dd_data;
3545 3549
3546 switch(param) { 3550 switch(param) {
3547 case ISCSI_PARAM_MAX_RECV_DLENGTH: 3551 case ISCSI_PARAM_MAX_RECV_DLENGTH:
@@ -3564,9 +3568,9 @@ iscsi_conn_get_param(void *data, enum iscsi_param param, uint32_t *value)
3564} 3568}
3565 3569
3566static void 3570static void
3567iscsi_conn_get_stats(iscsi_connh_t connh, struct iscsi_stats *stats) 3571iscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats)
3568{ 3572{
3569 struct iscsi_conn *conn = iscsi_ptr(connh); 3573 struct iscsi_conn *conn = cls_conn->dd_data;
3570 3574
3571 stats->txdata_octets = conn->txdata_octets; 3575 stats->txdata_octets = conn->txdata_octets;
3572 stats->rxdata_octets = conn->rxdata_octets; 3576 stats->rxdata_octets = conn->rxdata_octets;
@@ -3587,10 +3591,10 @@ iscsi_conn_get_stats(iscsi_connh_t connh, struct iscsi_stats *stats)
3587} 3591}
3588 3592
3589static int 3593static int
3590iscsi_conn_send_pdu(iscsi_connh_t connh, struct iscsi_hdr *hdr, char *data, 3594iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr,
3591 uint32_t data_size) 3595 char *data, uint32_t data_size)
3592{ 3596{
3593 struct iscsi_conn *conn = iscsi_ptr(connh); 3597 struct iscsi_conn *conn = cls_conn->dd_data;
3594 int rc; 3598 int rc;
3595 3599
3596 mutex_lock(&conn->xmitmutex); 3600 mutex_lock(&conn->xmitmutex);
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h
index f95e61b76f70..ba26741ac154 100644
--- a/drivers/scsi/iscsi_tcp.h
+++ b/drivers/scsi/iscsi_tcp.h
@@ -113,7 +113,10 @@ struct iscsi_tcp_recv {
113 int datadgst; 113 int datadgst;
114}; 114};
115 115
116struct iscsi_cls_conn;
117
116struct iscsi_conn { 118struct iscsi_conn {
119 struct iscsi_cls_conn *cls_conn; /* ptr to class connection */
117 struct iscsi_hdr hdr; /* header placeholder */ 120 struct iscsi_hdr hdr; /* header placeholder */
118 char hdrext[4*sizeof(__u16) + 121 char hdrext[4*sizeof(__u16) +
119 sizeof(__u32)]; 122 sizeof(__u32)];
@@ -143,7 +146,6 @@ struct iscsi_conn {
143 struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */ 146 struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */
144 struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */ 147 struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */
145 struct iscsi_cmd_task *ctask; /* xmit ctask in progress */ 148 struct iscsi_cmd_task *ctask; /* xmit ctask in progress */
146 spinlock_t lock; /* FIXME: to be removed */
147 149
148 /* old values for socket callbacks */ 150 /* old values for socket callbacks */
149 void (*old_data_ready)(struct sock *, int); 151 void (*old_data_ready)(struct sock *, int);
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 46c4cdbaee86..5f1d7580218d 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -614,7 +614,7 @@ int ata_rwcmd_protocol(struct ata_queued_cmd *qc)
614 } else if (lba48 && (qc->ap->flags & ATA_FLAG_PIO_LBA48)) { 614 } else if (lba48 && (qc->ap->flags & ATA_FLAG_PIO_LBA48)) {
615 /* Unable to use DMA due to host limitation */ 615 /* Unable to use DMA due to host limitation */
616 tf->protocol = ATA_PROT_PIO; 616 tf->protocol = ATA_PROT_PIO;
617 index = dev->multi_count ? 0 : 4; 617 index = dev->multi_count ? 0 : 8;
618 } else { 618 } else {
619 tf->protocol = ATA_PROT_DMA; 619 tf->protocol = ATA_PROT_DMA;
620 index = 16; 620 index = 16;
@@ -2514,7 +2514,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
2514 assert(sg != NULL); 2514 assert(sg != NULL);
2515 2515
2516 if (qc->flags & ATA_QCFLAG_SINGLE) 2516 if (qc->flags & ATA_QCFLAG_SINGLE)
2517 assert(qc->n_elem == 1); 2517 assert(qc->n_elem <= 1);
2518 2518
2519 VPRINTK("unmapping %u sg elements\n", qc->n_elem); 2519 VPRINTK("unmapping %u sg elements\n", qc->n_elem);
2520 2520
@@ -2537,7 +2537,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
2537 kunmap_atomic(addr, KM_IRQ0); 2537 kunmap_atomic(addr, KM_IRQ0);
2538 } 2538 }
2539 } else { 2539 } else {
2540 if (sg_dma_len(&sg[0]) > 0) 2540 if (qc->n_elem)
2541 dma_unmap_single(ap->host_set->dev, 2541 dma_unmap_single(ap->host_set->dev,
2542 sg_dma_address(&sg[0]), sg_dma_len(&sg[0]), 2542 sg_dma_address(&sg[0]), sg_dma_len(&sg[0]),
2543 dir); 2543 dir);
@@ -2570,7 +2570,7 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
2570 unsigned int idx; 2570 unsigned int idx;
2571 2571
2572 assert(qc->__sg != NULL); 2572 assert(qc->__sg != NULL);
2573 assert(qc->n_elem > 0); 2573 assert(qc->n_elem > 0 || qc->pad_len > 0);
2574 2574
2575 idx = 0; 2575 idx = 0;
2576 ata_for_each_sg(sg, qc) { 2576 ata_for_each_sg(sg, qc) {
@@ -2715,6 +2715,7 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
2715 int dir = qc->dma_dir; 2715 int dir = qc->dma_dir;
2716 struct scatterlist *sg = qc->__sg; 2716 struct scatterlist *sg = qc->__sg;
2717 dma_addr_t dma_address; 2717 dma_addr_t dma_address;
2718 int trim_sg = 0;
2718 2719
2719 /* we must lengthen transfers to end on a 32-bit boundary */ 2720 /* we must lengthen transfers to end on a 32-bit boundary */
2720 qc->pad_len = sg->length & 3; 2721 qc->pad_len = sg->length & 3;
@@ -2734,13 +2735,15 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
2734 sg_dma_len(psg) = ATA_DMA_PAD_SZ; 2735 sg_dma_len(psg) = ATA_DMA_PAD_SZ;
2735 /* trim sg */ 2736 /* trim sg */
2736 sg->length -= qc->pad_len; 2737 sg->length -= qc->pad_len;
2738 if (sg->length == 0)
2739 trim_sg = 1;
2737 2740
2738 DPRINTK("padding done, sg->length=%u pad_len=%u\n", 2741 DPRINTK("padding done, sg->length=%u pad_len=%u\n",
2739 sg->length, qc->pad_len); 2742 sg->length, qc->pad_len);
2740 } 2743 }
2741 2744
2742 if (!sg->length) { 2745 if (trim_sg) {
2743 sg_dma_address(sg) = 0; 2746 qc->n_elem--;
2744 goto skip_map; 2747 goto skip_map;
2745 } 2748 }
2746 2749
@@ -2753,9 +2756,9 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
2753 } 2756 }
2754 2757
2755 sg_dma_address(sg) = dma_address; 2758 sg_dma_address(sg) = dma_address;
2756skip_map:
2757 sg_dma_len(sg) = sg->length; 2759 sg_dma_len(sg) = sg->length;
2758 2760
2761skip_map:
2759 DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg), 2762 DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg),
2760 qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); 2763 qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
2761 2764
@@ -3357,11 +3360,12 @@ static void ata_pio_error(struct ata_port *ap)
3357{ 3360{
3358 struct ata_queued_cmd *qc; 3361 struct ata_queued_cmd *qc;
3359 3362
3360 printk(KERN_WARNING "ata%u: PIO error\n", ap->id);
3361
3362 qc = ata_qc_from_tag(ap, ap->active_tag); 3363 qc = ata_qc_from_tag(ap, ap->active_tag);
3363 assert(qc != NULL); 3364 assert(qc != NULL);
3364 3365
3366 if (qc->tf.command != ATA_CMD_PACKET)
3367 printk(KERN_WARNING "ata%u: PIO error\n", ap->id);
3368
3365 /* make sure qc->err_mask is available to 3369 /* make sure qc->err_mask is available to
3366 * know what's wrong and recover 3370 * know what's wrong and recover
3367 */ 3371 */
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index d101a8a6f4e8..7144674bc8e6 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -5049,7 +5049,7 @@ static struct pci_device_id megaraid_pci_tbl[] = {
5049MODULE_DEVICE_TABLE(pci, megaraid_pci_tbl); 5049MODULE_DEVICE_TABLE(pci, megaraid_pci_tbl);
5050 5050
5051static struct pci_driver megaraid_pci_driver = { 5051static struct pci_driver megaraid_pci_driver = {
5052 .name = "megaraid", 5052 .name = "megaraid_legacy",
5053 .id_table = megaraid_pci_tbl, 5053 .id_table = megaraid_pci_tbl,
5054 .probe = megaraid_probe_one, 5054 .probe = megaraid_probe_one,
5055 .remove = __devexit_p(megaraid_remove_one), 5055 .remove = __devexit_p(megaraid_remove_one),
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h
index 4b3e0d6e5afa..4b75fe619d9c 100644
--- a/drivers/scsi/megaraid.h
+++ b/drivers/scsi/megaraid.h
@@ -5,7 +5,7 @@
5#include <linux/mutex.h> 5#include <linux/mutex.h>
6 6
7#define MEGARAID_VERSION \ 7#define MEGARAID_VERSION \
8 "v2.00.3 (Release Date: Wed Feb 19 08:51:30 EST 2003)\n" 8 "v2.00.4 (Release Date: Thu Feb 9 08:51:30 EST 2006)\n"
9 9
10/* 10/*
11 * Driver features - change the values to enable or disable features in the 11 * Driver features - change the values to enable or disable features in the
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index a487f414960e..7de267e14458 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -10,7 +10,7 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 * 11 *
12 * FILE : megaraid_sas.c 12 * FILE : megaraid_sas.c
13 * Version : v00.00.02.02 13 * Version : v00.00.02.04
14 * 14 *
15 * Authors: 15 * Authors:
16 * Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com> 16 * Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com>
@@ -60,6 +60,12 @@ static struct pci_device_id megasas_pci_table[] = {
60 PCI_ANY_ID, 60 PCI_ANY_ID,
61 }, 61 },
62 { 62 {
63 PCI_VENDOR_ID_LSI_LOGIC,
64 PCI_DEVICE_ID_LSI_SAS1078R, // ppc IOP
65 PCI_ANY_ID,
66 PCI_ANY_ID,
67 },
68 {
63 PCI_VENDOR_ID_DELL, 69 PCI_VENDOR_ID_DELL,
64 PCI_DEVICE_ID_DELL_PERC5, // xscale IOP 70 PCI_DEVICE_ID_DELL_PERC5, // xscale IOP
65 PCI_ANY_ID, 71 PCI_ANY_ID,
@@ -199,6 +205,86 @@ static struct megasas_instance_template megasas_instance_template_xscale = {
199*/ 205*/
200 206
201/** 207/**
208* The following functions are defined for ppc (deviceid : 0x60)
209* controllers
210*/
211
212/**
213 * megasas_enable_intr_ppc - Enables interrupts
214 * @regs: MFI register set
215 */
216static inline void
217megasas_enable_intr_ppc(struct megasas_register_set __iomem * regs)
218{
219 writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear);
220
221 writel(~0x80000004, &(regs)->outbound_intr_mask);
222
223 /* Dummy readl to force pci flush */
224 readl(&regs->outbound_intr_mask);
225}
226
227/**
228 * megasas_read_fw_status_reg_ppc - returns the current FW status value
229 * @regs: MFI register set
230 */
231static u32
232megasas_read_fw_status_reg_ppc(struct megasas_register_set __iomem * regs)
233{
234 return readl(&(regs)->outbound_scratch_pad);
235}
236
237/**
238 * megasas_clear_interrupt_ppc - Check & clear interrupt
239 * @regs: MFI register set
240 */
241static int
242megasas_clear_intr_ppc(struct megasas_register_set __iomem * regs)
243{
244 u32 status;
245 /*
246 * Check if it is our interrupt
247 */
248 status = readl(&regs->outbound_intr_status);
249
250 if (!(status & MFI_REPLY_1078_MESSAGE_INTERRUPT)) {
251 return 1;
252 }
253
254 /*
255 * Clear the interrupt by writing back the same value
256 */
257 writel(status, &regs->outbound_doorbell_clear);
258
259 return 0;
260}
261/**
262 * megasas_fire_cmd_ppc - Sends command to the FW
263 * @frame_phys_addr : Physical address of cmd
264 * @frame_count : Number of frames for the command
265 * @regs : MFI register set
266 */
267static inline void
268megasas_fire_cmd_ppc(dma_addr_t frame_phys_addr, u32 frame_count, struct megasas_register_set __iomem *regs)
269{
270 writel((frame_phys_addr | (frame_count<<1))|1,
271 &(regs)->inbound_queue_port);
272}
273
274static struct megasas_instance_template megasas_instance_template_ppc = {
275
276 .fire_cmd = megasas_fire_cmd_ppc,
277 .enable_intr = megasas_enable_intr_ppc,
278 .clear_intr = megasas_clear_intr_ppc,
279 .read_fw_status_reg = megasas_read_fw_status_reg_ppc,
280};
281
282/**
283* This is the end of set of functions & definitions
284* specific to ppc (deviceid : 0x60) controllers
285*/
286
287/**
202 * megasas_disable_intr - Disables interrupts 288 * megasas_disable_intr - Disables interrupts
203 * @regs: MFI register set 289 * @regs: MFI register set
204 */ 290 */
@@ -1607,7 +1693,17 @@ static int megasas_init_mfi(struct megasas_instance *instance)
1607 1693
1608 reg_set = instance->reg_set; 1694 reg_set = instance->reg_set;
1609 1695
1610 instance->instancet = &megasas_instance_template_xscale; 1696 switch(instance->pdev->device)
1697 {
1698 case PCI_DEVICE_ID_LSI_SAS1078R:
1699 instance->instancet = &megasas_instance_template_ppc;
1700 break;
1701 case PCI_DEVICE_ID_LSI_SAS1064R:
1702 case PCI_DEVICE_ID_DELL_PERC5:
1703 default:
1704 instance->instancet = &megasas_instance_template_xscale;
1705 break;
1706 }
1611 1707
1612 /* 1708 /*
1613 * We expect the FW state to be READY 1709 * We expect the FW state to be READY
@@ -1983,6 +2079,7 @@ static int megasas_io_attach(struct megasas_instance *instance)
1983 host->max_channel = MEGASAS_MAX_CHANNELS - 1; 2079 host->max_channel = MEGASAS_MAX_CHANNELS - 1;
1984 host->max_id = MEGASAS_MAX_DEV_PER_CHANNEL; 2080 host->max_id = MEGASAS_MAX_DEV_PER_CHANNEL;
1985 host->max_lun = MEGASAS_MAX_LUN; 2081 host->max_lun = MEGASAS_MAX_LUN;
2082 host->max_cmd_len = 16;
1986 2083
1987 /* 2084 /*
1988 * Notify the mid-layer about the new controller 2085 * Notify the mid-layer about the new controller
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index d6d166c0663f..89639f0c38ef 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -18,9 +18,9 @@
18/** 18/**
19 * MegaRAID SAS Driver meta data 19 * MegaRAID SAS Driver meta data
20 */ 20 */
21#define MEGASAS_VERSION "00.00.02.02" 21#define MEGASAS_VERSION "00.00.02.04"
22#define MEGASAS_RELDATE "Jan 23, 2006" 22#define MEGASAS_RELDATE "Feb 03, 2006"
23#define MEGASAS_EXT_VERSION "Mon Jan 23 14:09:01 PST 2006" 23#define MEGASAS_EXT_VERSION "Fri Feb 03 14:31:44 PST 2006"
24/* 24/*
25 * ===================================== 25 * =====================================
26 * MegaRAID SAS MFI firmware definitions 26 * MegaRAID SAS MFI firmware definitions
@@ -553,31 +553,46 @@ struct megasas_ctrl_info {
553#define MFI_OB_INTR_STATUS_MASK 0x00000002 553#define MFI_OB_INTR_STATUS_MASK 0x00000002
554#define MFI_POLL_TIMEOUT_SECS 10 554#define MFI_POLL_TIMEOUT_SECS 10
555 555
556#define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000
557#define PCI_DEVICE_ID_LSI_SAS1078R 0x00000060
558
556struct megasas_register_set { 559struct megasas_register_set {
560 u32 reserved_0[4]; /*0000h*/
557 561
558 u32 reserved_0[4]; /*0000h */ 562 u32 inbound_msg_0; /*0010h*/
563 u32 inbound_msg_1; /*0014h*/
564 u32 outbound_msg_0; /*0018h*/
565 u32 outbound_msg_1; /*001Ch*/
559 566
560 u32 inbound_msg_0; /*0010h */ 567 u32 inbound_doorbell; /*0020h*/
561 u32 inbound_msg_1; /*0014h */ 568 u32 inbound_intr_status; /*0024h*/
562 u32 outbound_msg_0; /*0018h */ 569 u32 inbound_intr_mask; /*0028h*/
563 u32 outbound_msg_1; /*001Ch */
564 570
565 u32 inbound_doorbell; /*0020h */ 571 u32 outbound_doorbell; /*002Ch*/
566 u32 inbound_intr_status; /*0024h */ 572 u32 outbound_intr_status; /*0030h*/
567 u32 inbound_intr_mask; /*0028h */ 573 u32 outbound_intr_mask; /*0034h*/
568 574
569 u32 outbound_doorbell; /*002Ch */ 575 u32 reserved_1[2]; /*0038h*/
570 u32 outbound_intr_status; /*0030h */
571 u32 outbound_intr_mask; /*0034h */
572 576
573 u32 reserved_1[2]; /*0038h */ 577 u32 inbound_queue_port; /*0040h*/
578 u32 outbound_queue_port; /*0044h*/
574 579
575 u32 inbound_queue_port; /*0040h */ 580 u32 reserved_2[22]; /*0048h*/
576 u32 outbound_queue_port; /*0044h */
577 581
578 u32 reserved_2; /*004Ch */ 582 u32 outbound_doorbell_clear; /*00A0h*/
579 583
580 u32 index_registers[1004]; /*0050h */ 584 u32 reserved_3[3]; /*00A4h*/
585
586 u32 outbound_scratch_pad ; /*00B0h*/
587
588 u32 reserved_4[3]; /*00B4h*/
589
590 u32 inbound_low_queue_port ; /*00C0h*/
591
592 u32 inbound_high_queue_port ; /*00C4h*/
593
594 u32 reserved_5; /*00C8h*/
595 u32 index_registers[820]; /*00CCh*/
581 596
582} __attribute__ ((packed)); 597} __attribute__ ((packed));
583 598
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index b17ee62dd1a9..92b3e13e9061 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -7,7 +7,6 @@
7#include "qla_def.h" 7#include "qla_def.h"
8 8
9#include <linux/vmalloc.h> 9#include <linux/vmalloc.h>
10#include <scsi/scsi_transport_fc.h>
11 10
12/* SYSFS attributes --------------------------------------------------------- */ 11/* SYSFS attributes --------------------------------------------------------- */
13 12
@@ -114,7 +113,7 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off,
114 struct device, kobj))); 113 struct device, kobj)));
115 unsigned long flags; 114 unsigned long flags;
116 115
117 if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size) 116 if (!capable(CAP_SYS_ADMIN) || off != 0)
118 return 0; 117 return 0;
119 118
120 /* Read NVRAM. */ 119 /* Read NVRAM. */
@@ -123,7 +122,7 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off,
123 ha->nvram_size); 122 ha->nvram_size);
124 spin_unlock_irqrestore(&ha->hardware_lock, flags); 123 spin_unlock_irqrestore(&ha->hardware_lock, flags);
125 124
126 return (count); 125 return ha->nvram_size;
127} 126}
128 127
129static ssize_t 128static ssize_t
@@ -175,19 +174,150 @@ static struct bin_attribute sysfs_nvram_attr = {
175 .mode = S_IRUSR | S_IWUSR, 174 .mode = S_IRUSR | S_IWUSR,
176 .owner = THIS_MODULE, 175 .owner = THIS_MODULE,
177 }, 176 },
178 .size = 0, 177 .size = 512,
179 .read = qla2x00_sysfs_read_nvram, 178 .read = qla2x00_sysfs_read_nvram,
180 .write = qla2x00_sysfs_write_nvram, 179 .write = qla2x00_sysfs_write_nvram,
181}; 180};
182 181
182static ssize_t
183qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off,
184 size_t count)
185{
186 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
187 struct device, kobj)));
188
189 if (ha->optrom_state != QLA_SREADING)
190 return 0;
191 if (off > ha->optrom_size)
192 return 0;
193 if (off + count > ha->optrom_size)
194 count = ha->optrom_size - off;
195
196 memcpy(buf, &ha->optrom_buffer[off], count);
197
198 return count;
199}
200
201static ssize_t
202qla2x00_sysfs_write_optrom(struct kobject *kobj, char *buf, loff_t off,
203 size_t count)
204{
205 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
206 struct device, kobj)));
207
208 if (ha->optrom_state != QLA_SWRITING)
209 return -EINVAL;
210 if (off > ha->optrom_size)
211 return -ERANGE;
212 if (off + count > ha->optrom_size)
213 count = ha->optrom_size - off;
214
215 memcpy(&ha->optrom_buffer[off], buf, count);
216
217 return count;
218}
219
220static struct bin_attribute sysfs_optrom_attr = {
221 .attr = {
222 .name = "optrom",
223 .mode = S_IRUSR | S_IWUSR,
224 .owner = THIS_MODULE,
225 },
226 .size = OPTROM_SIZE_24XX,
227 .read = qla2x00_sysfs_read_optrom,
228 .write = qla2x00_sysfs_write_optrom,
229};
230
231static ssize_t
232qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, char *buf, loff_t off,
233 size_t count)
234{
235 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
236 struct device, kobj)));
237 int val;
238
239 if (off)
240 return 0;
241
242 if (sscanf(buf, "%d", &val) != 1)
243 return -EINVAL;
244
245 switch (val) {
246 case 0:
247 if (ha->optrom_state != QLA_SREADING &&
248 ha->optrom_state != QLA_SWRITING)
249 break;
250
251 ha->optrom_state = QLA_SWAITING;
252 vfree(ha->optrom_buffer);
253 ha->optrom_buffer = NULL;
254 break;
255 case 1:
256 if (ha->optrom_state != QLA_SWAITING)
257 break;
258
259 ha->optrom_state = QLA_SREADING;
260 ha->optrom_buffer = (uint8_t *)vmalloc(ha->optrom_size);
261 if (ha->optrom_buffer == NULL) {
262 qla_printk(KERN_WARNING, ha,
263 "Unable to allocate memory for optrom retrieval "
264 "(%x).\n", ha->optrom_size);
265
266 ha->optrom_state = QLA_SWAITING;
267 return count;
268 }
269
270 memset(ha->optrom_buffer, 0, ha->optrom_size);
271 ha->isp_ops.read_optrom(ha, ha->optrom_buffer, 0,
272 ha->optrom_size);
273 break;
274 case 2:
275 if (ha->optrom_state != QLA_SWAITING)
276 break;
277
278 ha->optrom_state = QLA_SWRITING;
279 ha->optrom_buffer = (uint8_t *)vmalloc(ha->optrom_size);
280 if (ha->optrom_buffer == NULL) {
281 qla_printk(KERN_WARNING, ha,
282 "Unable to allocate memory for optrom update "
283 "(%x).\n", ha->optrom_size);
284
285 ha->optrom_state = QLA_SWAITING;
286 return count;
287 }
288 memset(ha->optrom_buffer, 0, ha->optrom_size);
289 break;
290 case 3:
291 if (ha->optrom_state != QLA_SWRITING)
292 break;
293
294 ha->isp_ops.write_optrom(ha, ha->optrom_buffer, 0,
295 ha->optrom_size);
296 break;
297 }
298 return count;
299}
300
301static struct bin_attribute sysfs_optrom_ctl_attr = {
302 .attr = {
303 .name = "optrom_ctl",
304 .mode = S_IWUSR,
305 .owner = THIS_MODULE,
306 },
307 .size = 0,
308 .write = qla2x00_sysfs_write_optrom_ctl,
309};
310
183void 311void
184qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha) 312qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha)
185{ 313{
186 struct Scsi_Host *host = ha->host; 314 struct Scsi_Host *host = ha->host;
187 315
188 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); 316 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
189 sysfs_nvram_attr.size = ha->nvram_size;
190 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); 317 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
318 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr);
319 sysfs_create_bin_file(&host->shost_gendev.kobj,
320 &sysfs_optrom_ctl_attr);
191} 321}
192 322
193void 323void
@@ -197,6 +327,12 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *ha)
197 327
198 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); 328 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
199 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); 329 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
330 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr);
331 sysfs_remove_bin_file(&host->shost_gendev.kobj,
332 &sysfs_optrom_ctl_attr);
333
334 if (ha->beacon_blink_led == 1)
335 ha->isp_ops.beacon_off(ha);
200} 336}
201 337
202/* Scsi_Host attributes. */ 338/* Scsi_Host attributes. */
@@ -384,6 +520,50 @@ qla2x00_zio_timer_store(struct class_device *cdev, const char *buf,
384 return strlen(buf); 520 return strlen(buf);
385} 521}
386 522
523static ssize_t
524qla2x00_beacon_show(struct class_device *cdev, char *buf)
525{
526 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
527 int len = 0;
528
529 if (ha->beacon_blink_led)
530 len += snprintf(buf + len, PAGE_SIZE-len, "Enabled\n");
531 else
532 len += snprintf(buf + len, PAGE_SIZE-len, "Disabled\n");
533 return len;
534}
535
536static ssize_t
537qla2x00_beacon_store(struct class_device *cdev, const char *buf,
538 size_t count)
539{
540 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
541 int val = 0;
542 int rval;
543
544 if (IS_QLA2100(ha) || IS_QLA2200(ha))
545 return -EPERM;
546
547 if (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) {
548 qla_printk(KERN_WARNING, ha,
549 "Abort ISP active -- ignoring beacon request.\n");
550 return -EBUSY;
551 }
552
553 if (sscanf(buf, "%d", &val) != 1)
554 return -EINVAL;
555
556 if (val)
557 rval = ha->isp_ops.beacon_on(ha);
558 else
559 rval = ha->isp_ops.beacon_off(ha);
560
561 if (rval != QLA_SUCCESS)
562 count = 0;
563
564 return count;
565}
566
387static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, 567static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show,
388 NULL); 568 NULL);
389static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); 569static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL);
@@ -398,6 +578,8 @@ static CLASS_DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show,
398 qla2x00_zio_store); 578 qla2x00_zio_store);
399static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, 579static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show,
400 qla2x00_zio_timer_store); 580 qla2x00_zio_timer_store);
581static CLASS_DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show,
582 qla2x00_beacon_store);
401 583
402struct class_device_attribute *qla2x00_host_attrs[] = { 584struct class_device_attribute *qla2x00_host_attrs[] = {
403 &class_device_attr_driver_version, 585 &class_device_attr_driver_version,
@@ -411,6 +593,7 @@ struct class_device_attribute *qla2x00_host_attrs[] = {
411 &class_device_attr_state, 593 &class_device_attr_state,
412 &class_device_attr_zio, 594 &class_device_attr_zio,
413 &class_device_attr_zio_timer, 595 &class_device_attr_zio_timer,
596 &class_device_attr_beacon,
414 NULL, 597 NULL,
415}; 598};
416 599
@@ -426,6 +609,49 @@ qla2x00_get_host_port_id(struct Scsi_Host *shost)
426} 609}
427 610
428static void 611static void
612qla2x00_get_host_speed(struct Scsi_Host *shost)
613{
614 scsi_qla_host_t *ha = to_qla_host(shost);
615 uint32_t speed = 0;
616
617 switch (ha->link_data_rate) {
618 case LDR_1GB:
619 speed = 1;
620 break;
621 case LDR_2GB:
622 speed = 2;
623 break;
624 case LDR_4GB:
625 speed = 4;
626 break;
627 }
628 fc_host_speed(shost) = speed;
629}
630
631static void
632qla2x00_get_host_port_type(struct Scsi_Host *shost)
633{
634 scsi_qla_host_t *ha = to_qla_host(shost);
635 uint32_t port_type = FC_PORTTYPE_UNKNOWN;
636
637 switch (ha->current_topology) {
638 case ISP_CFG_NL:
639 port_type = FC_PORTTYPE_LPORT;
640 break;
641 case ISP_CFG_FL:
642 port_type = FC_PORTTYPE_NLPORT;
643 break;
644 case ISP_CFG_N:
645 port_type = FC_PORTTYPE_PTP;
646 break;
647 case ISP_CFG_F:
648 port_type = FC_PORTTYPE_NPORT;
649 break;
650 }
651 fc_host_port_type(shost) = port_type;
652}
653
654static void
429qla2x00_get_starget_node_name(struct scsi_target *starget) 655qla2x00_get_starget_node_name(struct scsi_target *starget)
430{ 656{
431 struct Scsi_Host *host = dev_to_shost(starget->dev.parent); 657 struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
@@ -512,6 +738,41 @@ qla2x00_issue_lip(struct Scsi_Host *shost)
512 return 0; 738 return 0;
513} 739}
514 740
741static struct fc_host_statistics *
742qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
743{
744 scsi_qla_host_t *ha = to_qla_host(shost);
745 int rval;
746 uint16_t mb_stat[1];
747 link_stat_t stat_buf;
748 struct fc_host_statistics *pfc_host_stat;
749
750 pfc_host_stat = &ha->fc_host_stat;
751 memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics));
752
753 if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
754 rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf,
755 sizeof(stat_buf) / 4, mb_stat);
756 } else {
757 rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf,
758 mb_stat);
759 }
760 if (rval != 0) {
761 qla_printk(KERN_WARNING, ha,
762 "Unable to retrieve host statistics (%d).\n", mb_stat[0]);
763 return pfc_host_stat;
764 }
765
766 pfc_host_stat->link_failure_count = stat_buf.link_fail_cnt;
767 pfc_host_stat->loss_of_sync_count = stat_buf.loss_sync_cnt;
768 pfc_host_stat->loss_of_signal_count = stat_buf.loss_sig_cnt;
769 pfc_host_stat->prim_seq_protocol_err_count = stat_buf.prim_seq_err_cnt;
770 pfc_host_stat->invalid_tx_word_count = stat_buf.inval_xmit_word_cnt;
771 pfc_host_stat->invalid_crc_count = stat_buf.inval_crc_cnt;
772
773 return pfc_host_stat;
774}
775
515struct fc_function_template qla2xxx_transport_functions = { 776struct fc_function_template qla2xxx_transport_functions = {
516 777
517 .show_host_node_name = 1, 778 .show_host_node_name = 1,
@@ -520,6 +781,10 @@ struct fc_function_template qla2xxx_transport_functions = {
520 781
521 .get_host_port_id = qla2x00_get_host_port_id, 782 .get_host_port_id = qla2x00_get_host_port_id,
522 .show_host_port_id = 1, 783 .show_host_port_id = 1,
784 .get_host_speed = qla2x00_get_host_speed,
785 .show_host_speed = 1,
786 .get_host_port_type = qla2x00_get_host_port_type,
787 .show_host_port_type = 1,
523 788
524 .dd_fcrport_size = sizeof(struct fc_port *), 789 .dd_fcrport_size = sizeof(struct fc_port *),
525 .show_rport_supported_classes = 1, 790 .show_rport_supported_classes = 1,
@@ -536,6 +801,7 @@ struct fc_function_template qla2xxx_transport_functions = {
536 .show_rport_dev_loss_tmo = 1, 801 .show_rport_dev_loss_tmo = 1,
537 802
538 .issue_fc_host_lip = qla2x00_issue_lip, 803 .issue_fc_host_lip = qla2x00_issue_lip,
804 .get_fc_host_stats = qla2x00_get_fc_host_stats,
539}; 805};
540 806
541void 807void
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index bad066e5772a..b31a03bbd14f 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -29,6 +29,7 @@
29#include <scsi/scsi_host.h> 29#include <scsi/scsi_host.h>
30#include <scsi/scsi_device.h> 30#include <scsi/scsi_device.h>
31#include <scsi/scsi_cmnd.h> 31#include <scsi/scsi_cmnd.h>
32#include <scsi/scsi_transport_fc.h>
32 33
33#if defined(CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE) 34#if defined(CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE)
34#if defined(CONFIG_SCSI_QLA21XX) || defined(CONFIG_SCSI_QLA21XX_MODULE) 35#if defined(CONFIG_SCSI_QLA21XX) || defined(CONFIG_SCSI_QLA21XX_MODULE)
@@ -181,6 +182,13 @@
181#define WRT_REG_DWORD(addr, data) writel(data,addr) 182#define WRT_REG_DWORD(addr, data) writel(data,addr)
182 183
183/* 184/*
185 * The ISP2312 v2 chip cannot access the FLASH/GPIO registers via MMIO in an
186 * 133Mhz slot.
187 */
188#define RD_REG_WORD_PIO(addr) (inw((unsigned long)addr))
189#define WRT_REG_WORD_PIO(addr, data) (outw(data,(unsigned long)addr))
190
191/*
184 * Fibre Channel device definitions. 192 * Fibre Channel device definitions.
185 */ 193 */
186#define WWN_SIZE 8 /* Size of WWPN, WWN & WWNN */ 194#define WWN_SIZE 8 /* Size of WWPN, WWN & WWNN */
@@ -432,6 +440,9 @@ struct device_reg_2xxx {
432#define GPIO_LED_GREEN_ON_AMBER_OFF 0x0040 440#define GPIO_LED_GREEN_ON_AMBER_OFF 0x0040
433#define GPIO_LED_GREEN_OFF_AMBER_ON 0x0080 441#define GPIO_LED_GREEN_OFF_AMBER_ON 0x0080
434#define GPIO_LED_GREEN_ON_AMBER_ON 0x00C0 442#define GPIO_LED_GREEN_ON_AMBER_ON 0x00C0
443#define GPIO_LED_ALL_OFF 0x0000
444#define GPIO_LED_RED_ON_OTHER_OFF 0x0001 /* isp2322 */
445#define GPIO_LED_RGA_ON 0x00C1 /* isp2322: red green amber */
435 446
436 union { 447 union {
437 struct { 448 struct {
@@ -2199,6 +2210,15 @@ struct isp_operations {
2199 2210
2200 void (*fw_dump) (struct scsi_qla_host *, int); 2211 void (*fw_dump) (struct scsi_qla_host *, int);
2201 void (*ascii_fw_dump) (struct scsi_qla_host *); 2212 void (*ascii_fw_dump) (struct scsi_qla_host *);
2213
2214 int (*beacon_on) (struct scsi_qla_host *);
2215 int (*beacon_off) (struct scsi_qla_host *);
2216 void (*beacon_blink) (struct scsi_qla_host *);
2217
2218 uint8_t * (*read_optrom) (struct scsi_qla_host *, uint8_t *,
2219 uint32_t, uint32_t);
2220 int (*write_optrom) (struct scsi_qla_host *, uint8_t *, uint32_t,
2221 uint32_t);
2202}; 2222};
2203 2223
2204/* 2224/*
@@ -2331,6 +2351,10 @@ typedef struct scsi_qla_host {
2331 uint16_t min_external_loopid; /* First external loop Id */ 2351 uint16_t min_external_loopid; /* First external loop Id */
2332 2352
2333 uint16_t link_data_rate; /* F/W operating speed */ 2353 uint16_t link_data_rate; /* F/W operating speed */
2354#define LDR_1GB 0
2355#define LDR_2GB 1
2356#define LDR_4GB 3
2357#define LDR_UNKNOWN 0xFFFF
2334 2358
2335 uint8_t current_topology; 2359 uint8_t current_topology;
2336 uint8_t prev_topology; 2360 uint8_t prev_topology;
@@ -2486,12 +2510,26 @@ typedef struct scsi_qla_host {
2486 uint8_t *port_name; 2510 uint8_t *port_name;
2487 uint32_t isp_abort_cnt; 2511 uint32_t isp_abort_cnt;
2488 2512
2513 /* Option ROM information. */
2514 char *optrom_buffer;
2515 uint32_t optrom_size;
2516 int optrom_state;
2517#define QLA_SWAITING 0
2518#define QLA_SREADING 1
2519#define QLA_SWRITING 2
2520
2489 /* Needed for BEACON */ 2521 /* Needed for BEACON */
2490 uint16_t beacon_blink_led; 2522 uint16_t beacon_blink_led;
2491 uint16_t beacon_green_on; 2523 uint8_t beacon_color_state;
2524#define QLA_LED_GRN_ON 0x01
2525#define QLA_LED_YLW_ON 0x02
2526#define QLA_LED_ABR_ON 0x04
2527#define QLA_LED_ALL_ON 0x07 /* yellow, green, amber. */
2528 /* ISP2322: red, green, amber. */
2492 2529
2493 uint16_t zio_mode; 2530 uint16_t zio_mode;
2494 uint16_t zio_timer; 2531 uint16_t zio_timer;
2532 struct fc_host_statistics fc_host_stat;
2495} scsi_qla_host_t; 2533} scsi_qla_host_t;
2496 2534
2497 2535
@@ -2557,7 +2595,9 @@ struct _qla2x00stats {
2557/* 2595/*
2558 * Flash support definitions 2596 * Flash support definitions
2559 */ 2597 */
2560#define FLASH_IMAGE_SIZE 131072 2598#define OPTROM_SIZE_2300 0x20000
2599#define OPTROM_SIZE_2322 0x100000
2600#define OPTROM_SIZE_24XX 0x100000
2561 2601
2562#include "qla_gbl.h" 2602#include "qla_gbl.h"
2563#include "qla_dbg.h" 2603#include "qla_dbg.h"
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 35266bd5d538..ffdc2680f049 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -75,12 +75,12 @@ extern void qla2x00_cmd_timeout(srb_t *);
75extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int); 75extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int);
76extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int); 76extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int);
77 77
78extern void qla2x00_blink_led(scsi_qla_host_t *);
79
80extern int qla2x00_down_timeout(struct semaphore *, unsigned long); 78extern int qla2x00_down_timeout(struct semaphore *, unsigned long);
81 79
82extern struct fw_blob *qla2x00_request_firmware(scsi_qla_host_t *); 80extern struct fw_blob *qla2x00_request_firmware(scsi_qla_host_t *);
83 81
82extern int qla2x00_wait_for_hba_online(scsi_qla_host_t *);
83
84/* 84/*
85 * Global Function Prototypes in qla_iocb.c source file. 85 * Global Function Prototypes in qla_iocb.c source file.
86 */ 86 */
@@ -185,6 +185,13 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *, uint16_t *, uint16_t *, uint16_t *,
185extern int 185extern int
186qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map); 186qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map);
187 187
188extern int
189qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, link_stat_t *,
190 uint16_t *);
191
192extern int
193qla24xx_get_isp_stats(scsi_qla_host_t *, uint32_t *, uint32_t, uint16_t *);
194
188extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *); 195extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *);
189extern int qla24xx_abort_target(fc_port_t *); 196extern int qla24xx_abort_target(fc_port_t *);
190 197
@@ -228,6 +235,22 @@ extern int qla2x00_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t,
228extern int qla24xx_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, 235extern int qla24xx_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t,
229 uint32_t); 236 uint32_t);
230 237
238extern int qla2x00_beacon_on(struct scsi_qla_host *);
239extern int qla2x00_beacon_off(struct scsi_qla_host *);
240extern void qla2x00_beacon_blink(struct scsi_qla_host *);
241extern int qla24xx_beacon_on(struct scsi_qla_host *);
242extern int qla24xx_beacon_off(struct scsi_qla_host *);
243extern void qla24xx_beacon_blink(struct scsi_qla_host *);
244
245extern uint8_t *qla2x00_read_optrom_data(struct scsi_qla_host *, uint8_t *,
246 uint32_t, uint32_t);
247extern int qla2x00_write_optrom_data(struct scsi_qla_host *, uint8_t *,
248 uint32_t, uint32_t);
249extern uint8_t *qla24xx_read_optrom_data(struct scsi_qla_host *, uint8_t *,
250 uint32_t, uint32_t);
251extern int qla24xx_write_optrom_data(struct scsi_qla_host *, uint8_t *,
252 uint32_t, uint32_t);
253
231/* 254/*
232 * Global Function Prototypes in qla_dbg.c source file. 255 * Global Function Prototypes in qla_dbg.c source file.
233 */ 256 */
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index e67bb0997818..634ee174bff2 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -8,7 +8,6 @@
8 8
9#include <linux/delay.h> 9#include <linux/delay.h>
10#include <linux/vmalloc.h> 10#include <linux/vmalloc.h>
11#include <scsi/scsi_transport_fc.h>
12 11
13#include "qla_devtbl.h" 12#include "qla_devtbl.h"
14 13
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 7ec0b8d6f07b..6544b6d0891d 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -814,6 +814,7 @@ qla24xx_start_scsi(srb_t *sp)
814 cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain; 814 cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain;
815 815
816 int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); 816 int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun);
817 host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
817 818
818 /* Load SCSI command packet. */ 819 /* Load SCSI command packet. */
819 memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len); 820 memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len);
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 71a46fcee8cc..42aa7a7c1a73 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -402,9 +402,9 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
402 break; 402 break;
403 403
404 case MBA_LOOP_UP: /* Loop Up Event */ 404 case MBA_LOOP_UP: /* Loop Up Event */
405 ha->link_data_rate = 0;
406 if (IS_QLA2100(ha) || IS_QLA2200(ha)) { 405 if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
407 link_speed = link_speeds[0]; 406 link_speed = link_speeds[0];
407 ha->link_data_rate = LDR_1GB;
408 } else { 408 } else {
409 link_speed = link_speeds[LS_UNKNOWN]; 409 link_speed = link_speeds[LS_UNKNOWN];
410 if (mb[1] < 5) 410 if (mb[1] < 5)
@@ -436,7 +436,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
436 } 436 }
437 437
438 ha->flags.management_server_logged_in = 0; 438 ha->flags.management_server_logged_in = 0;
439 ha->link_data_rate = 0; 439 ha->link_data_rate = LDR_UNKNOWN;
440 if (ql2xfdmienable) 440 if (ql2xfdmienable)
441 set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags); 441 set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags);
442 442
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 3099b379de9d..363dfdd042b0 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -7,7 +7,6 @@
7#include "qla_def.h" 7#include "qla_def.h"
8 8
9#include <linux/delay.h> 9#include <linux/delay.h>
10#include <scsi/scsi_transport_fc.h>
11 10
12static void 11static void
13qla2x00_mbx_sem_timeout(unsigned long data) 12qla2x00_mbx_sem_timeout(unsigned long data)
@@ -1874,7 +1873,8 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma,
1874 mcp->mb[3] = LSW(id_list_dma); 1873 mcp->mb[3] = LSW(id_list_dma);
1875 mcp->mb[6] = MSW(MSD(id_list_dma)); 1874 mcp->mb[6] = MSW(MSD(id_list_dma));
1876 mcp->mb[7] = LSW(MSD(id_list_dma)); 1875 mcp->mb[7] = LSW(MSD(id_list_dma));
1877 mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2; 1876 mcp->mb[8] = 0;
1877 mcp->out_mb |= MBX_8|MBX_7|MBX_6|MBX_3|MBX_2;
1878 } else { 1878 } else {
1879 mcp->mb[1] = MSW(id_list_dma); 1879 mcp->mb[1] = MSW(id_list_dma);
1880 mcp->mb[2] = LSW(id_list_dma); 1880 mcp->mb[2] = LSW(id_list_dma);
@@ -2017,8 +2017,109 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map)
2017 2017
2018 return rval; 2018 return rval;
2019} 2019}
2020#endif
2021
2022/*
2023 * qla2x00_get_link_status
2024 *
2025 * Input:
2026 * ha = adapter block pointer.
2027 * loop_id = device loop ID.
2028 * ret_buf = pointer to link status return buffer.
2029 *
2030 * Returns:
2031 * 0 = success.
2032 * BIT_0 = mem alloc error.
2033 * BIT_1 = mailbox error.
2034 */
2035int
2036qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id,
2037 link_stat_t *ret_buf, uint16_t *status)
2038{
2039 int rval;
2040 mbx_cmd_t mc;
2041 mbx_cmd_t *mcp = &mc;
2042 link_stat_t *stat_buf;
2043 dma_addr_t stat_buf_dma;
2044
2045 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
2046
2047 stat_buf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &stat_buf_dma);
2048 if (stat_buf == NULL) {
2049 DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n",
2050 __func__, ha->host_no));
2051 return BIT_0;
2052 }
2053 memset(stat_buf, 0, sizeof(link_stat_t));
2054
2055 mcp->mb[0] = MBC_GET_LINK_STATUS;
2056 mcp->mb[2] = MSW(stat_buf_dma);
2057 mcp->mb[3] = LSW(stat_buf_dma);
2058 mcp->mb[6] = MSW(MSD(stat_buf_dma));
2059 mcp->mb[7] = LSW(MSD(stat_buf_dma));
2060 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
2061 mcp->in_mb = MBX_0;
2062 if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
2063 mcp->mb[1] = loop_id;
2064 mcp->mb[4] = 0;
2065 mcp->mb[10] = 0;
2066 mcp->out_mb |= MBX_10|MBX_4|MBX_1;
2067 mcp->in_mb |= MBX_1;
2068 } else if (HAS_EXTENDED_IDS(ha)) {
2069 mcp->mb[1] = loop_id;
2070 mcp->mb[10] = 0;
2071 mcp->out_mb |= MBX_10|MBX_1;
2072 } else {
2073 mcp->mb[1] = loop_id << 8;
2074 mcp->out_mb |= MBX_1;
2075 }
2076 mcp->tov = 30;
2077 mcp->flags = IOCTL_CMD;
2078 rval = qla2x00_mailbox_command(ha, mcp);
2079
2080 if (rval == QLA_SUCCESS) {
2081 if (mcp->mb[0] != MBS_COMMAND_COMPLETE) {
2082 DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n",
2083 __func__, ha->host_no, mcp->mb[0]);)
2084 status[0] = mcp->mb[0];
2085 rval = BIT_1;
2086 } else {
2087 /* copy over data -- firmware data is LE. */
2088 ret_buf->link_fail_cnt =
2089 le32_to_cpu(stat_buf->link_fail_cnt);
2090 ret_buf->loss_sync_cnt =
2091 le32_to_cpu(stat_buf->loss_sync_cnt);
2092 ret_buf->loss_sig_cnt =
2093 le32_to_cpu(stat_buf->loss_sig_cnt);
2094 ret_buf->prim_seq_err_cnt =
2095 le32_to_cpu(stat_buf->prim_seq_err_cnt);
2096 ret_buf->inval_xmit_word_cnt =
2097 le32_to_cpu(stat_buf->inval_xmit_word_cnt);
2098 ret_buf->inval_crc_cnt =
2099 le32_to_cpu(stat_buf->inval_crc_cnt);
2100
2101 DEBUG11(printk("%s(%ld): stat dump: fail_cnt=%d "
2102 "loss_sync=%d loss_sig=%d seq_err=%d "
2103 "inval_xmt_word=%d inval_crc=%d.\n", __func__,
2104 ha->host_no, stat_buf->link_fail_cnt,
2105 stat_buf->loss_sync_cnt, stat_buf->loss_sig_cnt,
2106 stat_buf->prim_seq_err_cnt,
2107 stat_buf->inval_xmit_word_cnt,
2108 stat_buf->inval_crc_cnt);)
2109 }
2110 } else {
2111 /* Failed. */
2112 DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
2113 ha->host_no, rval);)
2114 rval = BIT_1;
2115 }
2116
2117 dma_pool_free(ha->s_dma_pool, stat_buf, stat_buf_dma);
2020 2118
2021uint8_t 2119 return rval;
2120}
2121
2122int
2022qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords, 2123qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords,
2023 uint16_t *status) 2124 uint16_t *status)
2024{ 2125{
@@ -2080,7 +2181,6 @@ qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords,
2080 2181
2081 return rval; 2182 return rval;
2082} 2183}
2083#endif
2084 2184
2085int 2185int
2086qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp) 2186qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp)
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 5866a7c706a8..9f91f1a20542 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -366,6 +366,12 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
366 goto qc_fail_command; 366 goto qc_fail_command;
367 } 367 }
368 368
369 /* Close window on fcport/rport state-transitioning. */
370 if (!*(fc_port_t **)rport->dd_data) {
371 cmd->result = DID_IMM_RETRY << 16;
372 goto qc_fail_command;
373 }
374
369 if (atomic_read(&fcport->state) != FCS_ONLINE) { 375 if (atomic_read(&fcport->state) != FCS_ONLINE) {
370 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || 376 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
371 atomic_read(&ha->loop_state) == LOOP_DEAD) { 377 atomic_read(&ha->loop_state) == LOOP_DEAD) {
@@ -421,6 +427,12 @@ qla24xx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
421 goto qc24_fail_command; 427 goto qc24_fail_command;
422 } 428 }
423 429
430 /* Close window on fcport/rport state-transitioning. */
431 if (!*(fc_port_t **)rport->dd_data) {
432 cmd->result = DID_IMM_RETRY << 16;
433 goto qc24_fail_command;
434 }
435
424 if (atomic_read(&fcport->state) != FCS_ONLINE) { 436 if (atomic_read(&fcport->state) != FCS_ONLINE) {
425 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || 437 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
426 atomic_read(&ha->loop_state) == LOOP_DEAD) { 438 atomic_read(&ha->loop_state) == LOOP_DEAD) {
@@ -513,7 +525,7 @@ qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
513 * Success (Adapter is online) : 0 525 * Success (Adapter is online) : 0
514 * Failed (Adapter is offline/disabled) : 1 526 * Failed (Adapter is offline/disabled) : 1
515 */ 527 */
516static int 528int
517qla2x00_wait_for_hba_online(scsi_qla_host_t *ha) 529qla2x00_wait_for_hba_online(scsi_qla_host_t *ha)
518{ 530{
519 int return_status; 531 int return_status;
@@ -1312,6 +1324,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1312 ha->ports = MAX_BUSES; 1324 ha->ports = MAX_BUSES;
1313 ha->init_cb_size = sizeof(init_cb_t); 1325 ha->init_cb_size = sizeof(init_cb_t);
1314 ha->mgmt_svr_loop_id = MANAGEMENT_SERVER; 1326 ha->mgmt_svr_loop_id = MANAGEMENT_SERVER;
1327 ha->link_data_rate = LDR_UNKNOWN;
1328 ha->optrom_size = OPTROM_SIZE_2300;
1315 1329
1316 /* Assign ISP specific operations. */ 1330 /* Assign ISP specific operations. */
1317 ha->isp_ops.pci_config = qla2100_pci_config; 1331 ha->isp_ops.pci_config = qla2100_pci_config;
@@ -1339,6 +1353,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1339 ha->isp_ops.write_nvram = qla2x00_write_nvram_data; 1353 ha->isp_ops.write_nvram = qla2x00_write_nvram_data;
1340 ha->isp_ops.fw_dump = qla2100_fw_dump; 1354 ha->isp_ops.fw_dump = qla2100_fw_dump;
1341 ha->isp_ops.ascii_fw_dump = qla2100_ascii_fw_dump; 1355 ha->isp_ops.ascii_fw_dump = qla2100_ascii_fw_dump;
1356 ha->isp_ops.read_optrom = qla2x00_read_optrom_data;
1357 ha->isp_ops.write_optrom = qla2x00_write_optrom_data;
1342 if (IS_QLA2100(ha)) { 1358 if (IS_QLA2100(ha)) {
1343 host->max_id = MAX_TARGETS_2100; 1359 host->max_id = MAX_TARGETS_2100;
1344 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; 1360 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100;
@@ -1364,7 +1380,12 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1364 ha->isp_ops.intr_handler = qla2300_intr_handler; 1380 ha->isp_ops.intr_handler = qla2300_intr_handler;
1365 ha->isp_ops.fw_dump = qla2300_fw_dump; 1381 ha->isp_ops.fw_dump = qla2300_fw_dump;
1366 ha->isp_ops.ascii_fw_dump = qla2300_ascii_fw_dump; 1382 ha->isp_ops.ascii_fw_dump = qla2300_ascii_fw_dump;
1383 ha->isp_ops.beacon_on = qla2x00_beacon_on;
1384 ha->isp_ops.beacon_off = qla2x00_beacon_off;
1385 ha->isp_ops.beacon_blink = qla2x00_beacon_blink;
1367 ha->gid_list_info_size = 6; 1386 ha->gid_list_info_size = 6;
1387 if (IS_QLA2322(ha) || IS_QLA6322(ha))
1388 ha->optrom_size = OPTROM_SIZE_2322;
1368 } else if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { 1389 } else if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
1369 host->max_id = MAX_TARGETS_2200; 1390 host->max_id = MAX_TARGETS_2200;
1370 ha->mbx_count = MAILBOX_REGISTER_COUNT; 1391 ha->mbx_count = MAILBOX_REGISTER_COUNT;
@@ -1400,7 +1421,13 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1400 ha->isp_ops.write_nvram = qla24xx_write_nvram_data; 1421 ha->isp_ops.write_nvram = qla24xx_write_nvram_data;
1401 ha->isp_ops.fw_dump = qla24xx_fw_dump; 1422 ha->isp_ops.fw_dump = qla24xx_fw_dump;
1402 ha->isp_ops.ascii_fw_dump = qla24xx_ascii_fw_dump; 1423 ha->isp_ops.ascii_fw_dump = qla24xx_ascii_fw_dump;
1424 ha->isp_ops.read_optrom = qla24xx_read_optrom_data;
1425 ha->isp_ops.write_optrom = qla24xx_write_optrom_data;
1426 ha->isp_ops.beacon_on = qla24xx_beacon_on;
1427 ha->isp_ops.beacon_off = qla24xx_beacon_off;
1428 ha->isp_ops.beacon_blink = qla24xx_beacon_blink;
1403 ha->gid_list_info_size = 8; 1429 ha->gid_list_info_size = 8;
1430 ha->optrom_size = OPTROM_SIZE_24XX;
1404 } 1431 }
1405 host->can_queue = ha->request_q_length + 128; 1432 host->can_queue = ha->request_q_length + 128;
1406 1433
@@ -1657,11 +1684,13 @@ qla2x00_schedule_rport_del(struct scsi_qla_host *ha, fc_port_t *fcport,
1657 spin_lock_irqsave(&fcport->rport_lock, flags); 1684 spin_lock_irqsave(&fcport->rport_lock, flags);
1658 fcport->drport = rport; 1685 fcport->drport = rport;
1659 fcport->rport = NULL; 1686 fcport->rport = NULL;
1687 *(fc_port_t **)rport->dd_data = NULL;
1660 spin_unlock_irqrestore(&fcport->rport_lock, flags); 1688 spin_unlock_irqrestore(&fcport->rport_lock, flags);
1661 set_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags); 1689 set_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags);
1662 } else { 1690 } else {
1663 spin_lock_irqsave(&fcport->rport_lock, flags); 1691 spin_lock_irqsave(&fcport->rport_lock, flags);
1664 fcport->rport = NULL; 1692 fcport->rport = NULL;
1693 *(fc_port_t **)rport->dd_data = NULL;
1665 spin_unlock_irqrestore(&fcport->rport_lock, flags); 1694 spin_unlock_irqrestore(&fcport->rport_lock, flags);
1666 fc_remote_port_delete(rport); 1695 fc_remote_port_delete(rport);
1667 } 1696 }
@@ -2066,6 +2095,8 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
2066 ha->fw_dumped = 0; 2095 ha->fw_dumped = 0;
2067 ha->fw_dump_reading = 0; 2096 ha->fw_dump_reading = 0;
2068 ha->fw_dump_buffer = NULL; 2097 ha->fw_dump_buffer = NULL;
2098
2099 vfree(ha->optrom_buffer);
2069} 2100}
2070 2101
2071/* 2102/*
@@ -2314,6 +2345,9 @@ qla2x00_do_dpc(void *data)
2314 if (!ha->interrupts_on) 2345 if (!ha->interrupts_on)
2315 ha->isp_ops.enable_intrs(ha); 2346 ha->isp_ops.enable_intrs(ha);
2316 2347
2348 if (test_and_clear_bit(BEACON_BLINK_NEEDED, &ha->dpc_flags))
2349 ha->isp_ops.beacon_blink(ha);
2350
2317 ha->dpc_active = 0; 2351 ha->dpc_active = 0;
2318 } /* End of while(1) */ 2352 } /* End of while(1) */
2319 2353
@@ -2491,6 +2525,12 @@ qla2x00_timer(scsi_qla_host_t *ha)
2491 atomic_read(&ha->loop_down_timer))); 2525 atomic_read(&ha->loop_down_timer)));
2492 } 2526 }
2493 2527
2528 /* Check if beacon LED needs to be blinked */
2529 if (ha->beacon_blink_led == 1) {
2530 set_bit(BEACON_BLINK_NEEDED, &ha->dpc_flags);
2531 start_dpc++;
2532 }
2533
2494 /* Schedule the DPC routine if needed */ 2534 /* Schedule the DPC routine if needed */
2495 if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || 2535 if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
2496 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || 2536 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) ||
@@ -2499,6 +2539,7 @@ qla2x00_timer(scsi_qla_host_t *ha)
2499 start_dpc || 2539 start_dpc ||
2500 test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags) || 2540 test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags) ||
2501 test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) || 2541 test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) ||
2542 test_bit(BEACON_BLINK_NEEDED, &ha->dpc_flags) ||
2502 test_bit(RELOGIN_NEEDED, &ha->dpc_flags)) && 2543 test_bit(RELOGIN_NEEDED, &ha->dpc_flags)) &&
2503 ha->dpc_wait && !ha->dpc_active) { 2544 ha->dpc_wait && !ha->dpc_active) {
2504 2545
diff --git a/drivers/scsi/qla2xxx/qla_rscn.c b/drivers/scsi/qla2xxx/qla_rscn.c
index 2c3342108dd8..b70bebe18c01 100644
--- a/drivers/scsi/qla2xxx/qla_rscn.c
+++ b/drivers/scsi/qla2xxx/qla_rscn.c
@@ -6,8 +6,6 @@
6 */ 6 */
7#include "qla_def.h" 7#include "qla_def.h"
8 8
9#include <scsi/scsi_transport_fc.h>
10
11/** 9/**
12 * IO descriptor handle definitions. 10 * IO descriptor handle definitions.
13 * 11 *
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index f4d755a643e4..3866a5760f15 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -695,3 +695,966 @@ qla24xx_write_nvram_data(scsi_qla_host_t *ha, uint8_t *buf, uint32_t naddr,
695 695
696 return ret; 696 return ret;
697} 697}
698
699
700static inline void
701qla2x00_flip_colors(scsi_qla_host_t *ha, uint16_t *pflags)
702{
703 if (IS_QLA2322(ha)) {
704 /* Flip all colors. */
705 if (ha->beacon_color_state == QLA_LED_ALL_ON) {
706 /* Turn off. */
707 ha->beacon_color_state = 0;
708 *pflags = GPIO_LED_ALL_OFF;
709 } else {
710 /* Turn on. */
711 ha->beacon_color_state = QLA_LED_ALL_ON;
712 *pflags = GPIO_LED_RGA_ON;
713 }
714 } else {
715 /* Flip green led only. */
716 if (ha->beacon_color_state == QLA_LED_GRN_ON) {
717 /* Turn off. */
718 ha->beacon_color_state = 0;
719 *pflags = GPIO_LED_GREEN_OFF_AMBER_OFF;
720 } else {
721 /* Turn on. */
722 ha->beacon_color_state = QLA_LED_GRN_ON;
723 *pflags = GPIO_LED_GREEN_ON_AMBER_OFF;
724 }
725 }
726}
727
728void
729qla2x00_beacon_blink(struct scsi_qla_host *ha)
730{
731 uint16_t gpio_enable;
732 uint16_t gpio_data;
733 uint16_t led_color = 0;
734 unsigned long flags;
735 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
736
737 if (ha->pio_address)
738 reg = (struct device_reg_2xxx __iomem *)ha->pio_address;
739
740 spin_lock_irqsave(&ha->hardware_lock, flags);
741
742 /* Save the Original GPIOE. */
743 if (ha->pio_address) {
744 gpio_enable = RD_REG_WORD_PIO(&reg->gpioe);
745 gpio_data = RD_REG_WORD_PIO(&reg->gpiod);
746 } else {
747 gpio_enable = RD_REG_WORD(&reg->gpioe);
748 gpio_data = RD_REG_WORD(&reg->gpiod);
749 }
750
751 /* Set the modified gpio_enable values */
752 gpio_enable |= GPIO_LED_MASK;
753
754 if (ha->pio_address) {
755 WRT_REG_WORD_PIO(&reg->gpioe, gpio_enable);
756 } else {
757 WRT_REG_WORD(&reg->gpioe, gpio_enable);
758 RD_REG_WORD(&reg->gpioe);
759 }
760
761 qla2x00_flip_colors(ha, &led_color);
762
763 /* Clear out any previously set LED color. */
764 gpio_data &= ~GPIO_LED_MASK;
765
766 /* Set the new input LED color to GPIOD. */
767 gpio_data |= led_color;
768
769 /* Set the modified gpio_data values */
770 if (ha->pio_address) {
771 WRT_REG_WORD_PIO(&reg->gpiod, gpio_data);
772 } else {
773 WRT_REG_WORD(&reg->gpiod, gpio_data);
774 RD_REG_WORD(&reg->gpiod);
775 }
776
777 spin_unlock_irqrestore(&ha->hardware_lock, flags);
778}
779
780int
781qla2x00_beacon_on(struct scsi_qla_host *ha)
782{
783 uint16_t gpio_enable;
784 uint16_t gpio_data;
785 unsigned long flags;
786 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
787
788 ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING;
789 ha->fw_options[1] |= FO1_DISABLE_GPIO6_7;
790
791 if (qla2x00_set_fw_options(ha, ha->fw_options) != QLA_SUCCESS) {
792 qla_printk(KERN_WARNING, ha,
793 "Unable to update fw options (beacon on).\n");
794 return QLA_FUNCTION_FAILED;
795 }
796
797 if (ha->pio_address)
798 reg = (struct device_reg_2xxx __iomem *)ha->pio_address;
799
800 /* Turn off LEDs. */
801 spin_lock_irqsave(&ha->hardware_lock, flags);
802 if (ha->pio_address) {
803 gpio_enable = RD_REG_WORD_PIO(&reg->gpioe);
804 gpio_data = RD_REG_WORD_PIO(&reg->gpiod);
805 } else {
806 gpio_enable = RD_REG_WORD(&reg->gpioe);
807 gpio_data = RD_REG_WORD(&reg->gpiod);
808 }
809 gpio_enable |= GPIO_LED_MASK;
810
811 /* Set the modified gpio_enable values. */
812 if (ha->pio_address) {
813 WRT_REG_WORD_PIO(&reg->gpioe, gpio_enable);
814 } else {
815 WRT_REG_WORD(&reg->gpioe, gpio_enable);
816 RD_REG_WORD(&reg->gpioe);
817 }
818
819 /* Clear out previously set LED colour. */
820 gpio_data &= ~GPIO_LED_MASK;
821 if (ha->pio_address) {
822 WRT_REG_WORD_PIO(&reg->gpiod, gpio_data);
823 } else {
824 WRT_REG_WORD(&reg->gpiod, gpio_data);
825 RD_REG_WORD(&reg->gpiod);
826 }
827 spin_unlock_irqrestore(&ha->hardware_lock, flags);
828
829 /*
830 * Let the per HBA timer kick off the blinking process based on
831 * the following flags. No need to do anything else now.
832 */
833 ha->beacon_blink_led = 1;
834 ha->beacon_color_state = 0;
835
836 return QLA_SUCCESS;
837}
838
839int
840qla2x00_beacon_off(struct scsi_qla_host *ha)
841{
842 int rval = QLA_SUCCESS;
843
844 ha->beacon_blink_led = 0;
845
846 /* Set the on flag so when it gets flipped it will be off. */
847 if (IS_QLA2322(ha))
848 ha->beacon_color_state = QLA_LED_ALL_ON;
849 else
850 ha->beacon_color_state = QLA_LED_GRN_ON;
851
852 ha->isp_ops.beacon_blink(ha); /* This turns green LED off */
853
854 ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING;
855 ha->fw_options[1] &= ~FO1_DISABLE_GPIO6_7;
856
857 rval = qla2x00_set_fw_options(ha, ha->fw_options);
858 if (rval != QLA_SUCCESS)
859 qla_printk(KERN_WARNING, ha,
860 "Unable to update fw options (beacon off).\n");
861 return rval;
862}
863
864
865static inline void
866qla24xx_flip_colors(scsi_qla_host_t *ha, uint16_t *pflags)
867{
868 /* Flip all colors. */
869 if (ha->beacon_color_state == QLA_LED_ALL_ON) {
870 /* Turn off. */
871 ha->beacon_color_state = 0;
872 *pflags = 0;
873 } else {
874 /* Turn on. */
875 ha->beacon_color_state = QLA_LED_ALL_ON;
876 *pflags = GPDX_LED_YELLOW_ON | GPDX_LED_AMBER_ON;
877 }
878}
879
880void
881qla24xx_beacon_blink(struct scsi_qla_host *ha)
882{
883 uint16_t led_color = 0;
884 uint32_t gpio_data;
885 unsigned long flags;
886 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
887
888 /* Save the Original GPIOD. */
889 spin_lock_irqsave(&ha->hardware_lock, flags);
890 gpio_data = RD_REG_DWORD(&reg->gpiod);
891
892 /* Enable the gpio_data reg for update. */
893 gpio_data |= GPDX_LED_UPDATE_MASK;
894
895 WRT_REG_DWORD(&reg->gpiod, gpio_data);
896 gpio_data = RD_REG_DWORD(&reg->gpiod);
897
898 /* Set the color bits. */
899 qla24xx_flip_colors(ha, &led_color);
900
901 /* Clear out any previously set LED color. */
902 gpio_data &= ~GPDX_LED_COLOR_MASK;
903
904 /* Set the new input LED color to GPIOD. */
905 gpio_data |= led_color;
906
907 /* Set the modified gpio_data values. */
908 WRT_REG_DWORD(&reg->gpiod, gpio_data);
909 gpio_data = RD_REG_DWORD(&reg->gpiod);
910 spin_unlock_irqrestore(&ha->hardware_lock, flags);
911}
912
913int
914qla24xx_beacon_on(struct scsi_qla_host *ha)
915{
916 uint32_t gpio_data;
917 unsigned long flags;
918 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
919
920 if (ha->beacon_blink_led == 0) {
921 /* Enable firmware for update */
922 ha->fw_options[1] |= ADD_FO1_DISABLE_GPIO_LED_CTRL;
923
924 if (qla2x00_set_fw_options(ha, ha->fw_options) != QLA_SUCCESS)
925 return QLA_FUNCTION_FAILED;
926
927 if (qla2x00_get_fw_options(ha, ha->fw_options) !=
928 QLA_SUCCESS) {
929 qla_printk(KERN_WARNING, ha,
930 "Unable to update fw options (beacon on).\n");
931 return QLA_FUNCTION_FAILED;
932 }
933
934 spin_lock_irqsave(&ha->hardware_lock, flags);
935 gpio_data = RD_REG_DWORD(&reg->gpiod);
936
937 /* Enable the gpio_data reg for update. */
938 gpio_data |= GPDX_LED_UPDATE_MASK;
939 WRT_REG_DWORD(&reg->gpiod, gpio_data);
940 RD_REG_DWORD(&reg->gpiod);
941
942 spin_unlock_irqrestore(&ha->hardware_lock, flags);
943 }
944
945 /* So all colors blink together. */
946 ha->beacon_color_state = 0;
947
948 /* Let the per HBA timer kick off the blinking process. */
949 ha->beacon_blink_led = 1;
950
951 return QLA_SUCCESS;
952}
953
954int
955qla24xx_beacon_off(struct scsi_qla_host *ha)
956{
957 uint32_t gpio_data;
958 unsigned long flags;
959 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
960
961 ha->beacon_blink_led = 0;
962 ha->beacon_color_state = QLA_LED_ALL_ON;
963
964 ha->isp_ops.beacon_blink(ha); /* Will flip to all off. */
965
966 /* Give control back to firmware. */
967 spin_lock_irqsave(&ha->hardware_lock, flags);
968 gpio_data = RD_REG_DWORD(&reg->gpiod);
969
970 /* Disable the gpio_data reg for update. */
971 gpio_data &= ~GPDX_LED_UPDATE_MASK;
972 WRT_REG_DWORD(&reg->gpiod, gpio_data);
973 RD_REG_DWORD(&reg->gpiod);
974 spin_unlock_irqrestore(&ha->hardware_lock, flags);
975
976 ha->fw_options[1] &= ~ADD_FO1_DISABLE_GPIO_LED_CTRL;
977
978 if (qla2x00_set_fw_options(ha, ha->fw_options) != QLA_SUCCESS) {
979 qla_printk(KERN_WARNING, ha,
980 "Unable to update fw options (beacon off).\n");
981 return QLA_FUNCTION_FAILED;
982 }
983
984 if (qla2x00_get_fw_options(ha, ha->fw_options) != QLA_SUCCESS) {
985 qla_printk(KERN_WARNING, ha,
986 "Unable to get fw options (beacon off).\n");
987 return QLA_FUNCTION_FAILED;
988 }
989
990 return QLA_SUCCESS;
991}
992
993
994/*
995 * Flash support routines
996 */
997
998/**
999 * qla2x00_flash_enable() - Setup flash for reading and writing.
1000 * @ha: HA context
1001 */
1002static void
1003qla2x00_flash_enable(scsi_qla_host_t *ha)
1004{
1005 uint16_t data;
1006 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1007
1008 data = RD_REG_WORD(&reg->ctrl_status);
1009 data |= CSR_FLASH_ENABLE;
1010 WRT_REG_WORD(&reg->ctrl_status, data);
1011 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1012}
1013
1014/**
1015 * qla2x00_flash_disable() - Disable flash and allow RISC to run.
1016 * @ha: HA context
1017 */
1018static void
1019qla2x00_flash_disable(scsi_qla_host_t *ha)
1020{
1021 uint16_t data;
1022 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1023
1024 data = RD_REG_WORD(&reg->ctrl_status);
1025 data &= ~(CSR_FLASH_ENABLE);
1026 WRT_REG_WORD(&reg->ctrl_status, data);
1027 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1028}
1029
1030/**
1031 * qla2x00_read_flash_byte() - Reads a byte from flash
1032 * @ha: HA context
1033 * @addr: Address in flash to read
1034 *
1035 * A word is read from the chip, but, only the lower byte is valid.
1036 *
1037 * Returns the byte read from flash @addr.
1038 */
1039static uint8_t
1040qla2x00_read_flash_byte(scsi_qla_host_t *ha, uint32_t addr)
1041{
1042 uint16_t data;
1043 uint16_t bank_select;
1044 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1045
1046 bank_select = RD_REG_WORD(&reg->ctrl_status);
1047
1048 if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
1049 /* Specify 64K address range: */
1050 /* clear out Module Select and Flash Address bits [19:16]. */
1051 bank_select &= ~0xf8;
1052 bank_select |= addr >> 12 & 0xf0;
1053 bank_select |= CSR_FLASH_64K_BANK;
1054 WRT_REG_WORD(&reg->ctrl_status, bank_select);
1055 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1056
1057 WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
1058 data = RD_REG_WORD(&reg->flash_data);
1059
1060 return (uint8_t)data;
1061 }
1062
1063 /* Setup bit 16 of flash address. */
1064 if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) {
1065 bank_select |= CSR_FLASH_64K_BANK;
1066 WRT_REG_WORD(&reg->ctrl_status, bank_select);
1067 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1068 } else if (((addr & BIT_16) == 0) &&
1069 (bank_select & CSR_FLASH_64K_BANK)) {
1070 bank_select &= ~(CSR_FLASH_64K_BANK);
1071 WRT_REG_WORD(&reg->ctrl_status, bank_select);
1072 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1073 }
1074
1075 /* Always perform IO mapped accesses to the FLASH registers. */
1076 if (ha->pio_address) {
1077 uint16_t data2;
1078
1079 reg = (struct device_reg_2xxx __iomem *)ha->pio_address;
1080 WRT_REG_WORD_PIO(&reg->flash_address, (uint16_t)addr);
1081 do {
1082 data = RD_REG_WORD_PIO(&reg->flash_data);
1083 barrier();
1084 cpu_relax();
1085 data2 = RD_REG_WORD_PIO(&reg->flash_data);
1086 } while (data != data2);
1087 } else {
1088 WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
1089 data = qla2x00_debounce_register(&reg->flash_data);
1090 }
1091
1092 return (uint8_t)data;
1093}
1094
1095/**
1096 * qla2x00_write_flash_byte() - Write a byte to flash
1097 * @ha: HA context
1098 * @addr: Address in flash to write
1099 * @data: Data to write
1100 */
1101static void
1102qla2x00_write_flash_byte(scsi_qla_host_t *ha, uint32_t addr, uint8_t data)
1103{
1104 uint16_t bank_select;
1105 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1106
1107 bank_select = RD_REG_WORD(&reg->ctrl_status);
1108 if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
1109 /* Specify 64K address range: */
1110 /* clear out Module Select and Flash Address bits [19:16]. */
1111 bank_select &= ~0xf8;
1112 bank_select |= addr >> 12 & 0xf0;
1113 bank_select |= CSR_FLASH_64K_BANK;
1114 WRT_REG_WORD(&reg->ctrl_status, bank_select);
1115 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1116
1117 WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
1118 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1119 WRT_REG_WORD(&reg->flash_data, (uint16_t)data);
1120 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1121
1122 return;
1123 }
1124
1125 /* Setup bit 16 of flash address. */
1126 if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) {
1127 bank_select |= CSR_FLASH_64K_BANK;
1128 WRT_REG_WORD(&reg->ctrl_status, bank_select);
1129 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1130 } else if (((addr & BIT_16) == 0) &&
1131 (bank_select & CSR_FLASH_64K_BANK)) {
1132 bank_select &= ~(CSR_FLASH_64K_BANK);
1133 WRT_REG_WORD(&reg->ctrl_status, bank_select);
1134 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1135 }
1136
1137 /* Always perform IO mapped accesses to the FLASH registers. */
1138 if (ha->pio_address) {
1139 reg = (struct device_reg_2xxx __iomem *)ha->pio_address;
1140 WRT_REG_WORD_PIO(&reg->flash_address, (uint16_t)addr);
1141 WRT_REG_WORD_PIO(&reg->flash_data, (uint16_t)data);
1142 } else {
1143 WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
1144 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1145 WRT_REG_WORD(&reg->flash_data, (uint16_t)data);
1146 RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
1147 }
1148}
1149
1150/**
1151 * qla2x00_poll_flash() - Polls flash for completion.
1152 * @ha: HA context
1153 * @addr: Address in flash to poll
1154 * @poll_data: Data to be polled
1155 * @man_id: Flash manufacturer ID
1156 * @flash_id: Flash ID
1157 *
1158 * This function polls the device until bit 7 of what is read matches data
1159 * bit 7 or until data bit 5 becomes a 1. If that hapens, the flash ROM timed
1160 * out (a fatal error). The flash book recommeds reading bit 7 again after
1161 * reading bit 5 as a 1.
1162 *
1163 * Returns 0 on success, else non-zero.
1164 */
1165static int
1166qla2x00_poll_flash(scsi_qla_host_t *ha, uint32_t addr, uint8_t poll_data,
1167 uint8_t man_id, uint8_t flash_id)
1168{
1169 int status;
1170 uint8_t flash_data;
1171 uint32_t cnt;
1172
1173 status = 1;
1174
1175 /* Wait for 30 seconds for command to finish. */
1176 poll_data &= BIT_7;
1177 for (cnt = 3000000; cnt; cnt--) {
1178 flash_data = qla2x00_read_flash_byte(ha, addr);
1179 if ((flash_data & BIT_7) == poll_data) {
1180 status = 0;
1181 break;
1182 }
1183
1184 if (man_id != 0x40 && man_id != 0xda) {
1185 if ((flash_data & BIT_5) && cnt > 2)
1186 cnt = 2;
1187 }
1188 udelay(10);
1189 barrier();
1190 }
1191 return status;
1192}
1193
1194#define IS_OEM_001(ha) \
1195 ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2322 && \
1196 (ha)->pdev->subsystem_vendor == 0x1028 && \
1197 (ha)->pdev->subsystem_device == 0x0170)
1198
1199/**
1200 * qla2x00_program_flash_address() - Programs a flash address
1201 * @ha: HA context
1202 * @addr: Address in flash to program
1203 * @data: Data to be written in flash
1204 * @man_id: Flash manufacturer ID
1205 * @flash_id: Flash ID
1206 *
1207 * Returns 0 on success, else non-zero.
1208 */
1209static int
1210qla2x00_program_flash_address(scsi_qla_host_t *ha, uint32_t addr, uint8_t data,
1211 uint8_t man_id, uint8_t flash_id)
1212{
1213 /* Write Program Command Sequence. */
1214 if (IS_OEM_001(ha)) {
1215 qla2x00_write_flash_byte(ha, 0xaaa, 0xaa);
1216 qla2x00_write_flash_byte(ha, 0x555, 0x55);
1217 qla2x00_write_flash_byte(ha, 0xaaa, 0xa0);
1218 qla2x00_write_flash_byte(ha, addr, data);
1219 } else {
1220 if (man_id == 0xda && flash_id == 0xc1) {
1221 qla2x00_write_flash_byte(ha, addr, data);
1222 if (addr & 0x7e)
1223 return 0;
1224 } else {
1225 qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
1226 qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
1227 qla2x00_write_flash_byte(ha, 0x5555, 0xa0);
1228 qla2x00_write_flash_byte(ha, addr, data);
1229 }
1230 }
1231
1232 udelay(150);
1233
1234 /* Wait for write to complete. */
1235 return qla2x00_poll_flash(ha, addr, data, man_id, flash_id);
1236}
1237
1238/**
1239 * qla2x00_erase_flash() - Erase the flash.
1240 * @ha: HA context
1241 * @man_id: Flash manufacturer ID
1242 * @flash_id: Flash ID
1243 *
1244 * Returns 0 on success, else non-zero.
1245 */
1246static int
1247qla2x00_erase_flash(scsi_qla_host_t *ha, uint8_t man_id, uint8_t flash_id)
1248{
1249 /* Individual Sector Erase Command Sequence */
1250 if (IS_OEM_001(ha)) {
1251 qla2x00_write_flash_byte(ha, 0xaaa, 0xaa);
1252 qla2x00_write_flash_byte(ha, 0x555, 0x55);
1253 qla2x00_write_flash_byte(ha, 0xaaa, 0x80);
1254 qla2x00_write_flash_byte(ha, 0xaaa, 0xaa);
1255 qla2x00_write_flash_byte(ha, 0x555, 0x55);
1256 qla2x00_write_flash_byte(ha, 0xaaa, 0x10);
1257 } else {
1258 qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
1259 qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
1260 qla2x00_write_flash_byte(ha, 0x5555, 0x80);
1261 qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
1262 qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
1263 qla2x00_write_flash_byte(ha, 0x5555, 0x10);
1264 }
1265
1266 udelay(150);
1267
1268 /* Wait for erase to complete. */
1269 return qla2x00_poll_flash(ha, 0x00, 0x80, man_id, flash_id);
1270}
1271
1272/**
1273 * qla2x00_erase_flash_sector() - Erase a flash sector.
1274 * @ha: HA context
1275 * @addr: Flash sector to erase
1276 * @sec_mask: Sector address mask
1277 * @man_id: Flash manufacturer ID
1278 * @flash_id: Flash ID
1279 *
1280 * Returns 0 on success, else non-zero.
1281 */
1282static int
1283qla2x00_erase_flash_sector(scsi_qla_host_t *ha, uint32_t addr,
1284 uint32_t sec_mask, uint8_t man_id, uint8_t flash_id)
1285{
1286 /* Individual Sector Erase Command Sequence */
1287 qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
1288 qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
1289 qla2x00_write_flash_byte(ha, 0x5555, 0x80);
1290 qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
1291 qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
1292 if (man_id == 0x1f && flash_id == 0x13)
1293 qla2x00_write_flash_byte(ha, addr & sec_mask, 0x10);
1294 else
1295 qla2x00_write_flash_byte(ha, addr & sec_mask, 0x30);
1296
1297 udelay(150);
1298
1299 /* Wait for erase to complete. */
1300 return qla2x00_poll_flash(ha, addr, 0x80, man_id, flash_id);
1301}
1302
1303/**
1304 * qla2x00_get_flash_manufacturer() - Read manufacturer ID from flash chip.
1305 * @man_id: Flash manufacturer ID
1306 * @flash_id: Flash ID
1307 */
1308static void
1309qla2x00_get_flash_manufacturer(scsi_qla_host_t *ha, uint8_t *man_id,
1310 uint8_t *flash_id)
1311{
1312 qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
1313 qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
1314 qla2x00_write_flash_byte(ha, 0x5555, 0x90);
1315 *man_id = qla2x00_read_flash_byte(ha, 0x0000);
1316 *flash_id = qla2x00_read_flash_byte(ha, 0x0001);
1317 qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
1318 qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
1319 qla2x00_write_flash_byte(ha, 0x5555, 0xf0);
1320}
1321
1322
1323static inline void
1324qla2x00_suspend_hba(struct scsi_qla_host *ha)
1325{
1326 int cnt;
1327 unsigned long flags;
1328 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1329
1330 /* Suspend HBA. */
1331 scsi_block_requests(ha->host);
1332 ha->isp_ops.disable_intrs(ha);
1333 set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
1334
1335 /* Pause RISC. */
1336 spin_lock_irqsave(&ha->hardware_lock, flags);
1337 WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
1338 RD_REG_WORD(&reg->hccr);
1339 if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) {
1340 for (cnt = 0; cnt < 30000; cnt++) {
1341 if ((RD_REG_WORD(&reg->hccr) & HCCR_RISC_PAUSE) != 0)
1342 break;
1343 udelay(100);
1344 }
1345 } else {
1346 udelay(10);
1347 }
1348 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1349}
1350
1351static inline void
1352qla2x00_resume_hba(struct scsi_qla_host *ha)
1353{
1354 /* Resume HBA. */
1355 clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
1356 set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
1357 up(ha->dpc_wait);
1358 qla2x00_wait_for_hba_online(ha);
1359 scsi_unblock_requests(ha->host);
1360}
1361
1362uint8_t *
1363qla2x00_read_optrom_data(struct scsi_qla_host *ha, uint8_t *buf,
1364 uint32_t offset, uint32_t length)
1365{
1366 unsigned long flags;
1367 uint32_t addr, midpoint;
1368 uint8_t *data;
1369 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1370
1371 /* Suspend HBA. */
1372 qla2x00_suspend_hba(ha);
1373
1374 /* Go with read. */
1375 spin_lock_irqsave(&ha->hardware_lock, flags);
1376 midpoint = ha->optrom_size / 2;
1377
1378 qla2x00_flash_enable(ha);
1379 WRT_REG_WORD(&reg->nvram, 0);
1380 RD_REG_WORD(&reg->nvram); /* PCI Posting. */
1381 for (addr = offset, data = buf; addr < length; addr++, data++) {
1382 if (addr == midpoint) {
1383 WRT_REG_WORD(&reg->nvram, NVR_SELECT);
1384 RD_REG_WORD(&reg->nvram); /* PCI Posting. */
1385 }
1386
1387 *data = qla2x00_read_flash_byte(ha, addr);
1388 }
1389 qla2x00_flash_disable(ha);
1390 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1391
1392 /* Resume HBA. */
1393 qla2x00_resume_hba(ha);
1394
1395 return buf;
1396}
1397
1398int
1399qla2x00_write_optrom_data(struct scsi_qla_host *ha, uint8_t *buf,
1400 uint32_t offset, uint32_t length)
1401{
1402
1403 int rval;
1404 unsigned long flags;
1405 uint8_t man_id, flash_id, sec_number, data;
1406 uint16_t wd;
1407 uint32_t addr, liter, sec_mask, rest_addr;
1408 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1409
1410 /* Suspend HBA. */
1411 qla2x00_suspend_hba(ha);
1412
1413 rval = QLA_SUCCESS;
1414 sec_number = 0;
1415
1416 /* Reset ISP chip. */
1417 spin_lock_irqsave(&ha->hardware_lock, flags);
1418 WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
1419 pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
1420
1421 /* Go with write. */
1422 qla2x00_flash_enable(ha);
1423 do { /* Loop once to provide quick error exit */
1424 /* Structure of flash memory based on manufacturer */
1425 if (IS_OEM_001(ha)) {
1426 /* OEM variant with special flash part. */
1427 man_id = flash_id = 0;
1428 rest_addr = 0xffff;
1429 sec_mask = 0x10000;
1430 goto update_flash;
1431 }
1432 qla2x00_get_flash_manufacturer(ha, &man_id, &flash_id);
1433 switch (man_id) {
1434 case 0x20: /* ST flash. */
1435 if (flash_id == 0xd2 || flash_id == 0xe3) {
1436 /*
1437 * ST m29w008at part - 64kb sector size with
1438 * 32kb,8kb,8kb,16kb sectors at memory address
1439 * 0xf0000.
1440 */
1441 rest_addr = 0xffff;
1442 sec_mask = 0x10000;
1443 break;
1444 }
1445 /*
1446 * ST m29w010b part - 16kb sector size
1447 * Default to 16kb sectors
1448 */
1449 rest_addr = 0x3fff;
1450 sec_mask = 0x1c000;
1451 break;
1452 case 0x40: /* Mostel flash. */
1453 /* Mostel v29c51001 part - 512 byte sector size. */
1454 rest_addr = 0x1ff;
1455 sec_mask = 0x1fe00;
1456 break;
1457 case 0xbf: /* SST flash. */
1458 /* SST39sf10 part - 4kb sector size. */
1459 rest_addr = 0xfff;
1460 sec_mask = 0x1f000;
1461 break;
1462 case 0xda: /* Winbond flash. */
1463 /* Winbond W29EE011 part - 256 byte sector size. */
1464 rest_addr = 0x7f;
1465 sec_mask = 0x1ff80;
1466 break;
1467 case 0xc2: /* Macronix flash. */
1468 /* 64k sector size. */
1469 if (flash_id == 0x38 || flash_id == 0x4f) {
1470 rest_addr = 0xffff;
1471 sec_mask = 0x10000;
1472 break;
1473 }
1474 /* Fall through... */
1475
1476 case 0x1f: /* Atmel flash. */
1477 /* 512k sector size. */
1478 if (flash_id == 0x13) {
1479 rest_addr = 0x7fffffff;
1480 sec_mask = 0x80000000;
1481 break;
1482 }
1483 /* Fall through... */
1484
1485 case 0x01: /* AMD flash. */
1486 if (flash_id == 0x38 || flash_id == 0x40 ||
1487 flash_id == 0x4f) {
1488 /* Am29LV081 part - 64kb sector size. */
1489 /* Am29LV002BT part - 64kb sector size. */
1490 rest_addr = 0xffff;
1491 sec_mask = 0x10000;
1492 break;
1493 } else if (flash_id == 0x3e) {
1494 /*
1495 * Am29LV008b part - 64kb sector size with
1496 * 32kb,8kb,8kb,16kb sector at memory address
1497 * h0xf0000.
1498 */
1499 rest_addr = 0xffff;
1500 sec_mask = 0x10000;
1501 break;
1502 } else if (flash_id == 0x20 || flash_id == 0x6e) {
1503 /*
1504 * Am29LV010 part or AM29f010 - 16kb sector
1505 * size.
1506 */
1507 rest_addr = 0x3fff;
1508 sec_mask = 0x1c000;
1509 break;
1510 } else if (flash_id == 0x6d) {
1511 /* Am29LV001 part - 8kb sector size. */
1512 rest_addr = 0x1fff;
1513 sec_mask = 0x1e000;
1514 break;
1515 }
1516 default:
1517 /* Default to 16 kb sector size. */
1518 rest_addr = 0x3fff;
1519 sec_mask = 0x1c000;
1520 break;
1521 }
1522
1523update_flash:
1524 if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
1525 if (qla2x00_erase_flash(ha, man_id, flash_id)) {
1526 rval = QLA_FUNCTION_FAILED;
1527 break;
1528 }
1529 }
1530
1531 for (addr = offset, liter = 0; liter < length; liter++,
1532 addr++) {
1533 data = buf[liter];
1534 /* Are we at the beginning of a sector? */
1535 if ((addr & rest_addr) == 0) {
1536 if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
1537 if (addr >= 0x10000UL) {
1538 if (((addr >> 12) & 0xf0) &&
1539 ((man_id == 0x01 &&
1540 flash_id == 0x3e) ||
1541 (man_id == 0x20 &&
1542 flash_id == 0xd2))) {
1543 sec_number++;
1544 if (sec_number == 1) {
1545 rest_addr =
1546 0x7fff;
1547 sec_mask =
1548 0x18000;
1549 } else if (
1550 sec_number == 2 ||
1551 sec_number == 3) {
1552 rest_addr =
1553 0x1fff;
1554 sec_mask =
1555 0x1e000;
1556 } else if (
1557 sec_number == 4) {
1558 rest_addr =
1559 0x3fff;
1560 sec_mask =
1561 0x1c000;
1562 }
1563 }
1564 }
1565 } else if (addr == ha->optrom_size / 2) {
1566 WRT_REG_WORD(&reg->nvram, NVR_SELECT);
1567 RD_REG_WORD(&reg->nvram);
1568 }
1569
1570 if (flash_id == 0xda && man_id == 0xc1) {
1571 qla2x00_write_flash_byte(ha, 0x5555,
1572 0xaa);
1573 qla2x00_write_flash_byte(ha, 0x2aaa,
1574 0x55);
1575 qla2x00_write_flash_byte(ha, 0x5555,
1576 0xa0);
1577 } else if (!IS_QLA2322(ha) && !IS_QLA6322(ha)) {
1578 /* Then erase it */
1579 if (qla2x00_erase_flash_sector(ha,
1580 addr, sec_mask, man_id,
1581 flash_id)) {
1582 rval = QLA_FUNCTION_FAILED;
1583 break;
1584 }
1585 if (man_id == 0x01 && flash_id == 0x6d)
1586 sec_number++;
1587 }
1588 }
1589
1590 if (man_id == 0x01 && flash_id == 0x6d) {
1591 if (sec_number == 1 &&
1592 addr == (rest_addr - 1)) {
1593 rest_addr = 0x0fff;
1594 sec_mask = 0x1f000;
1595 } else if (sec_number == 3 && (addr & 0x7ffe)) {
1596 rest_addr = 0x3fff;
1597 sec_mask = 0x1c000;
1598 }
1599 }
1600
1601 if (qla2x00_program_flash_address(ha, addr, data,
1602 man_id, flash_id)) {
1603 rval = QLA_FUNCTION_FAILED;
1604 break;
1605 }
1606 }
1607 } while (0);
1608 qla2x00_flash_disable(ha);
1609 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1610
1611 /* Resume HBA. */
1612 qla2x00_resume_hba(ha);
1613
1614 return rval;
1615}
1616
1617uint8_t *
1618qla24xx_read_optrom_data(struct scsi_qla_host *ha, uint8_t *buf,
1619 uint32_t offset, uint32_t length)
1620{
1621 /* Suspend HBA. */
1622 scsi_block_requests(ha->host);
1623 ha->isp_ops.disable_intrs(ha);
1624 set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
1625
1626 /* Go with read. */
1627 qla24xx_read_flash_data(ha, (uint32_t *)buf, offset >> 2, length >> 2);
1628
1629 /* Resume HBA. */
1630 clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
1631 ha->isp_ops.enable_intrs(ha);
1632 scsi_unblock_requests(ha->host);
1633
1634 return buf;
1635}
1636
1637int
1638qla24xx_write_optrom_data(struct scsi_qla_host *ha, uint8_t *buf,
1639 uint32_t offset, uint32_t length)
1640{
1641 int rval;
1642
1643 /* Suspend HBA. */
1644 scsi_block_requests(ha->host);
1645 ha->isp_ops.disable_intrs(ha);
1646 set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
1647
1648 /* Go with write. */
1649 rval = qla24xx_write_flash_data(ha, (uint32_t *)buf, offset >> 2,
1650 length >> 2);
1651
1652 /* Resume HBA -- RISC reset needed. */
1653 clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
1654 set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
1655 up(ha->dpc_wait);
1656 qla2x00_wait_for_hba_online(ha);
1657 scsi_unblock_requests(ha->host);
1658
1659 return rval;
1660}
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 6fddf17a3b70..2770005324b4 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -997,6 +997,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
997 case ATA_CMD_READ_EXT: 997 case ATA_CMD_READ_EXT:
998 case ATA_CMD_WRITE: 998 case ATA_CMD_WRITE:
999 case ATA_CMD_WRITE_EXT: 999 case ATA_CMD_WRITE_EXT:
1000 case ATA_CMD_WRITE_FUA_EXT:
1000 mv_crqb_pack_cmd(cw++, tf->hob_nsect, ATA_REG_NSECT, 0); 1001 mv_crqb_pack_cmd(cw++, tf->hob_nsect, ATA_REG_NSECT, 0);
1001 break; 1002 break;
1002#ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */ 1003#ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index de05e2883f9c..80480f0fb2b8 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -277,7 +277,7 @@ static unsigned int qs_fill_sg(struct ata_queued_cmd *qc)
277 u8 *prd = pp->pkt + QS_CPB_BYTES; 277 u8 *prd = pp->pkt + QS_CPB_BYTES;
278 278
279 assert(qc->__sg != NULL); 279 assert(qc->__sg != NULL);
280 assert(qc->n_elem > 0); 280 assert(qc->n_elem > 0 || qc->pad_len > 0);
281 281
282 nelem = 0; 282 nelem = 0;
283 ata_for_each_sg(sg, qc) { 283 ata_for_each_sg(sg, qc) {
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
index 2e2c3b7acb0c..e484e8db6810 100644
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -81,6 +81,19 @@
81/* Port stride */ 81/* Port stride */
82#define VSC_SATA_PORT_OFFSET 0x200 82#define VSC_SATA_PORT_OFFSET 0x200
83 83
84/* Error interrupt status bit offsets */
85#define VSC_SATA_INT_ERROR_E_OFFSET 2
86#define VSC_SATA_INT_ERROR_P_OFFSET 4
87#define VSC_SATA_INT_ERROR_T_OFFSET 5
88#define VSC_SATA_INT_ERROR_M_OFFSET 1
89#define is_vsc_sata_int_err(port_idx, int_status) \
90 (int_status & ((1 << (VSC_SATA_INT_ERROR_E_OFFSET + (8 * port_idx))) | \
91 (1 << (VSC_SATA_INT_ERROR_P_OFFSET + (8 * port_idx))) | \
92 (1 << (VSC_SATA_INT_ERROR_T_OFFSET + (8 * port_idx))) | \
93 (1 << (VSC_SATA_INT_ERROR_M_OFFSET + (8 * port_idx))) \
94 )\
95 )
96
84 97
85static u32 vsc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) 98static u32 vsc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
86{ 99{
@@ -201,13 +214,28 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance,
201 struct ata_port *ap; 214 struct ata_port *ap;
202 215
203 ap = host_set->ports[i]; 216 ap = host_set->ports[i];
217
218 if (is_vsc_sata_int_err(i, int_status)) {
219 u32 err_status;
220 printk(KERN_DEBUG "%s: ignoring interrupt(s)\n", __FUNCTION__);
221 err_status = ap ? vsc_sata_scr_read(ap, SCR_ERROR) : 0;
222 vsc_sata_scr_write(ap, SCR_ERROR, err_status);
223 handled++;
224 }
225
204 if (ap && !(ap->flags & 226 if (ap && !(ap->flags &
205 (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) { 227 (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) {
206 struct ata_queued_cmd *qc; 228 struct ata_queued_cmd *qc;
207 229
208 qc = ata_qc_from_tag(ap, ap->active_tag); 230 qc = ata_qc_from_tag(ap, ap->active_tag);
209 if (qc && (!(qc->tf.ctl & ATA_NIEN))) 231 if (qc && (!(qc->tf.ctl & ATA_NIEN))) {
210 handled += ata_host_intr(ap, qc); 232 handled += ata_host_intr(ap, qc);
233 } else {
234 printk(KERN_DEBUG "%s: ignoring interrupt(s)\n", __FUNCTION__);
235 ata_chk_status(ap);
236 handled++;
237 }
238
211 } 239 }
212 } 240 }
213 } 241 }
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 4a602853a98e..4362dcde74af 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/pci.h> 17#include <linux/pci.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/hardirq.h>
19 20
20#include <scsi/scsi.h> 21#include <scsi/scsi.h>
21#include <scsi/scsi_dbg.h> 22#include <scsi/scsi_dbg.h>
@@ -2248,3 +2249,61 @@ scsi_target_unblock(struct device *dev)
2248 device_for_each_child(dev, NULL, target_unblock); 2249 device_for_each_child(dev, NULL, target_unblock);
2249} 2250}
2250EXPORT_SYMBOL_GPL(scsi_target_unblock); 2251EXPORT_SYMBOL_GPL(scsi_target_unblock);
2252
2253
2254struct work_queue_work {
2255 struct work_struct work;
2256 void (*fn)(void *);
2257 void *data;
2258};
2259
2260static void execute_in_process_context_work(void *data)
2261{
2262 void (*fn)(void *data);
2263 struct work_queue_work *wqw = data;
2264
2265 fn = wqw->fn;
2266 data = wqw->data;
2267
2268 kfree(wqw);
2269
2270 fn(data);
2271}
2272
2273/**
2274 * scsi_execute_in_process_context - reliably execute the routine with user context
2275 * @fn: the function to execute
2276 * @data: data to pass to the function
2277 *
2278 * Executes the function immediately if process context is available,
2279 * otherwise schedules the function for delayed execution.
2280 *
2281 * Returns: 0 - function was executed
2282 * 1 - function was scheduled for execution
2283 * <0 - error
2284 */
2285int scsi_execute_in_process_context(void (*fn)(void *data), void *data)
2286{
2287 struct work_queue_work *wqw;
2288
2289 if (!in_interrupt()) {
2290 fn(data);
2291 return 0;
2292 }
2293
2294 wqw = kmalloc(sizeof(struct work_queue_work), GFP_ATOMIC);
2295
2296 if (unlikely(!wqw)) {
2297 printk(KERN_ERR "Failed to allocate memory\n");
2298 WARN_ON(1);
2299 return -ENOMEM;
2300 }
2301
2302 INIT_WORK(&wqw->work, execute_in_process_context_work, wqw);
2303 wqw->fn = fn;
2304 wqw->data = data;
2305 schedule_work(&wqw->work);
2306
2307 return 1;
2308}
2309EXPORT_SYMBOL_GPL(scsi_execute_in_process_context);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 752fb5da3de4..5acb83ca5ae5 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -387,19 +387,12 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
387 return found_target; 387 return found_target;
388} 388}
389 389
390struct work_queue_wrapper { 390static void scsi_target_reap_usercontext(void *data)
391 struct work_struct work; 391{
392 struct scsi_target *starget; 392 struct scsi_target *starget = data;
393};
394
395static void scsi_target_reap_work(void *data) {
396 struct work_queue_wrapper *wqw = (struct work_queue_wrapper *)data;
397 struct scsi_target *starget = wqw->starget;
398 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 393 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
399 unsigned long flags; 394 unsigned long flags;
400 395
401 kfree(wqw);
402
403 spin_lock_irqsave(shost->host_lock, flags); 396 spin_lock_irqsave(shost->host_lock, flags);
404 397
405 if (--starget->reap_ref == 0 && list_empty(&starget->devices)) { 398 if (--starget->reap_ref == 0 && list_empty(&starget->devices)) {
@@ -428,18 +421,7 @@ static void scsi_target_reap_work(void *data) {
428 */ 421 */
429void scsi_target_reap(struct scsi_target *starget) 422void scsi_target_reap(struct scsi_target *starget)
430{ 423{
431 struct work_queue_wrapper *wqw = 424 scsi_execute_in_process_context(scsi_target_reap_usercontext, starget);
432 kzalloc(sizeof(struct work_queue_wrapper), GFP_ATOMIC);
433
434 if (!wqw) {
435 starget_printk(KERN_ERR, starget,
436 "Failed to allocate memory in scsi_reap_target()\n");
437 return;
438 }
439
440 INIT_WORK(&wqw->work, scsi_target_reap_work, wqw);
441 wqw->starget = starget;
442 schedule_work(&wqw->work);
443} 425}
444 426
445/** 427/**
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index a77b32deaf8f..902a5def8e62 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -217,8 +217,9 @@ static void scsi_device_cls_release(struct class_device *class_dev)
217 put_device(&sdev->sdev_gendev); 217 put_device(&sdev->sdev_gendev);
218} 218}
219 219
220static void scsi_device_dev_release(struct device *dev) 220static void scsi_device_dev_release_usercontext(void *data)
221{ 221{
222 struct device *dev = data;
222 struct scsi_device *sdev; 223 struct scsi_device *sdev;
223 struct device *parent; 224 struct device *parent;
224 struct scsi_target *starget; 225 struct scsi_target *starget;
@@ -237,6 +238,7 @@ static void scsi_device_dev_release(struct device *dev)
237 238
238 if (sdev->request_queue) { 239 if (sdev->request_queue) {
239 sdev->request_queue->queuedata = NULL; 240 sdev->request_queue->queuedata = NULL;
241 /* user context needed to free queue */
240 scsi_free_queue(sdev->request_queue); 242 scsi_free_queue(sdev->request_queue);
241 /* temporary expedient, try to catch use of queue lock 243 /* temporary expedient, try to catch use of queue lock
242 * after free of sdev */ 244 * after free of sdev */
@@ -252,6 +254,11 @@ static void scsi_device_dev_release(struct device *dev)
252 put_device(parent); 254 put_device(parent);
253} 255}
254 256
257static void scsi_device_dev_release(struct device *dev)
258{
259 scsi_execute_in_process_context(scsi_device_dev_release_usercontext, dev);
260}
261
255static struct class sdev_class = { 262static struct class sdev_class = {
256 .name = "scsi_device", 263 .name = "scsi_device",
257 .release = scsi_device_cls_release, 264 .release = scsi_device_cls_release,
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 723f7acbeb12..71e54a64adca 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -39,10 +39,6 @@ struct iscsi_internal {
39 struct iscsi_transport *iscsi_transport; 39 struct iscsi_transport *iscsi_transport;
40 struct list_head list; 40 struct list_head list;
41 /* 41 /*
42 * List of sessions for this transport
43 */
44 struct list_head sessions;
45 /*
46 * based on transport capabilities, at register time we set these 42 * based on transport capabilities, at register time we set these
47 * bits to tell the transport class it wants attributes displayed 43 * bits to tell the transport class it wants attributes displayed
48 * in sysfs or that it can support different iSCSI Data-Path 44 * in sysfs or that it can support different iSCSI Data-Path
@@ -164,9 +160,43 @@ static struct mempool_zone *z_reply;
164#define Z_MAX_ERROR 16 160#define Z_MAX_ERROR 16
165#define Z_HIWAT_ERROR 12 161#define Z_HIWAT_ERROR 12
166 162
163static LIST_HEAD(sesslist);
164static DEFINE_SPINLOCK(sesslock);
167static LIST_HEAD(connlist); 165static LIST_HEAD(connlist);
168static DEFINE_SPINLOCK(connlock); 166static DEFINE_SPINLOCK(connlock);
169 167
168static struct iscsi_cls_session *iscsi_session_lookup(uint64_t handle)
169{
170 unsigned long flags;
171 struct iscsi_cls_session *sess;
172
173 spin_lock_irqsave(&sesslock, flags);
174 list_for_each_entry(sess, &sesslist, sess_list) {
175 if (sess == iscsi_ptr(handle)) {
176 spin_unlock_irqrestore(&sesslock, flags);
177 return sess;
178 }
179 }
180 spin_unlock_irqrestore(&sesslock, flags);
181 return NULL;
182}
183
184static struct iscsi_cls_conn *iscsi_conn_lookup(uint64_t handle)
185{
186 unsigned long flags;
187 struct iscsi_cls_conn *conn;
188
189 spin_lock_irqsave(&connlock, flags);
190 list_for_each_entry(conn, &connlist, conn_list) {
191 if (conn == iscsi_ptr(handle)) {
192 spin_unlock_irqrestore(&connlock, flags);
193 return conn;
194 }
195 }
196 spin_unlock_irqrestore(&connlock, flags);
197 return NULL;
198}
199
170/* 200/*
171 * The following functions can be used by LLDs that allocate 201 * The following functions can be used by LLDs that allocate
172 * their own scsi_hosts or by software iscsi LLDs 202 * their own scsi_hosts or by software iscsi LLDs
@@ -365,6 +395,7 @@ iscsi_transport_create_session(struct scsi_transport_template *scsit,
365{ 395{
366 struct iscsi_cls_session *session; 396 struct iscsi_cls_session *session;
367 struct Scsi_Host *shost; 397 struct Scsi_Host *shost;
398 unsigned long flags;
368 399
369 shost = scsi_host_alloc(transport->host_template, 400 shost = scsi_host_alloc(transport->host_template,
370 hostdata_privsize(transport)); 401 hostdata_privsize(transport));
@@ -389,6 +420,9 @@ iscsi_transport_create_session(struct scsi_transport_template *scsit,
389 goto remove_host; 420 goto remove_host;
390 421
391 *(unsigned long*)shost->hostdata = (unsigned long)session; 422 *(unsigned long*)shost->hostdata = (unsigned long)session;
423 spin_lock_irqsave(&sesslock, flags);
424 list_add(&session->sess_list, &sesslist);
425 spin_unlock_irqrestore(&sesslock, flags);
392 return shost; 426 return shost;
393 427
394remove_host: 428remove_host:
@@ -410,9 +444,13 @@ EXPORT_SYMBOL_GPL(iscsi_transport_create_session);
410int iscsi_transport_destroy_session(struct Scsi_Host *shost) 444int iscsi_transport_destroy_session(struct Scsi_Host *shost)
411{ 445{
412 struct iscsi_cls_session *session; 446 struct iscsi_cls_session *session;
447 unsigned long flags;
413 448
414 scsi_remove_host(shost); 449 scsi_remove_host(shost);
415 session = hostdata_session(shost->hostdata); 450 session = hostdata_session(shost->hostdata);
451 spin_lock_irqsave(&sesslock, flags);
452 list_del(&session->sess_list);
453 spin_unlock_irqrestore(&sesslock, flags);
416 iscsi_destroy_session(session); 454 iscsi_destroy_session(session);
417 /* ref from host alloc */ 455 /* ref from host alloc */
418 scsi_host_put(shost); 456 scsi_host_put(shost);
@@ -424,22 +462,6 @@ EXPORT_SYMBOL_GPL(iscsi_transport_destroy_session);
424/* 462/*
425 * iscsi interface functions 463 * iscsi interface functions
426 */ 464 */
427static struct iscsi_cls_conn*
428iscsi_if_find_conn(uint64_t key)
429{
430 unsigned long flags;
431 struct iscsi_cls_conn *conn;
432
433 spin_lock_irqsave(&connlock, flags);
434 list_for_each_entry(conn, &connlist, conn_list)
435 if (conn->connh == key) {
436 spin_unlock_irqrestore(&connlock, flags);
437 return conn;
438 }
439 spin_unlock_irqrestore(&connlock, flags);
440 return NULL;
441}
442
443static struct iscsi_internal * 465static struct iscsi_internal *
444iscsi_if_transport_lookup(struct iscsi_transport *tt) 466iscsi_if_transport_lookup(struct iscsi_transport *tt)
445{ 467{
@@ -504,6 +526,12 @@ mempool_zone_init(unsigned max, unsigned size, unsigned hiwat)
504 if (!zp) 526 if (!zp)
505 return NULL; 527 return NULL;
506 528
529 zp->size = size;
530 zp->hiwat = hiwat;
531 INIT_LIST_HEAD(&zp->freequeue);
532 spin_lock_init(&zp->freelock);
533 atomic_set(&zp->allocated, 0);
534
507 zp->pool = mempool_create(max, mempool_zone_alloc_skb, 535 zp->pool = mempool_create(max, mempool_zone_alloc_skb,
508 mempool_zone_free_skb, zp); 536 mempool_zone_free_skb, zp);
509 if (!zp->pool) { 537 if (!zp->pool) {
@@ -511,13 +539,6 @@ mempool_zone_init(unsigned max, unsigned size, unsigned hiwat)
511 return NULL; 539 return NULL;
512 } 540 }
513 541
514 zp->size = size;
515 zp->hiwat = hiwat;
516
517 INIT_LIST_HEAD(&zp->freequeue);
518 spin_lock_init(&zp->freelock);
519 atomic_set(&zp->allocated, 0);
520
521 return zp; 542 return zp;
522} 543}
523 544
@@ -559,25 +580,21 @@ iscsi_unicast_skb(struct mempool_zone *zone, struct sk_buff *skb)
559 return 0; 580 return 0;
560} 581}
561 582
562int iscsi_recv_pdu(iscsi_connh_t connh, struct iscsi_hdr *hdr, 583int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
563 char *data, uint32_t data_size) 584 char *data, uint32_t data_size)
564{ 585{
565 struct nlmsghdr *nlh; 586 struct nlmsghdr *nlh;
566 struct sk_buff *skb; 587 struct sk_buff *skb;
567 struct iscsi_uevent *ev; 588 struct iscsi_uevent *ev;
568 struct iscsi_cls_conn *conn;
569 char *pdu; 589 char *pdu;
570 int len = NLMSG_SPACE(sizeof(*ev) + sizeof(struct iscsi_hdr) + 590 int len = NLMSG_SPACE(sizeof(*ev) + sizeof(struct iscsi_hdr) +
571 data_size); 591 data_size);
572 592
573 conn = iscsi_if_find_conn(connh);
574 BUG_ON(!conn);
575
576 mempool_zone_complete(conn->z_pdu); 593 mempool_zone_complete(conn->z_pdu);
577 594
578 skb = mempool_zone_get_skb(conn->z_pdu); 595 skb = mempool_zone_get_skb(conn->z_pdu);
579 if (!skb) { 596 if (!skb) {
580 iscsi_conn_error(connh, ISCSI_ERR_CONN_FAILED); 597 iscsi_conn_error(conn, ISCSI_ERR_CONN_FAILED);
581 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver " 598 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver "
582 "control PDU: OOM\n"); 599 "control PDU: OOM\n");
583 return -ENOMEM; 600 return -ENOMEM;
@@ -590,7 +607,7 @@ int iscsi_recv_pdu(iscsi_connh_t connh, struct iscsi_hdr *hdr,
590 ev->type = ISCSI_KEVENT_RECV_PDU; 607 ev->type = ISCSI_KEVENT_RECV_PDU;
591 if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat) 608 if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat)
592 ev->iferror = -ENOMEM; 609 ev->iferror = -ENOMEM;
593 ev->r.recv_req.conn_handle = connh; 610 ev->r.recv_req.conn_handle = iscsi_handle(conn);
594 pdu = (char*)ev + sizeof(*ev); 611 pdu = (char*)ev + sizeof(*ev);
595 memcpy(pdu, hdr, sizeof(struct iscsi_hdr)); 612 memcpy(pdu, hdr, sizeof(struct iscsi_hdr));
596 memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size); 613 memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size);
@@ -599,17 +616,13 @@ int iscsi_recv_pdu(iscsi_connh_t connh, struct iscsi_hdr *hdr,
599} 616}
600EXPORT_SYMBOL_GPL(iscsi_recv_pdu); 617EXPORT_SYMBOL_GPL(iscsi_recv_pdu);
601 618
602void iscsi_conn_error(iscsi_connh_t connh, enum iscsi_err error) 619void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error)
603{ 620{
604 struct nlmsghdr *nlh; 621 struct nlmsghdr *nlh;
605 struct sk_buff *skb; 622 struct sk_buff *skb;
606 struct iscsi_uevent *ev; 623 struct iscsi_uevent *ev;
607 struct iscsi_cls_conn *conn;
608 int len = NLMSG_SPACE(sizeof(*ev)); 624 int len = NLMSG_SPACE(sizeof(*ev));
609 625
610 conn = iscsi_if_find_conn(connh);
611 BUG_ON(!conn);
612
613 mempool_zone_complete(conn->z_error); 626 mempool_zone_complete(conn->z_error);
614 627
615 skb = mempool_zone_get_skb(conn->z_error); 628 skb = mempool_zone_get_skb(conn->z_error);
@@ -626,7 +639,7 @@ void iscsi_conn_error(iscsi_connh_t connh, enum iscsi_err error)
626 if (atomic_read(&conn->z_error->allocated) >= conn->z_error->hiwat) 639 if (atomic_read(&conn->z_error->allocated) >= conn->z_error->hiwat)
627 ev->iferror = -ENOMEM; 640 ev->iferror = -ENOMEM;
628 ev->r.connerror.error = error; 641 ev->r.connerror.error = error;
629 ev->r.connerror.conn_handle = connh; 642 ev->r.connerror.conn_handle = iscsi_handle(conn);
630 643
631 iscsi_unicast_skb(conn->z_error, skb); 644 iscsi_unicast_skb(conn->z_error, skb);
632 645
@@ -662,8 +675,7 @@ iscsi_if_send_reply(int pid, int seq, int type, int done, int multi,
662} 675}
663 676
664static int 677static int
665iscsi_if_get_stats(struct iscsi_transport *transport, struct sk_buff *skb, 678iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh)
666 struct nlmsghdr *nlh)
667{ 679{
668 struct iscsi_uevent *ev = NLMSG_DATA(nlh); 680 struct iscsi_uevent *ev = NLMSG_DATA(nlh);
669 struct iscsi_stats *stats; 681 struct iscsi_stats *stats;
@@ -677,7 +689,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct sk_buff *skb,
677 ISCSI_STATS_CUSTOM_MAX); 689 ISCSI_STATS_CUSTOM_MAX);
678 int err = 0; 690 int err = 0;
679 691
680 conn = iscsi_if_find_conn(ev->u.get_stats.conn_handle); 692 conn = iscsi_conn_lookup(ev->u.get_stats.conn_handle);
681 if (!conn) 693 if (!conn)
682 return -EEXIST; 694 return -EEXIST;
683 695
@@ -707,14 +719,14 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct sk_buff *skb,
707 ((char*)evstat + sizeof(*evstat)); 719 ((char*)evstat + sizeof(*evstat));
708 memset(stats, 0, sizeof(*stats)); 720 memset(stats, 0, sizeof(*stats));
709 721
710 transport->get_stats(ev->u.get_stats.conn_handle, stats); 722 transport->get_stats(conn, stats);
711 actual_size = NLMSG_SPACE(sizeof(struct iscsi_uevent) + 723 actual_size = NLMSG_SPACE(sizeof(struct iscsi_uevent) +
712 sizeof(struct iscsi_stats) + 724 sizeof(struct iscsi_stats) +
713 sizeof(struct iscsi_stats_custom) * 725 sizeof(struct iscsi_stats_custom) *
714 stats->custom_length); 726 stats->custom_length);
715 actual_size -= sizeof(*nlhstat); 727 actual_size -= sizeof(*nlhstat);
716 actual_size = NLMSG_LENGTH(actual_size); 728 actual_size = NLMSG_LENGTH(actual_size);
717 skb_trim(skb, NLMSG_ALIGN(actual_size)); 729 skb_trim(skbstat, NLMSG_ALIGN(actual_size));
718 nlhstat->nlmsg_len = actual_size; 730 nlhstat->nlmsg_len = actual_size;
719 731
720 err = iscsi_unicast_skb(conn->z_pdu, skbstat); 732 err = iscsi_unicast_skb(conn->z_pdu, skbstat);
@@ -727,58 +739,34 @@ static int
727iscsi_if_create_session(struct iscsi_internal *priv, struct iscsi_uevent *ev) 739iscsi_if_create_session(struct iscsi_internal *priv, struct iscsi_uevent *ev)
728{ 740{
729 struct iscsi_transport *transport = priv->iscsi_transport; 741 struct iscsi_transport *transport = priv->iscsi_transport;
730 struct Scsi_Host *shost; 742 struct iscsi_cls_session *session;
731 743 uint32_t sid;
732 if (!transport->create_session)
733 return -EINVAL;
734 744
735 shost = transport->create_session(&priv->t, 745 session = transport->create_session(&priv->t,
736 ev->u.c_session.initial_cmdsn); 746 ev->u.c_session.initial_cmdsn,
737 if (!shost) 747 &sid);
748 if (!session)
738 return -ENOMEM; 749 return -ENOMEM;
739 750
740 ev->r.c_session_ret.session_handle = iscsi_handle(iscsi_hostdata(shost->hostdata)); 751 ev->r.c_session_ret.session_handle = iscsi_handle(session);
741 ev->r.c_session_ret.sid = shost->host_no; 752 ev->r.c_session_ret.sid = sid;
742 return 0; 753 return 0;
743} 754}
744 755
745static int 756static int
746iscsi_if_destroy_session(struct iscsi_internal *priv, struct iscsi_uevent *ev) 757iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev)
747{ 758{
748 struct iscsi_transport *transport = priv->iscsi_transport;
749
750 struct Scsi_Host *shost;
751
752 if (!transport->destroy_session)
753 return -EINVAL;
754
755 shost = scsi_host_lookup(ev->u.d_session.sid);
756 if (shost == ERR_PTR(-ENXIO))
757 return -EEXIST;
758
759 if (transport->destroy_session)
760 transport->destroy_session(shost);
761 /* ref from host lookup */
762 scsi_host_put(shost);
763 return 0;
764}
765
766static int
767iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev){
768 struct Scsi_Host *shost;
769 struct iscsi_cls_conn *conn; 759 struct iscsi_cls_conn *conn;
760 struct iscsi_cls_session *session;
770 unsigned long flags; 761 unsigned long flags;
771 762
772 if (!transport->create_conn) 763 session = iscsi_session_lookup(ev->u.c_conn.session_handle);
764 if (!session)
773 return -EINVAL; 765 return -EINVAL;
774 766
775 shost = scsi_host_lookup(ev->u.c_conn.sid); 767 conn = transport->create_conn(session, ev->u.c_conn.cid);
776 if (shost == ERR_PTR(-ENXIO))
777 return -EEXIST;
778
779 conn = transport->create_conn(shost, ev->u.c_conn.cid);
780 if (!conn) 768 if (!conn)
781 goto release_ref; 769 return -ENOMEM;
782 770
783 conn->z_pdu = mempool_zone_init(Z_MAX_PDU, 771 conn->z_pdu = mempool_zone_init(Z_MAX_PDU,
784 NLMSG_SPACE(sizeof(struct iscsi_uevent) + 772 NLMSG_SPACE(sizeof(struct iscsi_uevent) +
@@ -800,14 +788,13 @@ iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev)
800 goto free_pdu_pool; 788 goto free_pdu_pool;
801 } 789 }
802 790
803 ev->r.handle = conn->connh = iscsi_handle(conn->dd_data); 791 ev->r.handle = iscsi_handle(conn);
804 792
805 spin_lock_irqsave(&connlock, flags); 793 spin_lock_irqsave(&connlock, flags);
806 list_add(&conn->conn_list, &connlist); 794 list_add(&conn->conn_list, &connlist);
807 conn->active = 1; 795 conn->active = 1;
808 spin_unlock_irqrestore(&connlock, flags); 796 spin_unlock_irqrestore(&connlock, flags);
809 797
810 scsi_host_put(shost);
811 return 0; 798 return 0;
812 799
813free_pdu_pool: 800free_pdu_pool:
@@ -815,8 +802,6 @@ free_pdu_pool:
815destroy_conn: 802destroy_conn:
816 if (transport->destroy_conn) 803 if (transport->destroy_conn)
817 transport->destroy_conn(conn->dd_data); 804 transport->destroy_conn(conn->dd_data);
818release_ref:
819 scsi_host_put(shost);
820 return -ENOMEM; 805 return -ENOMEM;
821} 806}
822 807
@@ -827,13 +812,9 @@ iscsi_if_destroy_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev
827 struct iscsi_cls_conn *conn; 812 struct iscsi_cls_conn *conn;
828 struct mempool_zone *z_error, *z_pdu; 813 struct mempool_zone *z_error, *z_pdu;
829 814
830 conn = iscsi_if_find_conn(ev->u.d_conn.conn_handle); 815 conn = iscsi_conn_lookup(ev->u.d_conn.conn_handle);
831 if (!conn) 816 if (!conn)
832 return -EEXIST;
833
834 if (!transport->destroy_conn)
835 return -EINVAL; 817 return -EINVAL;
836
837 spin_lock_irqsave(&connlock, flags); 818 spin_lock_irqsave(&connlock, flags);
838 conn->active = 0; 819 conn->active = 0;
839 list_del(&conn->conn_list); 820 list_del(&conn->conn_list);
@@ -858,23 +839,27 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
858 struct iscsi_uevent *ev = NLMSG_DATA(nlh); 839 struct iscsi_uevent *ev = NLMSG_DATA(nlh);
859 struct iscsi_transport *transport = NULL; 840 struct iscsi_transport *transport = NULL;
860 struct iscsi_internal *priv; 841 struct iscsi_internal *priv;
861 842 struct iscsi_cls_session *session;
862 if (NETLINK_CREDS(skb)->uid) 843 struct iscsi_cls_conn *conn;
863 return -EPERM;
864 844
865 priv = iscsi_if_transport_lookup(iscsi_ptr(ev->transport_handle)); 845 priv = iscsi_if_transport_lookup(iscsi_ptr(ev->transport_handle));
866 if (!priv) 846 if (!priv)
867 return -EINVAL; 847 return -EINVAL;
868 transport = priv->iscsi_transport; 848 transport = priv->iscsi_transport;
869 849
870 daemon_pid = NETLINK_CREDS(skb)->pid; 850 if (!try_module_get(transport->owner))
851 return -EINVAL;
871 852
872 switch (nlh->nlmsg_type) { 853 switch (nlh->nlmsg_type) {
873 case ISCSI_UEVENT_CREATE_SESSION: 854 case ISCSI_UEVENT_CREATE_SESSION:
874 err = iscsi_if_create_session(priv, ev); 855 err = iscsi_if_create_session(priv, ev);
875 break; 856 break;
876 case ISCSI_UEVENT_DESTROY_SESSION: 857 case ISCSI_UEVENT_DESTROY_SESSION:
877 err = iscsi_if_destroy_session(priv, ev); 858 session = iscsi_session_lookup(ev->u.d_session.session_handle);
859 if (session)
860 transport->destroy_session(session);
861 else
862 err = -EINVAL;
878 break; 863 break;
879 case ISCSI_UEVENT_CREATE_CONN: 864 case ISCSI_UEVENT_CREATE_CONN:
880 err = iscsi_if_create_conn(transport, ev); 865 err = iscsi_if_create_conn(transport, ev);
@@ -883,56 +868,64 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
883 err = iscsi_if_destroy_conn(transport, ev); 868 err = iscsi_if_destroy_conn(transport, ev);
884 break; 869 break;
885 case ISCSI_UEVENT_BIND_CONN: 870 case ISCSI_UEVENT_BIND_CONN:
886 if (!iscsi_if_find_conn(ev->u.b_conn.conn_handle)) 871 session = iscsi_session_lookup(ev->u.b_conn.session_handle);
887 return -EEXIST; 872 conn = iscsi_conn_lookup(ev->u.b_conn.conn_handle);
888 ev->r.retcode = transport->bind_conn( 873
889 ev->u.b_conn.session_handle, 874 if (session && conn)
890 ev->u.b_conn.conn_handle, 875 ev->r.retcode = transport->bind_conn(session, conn,
891 ev->u.b_conn.transport_fd, 876 ev->u.b_conn.transport_fd,
892 ev->u.b_conn.is_leading); 877 ev->u.b_conn.is_leading);
878 else
879 err = -EINVAL;
893 break; 880 break;
894 case ISCSI_UEVENT_SET_PARAM: 881 case ISCSI_UEVENT_SET_PARAM:
895 if (!iscsi_if_find_conn(ev->u.set_param.conn_handle)) 882 conn = iscsi_conn_lookup(ev->u.set_param.conn_handle);
896 return -EEXIST; 883 if (conn)
897 ev->r.retcode = transport->set_param( 884 ev->r.retcode = transport->set_param(conn,
898 ev->u.set_param.conn_handle, 885 ev->u.set_param.param, ev->u.set_param.value);
899 ev->u.set_param.param, ev->u.set_param.value); 886 else
887 err = -EINVAL;
900 break; 888 break;
901 case ISCSI_UEVENT_START_CONN: 889 case ISCSI_UEVENT_START_CONN:
902 if (!iscsi_if_find_conn(ev->u.start_conn.conn_handle)) 890 conn = iscsi_conn_lookup(ev->u.start_conn.conn_handle);
903 return -EEXIST; 891 if (conn)
904 ev->r.retcode = transport->start_conn( 892 ev->r.retcode = transport->start_conn(conn);
905 ev->u.start_conn.conn_handle); 893 else
894 err = -EINVAL;
895
906 break; 896 break;
907 case ISCSI_UEVENT_STOP_CONN: 897 case ISCSI_UEVENT_STOP_CONN:
908 if (!iscsi_if_find_conn(ev->u.stop_conn.conn_handle)) 898 conn = iscsi_conn_lookup(ev->u.stop_conn.conn_handle);
909 return -EEXIST; 899 if (conn)
910 transport->stop_conn(ev->u.stop_conn.conn_handle, 900 transport->stop_conn(conn, ev->u.stop_conn.flag);
911 ev->u.stop_conn.flag); 901 else
902 err = -EINVAL;
912 break; 903 break;
913 case ISCSI_UEVENT_SEND_PDU: 904 case ISCSI_UEVENT_SEND_PDU:
914 if (!iscsi_if_find_conn(ev->u.send_pdu.conn_handle)) 905 conn = iscsi_conn_lookup(ev->u.send_pdu.conn_handle);
915 return -EEXIST; 906 if (conn)
916 ev->r.retcode = transport->send_pdu( 907 ev->r.retcode = transport->send_pdu(conn,
917 ev->u.send_pdu.conn_handle, 908 (struct iscsi_hdr*)((char*)ev + sizeof(*ev)),
918 (struct iscsi_hdr*)((char*)ev + sizeof(*ev)), 909 (char*)ev + sizeof(*ev) + ev->u.send_pdu.hdr_size,
919 (char*)ev + sizeof(*ev) + ev->u.send_pdu.hdr_size, 910 ev->u.send_pdu.data_size);
920 ev->u.send_pdu.data_size); 911 else
912 err = -EINVAL;
921 break; 913 break;
922 case ISCSI_UEVENT_GET_STATS: 914 case ISCSI_UEVENT_GET_STATS:
923 err = iscsi_if_get_stats(transport, skb, nlh); 915 err = iscsi_if_get_stats(transport, nlh);
924 break; 916 break;
925 default: 917 default:
926 err = -EINVAL; 918 err = -EINVAL;
927 break; 919 break;
928 } 920 }
929 921
922 module_put(transport->owner);
930 return err; 923 return err;
931} 924}
932 925
933/* Get message from skb (based on rtnetlink_rcv_skb). Each message is 926/* Get message from skb (based on rtnetlink_rcv_skb). Each message is
934 * processed by iscsi_if_recv_msg. Malformed skbs with wrong length are 927 * processed by iscsi_if_recv_msg. Malformed skbs with wrong length are
935 * discarded silently. */ 928 * or invalid creds discarded silently. */
936static void 929static void
937iscsi_if_rx(struct sock *sk, int len) 930iscsi_if_rx(struct sock *sk, int len)
938{ 931{
@@ -940,6 +933,12 @@ iscsi_if_rx(struct sock *sk, int len)
940 933
941 mutex_lock(&rx_queue_mutex); 934 mutex_lock(&rx_queue_mutex);
942 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { 935 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
936 if (NETLINK_CREDS(skb)->uid) {
937 skb_pull(skb, skb->len);
938 goto free_skb;
939 }
940 daemon_pid = NETLINK_CREDS(skb)->pid;
941
943 while (skb->len >= NLMSG_SPACE(0)) { 942 while (skb->len >= NLMSG_SPACE(0)) {
944 int err; 943 int err;
945 uint32_t rlen; 944 uint32_t rlen;
@@ -951,10 +950,12 @@ iscsi_if_rx(struct sock *sk, int len)
951 skb->len < nlh->nlmsg_len) { 950 skb->len < nlh->nlmsg_len) {
952 break; 951 break;
953 } 952 }
953
954 ev = NLMSG_DATA(nlh); 954 ev = NLMSG_DATA(nlh);
955 rlen = NLMSG_ALIGN(nlh->nlmsg_len); 955 rlen = NLMSG_ALIGN(nlh->nlmsg_len);
956 if (rlen > skb->len) 956 if (rlen > skb->len)
957 rlen = skb->len; 957 rlen = skb->len;
958
958 err = iscsi_if_recv_msg(skb, nlh); 959 err = iscsi_if_recv_msg(skb, nlh);
959 if (err) { 960 if (err) {
960 ev->type = ISCSI_KEVENT_IF_ERROR; 961 ev->type = ISCSI_KEVENT_IF_ERROR;
@@ -978,6 +979,7 @@ iscsi_if_rx(struct sock *sk, int len)
978 } while (err < 0 && err != -ECONNREFUSED); 979 } while (err < 0 && err != -ECONNREFUSED);
979 skb_pull(skb, rlen); 980 skb_pull(skb, rlen);
980 } 981 }
982free_skb:
981 kfree_skb(skb); 983 kfree_skb(skb);
982 } 984 }
983 mutex_unlock(&rx_queue_mutex); 985 mutex_unlock(&rx_queue_mutex);
@@ -997,7 +999,7 @@ show_conn_int_param_##param(struct class_device *cdev, char *buf) \
997 struct iscsi_cls_conn *conn = iscsi_cdev_to_conn(cdev); \ 999 struct iscsi_cls_conn *conn = iscsi_cdev_to_conn(cdev); \
998 struct iscsi_transport *t = conn->transport; \ 1000 struct iscsi_transport *t = conn->transport; \
999 \ 1001 \
1000 t->get_conn_param(conn->dd_data, param, &value); \ 1002 t->get_conn_param(conn, param, &value); \
1001 return snprintf(buf, 20, format"\n", value); \ 1003 return snprintf(buf, 20, format"\n", value); \
1002} 1004}
1003 1005
@@ -1024,10 +1026,9 @@ show_session_int_param_##param(struct class_device *cdev, char *buf) \
1024{ \ 1026{ \
1025 uint32_t value = 0; \ 1027 uint32_t value = 0; \
1026 struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); \ 1028 struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); \
1027 struct Scsi_Host *shost = iscsi_session_to_shost(session); \
1028 struct iscsi_transport *t = session->transport; \ 1029 struct iscsi_transport *t = session->transport; \
1029 \ 1030 \
1030 t->get_session_param(shost, param, &value); \ 1031 t->get_session_param(session, param, &value); \
1031 return snprintf(buf, 20, format"\n", value); \ 1032 return snprintf(buf, 20, format"\n", value); \
1032} 1033}
1033 1034
@@ -1121,7 +1122,6 @@ iscsi_register_transport(struct iscsi_transport *tt)
1121 return NULL; 1122 return NULL;
1122 memset(priv, 0, sizeof(*priv)); 1123 memset(priv, 0, sizeof(*priv));
1123 INIT_LIST_HEAD(&priv->list); 1124 INIT_LIST_HEAD(&priv->list);
1124 INIT_LIST_HEAD(&priv->sessions);
1125 priv->iscsi_transport = tt; 1125 priv->iscsi_transport = tt;
1126 1126
1127 priv->cdev.class = &iscsi_transport_class; 1127 priv->cdev.class = &iscsi_transport_class;
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 8260f040d39c..f4854c33f48d 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -3588,7 +3588,7 @@ static int sym_evaluate_dp(struct sym_hcb *np, struct sym_ccb *cp, u32 scr, int
3588 3588
3589 if (pm) { 3589 if (pm) {
3590 dp_scr = scr_to_cpu(pm->ret); 3590 dp_scr = scr_to_cpu(pm->ret);
3591 dp_ofs -= scr_to_cpu(pm->sg.size); 3591 dp_ofs -= scr_to_cpu(pm->sg.size) & 0x00ffffff;
3592 } 3592 }
3593 3593
3594 /* 3594 /*
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index b1fc97d5f643..244e8ff11977 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2198,7 +2198,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
2198 touch_nmi_watchdog(); 2198 touch_nmi_watchdog();
2199 2199
2200 /* 2200 /*
2201 * First save the UER then disable the interrupts 2201 * First save the IER then disable the interrupts
2202 */ 2202 */
2203 ier = serial_in(up, UART_IER); 2203 ier = serial_in(up, UART_IER);
2204 2204
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 0f4361c8466b..b3c561abe3f6 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -902,8 +902,8 @@ config SERIAL_JSM
902 something like this to connect more than two modems to your Linux 902 something like this to connect more than two modems to your Linux
903 box, for instance in order to become a dial-in server. This driver 903 box, for instance in order to become a dial-in server. This driver
904 supports PCI boards only. 904 supports PCI boards only.
905 If you have a card like this, say Y here and read the file 905
906 <file:Documentation/jsm.txt>. 906 If you have a card like this, say Y here, otherwise say N.
907 907
908 To compile this driver as a module, choose M here: the 908 To compile this driver as a module, choose M here: the
909 module will be called jsm. 909 module will be called jsm.
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index 1d85533d46d2..f3763d2ccb86 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -1717,11 +1717,9 @@ ioc4_change_speed(struct uart_port *the_port,
1717 } 1717 }
1718 1718
1719 if (cflag & CRTSCTS) { 1719 if (cflag & CRTSCTS) {
1720 info->flags |= ASYNC_CTS_FLOW;
1721 port->ip_sscr |= IOC4_SSCR_HFC_EN; 1720 port->ip_sscr |= IOC4_SSCR_HFC_EN;
1722 } 1721 }
1723 else { 1722 else {
1724 info->flags &= ~ASYNC_CTS_FLOW;
1725 port->ip_sscr &= ~IOC4_SSCR_HFC_EN; 1723 port->ip_sscr &= ~IOC4_SSCR_HFC_EN;
1726 } 1724 }
1727 writel(port->ip_sscr, &port->ip_serial_regs->sscr); 1725 writel(port->ip_sscr, &port->ip_serial_regs->sscr);
@@ -1760,18 +1758,6 @@ static inline int ic4_startup_local(struct uart_port *the_port)
1760 1758
1761 info = the_port->info; 1759 info = the_port->info;
1762 1760
1763 if (info->tty) {
1764 set_bit(TTY_IO_ERROR, &info->tty->flags);
1765 clear_bit(TTY_IO_ERROR, &info->tty->flags);
1766 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
1767 info->tty->alt_speed = 57600;
1768 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
1769 info->tty->alt_speed = 115200;
1770 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
1771 info->tty->alt_speed = 230400;
1772 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
1773 info->tty->alt_speed = 460800;
1774 }
1775 local_open(port); 1761 local_open(port);
1776 1762
1777 /* set the speed of the serial port */ 1763 /* set the speed of the serial port */
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 791c4dc550ae..94f5e8ed83a7 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -90,7 +90,7 @@ static int spi_suspend(struct device *dev, pm_message_t message)
90 int value; 90 int value;
91 struct spi_driver *drv = to_spi_driver(dev->driver); 91 struct spi_driver *drv = to_spi_driver(dev->driver);
92 92
93 if (!drv->suspend) 93 if (!drv || !drv->suspend)
94 return 0; 94 return 0;
95 95
96 /* suspend will stop irqs and dma; no more i/o */ 96 /* suspend will stop irqs and dma; no more i/o */
@@ -105,7 +105,7 @@ static int spi_resume(struct device *dev)
105 int value; 105 int value;
106 struct spi_driver *drv = to_spi_driver(dev->driver); 106 struct spi_driver *drv = to_spi_driver(dev->driver);
107 107
108 if (!drv->resume) 108 if (!drv || !drv->resume)
109 return 0; 109 return 0;
110 110
111 /* resume may restart the i/o queue */ 111 /* resume may restart the i/o queue */
@@ -449,7 +449,6 @@ void spi_unregister_master(struct spi_master *master)
449{ 449{
450 (void) device_for_each_child(master->cdev.dev, NULL, __unregister); 450 (void) device_for_each_child(master->cdev.dev, NULL, __unregister);
451 class_device_unregister(&master->cdev); 451 class_device_unregister(&master->cdev);
452 master->cdev.dev = NULL;
453} 452}
454EXPORT_SYMBOL_GPL(spi_unregister_master); 453EXPORT_SYMBOL_GPL(spi_unregister_master);
455 454
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index e9e5bc178cef..118288d94423 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -191,8 +191,9 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
191 } 191 }
192 if (wait_time <= 0) 192 if (wait_time <= 0)
193 printk(KERN_WARNING "%s %s: BIOS handoff " 193 printk(KERN_WARNING "%s %s: BIOS handoff "
194 "failed (BIOS bug ?)\n", 194 "failed (BIOS bug ?) %08x\n",
195 pdev->dev.bus_id, "OHCI"); 195 pdev->dev.bus_id, "OHCI",
196 readl(base + OHCI_CONTROL));
196 197
197 /* reset controller, preserving RWC */ 198 /* reset controller, preserving RWC */
198 writel(control & OHCI_CTRL_RWC, base + OHCI_CONTROL); 199 writel(control & OHCI_CTRL_RWC, base + OHCI_CONTROL);
@@ -243,6 +244,12 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
243 pr_debug("%s %s: BIOS handoff\n", 244 pr_debug("%s %s: BIOS handoff\n",
244 pdev->dev.bus_id, "EHCI"); 245 pdev->dev.bus_id, "EHCI");
245 246
247#if 0
248/* aleksey_gorelov@phoenix.com reports that some systems need SMI forced on,
249 * but that seems dubious in general (the BIOS left it off intentionally)
250 * and is known to prevent some systems from booting. so we won't do this
251 * unless maybe we can determine when we're on a system that needs SMI forced.
252 */
246 /* BIOS workaround (?): be sure the 253 /* BIOS workaround (?): be sure the
247 * pre-Linux code receives the SMI 254 * pre-Linux code receives the SMI
248 */ 255 */
@@ -252,6 +259,7 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
252 pci_write_config_dword(pdev, 259 pci_write_config_dword(pdev,
253 offset + EHCI_USBLEGCTLSTS, 260 offset + EHCI_USBLEGCTLSTS,
254 val | EHCI_USBLEGCTLSTS_SOOE); 261 val | EHCI_USBLEGCTLSTS_SOOE);
262#endif
255 } 263 }
256 264
257 /* always say Linux will own the hardware 265 /* always say Linux will own the hardware
@@ -274,8 +282,8 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
274 * it down, and hope nothing goes too wrong 282 * it down, and hope nothing goes too wrong
275 */ 283 */
276 printk(KERN_WARNING "%s %s: BIOS handoff " 284 printk(KERN_WARNING "%s %s: BIOS handoff "
277 "failed (BIOS bug ?)\n", 285 "failed (BIOS bug ?) %08x\n",
278 pdev->dev.bus_id, "EHCI"); 286 pdev->dev.bus_id, "EHCI", cap);
279 pci_write_config_byte(pdev, offset + 2, 0); 287 pci_write_config_byte(pdev, offset + 2, 0);
280 } 288 }
281 289
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c
index 466384d7c79f..134d2000128a 100644
--- a/drivers/usb/host/sl811_cs.c
+++ b/drivers/usb/host/sl811_cs.c
@@ -101,7 +101,7 @@ static struct resource resources[] = {
101 }, 101 },
102}; 102};
103 103
104extern struct device_driver sl811h_driver; 104extern struct platform_driver sl811h_driver;
105 105
106static struct platform_device platform_dev = { 106static struct platform_device platform_dev = {
107 .id = -1, 107 .id = -1,
@@ -132,7 +132,7 @@ static int sl811_hc_init(struct device *parent, ioaddr_t base_addr, int irq)
132 * initialized already because of the link order dependency created 132 * initialized already because of the link order dependency created
133 * by referencing "sl811h_driver". 133 * by referencing "sl811h_driver".
134 */ 134 */
135 platform_dev.name = sl811h_driver.name; 135 platform_dev.name = sl811h_driver.driver.name;
136 return platform_device_register(&platform_dev); 136 return platform_device_register(&platform_dev);
137} 137}
138 138
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 6f7a684c3e07..772478086bd3 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -1435,17 +1435,20 @@ void hid_init_reports(struct hid_device *hid)
1435#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 1435#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004
1436 1436
1437#define USB_VENDOR_ID_LD 0x0f11 1437#define USB_VENDOR_ID_LD 0x0f11
1438#define USB_DEVICE_ID_CASSY 0x1000 1438#define USB_DEVICE_ID_LD_CASSY 0x1000
1439#define USB_DEVICE_ID_POCKETCASSY 0x1010 1439#define USB_DEVICE_ID_LD_POCKETCASSY 0x1010
1440#define USB_DEVICE_ID_MOBILECASSY 0x1020 1440#define USB_DEVICE_ID_LD_MOBILECASSY 0x1020
1441#define USB_DEVICE_ID_JWM 0x1080 1441#define USB_DEVICE_ID_LD_JWM 0x1080
1442#define USB_DEVICE_ID_DMMP 0x1081 1442#define USB_DEVICE_ID_LD_DMMP 0x1081
1443#define USB_DEVICE_ID_UMIP 0x1090 1443#define USB_DEVICE_ID_LD_UMIP 0x1090
1444#define USB_DEVICE_ID_VIDEOCOM 0x1200 1444#define USB_DEVICE_ID_LD_XRAY1 0x1100
1445#define USB_DEVICE_ID_COM3LAB 0x2000 1445#define USB_DEVICE_ID_LD_XRAY2 0x1101
1446#define USB_DEVICE_ID_TELEPORT 0x2010 1446#define USB_DEVICE_ID_LD_VIDEOCOM 0x1200
1447#define USB_DEVICE_ID_NETWORKANALYSER 0x2020 1447#define USB_DEVICE_ID_LD_COM3LAB 0x2000
1448#define USB_DEVICE_ID_POWERCONTROL 0x2030 1448#define USB_DEVICE_ID_LD_TELEPORT 0x2010
1449#define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020
1450#define USB_DEVICE_ID_LD_POWERCONTROL 0x2030
1451#define USB_DEVICE_ID_LD_MACHINETEST 0x2040
1449 1452
1450#define USB_VENDOR_ID_APPLE 0x05ac 1453#define USB_VENDOR_ID_APPLE 0x05ac
1451#define USB_DEVICE_ID_APPLE_POWERMOUSE 0x0304 1454#define USB_DEVICE_ID_APPLE_POWERMOUSE 0x0304
@@ -1491,17 +1494,20 @@ static const struct hid_blacklist {
1491 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, 1494 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE },
1492 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, 1495 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE },
1493 { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, 1496 { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE },
1494 { USB_VENDOR_ID_LD, USB_DEVICE_ID_CASSY, HID_QUIRK_IGNORE }, 1497 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY, HID_QUIRK_IGNORE },
1495 { USB_VENDOR_ID_LD, USB_DEVICE_ID_POCKETCASSY, HID_QUIRK_IGNORE }, 1498 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY, HID_QUIRK_IGNORE },
1496 { USB_VENDOR_ID_LD, USB_DEVICE_ID_MOBILECASSY, HID_QUIRK_IGNORE }, 1499 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY, HID_QUIRK_IGNORE },
1497 { USB_VENDOR_ID_LD, USB_DEVICE_ID_JWM, HID_QUIRK_IGNORE }, 1500 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM, HID_QUIRK_IGNORE },
1498 { USB_VENDOR_ID_LD, USB_DEVICE_ID_DMMP, HID_QUIRK_IGNORE }, 1501 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP, HID_QUIRK_IGNORE },
1499 { USB_VENDOR_ID_LD, USB_DEVICE_ID_UMIP, HID_QUIRK_IGNORE }, 1502 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP, HID_QUIRK_IGNORE },
1500 { USB_VENDOR_ID_LD, USB_DEVICE_ID_VIDEOCOM, HID_QUIRK_IGNORE }, 1503 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY1, HID_QUIRK_IGNORE },
1501 { USB_VENDOR_ID_LD, USB_DEVICE_ID_COM3LAB, HID_QUIRK_IGNORE }, 1504 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2, HID_QUIRK_IGNORE },
1502 { USB_VENDOR_ID_LD, USB_DEVICE_ID_TELEPORT, HID_QUIRK_IGNORE }, 1505 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM, HID_QUIRK_IGNORE },
1503 { USB_VENDOR_ID_LD, USB_DEVICE_ID_NETWORKANALYSER, HID_QUIRK_IGNORE }, 1506 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB, HID_QUIRK_IGNORE },
1504 { USB_VENDOR_ID_LD, USB_DEVICE_ID_POWERCONTROL, HID_QUIRK_IGNORE }, 1507 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT, HID_QUIRK_IGNORE },
1508 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER, HID_QUIRK_IGNORE },
1509 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL, HID_QUIRK_IGNORE },
1510 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST, HID_QUIRK_IGNORE },
1505 { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS, HID_QUIRK_IGNORE }, 1511 { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS, HID_QUIRK_IGNORE },
1506 { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS, HID_QUIRK_IGNORE }, 1512 { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS, HID_QUIRK_IGNORE },
1507 { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE }, 1513 { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE },
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index 6649531fa824..8ba6a701e9c1 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -141,7 +141,7 @@ source "drivers/usb/misc/sisusbvga/Kconfig"
141 141
142config USB_LD 142config USB_LD
143 tristate "USB LD driver" 143 tristate "USB LD driver"
144 depends on USB && EXPERIMENTAL 144 depends on USB
145 help 145 help
146 This driver is for generic USB devices that use interrupt transfers, 146 This driver is for generic USB devices that use interrupt transfers,
147 like LD Didactic's USB devices. 147 like LD Didactic's USB devices.
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 331d4ae949ed..e2d1198623eb 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -24,6 +24,7 @@
24 * V0.1 (mh) Initial version 24 * V0.1 (mh) Initial version
25 * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint) 25 * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint)
26 * V0.12 (mh) Added kmalloc check for string buffer 26 * V0.12 (mh) Added kmalloc check for string buffer
27 * V0.13 (mh) Added support for LD X-Ray and Machine Test System
27 */ 28 */
28 29
29#include <linux/config.h> 30#include <linux/config.h>
@@ -40,17 +41,20 @@
40 41
41/* Define these values to match your devices */ 42/* Define these values to match your devices */
42#define USB_VENDOR_ID_LD 0x0f11 /* USB Vendor ID of LD Didactic GmbH */ 43#define USB_VENDOR_ID_LD 0x0f11 /* USB Vendor ID of LD Didactic GmbH */
43#define USB_DEVICE_ID_CASSY 0x1000 /* USB Product ID for all CASSY-S modules */ 44#define USB_DEVICE_ID_LD_CASSY 0x1000 /* USB Product ID of CASSY-S */
44#define USB_DEVICE_ID_POCKETCASSY 0x1010 /* USB Product ID for Pocket-CASSY */ 45#define USB_DEVICE_ID_LD_POCKETCASSY 0x1010 /* USB Product ID of Pocket-CASSY */
45#define USB_DEVICE_ID_MOBILECASSY 0x1020 /* USB Product ID for Mobile-CASSY */ 46#define USB_DEVICE_ID_LD_MOBILECASSY 0x1020 /* USB Product ID of Mobile-CASSY */
46#define USB_DEVICE_ID_JWM 0x1080 /* USB Product ID for Joule and Wattmeter */ 47#define USB_DEVICE_ID_LD_JWM 0x1080 /* USB Product ID of Joule and Wattmeter */
47#define USB_DEVICE_ID_DMMP 0x1081 /* USB Product ID for Digital Multimeter P (reserved) */ 48#define USB_DEVICE_ID_LD_DMMP 0x1081 /* USB Product ID of Digital Multimeter P (reserved) */
48#define USB_DEVICE_ID_UMIP 0x1090 /* USB Product ID for UMI P */ 49#define USB_DEVICE_ID_LD_UMIP 0x1090 /* USB Product ID of UMI P */
49#define USB_DEVICE_ID_VIDEOCOM 0x1200 /* USB Product ID for VideoCom */ 50#define USB_DEVICE_ID_LD_XRAY1 0x1100 /* USB Product ID of X-Ray Apparatus */
50#define USB_DEVICE_ID_COM3LAB 0x2000 /* USB Product ID for COM3LAB */ 51#define USB_DEVICE_ID_LD_XRAY2 0x1101 /* USB Product ID of X-Ray Apparatus */
51#define USB_DEVICE_ID_TELEPORT 0x2010 /* USB Product ID for Terminal Adapter */ 52#define USB_DEVICE_ID_LD_VIDEOCOM 0x1200 /* USB Product ID of VideoCom */
52#define USB_DEVICE_ID_NETWORKANALYSER 0x2020 /* USB Product ID for Network Analyser */ 53#define USB_DEVICE_ID_LD_COM3LAB 0x2000 /* USB Product ID of COM3LAB */
53#define USB_DEVICE_ID_POWERCONTROL 0x2030 /* USB Product ID for Controlling device for Power Electronics */ 54#define USB_DEVICE_ID_LD_TELEPORT 0x2010 /* USB Product ID of Terminal Adapter */
55#define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020 /* USB Product ID of Network Analyser */
56#define USB_DEVICE_ID_LD_POWERCONTROL 0x2030 /* USB Product ID of Converter Control Unit */
57#define USB_DEVICE_ID_LD_MACHINETEST 0x2040 /* USB Product ID of Machine Test System */
54 58
55#define USB_VENDOR_ID_VERNIER 0x08f7 59#define USB_VENDOR_ID_VERNIER 0x08f7
56#define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 60#define USB_DEVICE_ID_VERNIER_LABPRO 0x0001
@@ -67,17 +71,20 @@
67 71
68/* table of devices that work with this driver */ 72/* table of devices that work with this driver */
69static struct usb_device_id ld_usb_table [] = { 73static struct usb_device_id ld_usb_table [] = {
70 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_CASSY) }, 74 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) },
71 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_POCKETCASSY) }, 75 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) },
72 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_MOBILECASSY) }, 76 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY) },
73 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_JWM) }, 77 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) },
74 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_DMMP) }, 78 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) },
75 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_UMIP) }, 79 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) },
76 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_VIDEOCOM) }, 80 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY1) },
77 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_COM3LAB) }, 81 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2) },
78 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_TELEPORT) }, 82 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM) },
79 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_NETWORKANALYSER) }, 83 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB) },
80 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_POWERCONTROL) }, 84 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT) },
85 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER) },
86 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL) },
87 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST) },
81 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, 88 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) },
82 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, 89 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) },
83 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, 90 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
@@ -85,7 +92,7 @@ static struct usb_device_id ld_usb_table [] = {
85 { } /* Terminating entry */ 92 { } /* Terminating entry */
86}; 93};
87MODULE_DEVICE_TABLE(usb, ld_usb_table); 94MODULE_DEVICE_TABLE(usb, ld_usb_table);
88MODULE_VERSION("V0.12"); 95MODULE_VERSION("V0.13");
89MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>"); 96MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>");
90MODULE_DESCRIPTION("LD USB Driver"); 97MODULE_DESCRIPTION("LD USB Driver");
91MODULE_LICENSE("GPL"); 98MODULE_LICENSE("GPL");
@@ -632,8 +639,8 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
632 639
633 /* workaround for early firmware versions on fast computers */ 640 /* workaround for early firmware versions on fast computers */
634 if ((le16_to_cpu(udev->descriptor.idVendor) == USB_VENDOR_ID_LD) && 641 if ((le16_to_cpu(udev->descriptor.idVendor) == USB_VENDOR_ID_LD) &&
635 ((le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_CASSY) || 642 ((le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_LD_CASSY) ||
636 (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) && 643 (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_LD_COM3LAB)) &&
637 (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) { 644 (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) {
638 buffer = kmalloc(256, GFP_KERNEL); 645 buffer = kmalloc(256, GFP_KERNEL);
639 if (buffer == NULL) { 646 if (buffer == NULL) {
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index e8e575e037c1..37c81c08faad 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -73,9 +73,10 @@ static struct usb_device_id id_table [] = {
73 { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, 73 { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) },
74 { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) }, 74 { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) },
75 { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, 75 { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) },
76 { USB_DEVICE(NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID ) }, 76 { USB_DEVICE(NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID) },
77 { USB_DEVICE(CA_42_CA42_VENDOR_ID, CA_42_CA42_PRODUCT_ID ) }, 77 { USB_DEVICE(CA_42_CA42_VENDOR_ID, CA_42_CA42_PRODUCT_ID) },
78 { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) }, 78 { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) },
79 { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) },
79 { } /* Terminating entry */ 80 { } /* Terminating entry */
80}; 81};
81 82
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index 1807087a76e3..9bc4755162ad 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -71,3 +71,7 @@
71 71
72#define SAGEM_VENDOR_ID 0x079b 72#define SAGEM_VENDOR_ID 0x079b
73#define SAGEM_PRODUCT_ID 0x0027 73#define SAGEM_PRODUCT_ID 0x0027
74
75/* Leadtek GPS 9531 (ID 0413:2101) */
76#define LEADTEK_VENDOR_ID 0x0413
77#define LEADTEK_9531_PRODUCT_ID 0x2101
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index ee958f986eb8..e71c5ca1a07b 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -106,6 +106,13 @@ UNUSUAL_DEV( 0x0411, 0x001c, 0x0113, 0x0113,
106 US_SC_DEVICE, US_PR_DEVICE, NULL, 106 US_SC_DEVICE, US_PR_DEVICE, NULL,
107 US_FL_FIX_INQUIRY ), 107 US_FL_FIX_INQUIRY ),
108 108
109/* Reported by Christian Leber <christian@leber.de> */
110UNUSUAL_DEV( 0x0419, 0xaaf5, 0x0100, 0x0100,
111 "TrekStor",
112 "i.Beat 115 2.0",
113 US_SC_DEVICE, US_PR_DEVICE, NULL,
114 US_FL_IGNORE_RESIDUE | US_FL_NOT_LOCKABLE ),
115
109/* Reported by Stefan Werner <dustbln@gmx.de> */ 116/* Reported by Stefan Werner <dustbln@gmx.de> */
110UNUSUAL_DEV( 0x0419, 0xaaf6, 0x0100, 0x0100, 117UNUSUAL_DEV( 0x0419, 0xaaf6, 0x0100, 0x0100,
111 "TrekStor", 118 "TrekStor",
@@ -127,6 +134,14 @@ UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
127 US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ), 134 US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ),
128#endif 135#endif
129 136
137/* Patch submitted by Daniel Drake <dsd@gentoo.org>
138 * Device reports nonsense bInterfaceProtocol 6 when connected over USB2 */
139UNUSUAL_DEV( 0x0451, 0x5416, 0x0100, 0x0100,
140 "Neuros Audio",
141 "USB 2.0 HD 2.5",
142 US_SC_DEVICE, US_PR_BULK, NULL,
143 US_FL_NEED_OVERRIDE ),
144
130/* 145/*
131 * Pete Zaitcev <zaitcev@yahoo.com>, from Patrick C. F. Ernzer, bz#162559. 146 * Pete Zaitcev <zaitcev@yahoo.com>, from Patrick C. F. Ernzer, bz#162559.
132 * The key does not actually break, but it returns zero sense which 147 * The key does not actually break, but it returns zero sense which
@@ -137,13 +152,16 @@ UNUSUAL_DEV( 0x0457, 0x0150, 0x0100, 0x0100,
137 "USB Mass Storage Device", 152 "USB Mass Storage Device",
138 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ), 153 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ),
139 154
140/* Patch submitted by Daniel Drake <dsd@gentoo.org> 155/*
141 * Device reports nonsense bInterfaceProtocol 6 when connected over USB2 */ 156* Bohdan Linda <bohdan.linda@gmail.com>
142UNUSUAL_DEV( 0x0451, 0x5416, 0x0100, 0x0100, 157* 1GB USB sticks MyFlash High Speed. I have restricted
143 "Neuros Audio", 158* the revision to my model only
144 "USB 2.0 HD 2.5", 159*/
145 US_SC_DEVICE, US_PR_BULK, NULL, 160UNUSUAL_DEV( 0x0457, 0x0151, 0x0100, 0x0100,
146 US_FL_NEED_OVERRIDE ), 161 "USB 2.0",
162 "Flash Disk",
163 US_SC_DEVICE, US_PR_DEVICE, NULL,
164 US_FL_NOT_LOCKABLE ),
147 165
148UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101, 166UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101,
149 "Rio", 167 "Rio",
@@ -946,6 +964,12 @@ UNUSUAL_DEV( 0x084d, 0x0011, 0x0110, 0x0110,
946 US_SC_DEVICE, US_PR_DEVICE, NULL, 964 US_SC_DEVICE, US_PR_DEVICE, NULL,
947 US_FL_BULK32), 965 US_FL_BULK32),
948 966
967/* Submitted by Jan De Luyck <lkml@kcore.org> */
968UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000,
969 "CITIZEN",
970 "X1DE-USB",
971 US_SC_DEVICE, US_PR_DEVICE, NULL,
972 US_FL_SINGLE_LUN),
949 973
950/* Entry needed for flags. Moreover, all devices with this ID use 974/* Entry needed for flags. Moreover, all devices with this ID use
951 * bulk-only transport, but _some_ falsely report Control/Bulk instead. 975 * bulk-only transport, but _some_ falsely report Control/Bulk instead.
@@ -1085,6 +1109,13 @@ UNUSUAL_DEV( 0x0dda, 0x0301, 0x0012, 0x0012,
1085 US_SC_DEVICE, US_PR_DEVICE, NULL, 1109 US_SC_DEVICE, US_PR_DEVICE, NULL,
1086 US_FL_IGNORE_RESIDUE ), 1110 US_FL_IGNORE_RESIDUE ),
1087 1111
1112/* Reported by Jim McCloskey <mcclosk@ucsc.edu> */
1113UNUSUAL_DEV( 0x0e21, 0x0520, 0x0100, 0x0100,
1114 "Cowon Systems",
1115 "iAUDIO M5",
1116 US_SC_DEVICE, US_PR_BULK, NULL,
1117 0 ),
1118
1088/* Submitted by Antoine Mairesse <antoine.mairesse@free.fr> */ 1119/* Submitted by Antoine Mairesse <antoine.mairesse@free.fr> */
1089UNUSUAL_DEV( 0x0ed1, 0x6660, 0x0100, 0x0300, 1120UNUSUAL_DEV( 0x0ed1, 0x6660, 0x0100, 0x0300,
1090 "USB", 1121 "USB",
@@ -1162,6 +1193,13 @@ UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999,
1162 US_FL_SINGLE_LUN), 1193 US_FL_SINGLE_LUN),
1163#endif 1194#endif
1164 1195
1196/* Reported by Andrew Simmons <andrew.simmons@gmail.com> */
1197UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001,
1198 "DataStor",
1199 "USB4500 FW1.04",
1200 US_SC_DEVICE, US_PR_DEVICE, NULL,
1201 US_FL_FIX_CAPACITY),
1202
1165/* Control/Bulk transport for all SubClass values */ 1203/* Control/Bulk transport for all SubClass values */
1166USUAL_DEV(US_SC_RBC, US_PR_CB, USB_US_TYPE_STOR), 1204USUAL_DEV(US_SC_RBC, US_PR_CB, USB_US_TYPE_STOR),
1167USUAL_DEV(US_SC_8020, US_PR_CB, USB_US_TYPE_STOR), 1205USUAL_DEV(US_SC_8020, US_PR_CB, USB_US_TYPE_STOR),
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 3e153d313bb0..e64ed16bd42f 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -525,11 +525,6 @@ config FB_GBE_MEM
525 This is the amount of memory reserved for the framebuffer, 525 This is the amount of memory reserved for the framebuffer,
526 which can be any value between 1MB and 8MB. 526 which can be any value between 1MB and 8MB.
527 527
528config BUS_I2C
529 bool
530 depends on (FB = y) && VISWS
531 default y
532
533config FB_SUN3 528config FB_SUN3
534 bool "Sun3 framebuffer support" 529 bool "Sun3 framebuffer support"
535 depends on (FB = y) && (SUN3 || SUN3X) && BROKEN 530 depends on (FB = y) && (SUN3 || SUN3X) && BROKEN
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
index 556895e99645..1f8d805c61e5 100644
--- a/drivers/video/aty/radeon_pm.c
+++ b/drivers/video/aty/radeon_pm.c
@@ -1321,8 +1321,6 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo)
1321 mdelay( 15); 1321 mdelay( 15);
1322} 1322}
1323 1323
1324#ifdef CONFIG_PPC_OF
1325
1326static void radeon_pm_reset_pad_ctlr_strength(struct radeonfb_info *rinfo) 1324static void radeon_pm_reset_pad_ctlr_strength(struct radeonfb_info *rinfo)
1327{ 1325{
1328 u32 tmp, tmp2; 1326 u32 tmp, tmp2;
@@ -1836,6 +1834,8 @@ static void radeon_reinitialize_M10(struct radeonfb_info *rinfo)
1836 radeon_pm_m10_enable_lvds_spread_spectrum(rinfo); 1834 radeon_pm_m10_enable_lvds_spread_spectrum(rinfo);
1837} 1835}
1838 1836
1837#ifdef CONFIG_PPC_OF
1838
1839static void radeon_pm_m9p_reconfigure_mc(struct radeonfb_info *rinfo) 1839static void radeon_pm_m9p_reconfigure_mc(struct radeonfb_info *rinfo)
1840{ 1840{
1841 OUTREG(MC_CNTL, rinfo->save_regs[46]); 1841 OUTREG(MC_CNTL, rinfo->save_regs[46]);
@@ -2728,13 +2728,23 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk)
2728 printk("radeonfb: Dynamic Clock Power Management disabled\n"); 2728 printk("radeonfb: Dynamic Clock Power Management disabled\n");
2729 } 2729 }
2730 2730
2731#if defined(CONFIG_PM)
2731 /* Check if we can power manage on suspend/resume. We can do 2732 /* Check if we can power manage on suspend/resume. We can do
2732 * D2 on M6, M7 and M9, and we can resume from D3 cold a few other 2733 * D2 on M6, M7 and M9, and we can resume from D3 cold a few other
2733 * "Mac" cards, but that's all. We need more infos about what the 2734 * "Mac" cards, but that's all. We need more infos about what the
2734 * BIOS does tho. Right now, all this PM stuff is pmac-only for that 2735 * BIOS does tho. Right now, all this PM stuff is pmac-only for that
2735 * reason. --BenH 2736 * reason. --BenH
2736 */ 2737 */
2737#if defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) 2738 /* Special case for Samsung P35 laptops
2739 */
2740 if ((rinfo->pdev->vendor == PCI_VENDOR_ID_ATI) &&
2741 (rinfo->pdev->device == PCI_CHIP_RV350_NP) &&
2742 (rinfo->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG) &&
2743 (rinfo->pdev->subsystem_device == 0xc00c)) {
2744 rinfo->reinit_func = radeon_reinitialize_M10;
2745 rinfo->pm_mode |= radeon_pm_off;
2746 }
2747#if defined(CONFIG_PPC_PMAC)
2738 if (_machine == _MACH_Pmac && rinfo->of_node) { 2748 if (_machine == _MACH_Pmac && rinfo->of_node) {
2739 if (rinfo->is_mobility && rinfo->pm_reg && 2749 if (rinfo->is_mobility && rinfo->pm_reg &&
2740 rinfo->family <= CHIP_FAMILY_RV250) 2750 rinfo->family <= CHIP_FAMILY_RV250)
@@ -2778,7 +2788,8 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk)
2778 OUTREG(TV_DAC_CNTL, INREG(TV_DAC_CNTL) | 0x07000000); 2788 OUTREG(TV_DAC_CNTL, INREG(TV_DAC_CNTL) | 0x07000000);
2779#endif 2789#endif
2780 } 2790 }
2781#endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) */ 2791#endif /* defined(CONFIG_PPC_PMAC) */
2792#endif /* defined(CONFIG_PM) */
2782} 2793}
2783 2794
2784void radeonfb_pm_exit(struct radeonfb_info *rinfo) 2795void radeonfb_pm_exit(struct radeonfb_info *rinfo)
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index d2dede6ed3e5..996c7b58564e 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1550,6 +1550,7 @@ int fb_get_options(char *name, char **option)
1550 return retval; 1550 return retval;
1551} 1551}
1552 1552
1553#ifndef MODULE
1553/** 1554/**
1554 * video_setup - process command line options 1555 * video_setup - process command line options
1555 * @options: string of options 1556 * @options: string of options
@@ -1593,6 +1594,7 @@ static int __init video_setup(char *options)
1593 return 0; 1594 return 0;
1594} 1595}
1595__setup("video=", video_setup); 1596__setup("video=", video_setup);
1597#endif
1596 1598
1597 /* 1599 /*
1598 * Visible symbols for modules 1600 * Visible symbols for modules
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c
index 38d22729b129..c9a7cdf6d543 100644
--- a/drivers/video/gbefb.c
+++ b/drivers/video/gbefb.c
@@ -1243,7 +1243,7 @@ static int __devexit gbefb_remove(struct platform_device* p_dev)
1243 (void *)gbe_tiles.cpu, gbe_tiles.dma); 1243 (void *)gbe_tiles.cpu, gbe_tiles.dma);
1244 release_mem_region(GBE_BASE, sizeof(struct sgi_gbe)); 1244 release_mem_region(GBE_BASE, sizeof(struct sgi_gbe));
1245 iounmap(gbe); 1245 iounmap(gbe);
1246 gbefb_remove_sysfs(dev); 1246 gbefb_remove_sysfs(&p_dev->dev);
1247 framebuffer_release(info); 1247 framebuffer_release(info);
1248 1248
1249 return 0; 1249 return 0;
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
index 747602aa5615..a2e201dc40f7 100644
--- a/drivers/video/neofb.c
+++ b/drivers/video/neofb.c
@@ -843,6 +843,9 @@ static int neofb_set_par(struct fb_info *info)
843 843
844 par->SysIfaceCntl2 = 0xc0; /* VESA Bios sets this to 0x80! */ 844 par->SysIfaceCntl2 = 0xc0; /* VESA Bios sets this to 0x80! */
845 845
846 /* Initialize: by default, we want display config register to be read */
847 par->PanelDispCntlRegRead = 1;
848
846 /* Enable any user specified display devices. */ 849 /* Enable any user specified display devices. */
847 par->PanelDispCntlReg1 = 0x00; 850 par->PanelDispCntlReg1 = 0x00;
848 if (par->internal_display) 851 if (par->internal_display)
@@ -1334,6 +1337,18 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
1334 struct neofb_par *par = info->par; 1337 struct neofb_par *par = info->par;
1335 int seqflags, lcdflags, dpmsflags, reg; 1338 int seqflags, lcdflags, dpmsflags, reg;
1336 1339
1340
1341 /*
1342 * Reload the value stored in the register, if sensible. It might have
1343 * been changed via FN keystroke.
1344 */
1345 if (par->PanelDispCntlRegRead) {
1346 neoUnlock();
1347 par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03;
1348 neoLock(&par->state);
1349 }
1350 par->PanelDispCntlRegRead = !blank_mode;
1351
1337 switch (blank_mode) { 1352 switch (blank_mode) {
1338 case FB_BLANK_POWERDOWN: /* powerdown - both sync lines down */ 1353 case FB_BLANK_POWERDOWN: /* powerdown - both sync lines down */
1339 seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */ 1354 seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */
@@ -1366,7 +1381,7 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
1366 case FB_BLANK_NORMAL: /* just blank screen (backlight stays on) */ 1381 case FB_BLANK_NORMAL: /* just blank screen (backlight stays on) */
1367 seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */ 1382 seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */
1368 lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */ 1383 lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */
1369 dpmsflags = 0; /* no hsync/vsync suppression */ 1384 dpmsflags = 0x00; /* no hsync/vsync suppression */
1370 break; 1385 break;
1371 case FB_BLANK_UNBLANK: /* unblank */ 1386 case FB_BLANK_UNBLANK: /* unblank */
1372 seqflags = 0; /* Enable sequencer */ 1387 seqflags = 0; /* Enable sequencer */
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index dbcb8962e57d..a7c4e5e8ead6 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -138,6 +138,8 @@ static struct pci_device_id nvidiafb_pci_tbl[] = {
138 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 138 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
139 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420_8X, 139 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420_8X,
140 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 140 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
141 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_4000,
142 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
141 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_448_GO, 143 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_448_GO,
142 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 144 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
143 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_488_GO, 145 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_488_GO,
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index d574dd3c9c8a..9451932fbaf2 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -82,7 +82,6 @@
82#include <linux/fb.h> 82#include <linux/fb.h>
83#include <linux/init.h> 83#include <linux/init.h>
84#include <linux/dma-mapping.h> 84#include <linux/dma-mapping.h>
85#include <linux/string.h>
86#include <linux/interrupt.h> 85#include <linux/interrupt.h>
87#include <linux/workqueue.h> 86#include <linux/workqueue.h>
88#include <linux/wait.h> 87#include <linux/wait.h>
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 5250c428fc1f..ef3386549140 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -66,7 +66,7 @@ static match_table_t tokens = {
66 {Opt_afid, "afid=%u"}, 66 {Opt_afid, "afid=%u"},
67 {Opt_rfdno, "rfdno=%u"}, 67 {Opt_rfdno, "rfdno=%u"},
68 {Opt_wfdno, "wfdno=%u"}, 68 {Opt_wfdno, "wfdno=%u"},
69 {Opt_debug, "debug=%u"}, 69 {Opt_debug, "debug=%x"},
70 {Opt_name, "name=%s"}, 70 {Opt_name, "name=%s"},
71 {Opt_remotename, "aname=%s"}, 71 {Opt_remotename, "aname=%s"},
72 {Opt_unix, "proto=unix"}, 72 {Opt_unix, "proto=unix"},
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 217323b0c896..b41e8b379652 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1048,13 +1048,14 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
1048 cifs_small_buf_release(iov[0].iov_base); 1048 cifs_small_buf_release(iov[0].iov_base);
1049 else if(resp_buf_type == CIFS_LARGE_BUFFER) 1049 else if(resp_buf_type == CIFS_LARGE_BUFFER)
1050 cifs_buf_release(iov[0].iov_base); 1050 cifs_buf_release(iov[0].iov_base);
1051 } else /* return buffer to caller to free */ /* BB FIXME how do we tell caller if it is not a large buffer */ { 1051 } else if(resp_buf_type != CIFS_NO_BUFFER) {
1052 *buf = iov[0].iov_base; 1052 /* return buffer to caller to free */
1053 *buf = iov[0].iov_base;
1053 if(resp_buf_type == CIFS_SMALL_BUFFER) 1054 if(resp_buf_type == CIFS_SMALL_BUFFER)
1054 *pbuf_type = CIFS_SMALL_BUFFER; 1055 *pbuf_type = CIFS_SMALL_BUFFER;
1055 else if(resp_buf_type == CIFS_LARGE_BUFFER) 1056 else if(resp_buf_type == CIFS_LARGE_BUFFER)
1056 *pbuf_type = CIFS_LARGE_BUFFER; 1057 *pbuf_type = CIFS_LARGE_BUFFER;
1057 } 1058 } /* else no valid buffer on return - leave as null */
1058 1059
1059 /* Note: On -EAGAIN error only caller can retry on handle based calls 1060 /* Note: On -EAGAIN error only caller can retry on handle based calls
1060 since file handle passed in no longer valid */ 1061 since file handle passed in no longer valid */
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index e488603fb1e7..ef5ae6f93c75 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1795,10 +1795,10 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1795 conjunction with 52K kvec constraint on arch with 4K 1795 conjunction with 52K kvec constraint on arch with 4K
1796 page size */ 1796 page size */
1797 1797
1798 if(cifs_sb->rsize < PAGE_CACHE_SIZE) { 1798 if(cifs_sb->rsize < 2048) {
1799 cifs_sb->rsize = PAGE_CACHE_SIZE; 1799 cifs_sb->rsize = 2048;
1800 /* Windows ME does this */ 1800 /* Windows ME may prefer this */
1801 cFYI(1,("Attempt to set readsize for mount to less than one page (4096)")); 1801 cFYI(1,("readsize set to minimum 2048"));
1802 } 1802 }
1803 cifs_sb->mnt_uid = volume_info.linux_uid; 1803 cifs_sb->mnt_uid = volume_info.linux_uid;
1804 cifs_sb->mnt_gid = volume_info.linux_gid; 1804 cifs_sb->mnt_gid = volume_info.linux_gid;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index d17c97d07c80..675bd2568297 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1442,13 +1442,15 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
1442 &bytes_read, &smb_read_data, 1442 &bytes_read, &smb_read_data,
1443 &buf_type); 1443 &buf_type);
1444 pSMBr = (struct smb_com_read_rsp *)smb_read_data; 1444 pSMBr = (struct smb_com_read_rsp *)smb_read_data;
1445 if (copy_to_user(current_offset,
1446 smb_read_data + 4 /* RFC1001 hdr */
1447 + le16_to_cpu(pSMBr->DataOffset),
1448 bytes_read)) {
1449 rc = -EFAULT;
1450 }
1451 if (smb_read_data) { 1445 if (smb_read_data) {
1446 if (copy_to_user(current_offset,
1447 smb_read_data +
1448 4 /* RFC1001 length field */ +
1449 le16_to_cpu(pSMBr->DataOffset),
1450 bytes_read)) {
1451 rc = -EFAULT;
1452 }
1453
1452 if(buf_type == CIFS_SMALL_BUFFER) 1454 if(buf_type == CIFS_SMALL_BUFFER)
1453 cifs_small_buf_release(smb_read_data); 1455 cifs_small_buf_release(smb_read_data);
1454 else if(buf_type == CIFS_LARGE_BUFFER) 1456 else if(buf_type == CIFS_LARGE_BUFFER)
diff --git a/fs/compat.c b/fs/compat.c
index 70c5af4cc270..5333c7d7427f 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1751,11 +1751,15 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
1751 ret = compat_core_sys_select(n, inp, outp, exp, &timeout); 1751 ret = compat_core_sys_select(n, inp, outp, exp, &timeout);
1752 1752
1753 if (tvp) { 1753 if (tvp) {
1754 struct compat_timeval rtv;
1755
1754 if (current->personality & STICKY_TIMEOUTS) 1756 if (current->personality & STICKY_TIMEOUTS)
1755 goto sticky; 1757 goto sticky;
1756 tv.tv_usec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ)); 1758 rtv.tv_usec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ));
1757 tv.tv_sec = timeout; 1759 rtv.tv_sec = timeout;
1758 if (copy_to_user(tvp, &tv, sizeof(tv))) { 1760 if (compat_timeval_compare(&rtv, &tv) >= 0)
1761 rtv = tv;
1762 if (copy_to_user(tvp, &rtv, sizeof(rtv))) {
1759sticky: 1763sticky:
1760 /* 1764 /*
1761 * If an application puts its timeval in read-only 1765 * If an application puts its timeval in read-only
@@ -1822,13 +1826,17 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp,
1822 } while (!ret && !timeout && tsp && (ts.tv_sec || ts.tv_nsec)); 1826 } while (!ret && !timeout && tsp && (ts.tv_sec || ts.tv_nsec));
1823 1827
1824 if (tsp && !(current->personality & STICKY_TIMEOUTS)) { 1828 if (tsp && !(current->personality & STICKY_TIMEOUTS)) {
1825 ts.tv_sec += timeout / HZ; 1829 struct compat_timespec rts;
1826 ts.tv_nsec += (timeout % HZ) * (1000000000/HZ); 1830
1827 if (ts.tv_nsec >= 1000000000) { 1831 rts.tv_sec = timeout / HZ;
1828 ts.tv_sec++; 1832 rts.tv_nsec = (timeout % HZ) * (NSEC_PER_SEC/HZ);
1829 ts.tv_nsec -= 1000000000; 1833 if (rts.tv_nsec >= NSEC_PER_SEC) {
1834 rts.tv_sec++;
1835 rts.tv_nsec -= NSEC_PER_SEC;
1830 } 1836 }
1831 (void)copy_to_user(tsp, &ts, sizeof(ts)); 1837 if (compat_timespec_compare(&rts, &ts) >= 0)
1838 rts = ts;
1839 copy_to_user(tsp, &rts, sizeof(rts));
1832 } 1840 }
1833 1841
1834 if (ret == -ERESTARTNOHAND) { 1842 if (ret == -ERESTARTNOHAND) {
@@ -1918,12 +1926,17 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
1918 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 1926 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
1919 1927
1920 if (tsp && timeout >= 0) { 1928 if (tsp && timeout >= 0) {
1929 struct compat_timespec rts;
1930
1921 if (current->personality & STICKY_TIMEOUTS) 1931 if (current->personality & STICKY_TIMEOUTS)
1922 goto sticky; 1932 goto sticky;
1923 /* Yes, we know it's actually an s64, but it's also positive. */ 1933 /* Yes, we know it's actually an s64, but it's also positive. */
1924 ts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ)) * 1000; 1934 rts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ)) *
1925 ts.tv_sec = timeout; 1935 1000;
1926 if (copy_to_user(tsp, &ts, sizeof(ts))) { 1936 rts.tv_sec = timeout;
1937 if (compat_timespec_compare(&rts, &ts) >= 0)
1938 rts = ts;
1939 if (copy_to_user(tsp, &rts, sizeof(rts))) {
1927sticky: 1940sticky:
1928 /* 1941 /*
1929 * If an application puts its timeval in read-only 1942 * If an application puts its timeval in read-only
diff --git a/fs/exec.c b/fs/exec.c
index 055378d2513e..0e1c95074d42 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1403,7 +1403,7 @@ static void zap_threads (struct mm_struct *mm)
1403 do_each_thread(g,p) { 1403 do_each_thread(g,p) {
1404 if (mm == p->mm && p != tsk && 1404 if (mm == p->mm && p != tsk &&
1405 p->ptrace && p->parent->mm == mm) { 1405 p->ptrace && p->parent->mm == mm) {
1406 __ptrace_unlink(p); 1406 __ptrace_detach(p, 0);
1407 } 1407 }
1408 } while_each_thread(g,p); 1408 } while_each_thread(g,p);
1409 write_unlock_irq(&tasklist_lock); 1409 write_unlock_irq(&tasklist_lock);
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index a2ca3107d475..86ae8e93adb9 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -792,18 +792,20 @@ ext2_xattr_delete_inode(struct inode *inode)
792 ext2_free_blocks(inode, EXT2_I(inode)->i_file_acl, 1); 792 ext2_free_blocks(inode, EXT2_I(inode)->i_file_acl, 1);
793 get_bh(bh); 793 get_bh(bh);
794 bforget(bh); 794 bforget(bh);
795 unlock_buffer(bh);
795 } else { 796 } else {
796 HDR(bh)->h_refcount = cpu_to_le32( 797 HDR(bh)->h_refcount = cpu_to_le32(
797 le32_to_cpu(HDR(bh)->h_refcount) - 1); 798 le32_to_cpu(HDR(bh)->h_refcount) - 1);
798 if (ce) 799 if (ce)
799 mb_cache_entry_release(ce); 800 mb_cache_entry_release(ce);
801 ea_bdebug(bh, "refcount now=%d",
802 le32_to_cpu(HDR(bh)->h_refcount));
803 unlock_buffer(bh);
800 mark_buffer_dirty(bh); 804 mark_buffer_dirty(bh);
801 if (IS_SYNC(inode)) 805 if (IS_SYNC(inode))
802 sync_dirty_buffer(bh); 806 sync_dirty_buffer(bh);
803 DQUOT_FREE_BLOCK(inode, 1); 807 DQUOT_FREE_BLOCK(inode, 1);
804 } 808 }
805 ea_bdebug(bh, "refcount now=%d", le32_to_cpu(HDR(bh)->h_refcount) - 1);
806 unlock_buffer(bh);
807 EXT2_I(inode)->i_file_acl = 0; 809 EXT2_I(inode)->i_file_acl = 0;
808 810
809cleanup: 811cleanup:
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index f556a0d5c0d3..0c9a2ee54c91 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -66,6 +66,12 @@ static void restore_sigs(sigset_t *oldset)
66 sigprocmask(SIG_SETMASK, oldset, NULL); 66 sigprocmask(SIG_SETMASK, oldset, NULL);
67} 67}
68 68
69/*
70 * Reset request, so that it can be reused
71 *
72 * The caller must be _very_ careful to make sure, that it is holding
73 * the only reference to req
74 */
69void fuse_reset_request(struct fuse_req *req) 75void fuse_reset_request(struct fuse_req *req)
70{ 76{
71 int preallocated = req->preallocated; 77 int preallocated = req->preallocated;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 296351615b00..6f05379b0a0d 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -116,9 +116,14 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir)
116/* Special case for failed iget in CREATE */ 116/* Special case for failed iget in CREATE */
117static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req) 117static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req)
118{ 118{
119 u64 nodeid = req->in.h.nodeid; 119 /* If called from end_io_requests(), req has more than one
120 fuse_reset_request(req); 120 reference and fuse_reset_request() cannot work */
121 fuse_send_forget(fc, req, nodeid, 1); 121 if (fc->connected) {
122 u64 nodeid = req->in.h.nodeid;
123 fuse_reset_request(req);
124 fuse_send_forget(fc, req, nodeid, 1);
125 } else
126 fuse_put_request(fc, req);
122} 127}
123 128
124void fuse_send_release(struct fuse_conn *fc, struct fuse_file *ff, 129void fuse_send_release(struct fuse_conn *fc, struct fuse_file *ff,
diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c
index e6265a0b56b8..543ed543d1e5 100644
--- a/fs/jbd/checkpoint.c
+++ b/fs/jbd/checkpoint.c
@@ -24,75 +24,29 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25 25
26/* 26/*
27 * Unlink a buffer from a transaction checkpoint list. 27 * Unlink a buffer from a transaction.
28 * 28 *
29 * Called with j_list_lock held. 29 * Called with j_list_lock held.
30 */ 30 */
31 31
32static void __buffer_unlink_first(struct journal_head *jh) 32static inline void __buffer_unlink(struct journal_head *jh)
33{ 33{
34 transaction_t *transaction; 34 transaction_t *transaction;
35 35
36 transaction = jh->b_cp_transaction; 36 transaction = jh->b_cp_transaction;
37 jh->b_cp_transaction = NULL;
37 38
38 jh->b_cpnext->b_cpprev = jh->b_cpprev; 39 jh->b_cpnext->b_cpprev = jh->b_cpprev;
39 jh->b_cpprev->b_cpnext = jh->b_cpnext; 40 jh->b_cpprev->b_cpnext = jh->b_cpnext;
40 if (transaction->t_checkpoint_list == jh) { 41 if (transaction->t_checkpoint_list == jh)
41 transaction->t_checkpoint_list = jh->b_cpnext; 42 transaction->t_checkpoint_list = jh->b_cpnext;
42 if (transaction->t_checkpoint_list == jh) 43 if (transaction->t_checkpoint_list == jh)
43 transaction->t_checkpoint_list = NULL; 44 transaction->t_checkpoint_list = NULL;
44 }
45}
46
47/*
48 * Unlink a buffer from a transaction checkpoint(io) list.
49 *
50 * Called with j_list_lock held.
51 */
52
53static inline void __buffer_unlink(struct journal_head *jh)
54{
55 transaction_t *transaction;
56
57 transaction = jh->b_cp_transaction;
58
59 __buffer_unlink_first(jh);
60 if (transaction->t_checkpoint_io_list == jh) {
61 transaction->t_checkpoint_io_list = jh->b_cpnext;
62 if (transaction->t_checkpoint_io_list == jh)
63 transaction->t_checkpoint_io_list = NULL;
64 }
65}
66
67/*
68 * Move a buffer from the checkpoint list to the checkpoint io list
69 *
70 * Called with j_list_lock held
71 */
72
73static inline void __buffer_relink_io(struct journal_head *jh)
74{
75 transaction_t *transaction;
76
77 transaction = jh->b_cp_transaction;
78 __buffer_unlink_first(jh);
79
80 if (!transaction->t_checkpoint_io_list) {
81 jh->b_cpnext = jh->b_cpprev = jh;
82 } else {
83 jh->b_cpnext = transaction->t_checkpoint_io_list;
84 jh->b_cpprev = transaction->t_checkpoint_io_list->b_cpprev;
85 jh->b_cpprev->b_cpnext = jh;
86 jh->b_cpnext->b_cpprev = jh;
87 }
88 transaction->t_checkpoint_io_list = jh;
89} 45}
90 46
91/* 47/*
92 * Try to release a checkpointed buffer from its transaction. 48 * Try to release a checkpointed buffer from its transaction.
93 * Returns 1 if we released it and 2 if we also released the 49 * Returns 1 if we released it.
94 * whole transaction.
95 *
96 * Requires j_list_lock 50 * Requires j_list_lock
97 * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it 51 * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it
98 */ 52 */
@@ -103,11 +57,12 @@ static int __try_to_free_cp_buf(struct journal_head *jh)
103 57
104 if (jh->b_jlist == BJ_None && !buffer_locked(bh) && !buffer_dirty(bh)) { 58 if (jh->b_jlist == BJ_None && !buffer_locked(bh) && !buffer_dirty(bh)) {
105 JBUFFER_TRACE(jh, "remove from checkpoint list"); 59 JBUFFER_TRACE(jh, "remove from checkpoint list");
106 ret = __journal_remove_checkpoint(jh) + 1; 60 __journal_remove_checkpoint(jh);
107 jbd_unlock_bh_state(bh); 61 jbd_unlock_bh_state(bh);
108 journal_remove_journal_head(bh); 62 journal_remove_journal_head(bh);
109 BUFFER_TRACE(bh, "release"); 63 BUFFER_TRACE(bh, "release");
110 __brelse(bh); 64 __brelse(bh);
65 ret = 1;
111 } else { 66 } else {
112 jbd_unlock_bh_state(bh); 67 jbd_unlock_bh_state(bh);
113 } 68 }
@@ -162,53 +117,83 @@ static void jbd_sync_bh(journal_t *journal, struct buffer_head *bh)
162} 117}
163 118
164/* 119/*
165 * Clean up transaction's list of buffers submitted for io. 120 * Clean up a transaction's checkpoint list.
166 * We wait for any pending IO to complete and remove any clean 121 *
167 * buffers. Note that we take the buffers in the opposite ordering 122 * We wait for any pending IO to complete and make sure any clean
168 * from the one in which they were submitted for IO. 123 * buffers are removed from the transaction.
124 *
125 * Return 1 if we performed any actions which might have destroyed the
126 * checkpoint. (journal_remove_checkpoint() deletes the transaction when
127 * the last checkpoint buffer is cleansed)
169 * 128 *
170 * Called with j_list_lock held. 129 * Called with j_list_lock held.
171 */ 130 */
172 131static int __cleanup_transaction(journal_t *journal, transaction_t *transaction)
173static void __wait_cp_io(journal_t *journal, transaction_t *transaction)
174{ 132{
175 struct journal_head *jh; 133 struct journal_head *jh, *next_jh, *last_jh;
176 struct buffer_head *bh; 134 struct buffer_head *bh;
177 tid_t this_tid; 135 int ret = 0;
178 int released = 0; 136
179 137 assert_spin_locked(&journal->j_list_lock);
180 this_tid = transaction->t_tid; 138 jh = transaction->t_checkpoint_list;
181restart: 139 if (!jh)
182 /* Didn't somebody clean up the transaction in the meanwhile */ 140 return 0;
183 if (journal->j_checkpoint_transactions != transaction || 141
184 transaction->t_tid != this_tid) 142 last_jh = jh->b_cpprev;
185 return; 143 next_jh = jh;
186 while (!released && transaction->t_checkpoint_io_list) { 144 do {
187 jh = transaction->t_checkpoint_io_list; 145 jh = next_jh;
188 bh = jh2bh(jh); 146 bh = jh2bh(jh);
189 if (!jbd_trylock_bh_state(bh)) {
190 jbd_sync_bh(journal, bh);
191 spin_lock(&journal->j_list_lock);
192 goto restart;
193 }
194 if (buffer_locked(bh)) { 147 if (buffer_locked(bh)) {
195 atomic_inc(&bh->b_count); 148 atomic_inc(&bh->b_count);
196 spin_unlock(&journal->j_list_lock); 149 spin_unlock(&journal->j_list_lock);
197 jbd_unlock_bh_state(bh);
198 wait_on_buffer(bh); 150 wait_on_buffer(bh);
199 /* the journal_head may have gone by now */ 151 /* the journal_head may have gone by now */
200 BUFFER_TRACE(bh, "brelse"); 152 BUFFER_TRACE(bh, "brelse");
201 __brelse(bh); 153 __brelse(bh);
202 spin_lock(&journal->j_list_lock); 154 goto out_return_1;
203 goto restart;
204 } 155 }
156
205 /* 157 /*
206 * Now in whatever state the buffer currently is, we know that 158 * This is foul
207 * it has been written out and so we can drop it from the list
208 */ 159 */
209 released = __journal_remove_checkpoint(jh); 160 if (!jbd_trylock_bh_state(bh)) {
210 jbd_unlock_bh_state(bh); 161 jbd_sync_bh(journal, bh);
211 } 162 goto out_return_1;
163 }
164
165 if (jh->b_transaction != NULL) {
166 transaction_t *t = jh->b_transaction;
167 tid_t tid = t->t_tid;
168
169 spin_unlock(&journal->j_list_lock);
170 jbd_unlock_bh_state(bh);
171 log_start_commit(journal, tid);
172 log_wait_commit(journal, tid);
173 goto out_return_1;
174 }
175
176 /*
177 * AKPM: I think the buffer_jbddirty test is redundant - it
178 * shouldn't have NULL b_transaction?
179 */
180 next_jh = jh->b_cpnext;
181 if (!buffer_dirty(bh) && !buffer_jbddirty(bh)) {
182 BUFFER_TRACE(bh, "remove from checkpoint");
183 __journal_remove_checkpoint(jh);
184 jbd_unlock_bh_state(bh);
185 journal_remove_journal_head(bh);
186 __brelse(bh);
187 ret = 1;
188 } else {
189 jbd_unlock_bh_state(bh);
190 }
191 } while (jh != last_jh);
192
193 return ret;
194out_return_1:
195 spin_lock(&journal->j_list_lock);
196 return 1;
212} 197}
213 198
214#define NR_BATCH 64 199#define NR_BATCH 64
@@ -218,7 +203,9 @@ __flush_batch(journal_t *journal, struct buffer_head **bhs, int *batch_count)
218{ 203{
219 int i; 204 int i;
220 205
206 spin_unlock(&journal->j_list_lock);
221 ll_rw_block(SWRITE, *batch_count, bhs); 207 ll_rw_block(SWRITE, *batch_count, bhs);
208 spin_lock(&journal->j_list_lock);
222 for (i = 0; i < *batch_count; i++) { 209 for (i = 0; i < *batch_count; i++) {
223 struct buffer_head *bh = bhs[i]; 210 struct buffer_head *bh = bhs[i];
224 clear_buffer_jwrite(bh); 211 clear_buffer_jwrite(bh);
@@ -234,46 +221,19 @@ __flush_batch(journal_t *journal, struct buffer_head **bhs, int *batch_count)
234 * Return 1 if something happened which requires us to abort the current 221 * Return 1 if something happened which requires us to abort the current
235 * scan of the checkpoint list. 222 * scan of the checkpoint list.
236 * 223 *
237 * Called with j_list_lock held and drops it if 1 is returned 224 * Called with j_list_lock held.
238 * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it 225 * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it
239 */ 226 */
240static int __process_buffer(journal_t *journal, struct journal_head *jh, 227static int __flush_buffer(journal_t *journal, struct journal_head *jh,
241 struct buffer_head **bhs, int *batch_count) 228 struct buffer_head **bhs, int *batch_count,
229 int *drop_count)
242{ 230{
243 struct buffer_head *bh = jh2bh(jh); 231 struct buffer_head *bh = jh2bh(jh);
244 int ret = 0; 232 int ret = 0;
245 233
246 if (buffer_locked(bh)) { 234 if (buffer_dirty(bh) && !buffer_locked(bh) && jh->b_jlist == BJ_None) {
247 get_bh(bh); 235 J_ASSERT_JH(jh, jh->b_transaction == NULL);
248 spin_unlock(&journal->j_list_lock);
249 jbd_unlock_bh_state(bh);
250 wait_on_buffer(bh);
251 /* the journal_head may have gone by now */
252 BUFFER_TRACE(bh, "brelse");
253 put_bh(bh);
254 ret = 1;
255 }
256 else if (jh->b_transaction != NULL) {
257 transaction_t *t = jh->b_transaction;
258 tid_t tid = t->t_tid;
259 236
260 spin_unlock(&journal->j_list_lock);
261 jbd_unlock_bh_state(bh);
262 log_start_commit(journal, tid);
263 log_wait_commit(journal, tid);
264 ret = 1;
265 }
266 else if (!buffer_dirty(bh)) {
267 J_ASSERT_JH(jh, !buffer_jbddirty(bh));
268 BUFFER_TRACE(bh, "remove from checkpoint");
269 __journal_remove_checkpoint(jh);
270 spin_unlock(&journal->j_list_lock);
271 jbd_unlock_bh_state(bh);
272 journal_remove_journal_head(bh);
273 put_bh(bh);
274 ret = 1;
275 }
276 else {
277 /* 237 /*
278 * Important: we are about to write the buffer, and 238 * Important: we are about to write the buffer, and
279 * possibly block, while still holding the journal lock. 239 * possibly block, while still holding the journal lock.
@@ -286,30 +246,45 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh,
286 J_ASSERT_BH(bh, !buffer_jwrite(bh)); 246 J_ASSERT_BH(bh, !buffer_jwrite(bh));
287 set_buffer_jwrite(bh); 247 set_buffer_jwrite(bh);
288 bhs[*batch_count] = bh; 248 bhs[*batch_count] = bh;
289 __buffer_relink_io(jh);
290 jbd_unlock_bh_state(bh); 249 jbd_unlock_bh_state(bh);
291 (*batch_count)++; 250 (*batch_count)++;
292 if (*batch_count == NR_BATCH) { 251 if (*batch_count == NR_BATCH) {
293 spin_unlock(&journal->j_list_lock);
294 __flush_batch(journal, bhs, batch_count); 252 __flush_batch(journal, bhs, batch_count);
295 ret = 1; 253 ret = 1;
296 } 254 }
255 } else {
256 int last_buffer = 0;
257 if (jh->b_cpnext == jh) {
258 /* We may be about to drop the transaction. Tell the
259 * caller that the lists have changed.
260 */
261 last_buffer = 1;
262 }
263 if (__try_to_free_cp_buf(jh)) {
264 (*drop_count)++;
265 ret = last_buffer;
266 }
297 } 267 }
298 return ret; 268 return ret;
299} 269}
300 270
301/* 271/*
302 * Perform an actual checkpoint. We take the first transaction on the 272 * Perform an actual checkpoint. We don't write out only enough to
303 * list of transactions to be checkpointed and send all its buffers 273 * satisfy the current blocked requests: rather we submit a reasonably
304 * to disk. We submit larger chunks of data at once. 274 * sized chunk of the outstanding data to disk at once for
275 * efficiency. __log_wait_for_space() will retry if we didn't free enough.
305 * 276 *
277 * However, we _do_ take into account the amount requested so that once
278 * the IO has been queued, we can return as soon as enough of it has
279 * completed to disk.
280 *
306 * The journal should be locked before calling this function. 281 * The journal should be locked before calling this function.
307 */ 282 */
308int log_do_checkpoint(journal_t *journal) 283int log_do_checkpoint(journal_t *journal)
309{ 284{
310 transaction_t *transaction;
311 tid_t this_tid;
312 int result; 285 int result;
286 int batch_count = 0;
287 struct buffer_head *bhs[NR_BATCH];
313 288
314 jbd_debug(1, "Start checkpoint\n"); 289 jbd_debug(1, "Start checkpoint\n");
315 290
@@ -324,70 +299,79 @@ int log_do_checkpoint(journal_t *journal)
324 return result; 299 return result;
325 300
326 /* 301 /*
327 * OK, we need to start writing disk blocks. Take one transaction 302 * OK, we need to start writing disk blocks. Try to free up a
328 * and write it. 303 * quarter of the log in a single checkpoint if we can.
329 */ 304 */
330 spin_lock(&journal->j_list_lock);
331 if (!journal->j_checkpoint_transactions)
332 goto out;
333 transaction = journal->j_checkpoint_transactions;
334 this_tid = transaction->t_tid;
335restart:
336 /* 305 /*
337 * If someone cleaned up this transaction while we slept, we're 306 * AKPM: check this code. I had a feeling a while back that it
338 * done (maybe it's a new transaction, but it fell at the same 307 * degenerates into a busy loop at unmount time.
339 * address).
340 */ 308 */
341 if (journal->j_checkpoint_transactions == transaction && 309 spin_lock(&journal->j_list_lock);
342 transaction->t_tid == this_tid) { 310 while (journal->j_checkpoint_transactions) {
343 int batch_count = 0; 311 transaction_t *transaction;
344 struct buffer_head *bhs[NR_BATCH]; 312 struct journal_head *jh, *last_jh, *next_jh;
345 struct journal_head *jh; 313 int drop_count = 0;
346 int retry = 0; 314 int cleanup_ret, retry = 0;
347 315 tid_t this_tid;
348 while (!retry && transaction->t_checkpoint_list) { 316
317 transaction = journal->j_checkpoint_transactions;
318 this_tid = transaction->t_tid;
319 jh = transaction->t_checkpoint_list;
320 last_jh = jh->b_cpprev;
321 next_jh = jh;
322 do {
349 struct buffer_head *bh; 323 struct buffer_head *bh;
350 324
351 jh = transaction->t_checkpoint_list; 325 jh = next_jh;
326 next_jh = jh->b_cpnext;
352 bh = jh2bh(jh); 327 bh = jh2bh(jh);
353 if (!jbd_trylock_bh_state(bh)) { 328 if (!jbd_trylock_bh_state(bh)) {
354 jbd_sync_bh(journal, bh); 329 jbd_sync_bh(journal, bh);
330 spin_lock(&journal->j_list_lock);
355 retry = 1; 331 retry = 1;
356 break; 332 break;
357 } 333 }
358 retry = __process_buffer(journal, jh, bhs, 334 retry = __flush_buffer(journal, jh, bhs, &batch_count, &drop_count);
359 &batch_count); 335 if (cond_resched_lock(&journal->j_list_lock)) {
360 if (!retry &&
361 lock_need_resched(&journal->j_list_lock)) {
362 spin_unlock(&journal->j_list_lock);
363 retry = 1; 336 retry = 1;
364 break; 337 break;
365 } 338 }
366 } 339 } while (jh != last_jh && !retry);
367 340
368 if (batch_count) { 341 if (batch_count) {
369 if (!retry) {
370 spin_unlock(&journal->j_list_lock);
371 retry = 1;
372 }
373 __flush_batch(journal, bhs, &batch_count); 342 __flush_batch(journal, bhs, &batch_count);
343 retry = 1;
374 } 344 }
375 345
376 if (retry) {
377 spin_lock(&journal->j_list_lock);
378 goto restart;
379 }
380 /* 346 /*
381 * Now we have cleaned up the first transaction's checkpoint 347 * If someone cleaned up this transaction while we slept, we're
382 * list. Let's clean up the second one. 348 * done
349 */
350 if (journal->j_checkpoint_transactions != transaction)
351 break;
352 if (retry)
353 continue;
354 /*
355 * Maybe it's a new transaction, but it fell at the same
356 * address
383 */ 357 */
384 __wait_cp_io(journal, transaction); 358 if (transaction->t_tid != this_tid)
359 continue;
360 /*
361 * We have walked the whole transaction list without
362 * finding anything to write to disk. We had better be
363 * able to make some progress or we are in trouble.
364 */
365 cleanup_ret = __cleanup_transaction(journal, transaction);
366 J_ASSERT(drop_count != 0 || cleanup_ret != 0);
367 if (journal->j_checkpoint_transactions != transaction)
368 break;
385 } 369 }
386out:
387 spin_unlock(&journal->j_list_lock); 370 spin_unlock(&journal->j_list_lock);
388 result = cleanup_journal_tail(journal); 371 result = cleanup_journal_tail(journal);
389 if (result < 0) 372 if (result < 0)
390 return result; 373 return result;
374
391 return 0; 375 return 0;
392} 376}
393 377
@@ -472,91 +456,52 @@ int cleanup_journal_tail(journal_t *journal)
472/* Checkpoint list management */ 456/* Checkpoint list management */
473 457
474/* 458/*
475 * journal_clean_one_cp_list
476 *
477 * Find all the written-back checkpoint buffers in the given list and release them.
478 *
479 * Called with the journal locked.
480 * Called with j_list_lock held.
481 * Returns number of bufers reaped (for debug)
482 */
483
484static int journal_clean_one_cp_list(struct journal_head *jh, int *released)
485{
486 struct journal_head *last_jh;
487 struct journal_head *next_jh = jh;
488 int ret, freed = 0;
489
490 *released = 0;
491 if (!jh)
492 return 0;
493
494 last_jh = jh->b_cpprev;
495 do {
496 jh = next_jh;
497 next_jh = jh->b_cpnext;
498 /* Use trylock because of the ranking */
499 if (jbd_trylock_bh_state(jh2bh(jh))) {
500 ret = __try_to_free_cp_buf(jh);
501 if (ret) {
502 freed++;
503 if (ret == 2) {
504 *released = 1;
505 return freed;
506 }
507 }
508 }
509 /*
510 * This function only frees up some memory if possible so we
511 * dont have an obligation to finish processing. Bail out if
512 * preemption requested:
513 */
514 if (need_resched())
515 return freed;
516 } while (jh != last_jh);
517
518 return freed;
519}
520
521/*
522 * journal_clean_checkpoint_list 459 * journal_clean_checkpoint_list
523 * 460 *
524 * Find all the written-back checkpoint buffers in the journal and release them. 461 * Find all the written-back checkpoint buffers in the journal and release them.
525 * 462 *
526 * Called with the journal locked. 463 * Called with the journal locked.
527 * Called with j_list_lock held. 464 * Called with j_list_lock held.
528 * Returns number of buffers reaped (for debug) 465 * Returns number of bufers reaped (for debug)
529 */ 466 */
530 467
531int __journal_clean_checkpoint_list(journal_t *journal) 468int __journal_clean_checkpoint_list(journal_t *journal)
532{ 469{
533 transaction_t *transaction, *last_transaction, *next_transaction; 470 transaction_t *transaction, *last_transaction, *next_transaction;
534 int ret = 0, released; 471 int ret = 0;
535 472
536 transaction = journal->j_checkpoint_transactions; 473 transaction = journal->j_checkpoint_transactions;
537 if (!transaction) 474 if (transaction == 0)
538 goto out; 475 goto out;
539 476
540 last_transaction = transaction->t_cpprev; 477 last_transaction = transaction->t_cpprev;
541 next_transaction = transaction; 478 next_transaction = transaction;
542 do { 479 do {
480 struct journal_head *jh;
481
543 transaction = next_transaction; 482 transaction = next_transaction;
544 next_transaction = transaction->t_cpnext; 483 next_transaction = transaction->t_cpnext;
545 ret += journal_clean_one_cp_list(transaction-> 484 jh = transaction->t_checkpoint_list;
546 t_checkpoint_list, &released); 485 if (jh) {
547 if (need_resched()) 486 struct journal_head *last_jh = jh->b_cpprev;
548 goto out; 487 struct journal_head *next_jh = jh;
549 if (released) 488
550 continue; 489 do {
551 /* 490 jh = next_jh;
552 * It is essential that we are as careful as in the case of 491 next_jh = jh->b_cpnext;
553 * t_checkpoint_list with removing the buffer from the list as 492 /* Use trylock because of the ranknig */
554 * we can possibly see not yet submitted buffers on io_list 493 if (jbd_trylock_bh_state(jh2bh(jh)))
555 */ 494 ret += __try_to_free_cp_buf(jh);
556 ret += journal_clean_one_cp_list(transaction-> 495 /*
557 t_checkpoint_io_list, &released); 496 * This function only frees up some memory
558 if (need_resched()) 497 * if possible so we dont have an obligation
559 goto out; 498 * to finish processing. Bail out if preemption
499 * requested:
500 */
501 if (need_resched())
502 goto out;
503 } while (jh != last_jh);
504 }
560 } while (transaction != last_transaction); 505 } while (transaction != last_transaction);
561out: 506out:
562 return ret; 507 return ret;
@@ -571,22 +516,18 @@ out:
571 * buffer updates committed in that transaction have safely been stored 516 * buffer updates committed in that transaction have safely been stored
572 * elsewhere on disk. To achieve this, all of the buffers in a 517 * elsewhere on disk. To achieve this, all of the buffers in a
573 * transaction need to be maintained on the transaction's checkpoint 518 * transaction need to be maintained on the transaction's checkpoint
574 * lists until they have been rewritten, at which point this function is 519 * list until they have been rewritten, at which point this function is
575 * called to remove the buffer from the existing transaction's 520 * called to remove the buffer from the existing transaction's
576 * checkpoint lists. 521 * checkpoint list.
577 *
578 * The function returns 1 if it frees the transaction, 0 otherwise.
579 * 522 *
580 * This function is called with the journal locked. 523 * This function is called with the journal locked.
581 * This function is called with j_list_lock held. 524 * This function is called with j_list_lock held.
582 * This function is called with jbd_lock_bh_state(jh2bh(jh))
583 */ 525 */
584 526
585int __journal_remove_checkpoint(struct journal_head *jh) 527void __journal_remove_checkpoint(struct journal_head *jh)
586{ 528{
587 transaction_t *transaction; 529 transaction_t *transaction;
588 journal_t *journal; 530 journal_t *journal;
589 int ret = 0;
590 531
591 JBUFFER_TRACE(jh, "entry"); 532 JBUFFER_TRACE(jh, "entry");
592 533
@@ -597,10 +538,8 @@ int __journal_remove_checkpoint(struct journal_head *jh)
597 journal = transaction->t_journal; 538 journal = transaction->t_journal;
598 539
599 __buffer_unlink(jh); 540 __buffer_unlink(jh);
600 jh->b_cp_transaction = NULL;
601 541
602 if (transaction->t_checkpoint_list != NULL || 542 if (transaction->t_checkpoint_list != NULL)
603 transaction->t_checkpoint_io_list != NULL)
604 goto out; 543 goto out;
605 JBUFFER_TRACE(jh, "transaction has no more buffers"); 544 JBUFFER_TRACE(jh, "transaction has no more buffers");
606 545
@@ -626,10 +565,8 @@ int __journal_remove_checkpoint(struct journal_head *jh)
626 /* Just in case anybody was waiting for more transactions to be 565 /* Just in case anybody was waiting for more transactions to be
627 checkpointed... */ 566 checkpointed... */
628 wake_up(&journal->j_wait_logspace); 567 wake_up(&journal->j_wait_logspace);
629 ret = 1;
630out: 568out:
631 JBUFFER_TRACE(jh, "exit"); 569 JBUFFER_TRACE(jh, "exit");
632 return ret;
633} 570}
634 571
635/* 572/*
@@ -691,7 +628,6 @@ void __journal_drop_transaction(journal_t *journal, transaction_t *transaction)
691 J_ASSERT(transaction->t_shadow_list == NULL); 628 J_ASSERT(transaction->t_shadow_list == NULL);
692 J_ASSERT(transaction->t_log_list == NULL); 629 J_ASSERT(transaction->t_log_list == NULL);
693 J_ASSERT(transaction->t_checkpoint_list == NULL); 630 J_ASSERT(transaction->t_checkpoint_list == NULL);
694 J_ASSERT(transaction->t_checkpoint_io_list == NULL);
695 J_ASSERT(transaction->t_updates == 0); 631 J_ASSERT(transaction->t_updates == 0);
696 J_ASSERT(journal->j_committing_transaction != transaction); 632 J_ASSERT(journal->j_committing_transaction != transaction);
697 J_ASSERT(journal->j_running_transaction != transaction); 633 J_ASSERT(journal->j_running_transaction != transaction);
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c
index 29e62d98bae6..002ad2bbc769 100644
--- a/fs/jbd/commit.c
+++ b/fs/jbd/commit.c
@@ -829,8 +829,7 @@ restart_loop:
829 journal->j_committing_transaction = NULL; 829 journal->j_committing_transaction = NULL;
830 spin_unlock(&journal->j_state_lock); 830 spin_unlock(&journal->j_state_lock);
831 831
832 if (commit_transaction->t_checkpoint_list == NULL && 832 if (commit_transaction->t_checkpoint_list == NULL) {
833 commit_transaction->t_checkpoint_io_list == NULL) {
834 __journal_drop_transaction(journal, commit_transaction); 833 __journal_drop_transaction(journal, commit_transaction);
835 } else { 834 } else {
836 if (journal->j_checkpoint_transactions == NULL) { 835 if (journal->j_checkpoint_transactions == NULL) {
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index 3eaf6e701087..da6354baa0b8 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -111,9 +111,10 @@ long nlmclnt_block(struct nlm_rqst *req, long timeout)
111/* 111/*
112 * The server lockd has called us back to tell us the lock was granted 112 * The server lockd has called us back to tell us the lock was granted
113 */ 113 */
114u32 114u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock)
115nlmclnt_grant(struct nlm_lock *lock)
116{ 115{
116 const struct file_lock *fl = &lock->fl;
117 const struct nfs_fh *fh = &lock->fh;
117 struct nlm_wait *block; 118 struct nlm_wait *block;
118 u32 res = nlm_lck_denied; 119 u32 res = nlm_lck_denied;
119 120
@@ -122,14 +123,20 @@ nlmclnt_grant(struct nlm_lock *lock)
122 * Warning: must not use cookie to match it! 123 * Warning: must not use cookie to match it!
123 */ 124 */
124 list_for_each_entry(block, &nlm_blocked, b_list) { 125 list_for_each_entry(block, &nlm_blocked, b_list) {
125 if (nlm_compare_locks(block->b_lock, &lock->fl)) { 126 struct file_lock *fl_blocked = block->b_lock;
126 /* Alright, we found a lock. Set the return status 127
127 * and wake up the caller 128 if (!nlm_compare_locks(fl_blocked, fl))
128 */ 129 continue;
129 block->b_status = NLM_LCK_GRANTED; 130 if (!nlm_cmp_addr(&block->b_host->h_addr, addr))
130 wake_up(&block->b_wait); 131 continue;
131 res = nlm_granted; 132 if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_dentry->d_inode) ,fh) != 0)
132 } 133 continue;
134 /* Alright, we found a lock. Set the return status
135 * and wake up the caller
136 */
137 block->b_status = NLM_LCK_GRANTED;
138 wake_up(&block->b_wait);
139 res = nlm_granted;
133 } 140 }
134 return res; 141 return res;
135} 142}
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index 4063095d849e..b10f913aa06a 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -228,7 +228,7 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
228 resp->cookie = argp->cookie; 228 resp->cookie = argp->cookie;
229 229
230 dprintk("lockd: GRANTED called\n"); 230 dprintk("lockd: GRANTED called\n");
231 resp->status = nlmclnt_grant(&argp->lock); 231 resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock);
232 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); 232 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
233 return rpc_success; 233 return rpc_success;
234} 234}
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 3bc437e0cf5b..35681d9cf1fc 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -256,7 +256,7 @@ nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
256 resp->cookie = argp->cookie; 256 resp->cookie = argp->cookie;
257 257
258 dprintk("lockd: GRANTED called\n"); 258 dprintk("lockd: GRANTED called\n");
259 resp->status = nlmclnt_grant(&argp->lock); 259 resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock);
260 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); 260 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
261 return rpc_success; 261 return rpc_success;
262} 262}
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
index 42eb53b5293b..23ceaa7127b4 100644
--- a/fs/ocfs2/dlm/dlmcommon.h
+++ b/fs/ocfs2/dlm/dlmcommon.h
@@ -208,6 +208,9 @@ static inline void __dlm_set_joining_node(struct dlm_ctxt *dlm,
208#define DLM_LOCK_RES_IN_PROGRESS 0x00000010 208#define DLM_LOCK_RES_IN_PROGRESS 0x00000010
209#define DLM_LOCK_RES_MIGRATING 0x00000020 209#define DLM_LOCK_RES_MIGRATING 0x00000020
210 210
211/* max milliseconds to wait to sync up a network failure with a node death */
212#define DLM_NODE_DEATH_WAIT_MAX (5 * 1000)
213
211#define DLM_PURGE_INTERVAL_MS (8 * 1000) 214#define DLM_PURGE_INTERVAL_MS (8 * 1000)
212 215
213struct dlm_lock_resource 216struct dlm_lock_resource
@@ -658,6 +661,7 @@ int dlm_launch_recovery_thread(struct dlm_ctxt *dlm);
658void dlm_complete_recovery_thread(struct dlm_ctxt *dlm); 661void dlm_complete_recovery_thread(struct dlm_ctxt *dlm);
659void dlm_wait_for_recovery(struct dlm_ctxt *dlm); 662void dlm_wait_for_recovery(struct dlm_ctxt *dlm);
660int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node); 663int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node);
664int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout);
661 665
662void dlm_put(struct dlm_ctxt *dlm); 666void dlm_put(struct dlm_ctxt *dlm);
663struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm); 667struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm);
diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c
index 6001b22a997d..f66e2d818ccd 100644
--- a/fs/ocfs2/dlm/dlmconvert.c
+++ b/fs/ocfs2/dlm/dlmconvert.c
@@ -392,6 +392,11 @@ static enum dlm_status dlm_send_remote_convert_request(struct dlm_ctxt *dlm,
392 } else { 392 } else {
393 mlog_errno(tmpret); 393 mlog_errno(tmpret);
394 if (dlm_is_host_down(tmpret)) { 394 if (dlm_is_host_down(tmpret)) {
395 /* instead of logging the same network error over
396 * and over, sleep here and wait for the heartbeat
397 * to notice the node is dead. times out after 5s. */
398 dlm_wait_for_node_death(dlm, res->owner,
399 DLM_NODE_DEATH_WAIT_MAX);
395 ret = DLM_RECOVERING; 400 ret = DLM_RECOVERING;
396 mlog(0, "node %u died so returning DLM_RECOVERING " 401 mlog(0, "node %u died so returning DLM_RECOVERING "
397 "from convert message!\n", res->owner); 402 "from convert message!\n", res->owner);
@@ -421,7 +426,7 @@ int dlm_convert_lock_handler(struct o2net_msg *msg, u32 len, void *data)
421 struct dlm_lockstatus *lksb; 426 struct dlm_lockstatus *lksb;
422 enum dlm_status status = DLM_NORMAL; 427 enum dlm_status status = DLM_NORMAL;
423 u32 flags; 428 u32 flags;
424 int call_ast = 0, kick_thread = 0; 429 int call_ast = 0, kick_thread = 0, ast_reserved = 0;
425 430
426 if (!dlm_grab(dlm)) { 431 if (!dlm_grab(dlm)) {
427 dlm_error(DLM_REJECTED); 432 dlm_error(DLM_REJECTED);
@@ -490,6 +495,7 @@ int dlm_convert_lock_handler(struct o2net_msg *msg, u32 len, void *data)
490 status = __dlm_lockres_state_to_status(res); 495 status = __dlm_lockres_state_to_status(res);
491 if (status == DLM_NORMAL) { 496 if (status == DLM_NORMAL) {
492 __dlm_lockres_reserve_ast(res); 497 __dlm_lockres_reserve_ast(res);
498 ast_reserved = 1;
493 res->state |= DLM_LOCK_RES_IN_PROGRESS; 499 res->state |= DLM_LOCK_RES_IN_PROGRESS;
494 status = __dlmconvert_master(dlm, res, lock, flags, 500 status = __dlmconvert_master(dlm, res, lock, flags,
495 cnv->requested_type, 501 cnv->requested_type,
@@ -512,10 +518,10 @@ leave:
512 else 518 else
513 dlm_lock_put(lock); 519 dlm_lock_put(lock);
514 520
515 /* either queue the ast or release it */ 521 /* either queue the ast or release it, if reserved */
516 if (call_ast) 522 if (call_ast)
517 dlm_queue_ast(dlm, lock); 523 dlm_queue_ast(dlm, lock);
518 else 524 else if (ast_reserved)
519 dlm_lockres_release_ast(dlm, res); 525 dlm_lockres_release_ast(dlm, res);
520 526
521 if (kick_thread) 527 if (kick_thread)
diff --git a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c
index d1a0038557a3..671d4ff222cc 100644
--- a/fs/ocfs2/dlm/dlmlock.c
+++ b/fs/ocfs2/dlm/dlmlock.c
@@ -220,6 +220,17 @@ static enum dlm_status dlmlock_remote(struct dlm_ctxt *dlm,
220 dlm_error(status); 220 dlm_error(status);
221 dlm_revert_pending_lock(res, lock); 221 dlm_revert_pending_lock(res, lock);
222 dlm_lock_put(lock); 222 dlm_lock_put(lock);
223 } else if (dlm_is_recovery_lock(res->lockname.name,
224 res->lockname.len)) {
225 /* special case for the $RECOVERY lock.
226 * there will never be an AST delivered to put
227 * this lock on the proper secondary queue
228 * (granted), so do it manually. */
229 mlog(0, "%s: $RECOVERY lock for this node (%u) is "
230 "mastered by %u; got lock, manually granting (no ast)\n",
231 dlm->name, dlm->node_num, res->owner);
232 list_del_init(&lock->list);
233 list_add_tail(&lock->list, &res->granted);
223 } 234 }
224 spin_unlock(&res->spinlock); 235 spin_unlock(&res->spinlock);
225 236
@@ -646,7 +657,19 @@ retry_lock:
646 mlog(0, "retrying lock with migration/" 657 mlog(0, "retrying lock with migration/"
647 "recovery/in progress\n"); 658 "recovery/in progress\n");
648 msleep(100); 659 msleep(100);
649 dlm_wait_for_recovery(dlm); 660 /* no waiting for dlm_reco_thread */
661 if (recovery) {
662 if (status == DLM_RECOVERING) {
663 mlog(0, "%s: got RECOVERING "
664 "for $REOCVERY lock, master "
665 "was %u\n", dlm->name,
666 res->owner);
667 dlm_wait_for_node_death(dlm, res->owner,
668 DLM_NODE_DEATH_WAIT_MAX);
669 }
670 } else {
671 dlm_wait_for_recovery(dlm);
672 }
650 goto retry_lock; 673 goto retry_lock;
651 } 674 }
652 675
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index a3194fe173d9..2e2e95e69499 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2482,7 +2482,9 @@ top:
2482 atomic_set(&mle->woken, 1); 2482 atomic_set(&mle->woken, 1);
2483 spin_unlock(&mle->spinlock); 2483 spin_unlock(&mle->spinlock);
2484 wake_up(&mle->wq); 2484 wake_up(&mle->wq);
2485 /* final put will take care of list removal */ 2485 /* do not need events any longer, so detach
2486 * from heartbeat */
2487 __dlm_mle_detach_hb_events(dlm, mle);
2486 __dlm_put_mle(mle); 2488 __dlm_put_mle(mle);
2487 } 2489 }
2488 continue; 2490 continue;
@@ -2537,6 +2539,9 @@ top:
2537 spin_unlock(&res->spinlock); 2539 spin_unlock(&res->spinlock);
2538 dlm_lockres_put(res); 2540 dlm_lockres_put(res);
2539 2541
2542 /* about to get rid of mle, detach from heartbeat */
2543 __dlm_mle_detach_hb_events(dlm, mle);
2544
2540 /* dump the mle */ 2545 /* dump the mle */
2541 spin_lock(&dlm->master_lock); 2546 spin_lock(&dlm->master_lock);
2542 __dlm_put_mle(mle); 2547 __dlm_put_mle(mle);
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index 186e9a76aa58..ed76bda1a534 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -278,6 +278,24 @@ int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node)
278 return dead; 278 return dead;
279} 279}
280 280
281int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout)
282{
283 if (timeout) {
284 mlog(ML_NOTICE, "%s: waiting %dms for notification of "
285 "death of node %u\n", dlm->name, timeout, node);
286 wait_event_timeout(dlm->dlm_reco_thread_wq,
287 dlm_is_node_dead(dlm, node),
288 msecs_to_jiffies(timeout));
289 } else {
290 mlog(ML_NOTICE, "%s: waiting indefinitely for notification "
291 "of death of node %u\n", dlm->name, node);
292 wait_event(dlm->dlm_reco_thread_wq,
293 dlm_is_node_dead(dlm, node));
294 }
295 /* for now, return 0 */
296 return 0;
297}
298
281/* callers of the top-level api calls (dlmlock/dlmunlock) should 299/* callers of the top-level api calls (dlmlock/dlmunlock) should
282 * block on the dlm->reco.event when recovery is in progress. 300 * block on the dlm->reco.event when recovery is in progress.
283 * the dlm recovery thread will set this state when it begins 301 * the dlm recovery thread will set this state when it begins
@@ -2032,6 +2050,30 @@ again:
2032 dlm->reco.new_master); 2050 dlm->reco.new_master);
2033 status = -EEXIST; 2051 status = -EEXIST;
2034 } else { 2052 } else {
2053 status = 0;
2054
2055 /* see if recovery was already finished elsewhere */
2056 spin_lock(&dlm->spinlock);
2057 if (dlm->reco.dead_node == O2NM_INVALID_NODE_NUM) {
2058 status = -EINVAL;
2059 mlog(0, "%s: got reco EX lock, but "
2060 "node got recovered already\n", dlm->name);
2061 if (dlm->reco.new_master != O2NM_INVALID_NODE_NUM) {
2062 mlog(ML_ERROR, "%s: new master is %u "
2063 "but no dead node!\n",
2064 dlm->name, dlm->reco.new_master);
2065 BUG();
2066 }
2067 }
2068 spin_unlock(&dlm->spinlock);
2069 }
2070
2071 /* if this node has actually become the recovery master,
2072 * set the master and send the messages to begin recovery */
2073 if (!status) {
2074 mlog(0, "%s: dead=%u, this=%u, sending "
2075 "begin_reco now\n", dlm->name,
2076 dlm->reco.dead_node, dlm->node_num);
2035 status = dlm_send_begin_reco_message(dlm, 2077 status = dlm_send_begin_reco_message(dlm,
2036 dlm->reco.dead_node); 2078 dlm->reco.dead_node);
2037 /* this always succeeds */ 2079 /* this always succeeds */
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index fa0bcac5ceae..d329c9df90ae 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1584,10 +1584,9 @@ static int ocfs2_commit_thread(void *arg)
1584 while (!(kthread_should_stop() && 1584 while (!(kthread_should_stop() &&
1585 atomic_read(&journal->j_num_trans) == 0)) { 1585 atomic_read(&journal->j_num_trans) == 0)) {
1586 1586
1587 wait_event_interruptible_timeout(osb->checkpoint_event, 1587 wait_event_interruptible(osb->checkpoint_event,
1588 atomic_read(&journal->j_num_trans) 1588 atomic_read(&journal->j_num_trans)
1589 || kthread_should_stop(), 1589 || kthread_should_stop());
1590 OCFS2_CHECKPOINT_INTERVAL);
1591 1590
1592 status = ocfs2_commit_cache(osb); 1591 status = ocfs2_commit_cache(osb);
1593 if (status < 0) 1592 if (status < 0)
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
index 7d0a816184fa..2f3a6acdac45 100644
--- a/fs/ocfs2/journal.h
+++ b/fs/ocfs2/journal.h
@@ -29,8 +29,6 @@
29#include <linux/fs.h> 29#include <linux/fs.h>
30#include <linux/jbd.h> 30#include <linux/jbd.h>
31 31
32#define OCFS2_CHECKPOINT_INTERVAL (8 * HZ)
33
34enum ocfs2_journal_state { 32enum ocfs2_journal_state {
35 OCFS2_JOURNAL_FREE = 0, 33 OCFS2_JOURNAL_FREE = 0,
36 OCFS2_JOURNAL_LOADED, 34 OCFS2_JOURNAL_LOADED,
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 6573f31f1fd9..075d3e945602 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -204,10 +204,6 @@ int proc_fill_super(struct super_block *s, void *data, int silent)
204 root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root); 204 root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root);
205 if (!root_inode) 205 if (!root_inode)
206 goto out_no_root; 206 goto out_no_root;
207 /*
208 * Fixup the root inode's nlink value
209 */
210 root_inode->i_nlink += nr_processes();
211 root_inode->i_uid = 0; 207 root_inode->i_uid = 0;
212 root_inode->i_gid = 0; 208 root_inode->i_gid = 0;
213 s->s_root = d_alloc_root(root_inode); 209 s->s_root = d_alloc_root(root_inode);
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 68896283c8ae..c3fd3611112f 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -80,16 +80,16 @@ void __init proc_root_init(void)
80 proc_bus = proc_mkdir("bus", NULL); 80 proc_bus = proc_mkdir("bus", NULL);
81} 81}
82 82
83static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry, struct nameidata *nd) 83static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
84)
84{ 85{
85 /* 86 generic_fillattr(dentry->d_inode, stat);
86 * nr_threads is actually protected by the tasklist_lock; 87 stat->nlink = proc_root.nlink + nr_processes();
87 * however, it's conventional to do reads, especially for 88 return 0;
88 * reporting, without any locking whatsoever. 89}
89 */
90 if (dir->i_ino == PROC_ROOT_INO) /* check for safety... */
91 dir->i_nlink = proc_root.nlink + nr_threads;
92 90
91static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry, struct nameidata *nd)
92{
93 if (!proc_lookup(dir, dentry, nd)) { 93 if (!proc_lookup(dir, dentry, nd)) {
94 return NULL; 94 return NULL;
95 } 95 }
@@ -134,6 +134,7 @@ static struct file_operations proc_root_operations = {
134 */ 134 */
135static struct inode_operations proc_root_inode_operations = { 135static struct inode_operations proc_root_inode_operations = {
136 .lookup = proc_root_lookup, 136 .lookup = proc_root_lookup,
137 .getattr = proc_root_getattr,
137}; 138};
138 139
139/* 140/*
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index ef5e5414e7a8..d63da756eb49 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1124,8 +1124,6 @@ static void handle_attrs(struct super_block *s)
1124 "reiserfs: cannot support attributes until flag is set in super-block"); 1124 "reiserfs: cannot support attributes until flag is set in super-block");
1125 REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS); 1125 REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS);
1126 } 1126 }
1127 } else if (le32_to_cpu(rs->s_flags) & reiserfs_attrs_cleared) {
1128 REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ATTRS);
1129 } 1127 }
1130} 1128}
1131 1129
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index 43de3ba83332..ab8894c3b9e5 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -228,7 +228,8 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
228 acl = ERR_PTR(retval); 228 acl = ERR_PTR(retval);
229 } else { 229 } else {
230 acl = posix_acl_from_disk(value, retval); 230 acl = posix_acl_from_disk(value, retval);
231 *p_acl = posix_acl_dup(acl); 231 if (!IS_ERR(acl))
232 *p_acl = posix_acl_dup(acl);
232 } 233 }
233 234
234 kfree(value); 235 kfree(value);
diff --git a/fs/select.c b/fs/select.c
index bc60a3e14ef3..1815a57d2255 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -398,11 +398,15 @@ asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
398 ret = core_sys_select(n, inp, outp, exp, &timeout); 398 ret = core_sys_select(n, inp, outp, exp, &timeout);
399 399
400 if (tvp) { 400 if (tvp) {
401 struct timeval rtv;
402
401 if (current->personality & STICKY_TIMEOUTS) 403 if (current->personality & STICKY_TIMEOUTS)
402 goto sticky; 404 goto sticky;
403 tv.tv_usec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ)); 405 rtv.tv_usec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ));
404 tv.tv_sec = timeout; 406 rtv.tv_sec = timeout;
405 if (copy_to_user(tvp, &tv, sizeof(tv))) { 407 if (timeval_compare(&rtv, &tv) >= 0)
408 rtv = tv;
409 if (copy_to_user(tvp, &rtv, sizeof(rtv))) {
406sticky: 410sticky:
407 /* 411 /*
408 * If an application puts its timeval in read-only 412 * If an application puts its timeval in read-only
@@ -460,11 +464,16 @@ asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp,
460 ret = core_sys_select(n, inp, outp, exp, &timeout); 464 ret = core_sys_select(n, inp, outp, exp, &timeout);
461 465
462 if (tsp) { 466 if (tsp) {
467 struct timespec rts;
468
463 if (current->personality & STICKY_TIMEOUTS) 469 if (current->personality & STICKY_TIMEOUTS)
464 goto sticky; 470 goto sticky;
465 ts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ)) * 1000; 471 rts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ)) *
466 ts.tv_sec = timeout; 472 1000;
467 if (copy_to_user(tsp, &ts, sizeof(ts))) { 473 rts.tv_sec = timeout;
474 if (timespec_compare(&rts, &ts) >= 0)
475 rts = ts;
476 if (copy_to_user(tsp, &rts, sizeof(rts))) {
468sticky: 477sticky:
469 /* 478 /*
470 * If an application puts its timeval in read-only 479 * If an application puts its timeval in read-only
@@ -758,12 +767,17 @@ asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds,
758 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 767 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
759 768
760 if (tsp && timeout >= 0) { 769 if (tsp && timeout >= 0) {
770 struct timespec rts;
771
761 if (current->personality & STICKY_TIMEOUTS) 772 if (current->personality & STICKY_TIMEOUTS)
762 goto sticky; 773 goto sticky;
763 /* Yes, we know it's actually an s64, but it's also positive. */ 774 /* Yes, we know it's actually an s64, but it's also positive. */
764 ts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ)) * 1000; 775 rts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ)) *
765 ts.tv_sec = timeout; 776 1000;
766 if (copy_to_user(tsp, &ts, sizeof(ts))) { 777 rts.tv_sec = timeout;
778 if (timespec_compare(&rts, &ts) >= 0)
779 rts = ts;
780 if (copy_to_user(tsp, &rts, sizeof(rts))) {
767 sticky: 781 sticky:
768 /* 782 /*
769 * If an application puts its timeval in read-only 783 * If an application puts its timeval in read-only
diff --git a/fs/stat.c b/fs/stat.c
index 24211b030f39..9948cc1685a4 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -261,6 +261,7 @@ asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf)
261 return error; 261 return error;
262} 262}
263 263
264#ifndef __ARCH_WANT_STAT64
264asmlinkage long sys_newfstatat(int dfd, char __user *filename, 265asmlinkage long sys_newfstatat(int dfd, char __user *filename,
265 struct stat __user *statbuf, int flag) 266 struct stat __user *statbuf, int flag)
266{ 267{
@@ -281,6 +282,7 @@ asmlinkage long sys_newfstatat(int dfd, char __user *filename,
281out: 282out:
282 return error; 283 return error;
283} 284}
285#endif
284 286
285asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf) 287asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf)
286{ 288{
@@ -395,6 +397,26 @@ asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf)
395 return error; 397 return error;
396} 398}
397 399
400asmlinkage long sys_fstatat64(int dfd, char __user *filename,
401 struct stat64 __user *statbuf, int flag)
402{
403 struct kstat stat;
404 int error = -EINVAL;
405
406 if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
407 goto out;
408
409 if (flag & AT_SYMLINK_NOFOLLOW)
410 error = vfs_lstat_fd(dfd, filename, &stat);
411 else
412 error = vfs_stat_fd(dfd, filename, &stat);
413
414 if (!error)
415 error = cp_new_stat64(&stat, statbuf);
416
417out:
418 return error;
419}
398#endif /* __ARCH_WANT_STAT64 */ 420#endif /* __ARCH_WANT_STAT64 */
399 421
400void inode_add_bytes(struct inode *inode, loff_t bytes) 422void inode_add_bytes(struct inode *inode, loff_t bytes)
diff --git a/fs/super.c b/fs/super.c
index 30294218fa63..e20b5580afd5 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -666,6 +666,16 @@ static int test_bdev_super(struct super_block *s, void *data)
666 return (void *)s->s_bdev == data; 666 return (void *)s->s_bdev == data;
667} 667}
668 668
669static void bdev_uevent(struct block_device *bdev, enum kobject_action action)
670{
671 if (bdev->bd_disk) {
672 if (bdev->bd_part)
673 kobject_uevent(&bdev->bd_part->kobj, action);
674 else
675 kobject_uevent(&bdev->bd_disk->kobj, action);
676 }
677}
678
669struct super_block *get_sb_bdev(struct file_system_type *fs_type, 679struct super_block *get_sb_bdev(struct file_system_type *fs_type,
670 int flags, const char *dev_name, void *data, 680 int flags, const char *dev_name, void *data,
671 int (*fill_super)(struct super_block *, void *, int)) 681 int (*fill_super)(struct super_block *, void *, int))
@@ -707,8 +717,10 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
707 up_write(&s->s_umount); 717 up_write(&s->s_umount);
708 deactivate_super(s); 718 deactivate_super(s);
709 s = ERR_PTR(error); 719 s = ERR_PTR(error);
710 } else 720 } else {
711 s->s_flags |= MS_ACTIVE; 721 s->s_flags |= MS_ACTIVE;
722 bdev_uevent(bdev, KOBJ_MOUNT);
723 }
712 } 724 }
713 725
714 return s; 726 return s;
@@ -724,6 +736,7 @@ void kill_block_super(struct super_block *sb)
724{ 736{
725 struct block_device *bdev = sb->s_bdev; 737 struct block_device *bdev = sb->s_bdev;
726 738
739 bdev_uevent(bdev, KOBJ_UMOUNT);
727 generic_shutdown_super(sb); 740 generic_shutdown_super(sb);
728 sync_blockdev(bdev); 741 sync_blockdev(bdev);
729 close_bdev_excl(bdev); 742 close_bdev_excl(bdev);
diff --git a/include/asm-alpha/mman.h b/include/asm-alpha/mman.h
index f6439532a262..5f24c755f577 100644
--- a/include/asm-alpha/mman.h
+++ b/include/asm-alpha/mman.h
@@ -42,7 +42,11 @@
42#define MADV_WILLNEED 3 /* will need these pages */ 42#define MADV_WILLNEED 3 /* will need these pages */
43#define MADV_SPACEAVAIL 5 /* ensure resources are available */ 43#define MADV_SPACEAVAIL 5 /* ensure resources are available */
44#define MADV_DONTNEED 6 /* don't need these pages */ 44#define MADV_DONTNEED 6 /* don't need these pages */
45#define MADV_REMOVE 7 /* remove these pages & resources */ 45
46/* common/generic parameters */
47#define MADV_REMOVE 9 /* remove these pages & resources */
48#define MADV_DONTFORK 10 /* don't inherit across fork */
49#define MADV_DOFORK 11 /* do inherit across fork */
46 50
47/* compatibility flags */ 51/* compatibility flags */
48#define MAP_ANON MAP_ANONYMOUS 52#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-arm/arch-at91rm9200/gpio.h b/include/asm-arm/arch-at91rm9200/gpio.h
index 0f0a61e2f129..6176ab2dc417 100644
--- a/include/asm-arm/arch-at91rm9200/gpio.h
+++ b/include/asm-arm/arch-at91rm9200/gpio.h
@@ -183,6 +183,7 @@ extern int at91_set_B_periph(unsigned pin, int use_pullup);
183extern int at91_set_gpio_input(unsigned pin, int use_pullup); 183extern int at91_set_gpio_input(unsigned pin, int use_pullup);
184extern int at91_set_gpio_output(unsigned pin, int value); 184extern int at91_set_gpio_output(unsigned pin, int value);
185extern int at91_set_deglitch(unsigned pin, int is_on); 185extern int at91_set_deglitch(unsigned pin, int is_on);
186extern int at91_set_multi_drive(unsigned pin, int is_on);
186 187
187/* callable at any time */ 188/* callable at any time */
188extern int at91_set_gpio_value(unsigned pin, int value); 189extern int at91_set_gpio_value(unsigned pin, int value);
diff --git a/include/asm-arm/arch-ixp4xx/nas100d.h b/include/asm-arm/arch-ixp4xx/nas100d.h
index 51ac0180427c..84467a5190d0 100644
--- a/include/asm-arm/arch-ixp4xx/nas100d.h
+++ b/include/asm-arm/arch-ixp4xx/nas100d.h
@@ -19,8 +19,8 @@
19#error "Do not include this directly, instead #include <asm/hardware.h>" 19#error "Do not include this directly, instead #include <asm/hardware.h>"
20#endif 20#endif
21 21
22#define NAS100D_SDA_PIN 6 22#define NAS100D_SDA_PIN 5
23#define NAS100D_SCL_PIN 5 23#define NAS100D_SCL_PIN 6
24 24
25/* 25/*
26 * NAS100D PCI IRQs 26 * NAS100D PCI IRQs
diff --git a/include/asm-arm/arch-s3c2410/h1940-latch.h b/include/asm-arm/arch-s3c2410/h1940-latch.h
new file mode 100644
index 000000000000..c5802411f43d
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/h1940-latch.h
@@ -0,0 +1,64 @@
1/* linux/include/asm-arm/arch-s3c2410/h1940-latch.h
2 *
3 * (c) 2005 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * iPAQ H1940 series - latch definitions
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 version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_H1940_LATCH_H
15#define __ASM_ARCH_H1940_LATCH_H
16
17
18#ifndef __ASSEMBLY__
19#define H1940_LATCH ((void __iomem *)0xF8000000)
20#else
21#define H1940_LATCH 0xF8000000
22#endif
23
24#define H1940_PA_LATCH (S3C2410_CS2)
25
26/* SD layer latch */
27
28#define H1940_LATCH_SDQ1 (1<<16)
29#define H1940_LATCH_LCD_P1 (1<<17)
30#define H1940_LATCH_LCD_P2 (1<<18)
31#define H1940_LATCH_LCD_P3 (1<<19)
32#define H1940_LATCH_MAX1698_nSHUTDOWN (1<<20) /* LCD backlight */
33#define H1940_LATCH_LED_RED (1<<21)
34#define H1940_LATCH_SDQ7 (1<<22)
35#define H1940_LATCH_USB_DP (1<<23)
36
37/* CPU layer latch */
38
39#define H1940_LATCH_UDA_POWER (1<<24)
40#define H1940_LATCH_AUDIO_POWER (1<<25)
41#define H1940_LATCH_SM803_ENABLE (1<<26)
42#define H1940_LATCH_LCD_P4 (1<<27)
43#define H1940_LATCH_CPUQ5 (1<<28) /* untraced */
44#define H1940_LATCH_BLUETOOTH_POWER (1<<29) /* active high */
45#define H1940_LATCH_LED_GREEN (1<<30)
46#define H1940_LATCH_LED_FLASH (1<<31)
47
48/* default settings */
49
50#define H1940_LATCH_DEFAULT \
51 H1940_LATCH_LCD_P4 | \
52 H1940_LATCH_SM803_ENABLE | \
53 H1940_LATCH_SDQ1 | \
54 H1940_LATCH_LCD_P1 | \
55 H1940_LATCH_LCD_P2 | \
56 H1940_LATCH_LCD_P3 | \
57 H1940_LATCH_MAX1698_nSHUTDOWN | \
58 H1940_LATCH_CPUQ5
59
60/* control functions */
61
62extern void h1940_latch_control(unsigned int clear, unsigned int set);
63
64#endif /* __ASM_ARCH_H1940_LATCH_H */
diff --git a/include/asm-arm/mman.h b/include/asm-arm/mman.h
index f0bebca2ac21..54570d2e95b7 100644
--- a/include/asm-arm/mman.h
+++ b/include/asm-arm/mman.h
@@ -1,19 +1,7 @@
1#ifndef __ARM_MMAN_H__ 1#ifndef __ARM_MMAN_H__
2#define __ARM_MMAN_H__ 2#define __ARM_MMAN_H__
3 3
4#define PROT_READ 0x1 /* page can be read */ 4#include <asm-generic/mman.h>
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_SEM 0x8 /* page may be used for atomic ops */
8#define PROT_NONE 0x0 /* page can not be accessed */
9#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
10#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
11
12#define MAP_SHARED 0x01 /* Share changes */
13#define MAP_PRIVATE 0x02 /* Changes are private */
14#define MAP_TYPE 0x0f /* Mask for type of mapping */
15#define MAP_FIXED 0x10 /* Interpret addr exactly */
16#define MAP_ANONYMOUS 0x20 /* don't use a file */
17 5
18#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
19#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
@@ -23,22 +11,7 @@
23#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */ 11#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */
24#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
25 13
26#define MS_ASYNC 1 /* sync memory asynchronously */
27#define MS_INVALIDATE 2 /* invalidate the caches */
28#define MS_SYNC 4 /* synchronous memory sync */
29
30#define MCL_CURRENT 1 /* lock all current mappings */ 14#define MCL_CURRENT 1 /* lock all current mappings */
31#define MCL_FUTURE 2 /* lock all future mappings */ 15#define MCL_FUTURE 2 /* lock all future mappings */
32 16
33#define MADV_NORMAL 0x0 /* default page-in behavior */
34#define MADV_RANDOM 0x1 /* page-in minimum required */
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
39
40/* compatibility flags */
41#define MAP_ANON MAP_ANONYMOUS
42#define MAP_FILE 0
43
44#endif /* __ARM_MMAN_H__ */ 17#endif /* __ARM_MMAN_H__ */
diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h
index 5a72e50ca9fc..fe45f7f61223 100644
--- a/include/asm-arm/smp.h
+++ b/include/asm-arm/smp.h
@@ -42,6 +42,11 @@ extern void show_ipi_list(struct seq_file *p);
42asmlinkage void do_IPI(struct pt_regs *regs); 42asmlinkage void do_IPI(struct pt_regs *regs);
43 43
44/* 44/*
45 * Setup the SMP cpu_possible_map
46 */
47extern void smp_init_cpus(void);
48
49/*
45 * Move global data into per-processor storage. 50 * Move global data into per-processor storage.
46 */ 51 */
47extern void smp_store_cpu_info(unsigned int cpuid); 52extern void smp_store_cpu_info(unsigned int cpuid);
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 77430d6178ae..8f331bbd39a8 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -309,7 +309,7 @@
309#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279) 309#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279)
310#define __NR_waitid (__NR_SYSCALL_BASE+280) 310#define __NR_waitid (__NR_SYSCALL_BASE+280)
311 311
312#if 0 /* reserve these for un-muxing socketcall */ 312#if defined(__ARM_EABI__) /* reserve these for un-muxing socketcall */
313#define __NR_socket (__NR_SYSCALL_BASE+281) 313#define __NR_socket (__NR_SYSCALL_BASE+281)
314#define __NR_bind (__NR_SYSCALL_BASE+282) 314#define __NR_bind (__NR_SYSCALL_BASE+282)
315#define __NR_connect (__NR_SYSCALL_BASE+283) 315#define __NR_connect (__NR_SYSCALL_BASE+283)
@@ -329,7 +329,7 @@
329#define __NR_recvmsg (__NR_SYSCALL_BASE+297) 329#define __NR_recvmsg (__NR_SYSCALL_BASE+297)
330#endif 330#endif
331 331
332#if 0 /* reserve these for un-muxing ipc */ 332#if defined(__ARM_EABI__) /* reserve these for un-muxing ipc */
333#define __NR_semop (__NR_SYSCALL_BASE+298) 333#define __NR_semop (__NR_SYSCALL_BASE+298)
334#define __NR_semget (__NR_SYSCALL_BASE+299) 334#define __NR_semget (__NR_SYSCALL_BASE+299)
335#define __NR_semctl (__NR_SYSCALL_BASE+300) 335#define __NR_semctl (__NR_SYSCALL_BASE+300)
@@ -347,7 +347,7 @@
347#define __NR_request_key (__NR_SYSCALL_BASE+310) 347#define __NR_request_key (__NR_SYSCALL_BASE+310)
348#define __NR_keyctl (__NR_SYSCALL_BASE+311) 348#define __NR_keyctl (__NR_SYSCALL_BASE+311)
349 349
350#if 0 /* reserved for un-muxing ipc */ 350#if defined(__ARM_EABI__) /* reserved for un-muxing ipc */
351#define __NR_semtimedop (__NR_SYSCALL_BASE+312) 351#define __NR_semtimedop (__NR_SYSCALL_BASE+312)
352#endif 352#endif
353 353
diff --git a/include/asm-arm26/mman.h b/include/asm-arm26/mman.h
index 0ed7780541fa..4000a6c1b76b 100644
--- a/include/asm-arm26/mman.h
+++ b/include/asm-arm26/mman.h
@@ -1,19 +1,7 @@
1#ifndef __ARM_MMAN_H__ 1#ifndef __ARM_MMAN_H__
2#define __ARM_MMAN_H__ 2#define __ARM_MMAN_H__
3 3
4#define PROT_READ 0x1 /* page can be read */ 4#include <asm-generic/mman.h>
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_SEM 0x8 /* page may be used for atomic ops */
8#define PROT_NONE 0x0 /* page can not be accessed */
9#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
10#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
11
12#define MAP_SHARED 0x01 /* Share changes */
13#define MAP_PRIVATE 0x02 /* Changes are private */
14#define MAP_TYPE 0x0f /* Mask for type of mapping */
15#define MAP_FIXED 0x10 /* Interpret addr exactly */
16#define MAP_ANONYMOUS 0x20 /* don't use a file */
17 5
18#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
19#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
@@ -23,22 +11,7 @@
23#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */ 11#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */
24#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
25 13
26#define MS_ASYNC 1 /* sync memory asynchronously */
27#define MS_INVALIDATE 2 /* invalidate the caches */
28#define MS_SYNC 4 /* synchronous memory sync */
29
30#define MCL_CURRENT 1 /* lock all current mappings */ 14#define MCL_CURRENT 1 /* lock all current mappings */
31#define MCL_FUTURE 2 /* lock all future mappings */ 15#define MCL_FUTURE 2 /* lock all future mappings */
32 16
33#define MADV_NORMAL 0x0 /* default page-in behavior */
34#define MADV_RANDOM 0x1 /* page-in minimum required */
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
39
40/* compatibility flags */
41#define MAP_ANON MAP_ANONYMOUS
42#define MAP_FILE 0
43
44#endif /* __ARM_MMAN_H__ */ 17#endif /* __ARM_MMAN_H__ */
diff --git a/include/asm-cris/mman.h b/include/asm-cris/mman.h
index 5a382b8bf3f7..1c35e1b66b46 100644
--- a/include/asm-cris/mman.h
+++ b/include/asm-cris/mman.h
@@ -3,19 +3,7 @@
3 3
4/* verbatim copy of asm-i386/ version */ 4/* verbatim copy of asm-i386/ version */
5 5
6#define PROT_READ 0x1 /* page can be read */ 6#include <asm-generic/mman.h>
7#define PROT_WRITE 0x2 /* page can be written */
8#define PROT_EXEC 0x4 /* page can be executed */
9#define PROT_SEM 0x8 /* page may be used for atomic ops */
10#define PROT_NONE 0x0 /* page can not be accessed */
11#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
12#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
13
14#define MAP_SHARED 0x01 /* Share changes */
15#define MAP_PRIVATE 0x02 /* Changes are private */
16#define MAP_TYPE 0x0f /* Mask for type of mapping */
17#define MAP_FIXED 0x10 /* Interpret addr exactly */
18#define MAP_ANONYMOUS 0x20 /* don't use a file */
19 7
20#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 8#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
21#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 9#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
@@ -25,22 +13,7 @@
25#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 13#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
26#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 14#define MAP_NONBLOCK 0x10000 /* do not block on IO */
27 15
28#define MS_ASYNC 1 /* sync memory asynchronously */
29#define MS_INVALIDATE 2 /* invalidate the caches */
30#define MS_SYNC 4 /* synchronous memory sync */
31
32#define MCL_CURRENT 1 /* lock all current mappings */ 16#define MCL_CURRENT 1 /* lock all current mappings */
33#define MCL_FUTURE 2 /* lock all future mappings */ 17#define MCL_FUTURE 2 /* lock all future mappings */
34 18
35#define MADV_NORMAL 0x0 /* default page-in behavior */
36#define MADV_RANDOM 0x1 /* page-in minimum required */
37#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
38#define MADV_WILLNEED 0x3 /* pre-fault pages */
39#define MADV_DONTNEED 0x4 /* discard these pages */
40#define MADV_REMOVE 0x5 /* remove these pages & resources */
41
42/* compatibility flags */
43#define MAP_ANON MAP_ANONYMOUS
44#define MAP_FILE 0
45
46#endif /* __CRIS_MMAN_H__ */ 19#endif /* __CRIS_MMAN_H__ */
diff --git a/include/asm-frv/atomic.h b/include/asm-frv/atomic.h
index a59f684b4f33..5d9f84bfdcad 100644
--- a/include/asm-frv/atomic.h
+++ b/include/asm-frv/atomic.h
@@ -220,9 +220,9 @@ extern unsigned long atomic_test_and_XOR_mask(unsigned long mask, volatile unsig
220 switch (sizeof(__xg_orig)) { \ 220 switch (sizeof(__xg_orig)) { \
221 case 4: \ 221 case 4: \
222 asm volatile( \ 222 asm volatile( \
223 "swap%I0 %2,%M0" \ 223 "swap%I0 %M0,%1" \
224 : "+m"(*__xg_ptr), "=&r"(__xg_orig) \ 224 : "+m"(*__xg_ptr), "=r"(__xg_orig) \
225 : "r"(x) \ 225 : "1"(x) \
226 : "memory" \ 226 : "memory" \
227 ); \ 227 ); \
228 break; \ 228 break; \
diff --git a/include/asm-frv/cacheflush.h b/include/asm-frv/cacheflush.h
index 3007deccb490..eaa5826bc1c8 100644
--- a/include/asm-frv/cacheflush.h
+++ b/include/asm-frv/cacheflush.h
@@ -87,5 +87,17 @@ static inline void flush_icache_page(struct vm_area_struct *vma, struct page *pa
87 flush_icache_user_range(vma, page, page_to_phys(page), PAGE_SIZE); 87 flush_icache_user_range(vma, page, page_to_phys(page), PAGE_SIZE);
88} 88}
89 89
90/*
91 * permit ptrace to access another process's address space through the icache
92 * and the dcache
93 */
94#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
95do { \
96 memcpy((dst), (src), (len)); \
97 flush_icache_user_range((vma), (page), (vaddr), (len)); \
98} while(0)
99
100#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
101 memcpy((dst), (src), (len))
90 102
91#endif /* _ASM_CACHEFLUSH_H */ 103#endif /* _ASM_CACHEFLUSH_H */
diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h
index 075369b1a34b..01247cb2bc39 100644
--- a/include/asm-frv/io.h
+++ b/include/asm-frv/io.h
@@ -251,7 +251,6 @@ static inline void writel(uint32_t datum, volatile void __iomem *addr)
251#define IOMAP_WRITETHROUGH 3 251#define IOMAP_WRITETHROUGH 3
252 252
253extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag); 253extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag);
254extern void __iounmap(void __iomem *addr, unsigned long size);
255 254
256static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size) 255static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
257{ 256{
diff --git a/include/asm-frv/mman.h b/include/asm-frv/mman.h
index 8af4a41c255e..b4371e928683 100644
--- a/include/asm-frv/mman.h
+++ b/include/asm-frv/mman.h
@@ -1,19 +1,7 @@
1#ifndef __ASM_MMAN_H__ 1#ifndef __ASM_MMAN_H__
2#define __ASM_MMAN_H__ 2#define __ASM_MMAN_H__
3 3
4#define PROT_READ 0x1 /* page can be read */ 4#include <asm-generic/mman.h>
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_SEM 0x8 /* page may be used for atomic ops */
8#define PROT_NONE 0x0 /* page can not be accessed */
9#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
10#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
11
12#define MAP_SHARED 0x01 /* Share changes */
13#define MAP_PRIVATE 0x02 /* Changes are private */
14#define MAP_TYPE 0x0f /* Mask for type of mapping */
15#define MAP_FIXED 0x10 /* Interpret addr exactly */
16#define MAP_ANONYMOUS 0x20 /* don't use a file */
17 5
18#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
19#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
@@ -23,23 +11,8 @@
23#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
24#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
25 13
26#define MS_ASYNC 1 /* sync memory asynchronously */
27#define MS_INVALIDATE 2 /* invalidate the caches */
28#define MS_SYNC 4 /* synchronous memory sync */
29
30#define MCL_CURRENT 1 /* lock all current mappings */ 14#define MCL_CURRENT 1 /* lock all current mappings */
31#define MCL_FUTURE 2 /* lock all future mappings */ 15#define MCL_FUTURE 2 /* lock all future mappings */
32 16
33#define MADV_NORMAL 0x0 /* default page-in behavior */
34#define MADV_RANDOM 0x1 /* page-in minimum required */
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
39
40/* compatibility flags */
41#define MAP_ANON MAP_ANONYMOUS
42#define MAP_FILE 0
43
44#endif /* __ASM_MMAN_H__ */ 17#endif /* __ASM_MMAN_H__ */
45 18
diff --git a/include/asm-frv/spr-regs.h b/include/asm-frv/spr-regs.h
index ef472f058d9c..c2a541ef828d 100644
--- a/include/asm-frv/spr-regs.h
+++ b/include/asm-frv/spr-regs.h
@@ -98,6 +98,7 @@
98#define TBR_TT_TRAP0 (0x80 << 4) 98#define TBR_TT_TRAP0 (0x80 << 4)
99#define TBR_TT_TRAP1 (0x81 << 4) 99#define TBR_TT_TRAP1 (0x81 << 4)
100#define TBR_TT_TRAP2 (0x82 << 4) 100#define TBR_TT_TRAP2 (0x82 << 4)
101#define TBR_TT_TRAP3 (0x83 << 4)
101#define TBR_TT_TRAP126 (0xfe << 4) 102#define TBR_TT_TRAP126 (0xfe << 4)
102#define TBR_TT_BREAK (0xff << 4) 103#define TBR_TT_BREAK (0xff << 4)
103 104
diff --git a/include/asm-frv/system.h b/include/asm-frv/system.h
index d2aea70a5f64..f72ff0c4dc0b 100644
--- a/include/asm-frv/system.h
+++ b/include/asm-frv/system.h
@@ -40,8 +40,84 @@ do { \
40 40
41/* 41/*
42 * interrupt flag manipulation 42 * interrupt flag manipulation
43 * - use virtual interrupt management since touching the PSR is slow
44 * - ICC2.Z: T if interrupts virtually disabled
45 * - ICC2.C: F if interrupts really disabled
46 * - if Z==1 upon interrupt:
47 * - C is set to 0
48 * - interrupts are really disabled
49 * - entry.S returns immediately
50 * - uses TIHI (TRAP if Z==0 && C==0) #2 to really reenable interrupts
51 * - if taken, the trap:
52 * - sets ICC2.C
53 * - enables interrupts
43 */ 54 */
44#define local_irq_disable() \ 55#define local_irq_disable() \
56do { \
57 /* set Z flag, but don't change the C flag */ \
58 asm volatile(" andcc gr0,gr0,gr0,icc2 \n" \
59 : \
60 : \
61 : "memory", "icc2" \
62 ); \
63} while(0)
64
65#define local_irq_enable() \
66do { \
67 /* clear Z flag and then test the C flag */ \
68 asm volatile(" oricc gr0,#1,gr0,icc2 \n" \
69 " tihi icc2,gr0,#2 \n" \
70 : \
71 : \
72 : "memory", "icc2" \
73 ); \
74} while(0)
75
76#define local_save_flags(flags) \
77do { \
78 typecheck(unsigned long, flags); \
79 asm volatile("movsg ccr,%0" \
80 : "=r"(flags) \
81 : \
82 : "memory"); \
83 \
84 /* shift ICC2.Z to bit 0 */ \
85 flags >>= 26; \
86 \
87 /* make flags 1 if interrupts disabled, 0 otherwise */ \
88 flags &= 1UL; \
89} while(0)
90
91#define irqs_disabled() \
92 ({unsigned long flags; local_save_flags(flags); flags; })
93
94#define local_irq_save(flags) \
95do { \
96 typecheck(unsigned long, flags); \
97 local_save_flags(flags); \
98 local_irq_disable(); \
99} while(0)
100
101#define local_irq_restore(flags) \
102do { \
103 typecheck(unsigned long, flags); \
104 \
105 /* load the Z flag by turning 1 if disabled into 0 if disabled \
106 * and thus setting the Z flag but not the C flag */ \
107 asm volatile(" xoricc %0,#1,gr0,icc2 \n" \
108 /* then test Z=0 and C=0 */ \
109 " tihi icc2,gr0,#2 \n" \
110 : \
111 : "r"(flags) \
112 : "memory", "icc2" \
113 ); \
114 \
115} while(0)
116
117/*
118 * real interrupt flag manipulation
119 */
120#define __local_irq_disable() \
45do { \ 121do { \
46 unsigned long psr; \ 122 unsigned long psr; \
47 asm volatile(" movsg psr,%0 \n" \ 123 asm volatile(" movsg psr,%0 \n" \
@@ -53,7 +129,7 @@ do { \
53 : "memory"); \ 129 : "memory"); \
54} while(0) 130} while(0)
55 131
56#define local_irq_enable() \ 132#define __local_irq_enable() \
57do { \ 133do { \
58 unsigned long psr; \ 134 unsigned long psr; \
59 asm volatile(" movsg psr,%0 \n" \ 135 asm volatile(" movsg psr,%0 \n" \
@@ -64,7 +140,7 @@ do { \
64 : "memory"); \ 140 : "memory"); \
65} while(0) 141} while(0)
66 142
67#define local_save_flags(flags) \ 143#define __local_save_flags(flags) \
68do { \ 144do { \
69 typecheck(unsigned long, flags); \ 145 typecheck(unsigned long, flags); \
70 asm("movsg psr,%0" \ 146 asm("movsg psr,%0" \
@@ -73,7 +149,7 @@ do { \
73 : "memory"); \ 149 : "memory"); \
74} while(0) 150} while(0)
75 151
76#define local_irq_save(flags) \ 152#define __local_irq_save(flags) \
77do { \ 153do { \
78 unsigned long npsr; \ 154 unsigned long npsr; \
79 typecheck(unsigned long, flags); \ 155 typecheck(unsigned long, flags); \
@@ -86,7 +162,7 @@ do { \
86 : "memory"); \ 162 : "memory"); \
87} while(0) 163} while(0)
88 164
89#define local_irq_restore(flags) \ 165#define __local_irq_restore(flags) \
90do { \ 166do { \
91 typecheck(unsigned long, flags); \ 167 typecheck(unsigned long, flags); \
92 asm volatile(" movgs %0,psr \n" \ 168 asm volatile(" movgs %0,psr \n" \
@@ -95,7 +171,7 @@ do { \
95 : "memory"); \ 171 : "memory"); \
96} while(0) 172} while(0)
97 173
98#define irqs_disabled() \ 174#define __irqs_disabled() \
99 ((__get_PSR() & PSR_PIL) >= PSR_PIL_14) 175 ((__get_PSR() & PSR_PIL) >= PSR_PIL_14)
100 176
101/* 177/*
diff --git a/include/asm-frv/uaccess.h b/include/asm-frv/uaccess.h
index b6bcbe01f6ee..a1d140438863 100644
--- a/include/asm-frv/uaccess.h
+++ b/include/asm-frv/uaccess.h
@@ -306,7 +306,4 @@ extern long strnlen_user(const char *src, long count);
306 306
307extern unsigned long search_exception_table(unsigned long addr); 307extern unsigned long search_exception_table(unsigned long addr);
308 308
309#define copy_to_user_page(vma, page, vaddr, dst, src, len) memcpy(dst, src, len)
310#define copy_from_user_page(vma, page, vaddr, dst, src, len) memcpy(dst, src, len)
311
312#endif /* _ASM_UACCESS_H */ 309#endif /* _ASM_UACCESS_H */
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index 4d994d2e99e3..322531caa484 100644
--- a/include/asm-frv/unistd.h
+++ b/include/asm-frv/unistd.h
@@ -295,13 +295,29 @@
295#define __NR_add_key 286 295#define __NR_add_key 286
296#define __NR_request_key 287 296#define __NR_request_key 287
297#define __NR_keyctl 288 297#define __NR_keyctl 288
298#define __NR_vperfctr_open 289 298#define __NR_ioprio_set 289
299#define __NR_vperfctr_control (__NR_perfctr_info+1) 299#define __NR_ioprio_get 290
300#define __NR_vperfctr_unlink (__NR_perfctr_info+2) 300#define __NR_inotify_init 291
301#define __NR_vperfctr_iresume (__NR_perfctr_info+3) 301#define __NR_inotify_add_watch 292
302#define __NR_vperfctr_read (__NR_perfctr_info+4) 302#define __NR_inotify_rm_watch 293
303#define __NR_migrate_pages 294
304#define __NR_openat 295
305#define __NR_mkdirat 296
306#define __NR_mknodat 297
307#define __NR_fchownat 298
308#define __NR_futimesat 299
309#define __NR_newfstatat 300
310#define __NR_unlinkat 301
311#define __NR_renameat 302
312#define __NR_linkat 303
313#define __NR_symlinkat 304
314#define __NR_readlinkat 305
315#define __NR_fchmodat 306
316#define __NR_faccessat 307
317#define __NR_pselect6 308
318#define __NR_ppoll 309
303 319
304#define NR_syscalls 294 320#define NR_syscalls 310
305 321
306/* 322/*
307 * process the return value of a syscall, consigning it to one of two possible fates 323 * process the return value of a syscall, consigning it to one of two possible fates
diff --git a/include/asm-generic/mman.h b/include/asm-generic/mman.h
new file mode 100644
index 000000000000..3b41d2bb70da
--- /dev/null
+++ b/include/asm-generic/mman.h
@@ -0,0 +1,42 @@
1#ifndef _ASM_GENERIC_MMAN_H
2#define _ASM_GENERIC_MMAN_H
3
4/*
5 Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
6 Based on: asm-xxx/mman.h
7*/
8
9#define PROT_READ 0x1 /* page can be read */
10#define PROT_WRITE 0x2 /* page can be written */
11#define PROT_EXEC 0x4 /* page can be executed */
12#define PROT_SEM 0x8 /* page may be used for atomic ops */
13#define PROT_NONE 0x0 /* page can not be accessed */
14#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
15#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
16
17#define MAP_SHARED 0x01 /* Share changes */
18#define MAP_PRIVATE 0x02 /* Changes are private */
19#define MAP_TYPE 0x0f /* Mask for type of mapping */
20#define MAP_FIXED 0x10 /* Interpret addr exactly */
21#define MAP_ANONYMOUS 0x20 /* don't use a file */
22
23#define MS_ASYNC 1 /* sync memory asynchronously */
24#define MS_INVALIDATE 2 /* invalidate the caches */
25#define MS_SYNC 4 /* synchronous memory sync */
26
27#define MADV_NORMAL 0 /* no further special treatment */
28#define MADV_RANDOM 1 /* expect random page references */
29#define MADV_SEQUENTIAL 2 /* expect sequential page references */
30#define MADV_WILLNEED 3 /* will need these pages */
31#define MADV_DONTNEED 4 /* don't need these pages */
32
33/* common parameters: try to keep these consistent across architectures */
34#define MADV_REMOVE 9 /* remove these pages & resources */
35#define MADV_DONTFORK 10 /* don't inherit across fork */
36#define MADV_DOFORK 11 /* do inherit across fork */
37
38/* compatibility flags */
39#define MAP_ANON MAP_ANONYMOUS
40#define MAP_FILE 0
41
42#endif
diff --git a/include/asm-h8300/mman.h b/include/asm-h8300/mman.h
index 744a8fb485c2..b9f104f22a36 100644
--- a/include/asm-h8300/mman.h
+++ b/include/asm-h8300/mman.h
@@ -1,19 +1,7 @@
1#ifndef __H8300_MMAN_H__ 1#ifndef __H8300_MMAN_H__
2#define __H8300_MMAN_H__ 2#define __H8300_MMAN_H__
3 3
4#define PROT_READ 0x1 /* page can be read */ 4#include <asm-generic/mman.h>
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_SEM 0x8 /* page may be used for atomic ops */
8#define PROT_NONE 0x0 /* page can not be accessed */
9#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
10#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
11
12#define MAP_SHARED 0x01 /* Share changes */
13#define MAP_PRIVATE 0x02 /* Changes are private */
14#define MAP_TYPE 0x0f /* Mask for type of mapping */
15#define MAP_FIXED 0x10 /* Interpret addr exactly */
16#define MAP_ANONYMOUS 0x20 /* don't use a file */
17 5
18#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
19#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
@@ -23,22 +11,7 @@
23#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
24#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
25 13
26#define MS_ASYNC 1 /* sync memory asynchronously */
27#define MS_INVALIDATE 2 /* invalidate the caches */
28#define MS_SYNC 4 /* synchronous memory sync */
29
30#define MCL_CURRENT 1 /* lock all current mappings */ 14#define MCL_CURRENT 1 /* lock all current mappings */
31#define MCL_FUTURE 2 /* lock all future mappings */ 15#define MCL_FUTURE 2 /* lock all future mappings */
32 16
33#define MADV_NORMAL 0x0 /* default page-in behavior */
34#define MADV_RANDOM 0x1 /* page-in minimum required */
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
39
40/* compatibility flags */
41#define MAP_ANON MAP_ANONYMOUS
42#define MAP_FILE 0
43
44#endif /* __H8300_MMAN_H__ */ 17#endif /* __H8300_MMAN_H__ */
diff --git a/include/asm-i386/mman.h b/include/asm-i386/mman.h
index ba4941e6f643..8fd9d7ab7faf 100644
--- a/include/asm-i386/mman.h
+++ b/include/asm-i386/mman.h
@@ -1,19 +1,7 @@
1#ifndef __I386_MMAN_H__ 1#ifndef __I386_MMAN_H__
2#define __I386_MMAN_H__ 2#define __I386_MMAN_H__
3 3
4#define PROT_READ 0x1 /* page can be read */ 4#include <asm-generic/mman.h>
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_SEM 0x8 /* page may be used for atomic ops */
8#define PROT_NONE 0x0 /* page can not be accessed */
9#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
10#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
11
12#define MAP_SHARED 0x01 /* Share changes */
13#define MAP_PRIVATE 0x02 /* Changes are private */
14#define MAP_TYPE 0x0f /* Mask for type of mapping */
15#define MAP_FIXED 0x10 /* Interpret addr exactly */
16#define MAP_ANONYMOUS 0x20 /* don't use a file */
17 5
18#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
19#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
@@ -23,22 +11,7 @@
23#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
24#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
25 13
26#define MS_ASYNC 1 /* sync memory asynchronously */
27#define MS_INVALIDATE 2 /* invalidate the caches */
28#define MS_SYNC 4 /* synchronous memory sync */
29
30#define MCL_CURRENT 1 /* lock all current mappings */ 14#define MCL_CURRENT 1 /* lock all current mappings */
31#define MCL_FUTURE 2 /* lock all future mappings */ 15#define MCL_FUTURE 2 /* lock all future mappings */
32 16
33#define MADV_NORMAL 0x0 /* default page-in behavior */
34#define MADV_RANDOM 0x1 /* page-in minimum required */
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
39
40/* compatibility flags */
41#define MAP_ANON MAP_ANONYMOUS
42#define MAP_FILE 0
43
44#endif /* __I386_MMAN_H__ */ 17#endif /* __I386_MMAN_H__ */
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index e20e99551d71..1f7d48c9ba3f 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -158,8 +158,8 @@ register unsigned long current_stack_pointer asm("esp") __attribute_used__;
158 158
159/* work to do on interrupt/exception return */ 159/* work to do on interrupt/exception return */
160#define _TIF_WORK_MASK \ 160#define _TIF_WORK_MASK \
161 (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP|\ 161 (0x0000FFFF & ~(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
162 _TIF_SECCOMP|_TIF_SYSCALL_EMU)) 162 _TIF_SECCOMP | _TIF_SYSCALL_EMU))
163/* work to do on any return to u-space */ 163/* work to do on any return to u-space */
164#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) 164#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
165 165
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h
index af503a122b23..aa958c6ee83e 100644
--- a/include/asm-i386/topology.h
+++ b/include/asm-i386/topology.h
@@ -27,7 +27,7 @@
27#ifndef _ASM_I386_TOPOLOGY_H 27#ifndef _ASM_I386_TOPOLOGY_H
28#define _ASM_I386_TOPOLOGY_H 28#define _ASM_I386_TOPOLOGY_H
29 29
30#ifdef CONFIG_SMP 30#ifdef CONFIG_X86_HT
31#define topology_physical_package_id(cpu) \ 31#define topology_physical_package_id(cpu) \
32 (phys_proc_id[cpu] == BAD_APICID ? -1 : phys_proc_id[cpu]) 32 (phys_proc_id[cpu] == BAD_APICID ? -1 : phys_proc_id[cpu])
33#define topology_core_id(cpu) \ 33#define topology_core_id(cpu) \
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index cf6f2cd9c514..dc81a55dd94d 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -305,7 +305,7 @@
305#define __NR_mknodat 297 305#define __NR_mknodat 297
306#define __NR_fchownat 298 306#define __NR_fchownat 298
307#define __NR_futimesat 299 307#define __NR_futimesat 299
308#define __NR_newfstatat 300 308#define __NR_fstatat64 300
309#define __NR_unlinkat 301 309#define __NR_unlinkat 301
310#define __NR_renameat 302 310#define __NR_renameat 302
311#define __NR_linkat 303 311#define __NR_linkat 303
diff --git a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h
index 3a544ffc5008..f7a517654308 100644
--- a/include/asm-ia64/acpi.h
+++ b/include/asm-ia64/acpi.h
@@ -106,6 +106,8 @@ extern unsigned int can_cpei_retarget(void);
106extern unsigned int is_cpu_cpei_target(unsigned int cpu); 106extern unsigned int is_cpu_cpei_target(unsigned int cpu);
107extern void set_cpei_target_cpu(unsigned int cpu); 107extern void set_cpei_target_cpu(unsigned int cpu);
108extern unsigned int get_cpei_target_cpu(void); 108extern unsigned int get_cpei_target_cpu(void);
109extern void prefill_possible_map(void);
110extern int additional_cpus;
109 111
110#ifdef CONFIG_ACPI_NUMA 112#ifdef CONFIG_ACPI_NUMA
111/* Proximity bitmap length; _PXM is at most 255 (8 bit)*/ 113/* Proximity bitmap length; _PXM is at most 255 (8 bit)*/
diff --git a/include/asm-ia64/machvec_sn2.h b/include/asm-ia64/machvec_sn2.h
index e1b6cd63f49e..03d00faf03b5 100644
--- a/include/asm-ia64/machvec_sn2.h
+++ b/include/asm-ia64/machvec_sn2.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2002-2003 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2002-2003, 2006 Silicon Graphics, Inc. All Rights Reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License 5 * under the terms of version 2 of the GNU General Public License
@@ -20,11 +20,6 @@
20 * License along with this program; if not, write the Free Software 20 * License along with this program; if not, write the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 * 22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see: 23 * For further information regarding this notice, see:
29 * 24 *
30 * http://oss.sgi.com/projects/GenInfo/NoticeExplan 25 * http://oss.sgi.com/projects/GenInfo/NoticeExplan
diff --git a/include/asm-ia64/mman.h b/include/asm-ia64/mman.h
index 828beb24a20e..6ba179f12718 100644
--- a/include/asm-ia64/mman.h
+++ b/include/asm-ia64/mman.h
@@ -8,19 +8,7 @@
8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
9 */ 9 */
10 10
11#define PROT_READ 0x1 /* page can be read */ 11#include <asm-generic/mman.h>
12#define PROT_WRITE 0x2 /* page can be written */
13#define PROT_EXEC 0x4 /* page can be executed */
14#define PROT_SEM 0x8 /* page may be used for atomic ops */
15#define PROT_NONE 0x0 /* page can not be accessed */
16#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
17#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
18
19#define MAP_SHARED 0x01 /* Share changes */
20#define MAP_PRIVATE 0x02 /* Changes are private */
21#define MAP_TYPE 0x0f /* Mask for type of mapping */
22#define MAP_FIXED 0x10 /* Interpret addr exactly */
23#define MAP_ANONYMOUS 0x20 /* don't use a file */
24 12
25#define MAP_GROWSDOWN 0x00100 /* stack-like segment */ 13#define MAP_GROWSDOWN 0x00100 /* stack-like segment */
26#define MAP_GROWSUP 0x00200 /* register stack-like segment */ 14#define MAP_GROWSUP 0x00200 /* register stack-like segment */
@@ -31,22 +19,7 @@
31#define MAP_POPULATE 0x08000 /* populate (prefault) pagetables */ 19#define MAP_POPULATE 0x08000 /* populate (prefault) pagetables */
32#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 20#define MAP_NONBLOCK 0x10000 /* do not block on IO */
33 21
34#define MS_ASYNC 1 /* sync memory asynchronously */
35#define MS_INVALIDATE 2 /* invalidate the caches */
36#define MS_SYNC 4 /* synchronous memory sync */
37
38#define MCL_CURRENT 1 /* lock all current mappings */ 22#define MCL_CURRENT 1 /* lock all current mappings */
39#define MCL_FUTURE 2 /* lock all future mappings */ 23#define MCL_FUTURE 2 /* lock all future mappings */
40 24
41#define MADV_NORMAL 0x0 /* default page-in behavior */
42#define MADV_RANDOM 0x1 /* page-in minimum required */
43#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
44#define MADV_WILLNEED 0x3 /* pre-fault pages */
45#define MADV_DONTNEED 0x4 /* discard these pages */
46#define MADV_REMOVE 0x5 /* remove these pages & resources */
47
48/* compatibility flags */
49#define MAP_ANON MAP_ANONYMOUS
50#define MAP_FILE 0
51
52#endif /* _ASM_IA64_MMAN_H */ 25#endif /* _ASM_IA64_MMAN_H */
diff --git a/include/asm-ia64/sn/arch.h b/include/asm-ia64/sn/arch.h
index 1a3831c04af6..91c31be87b13 100644
--- a/include/asm-ia64/sn/arch.h
+++ b/include/asm-ia64/sn/arch.h
@@ -70,7 +70,7 @@ DECLARE_PER_CPU(struct sn_hub_info_s, __sn_hub_info);
70 * Compact node ID to nasid mappings kept in the per-cpu data areas of each 70 * Compact node ID to nasid mappings kept in the per-cpu data areas of each
71 * cpu. 71 * cpu.
72 */ 72 */
73DECLARE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_NUMNODES]); 73DECLARE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_COMPACT_NODES]);
74#define sn_cnodeid_to_nasid (&__get_cpu_var(__sn_cnodeid_to_nasid[0])) 74#define sn_cnodeid_to_nasid (&__get_cpu_var(__sn_cnodeid_to_nasid[0]))
75 75
76 76
diff --git a/include/asm-ia64/sn/bte.h b/include/asm-ia64/sn/bte.h
index 01e5b4103235..5335d87ca5f8 100644
--- a/include/asm-ia64/sn/bte.h
+++ b/include/asm-ia64/sn/bte.h
@@ -46,7 +46,7 @@
46#define BTES_PER_NODE (is_shub2() ? 4 : 2) 46#define BTES_PER_NODE (is_shub2() ? 4 : 2)
47#define MAX_BTES_PER_NODE 4 47#define MAX_BTES_PER_NODE 4
48 48
49#define BTE2OFF_CTRL (0) 49#define BTE2OFF_CTRL 0
50#define BTE2OFF_SRC (SH2_BT_ENG_SRC_ADDR_0 - SH2_BT_ENG_CSR_0) 50#define BTE2OFF_SRC (SH2_BT_ENG_SRC_ADDR_0 - SH2_BT_ENG_CSR_0)
51#define BTE2OFF_DEST (SH2_BT_ENG_DEST_ADDR_0 - SH2_BT_ENG_CSR_0) 51#define BTE2OFF_DEST (SH2_BT_ENG_DEST_ADDR_0 - SH2_BT_ENG_CSR_0)
52#define BTE2OFF_NOTIFY (SH2_BT_ENG_NOTIF_ADDR_0 - SH2_BT_ENG_CSR_0) 52#define BTE2OFF_NOTIFY (SH2_BT_ENG_NOTIF_ADDR_0 - SH2_BT_ENG_CSR_0)
@@ -75,11 +75,11 @@
75 : base + (BTEOFF_NOTIFY/8)) 75 : base + (BTEOFF_NOTIFY/8))
76 76
77/* Define hardware modes */ 77/* Define hardware modes */
78#define BTE_NOTIFY (IBCT_NOTIFY) 78#define BTE_NOTIFY IBCT_NOTIFY
79#define BTE_NORMAL BTE_NOTIFY 79#define BTE_NORMAL BTE_NOTIFY
80#define BTE_ZERO_FILL (BTE_NOTIFY | IBCT_ZFIL_MODE) 80#define BTE_ZERO_FILL (BTE_NOTIFY | IBCT_ZFIL_MODE)
81/* Use a reserved bit to let the caller specify a wait for any BTE */ 81/* Use a reserved bit to let the caller specify a wait for any BTE */
82#define BTE_WACQUIRE (0x4000) 82#define BTE_WACQUIRE 0x4000
83/* Use the BTE on the node with the destination memory */ 83/* Use the BTE on the node with the destination memory */
84#define BTE_USE_DEST (BTE_WACQUIRE << 1) 84#define BTE_USE_DEST (BTE_WACQUIRE << 1)
85/* Use any available BTE interface on any node for the transfer */ 85/* Use any available BTE interface on any node for the transfer */
diff --git a/include/asm-ia64/sn/pcibr_provider.h b/include/asm-ia64/sn/pcibr_provider.h
index 9334078b089a..a601d3af39b6 100644
--- a/include/asm-ia64/sn/pcibr_provider.h
+++ b/include/asm-ia64/sn/pcibr_provider.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#ifndef _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H 8#ifndef _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H
9#define _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H 9#define _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H
@@ -115,18 +115,6 @@ struct pcibus_info {
115 spinlock_t pbi_lock; 115 spinlock_t pbi_lock;
116}; 116};
117 117
118/*
119 * pcibus_info structure locking macros
120 */
121inline static unsigned long
122pcibr_lock(struct pcibus_info *pcibus_info)
123{
124 unsigned long flag;
125 spin_lock_irqsave(&pcibus_info->pbi_lock, flag);
126 return(flag);
127}
128#define pcibr_unlock(pcibus_info, flag) spin_unlock_irqrestore(&pcibus_info->pbi_lock, flag)
129
130extern int pcibr_init_provider(void); 118extern int pcibr_init_provider(void);
131extern void *pcibr_bus_fixup(struct pcibus_bussoft *, struct pci_controller *); 119extern void *pcibr_bus_fixup(struct pcibus_bussoft *, struct pci_controller *);
132extern dma_addr_t pcibr_dma_map(struct pci_dev *, unsigned long, size_t); 120extern dma_addr_t pcibr_dma_map(struct pci_dev *, unsigned long, size_t);
diff --git a/include/asm-ia64/sn/sn_feature_sets.h b/include/asm-ia64/sn/sn_feature_sets.h
index 9ca642cad338..ff33e3bd3f8e 100644
--- a/include/asm-ia64/sn/sn_feature_sets.h
+++ b/include/asm-ia64/sn/sn_feature_sets.h
@@ -12,9 +12,6 @@
12 */ 12 */
13 13
14 14
15#include <asm/types.h>
16#include <asm/bitops.h>
17
18/* --------------------- PROM Features -----------------------------*/ 15/* --------------------- PROM Features -----------------------------*/
19extern int sn_prom_feature_available(int id); 16extern int sn_prom_feature_available(int id);
20 17
diff --git a/include/asm-ia64/sn/xpc.h b/include/asm-ia64/sn/xpc.h
index 0c36928ffd8b..df7f5f4f3cde 100644
--- a/include/asm-ia64/sn/xpc.h
+++ b/include/asm-ia64/sn/xpc.h
@@ -508,19 +508,24 @@ struct xpc_channel {
508#define XPC_C_OPENREQUEST 0x00000010 /* local open channel request */ 508#define XPC_C_OPENREQUEST 0x00000010 /* local open channel request */
509 509
510#define XPC_C_SETUP 0x00000020 /* channel's msgqueues are alloc'd */ 510#define XPC_C_SETUP 0x00000020 /* channel's msgqueues are alloc'd */
511#define XPC_C_CONNECTCALLOUT 0x00000040 /* channel connected callout made */ 511#define XPC_C_CONNECTEDCALLOUT 0x00000040 /* connected callout initiated */
512#define XPC_C_CONNECTED 0x00000080 /* local channel is connected */ 512#define XPC_C_CONNECTEDCALLOUT_MADE \
513#define XPC_C_CONNECTING 0x00000100 /* channel is being connected */ 513 0x00000080 /* connected callout completed */
514 514#define XPC_C_CONNECTED 0x00000100 /* local channel is connected */
515#define XPC_C_RCLOSEREPLY 0x00000200 /* remote close channel reply */ 515#define XPC_C_CONNECTING 0x00000200 /* channel is being connected */
516#define XPC_C_CLOSEREPLY 0x00000400 /* local close channel reply */ 516
517#define XPC_C_RCLOSEREQUEST 0x00000800 /* remote close channel request */ 517#define XPC_C_RCLOSEREPLY 0x00000400 /* remote close channel reply */
518#define XPC_C_CLOSEREQUEST 0x00001000 /* local close channel request */ 518#define XPC_C_CLOSEREPLY 0x00000800 /* local close channel reply */
519 519#define XPC_C_RCLOSEREQUEST 0x00001000 /* remote close channel request */
520#define XPC_C_DISCONNECTED 0x00002000 /* channel is disconnected */ 520#define XPC_C_CLOSEREQUEST 0x00002000 /* local close channel request */
521#define XPC_C_DISCONNECTING 0x00004000 /* channel is being disconnected */ 521
522#define XPC_C_DISCONNECTCALLOUT 0x00008000 /* chan disconnected callout made */ 522#define XPC_C_DISCONNECTED 0x00004000 /* channel is disconnected */
523#define XPC_C_WDISCONNECT 0x00010000 /* waiting for channel disconnect */ 523#define XPC_C_DISCONNECTING 0x00008000 /* channel is being disconnected */
524#define XPC_C_DISCONNECTINGCALLOUT \
525 0x00010000 /* disconnecting callout initiated */
526#define XPC_C_DISCONNECTINGCALLOUT_MADE \
527 0x00020000 /* disconnecting callout completed */
528#define XPC_C_WDISCONNECT 0x00040000 /* waiting for channel disconnect */
524 529
525 530
526 531
diff --git a/include/asm-ia64/timex.h b/include/asm-ia64/timex.h
index 414aae060440..05a6baf8a472 100644
--- a/include/asm-ia64/timex.h
+++ b/include/asm-ia64/timex.h
@@ -15,6 +15,8 @@
15 15
16typedef unsigned long cycles_t; 16typedef unsigned long cycles_t;
17 17
18extern void (*ia64_udelay)(unsigned long usecs);
19
18/* 20/*
19 * For performance reasons, we don't want to define CLOCK_TICK_TRATE as 21 * For performance reasons, we don't want to define CLOCK_TICK_TRATE as
20 * local_cpu_data->itc_rate. Fortunately, we don't have to, either: according to George 22 * local_cpu_data->itc_rate. Fortunately, we don't have to, either: according to George
diff --git a/include/asm-m32r/mman.h b/include/asm-m32r/mman.h
index 12e29747bc84..695a860c024f 100644
--- a/include/asm-m32r/mman.h
+++ b/include/asm-m32r/mman.h
@@ -1,21 +1,9 @@
1#ifndef __M32R_MMAN_H__ 1#ifndef __M32R_MMAN_H__
2#define __M32R_MMAN_H__ 2#define __M32R_MMAN_H__
3 3
4/* orig : i386 2.6.0-test6 */ 4#include <asm-generic/mman.h>
5
6#define PROT_READ 0x1 /* page can be read */
7#define PROT_WRITE 0x2 /* page can be written */
8#define PROT_EXEC 0x4 /* page can be executed */
9#define PROT_SEM 0x8 /* page may be used for atomic ops */
10#define PROT_NONE 0x0 /* page can not be accessed */
11#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
12#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
13 5
14#define MAP_SHARED 0x01 /* Share changes */ 6/* orig : i386 2.6.0-test6 */
15#define MAP_PRIVATE 0x02 /* Changes are private */
16#define MAP_TYPE 0x0f /* Mask for type of mapping */
17#define MAP_FIXED 0x10 /* Interpret addr exactly */
18#define MAP_ANONYMOUS 0x20 /* don't use a file */
19 7
20#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 8#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
21#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 9#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
@@ -25,22 +13,7 @@
25#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 13#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
26#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 14#define MAP_NONBLOCK 0x10000 /* do not block on IO */
27 15
28#define MS_ASYNC 1 /* sync memory asynchronously */
29#define MS_INVALIDATE 2 /* invalidate the caches */
30#define MS_SYNC 4 /* synchronous memory sync */
31
32#define MCL_CURRENT 1 /* lock all current mappings */ 16#define MCL_CURRENT 1 /* lock all current mappings */
33#define MCL_FUTURE 2 /* lock all future mappings */ 17#define MCL_FUTURE 2 /* lock all future mappings */
34 18
35#define MADV_NORMAL 0x0 /* default page-in behavior */
36#define MADV_RANDOM 0x1 /* page-in minimum required */
37#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
38#define MADV_WILLNEED 0x3 /* pre-fault pages */
39#define MADV_DONTNEED 0x4 /* discard these pages */
40#define MADV_REMOVE 0x5 /* remove these pages & resources */
41
42/* compatibility flags */
43#define MAP_ANON MAP_ANONYMOUS
44#define MAP_FILE 0
45
46#endif /* __M32R_MMAN_H__ */ 19#endif /* __M32R_MMAN_H__ */
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index 06c12a037cba..d6a2c613be68 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -239,7 +239,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
239 " bra 2f; \n" 239 " bra 2f; \n"
240 " .fillinsn \n" 240 " .fillinsn \n"
241 "1:" 241 "1:"
242 M32R_UNLOCK" %2, @%1; \n" 242 M32R_UNLOCK" %0, @%1; \n"
243 " .fillinsn \n" 243 " .fillinsn \n"
244 "2:" 244 "2:"
245 : "=&r" (retval) 245 : "=&r" (retval)
diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h
index 325c86f8512d..9ac047c400c4 100644
--- a/include/asm-m68k/irq.h
+++ b/include/asm-m68k/irq.h
@@ -79,7 +79,7 @@ static __inline__ int irq_canonicalize(int irq)
79 79
80extern void (*enable_irq)(unsigned int); 80extern void (*enable_irq)(unsigned int);
81extern void (*disable_irq)(unsigned int); 81extern void (*disable_irq)(unsigned int);
82#define enable_irq_nosync enable_irq 82#define disable_irq_nosync disable_irq
83 83
84struct pt_regs; 84struct pt_regs;
85 85
diff --git a/include/asm-m68k/mman.h b/include/asm-m68k/mman.h
index ea262ab88b3b..1626d37f4898 100644
--- a/include/asm-m68k/mman.h
+++ b/include/asm-m68k/mman.h
@@ -1,19 +1,7 @@
1#ifndef __M68K_MMAN_H__ 1#ifndef __M68K_MMAN_H__
2#define __M68K_MMAN_H__ 2#define __M68K_MMAN_H__
3 3
4#define PROT_READ 0x1 /* page can be read */ 4#include <asm-generic/mman.h>
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_SEM 0x8 /* page may be used for atomic ops */
8#define PROT_NONE 0x0 /* page can not be accessed */
9#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
10#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
11
12#define MAP_SHARED 0x01 /* Share changes */
13#define MAP_PRIVATE 0x02 /* Changes are private */
14#define MAP_TYPE 0x0f /* Mask for type of mapping */
15#define MAP_FIXED 0x10 /* Interpret addr exactly */
16#define MAP_ANONYMOUS 0x20 /* don't use a file */
17 5
18#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
19#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
@@ -23,22 +11,7 @@
23#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
24#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
25 13
26#define MS_ASYNC 1 /* sync memory asynchronously */
27#define MS_INVALIDATE 2 /* invalidate the caches */
28#define MS_SYNC 4 /* synchronous memory sync */
29
30#define MCL_CURRENT 1 /* lock all current mappings */ 14#define MCL_CURRENT 1 /* lock all current mappings */
31#define MCL_FUTURE 2 /* lock all future mappings */ 15#define MCL_FUTURE 2 /* lock all future mappings */
32 16
33#define MADV_NORMAL 0x0 /* default page-in behavior */
34#define MADV_RANDOM 0x1 /* page-in minimum required */
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
39
40/* compatibility flags */
41#define MAP_ANON MAP_ANONYMOUS
42#define MAP_FILE 0
43
44#endif /* __M68K_MMAN_H__ */ 17#endif /* __M68K_MMAN_H__ */
diff --git a/include/asm-m68k/raw_io.h b/include/asm-m68k/raw_io.h
index 5439bcaa57c6..811ccd25d4a6 100644
--- a/include/asm-m68k/raw_io.h
+++ b/include/asm-m68k/raw_io.h
@@ -336,6 +336,7 @@ static inline void raw_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
336 : "d0", "a0", "a1", "d6"); 336 : "d0", "a0", "a1", "d6");
337} 337}
338 338
339#define __raw_writel raw_outl
339 340
340#endif /* __KERNEL__ */ 341#endif /* __KERNEL__ */
341 342
diff --git a/include/asm-mips/cpu.h b/include/asm-mips/cpu.h
index 934e063e79f1..818b9a97e214 100644
--- a/include/asm-mips/cpu.h
+++ b/include/asm-mips/cpu.h
@@ -204,9 +204,9 @@
204 */ 204 */
205#define MIPS_CPU_ISA_I 0x00000001 205#define MIPS_CPU_ISA_I 0x00000001
206#define MIPS_CPU_ISA_II 0x00000002 206#define MIPS_CPU_ISA_II 0x00000002
207#define MIPS_CPU_ISA_III 0x00000003 207#define MIPS_CPU_ISA_III 0x00000004
208#define MIPS_CPU_ISA_IV 0x00000004 208#define MIPS_CPU_ISA_IV 0x00000008
209#define MIPS_CPU_ISA_V 0x00000005 209#define MIPS_CPU_ISA_V 0x00000010
210#define MIPS_CPU_ISA_M32R1 0x00000020 210#define MIPS_CPU_ISA_M32R1 0x00000020
211#define MIPS_CPU_ISA_M32R2 0x00000040 211#define MIPS_CPU_ISA_M32R2 0x00000040
212#define MIPS_CPU_ISA_M64R1 0x00000080 212#define MIPS_CPU_ISA_M64R1 0x00000080
diff --git a/include/asm-mips/gcc/sgidefs.h b/include/asm-mips/gcc/sgidefs.h
deleted file mode 100644
index 05994371a2af..000000000000
--- a/include/asm-mips/gcc/sgidefs.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * include/sgidefs.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996 by Ralf Baechle
9 *
10 * This file is here to satisfy GCC's expectations.
11 */
12#ifndef __SGIDEFS_H
13#define __SGIDEFS_H
14
15#include <asm/sgidefs.h>
16
17#endif /* __SGIDEFS_H */
diff --git a/include/asm-mips/mach-generic/timex.h b/include/asm-mips/mach-generic/timex.h
index c6a2e5f0574a..48b4cfaa0d50 100644
--- a/include/asm-mips/mach-generic/timex.h
+++ b/include/asm-mips/mach-generic/timex.h
@@ -3,20 +3,11 @@
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) 2003 by Ralf Baechle 6 * Copyright (C) 2003, 2005 by Ralf Baechle
7 */ 7 */
8#ifndef __ASM_MACH_GENERIC_TIMEX_H 8#ifndef __ASM_MACH_GENERIC_TIMEX_H
9#define __ASM_MACH_GENERIC_TIMEX_H 9#define __ASM_MACH_GENERIC_TIMEX_H
10 10
11#include <linux/config.h>
12
13/*
14 * Last remaining user of the i8254 PIC, will be converted, too ...
15 */
16#ifdef CONFIG_SNI_RM200_PCI
17#define CLOCK_TICK_RATE 1193182
18#else
19#define CLOCK_TICK_RATE 500000 11#define CLOCK_TICK_RATE 500000
20#endif
21 12
22#endif /* __ASM_MACH_GENERIC_TIMEX_H */ 13#endif /* __ASM_MACH_GENERIC_TIMEX_H */
diff --git a/include/asm-mips/mach-rm200/timex.h b/include/asm-mips/mach-rm200/timex.h
new file mode 100644
index 000000000000..11ff6cb0f214
--- /dev/null
+++ b/include/asm-mips/mach-rm200/timex.h
@@ -0,0 +1,13 @@
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) 2003, 2005 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_RM200_TIMEX_H
9#define __ASM_MACH_RM200_TIMEX_H
10
11#define CLOCK_TICK_RATE 1193182
12
13#endif /* __ASM_MACH_RM200_TIMEX_H */
diff --git a/include/asm-mips/mman.h b/include/asm-mips/mman.h
index dd17c8bd62a1..046cf686bee7 100644
--- a/include/asm-mips/mman.h
+++ b/include/asm-mips/mman.h
@@ -60,15 +60,19 @@
60#define MCL_CURRENT 1 /* lock all current mappings */ 60#define MCL_CURRENT 1 /* lock all current mappings */
61#define MCL_FUTURE 2 /* lock all future mappings */ 61#define MCL_FUTURE 2 /* lock all future mappings */
62 62
63#define MADV_NORMAL 0x0 /* default page-in behavior */ 63#define MADV_NORMAL 0 /* no further special treatment */
64#define MADV_RANDOM 0x1 /* page-in minimum required */ 64#define MADV_RANDOM 1 /* expect random page references */
65#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 65#define MADV_SEQUENTIAL 2 /* expect sequential page references */
66#define MADV_WILLNEED 0x3 /* pre-fault pages */ 66#define MADV_WILLNEED 3 /* will need these pages */
67#define MADV_DONTNEED 0x4 /* discard these pages */ 67#define MADV_DONTNEED 4 /* don't need these pages */
68#define MADV_REMOVE 0x5 /* remove these pages & resources */ 68
69/* common parameters: try to keep these consistent across architectures */
70#define MADV_REMOVE 9 /* remove these pages & resources */
71#define MADV_DONTFORK 10 /* don't inherit across fork */
72#define MADV_DOFORK 11 /* do inherit across fork */
69 73
70/* compatibility flags */ 74/* compatibility flags */
71#define MAP_ANON MAP_ANONYMOUS 75#define MAP_ANON MAP_ANONYMOUS
72#define MAP_FILE 0 76#define MAP_FILE 0
73 77
74#endif /* _ASM_MMAN_H */ 78#endif /* _ASM_MMAN_H */
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
index cc53196efa40..9632c27dad15 100644
--- a/include/asm-mips/r4kcache.h
+++ b/include/asm-mips/r4kcache.h
@@ -14,6 +14,7 @@
14 14
15#include <asm/asm.h> 15#include <asm/asm.h>
16#include <asm/cacheops.h> 16#include <asm/cacheops.h>
17#include <asm/cpu-features.h>
17 18
18/* 19/*
19 * This macro return a properly sign-extended address suitable as base address 20 * This macro return a properly sign-extended address suitable as base address
@@ -78,22 +79,25 @@ static inline void flush_scache_line(unsigned long addr)
78 cache_op(Hit_Writeback_Inv_SD, addr); 79 cache_op(Hit_Writeback_Inv_SD, addr);
79} 80}
80 81
82#define protected_cache_op(op,addr) \
83 __asm__ __volatile__( \
84 " .set push \n" \
85 " .set noreorder \n" \
86 " .set mips3 \n" \
87 "1: cache %0, (%1) \n" \
88 "2: .set pop \n" \
89 " .section __ex_table,\"a\" \n" \
90 " "STR(PTR)" 1b, 2b \n" \
91 " .previous" \
92 : \
93 : "i" (op), "r" (addr))
94
81/* 95/*
82 * The next two are for badland addresses like signal trampolines. 96 * The next two are for badland addresses like signal trampolines.
83 */ 97 */
84static inline void protected_flush_icache_line(unsigned long addr) 98static inline void protected_flush_icache_line(unsigned long addr)
85{ 99{
86 __asm__ __volatile__( 100 protected_cache_op(Hit_Invalidate_I, addr);
87 " .set push \n"
88 " .set noreorder \n"
89 " .set mips3 \n"
90 "1: cache %0, (%1) \n"
91 "2: .set pop \n"
92 " .section __ex_table,\"a\" \n"
93 " "STR(PTR)" 1b, 2b \n"
94 " .previous"
95 :
96 : "i" (Hit_Invalidate_I), "r" (addr));
97} 101}
98 102
99/* 103/*
@@ -104,32 +108,12 @@ static inline void protected_flush_icache_line(unsigned long addr)
104 */ 108 */
105static inline void protected_writeback_dcache_line(unsigned long addr) 109static inline void protected_writeback_dcache_line(unsigned long addr)
106{ 110{
107 __asm__ __volatile__( 111 protected_cache_op(Hit_Writeback_Inv_D, addr);
108 " .set push \n"
109 " .set noreorder \n"
110 " .set mips3 \n"
111 "1: cache %0, (%1) \n"
112 "2: .set pop \n"
113 " .section __ex_table,\"a\" \n"
114 " "STR(PTR)" 1b, 2b \n"
115 " .previous"
116 :
117 : "i" (Hit_Writeback_Inv_D), "r" (addr));
118} 112}
119 113
120static inline void protected_writeback_scache_line(unsigned long addr) 114static inline void protected_writeback_scache_line(unsigned long addr)
121{ 115{
122 __asm__ __volatile__( 116 protected_cache_op(Hit_Writeback_Inv_SD, addr);
123 " .set push \n"
124 " .set noreorder \n"
125 " .set mips3 \n"
126 "1: cache %0, (%1) \n"
127 "2: .set pop \n"
128 " .section __ex_table,\"a\" \n"
129 " "STR(PTR)" 1b, 2b \n"
130 " .previous"
131 :
132 : "i" (Hit_Writeback_Inv_SD), "r" (addr));
133} 117}
134 118
135/* 119/*
@@ -295,4 +279,28 @@ __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) 279__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) 280__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128)
297 281
282/* build blast_xxx_range, protected_blast_xxx_range */
283#define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot) \
284static inline void prot##blast_##pfx##cache##_range(unsigned long start, \
285 unsigned long end) \
286{ \
287 unsigned long lsize = cpu_##desc##_line_size(); \
288 unsigned long addr = start & ~(lsize - 1); \
289 unsigned long aend = (end - 1) & ~(lsize - 1); \
290 while (1) { \
291 prot##cache_op(hitop, addr); \
292 if (addr == aend) \
293 break; \
294 addr += lsize; \
295 } \
296}
297
298__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_)
299__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, protected_)
300__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, protected_)
301__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, )
302__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, )
303/* blast_inv_dcache_range */
304__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, )
305
298#endif /* _ASM_R4KCACHE_H */ 306#endif /* _ASM_R4KCACHE_H */
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
index 91d813a37823..b96f3e0f3933 100644
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -233,7 +233,7 @@ do { \
233#define __get_user_check(x,ptr,size) \ 233#define __get_user_check(x,ptr,size) \
234({ \ 234({ \
235 long __gu_err = -EFAULT; \ 235 long __gu_err = -EFAULT; \
236 const void __user * __gu_ptr = (ptr); \ 236 const __typeof__(*(ptr)) __user * __gu_ptr = (ptr); \
237 \ 237 \
238 if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ 238 if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \
239 __get_user_common((x), size, __gu_ptr); \ 239 __get_user_common((x), size, __gu_ptr); \
@@ -258,7 +258,7 @@ do { \
258 : "=r" (__gu_err), "=r" (__gu_tmp) \ 258 : "=r" (__gu_err), "=r" (__gu_tmp) \
259 : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); \ 259 : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); \
260 \ 260 \
261 (val) = (__typeof__(val)) __gu_tmp; \ 261 (val) = (__typeof__(*(addr))) __gu_tmp; \
262} 262}
263 263
264/* 264/*
@@ -266,6 +266,8 @@ do { \
266 */ 266 */
267#define __get_user_asm_ll32(val, addr) \ 267#define __get_user_asm_ll32(val, addr) \
268{ \ 268{ \
269 unsigned long long __gu_tmp; \
270 \
269 __asm__ __volatile__( \ 271 __asm__ __volatile__( \
270 "1: lw %1, (%3) \n" \ 272 "1: lw %1, (%3) \n" \
271 "2: lw %D1, 4(%3) \n" \ 273 "2: lw %D1, 4(%3) \n" \
@@ -280,8 +282,9 @@ do { \
280 " " __UA_ADDR " 1b, 4b \n" \ 282 " " __UA_ADDR " 1b, 4b \n" \
281 " " __UA_ADDR " 2b, 4b \n" \ 283 " " __UA_ADDR " 2b, 4b \n" \
282 " .previous \n" \ 284 " .previous \n" \
283 : "=r" (__gu_err), "=&r" (val) \ 285 : "=r" (__gu_err), "=&r" (__gu_tmp) \
284 : "0" (0), "r" (addr), "i" (-EFAULT)); \ 286 : "0" (0), "r" (addr), "i" (-EFAULT)); \
287 (val) = (__typeof__(*(addr))) __gu_tmp; \
285} 288}
286 289
287/* 290/*
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index e7ff9b187783..b5c78a4a0192 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -313,7 +313,7 @@
313#define __NR_mknodat (__NR_Linux + 290) 313#define __NR_mknodat (__NR_Linux + 290)
314#define __NR_fchownat (__NR_Linux + 291) 314#define __NR_fchownat (__NR_Linux + 291)
315#define __NR_futimesat (__NR_Linux + 292) 315#define __NR_futimesat (__NR_Linux + 292)
316#define __NR_newfstatat (__NR_Linux + 293) 316#define __NR_fstatat (__NR_Linux + 293)
317#define __NR_unlinkat (__NR_Linux + 294) 317#define __NR_unlinkat (__NR_Linux + 294)
318#define __NR_renameat (__NR_Linux + 295) 318#define __NR_renameat (__NR_Linux + 295)
319#define __NR_linkat (__NR_Linux + 296) 319#define __NR_linkat (__NR_Linux + 296)
@@ -593,7 +593,7 @@
593#define __NR_mknodat (__NR_Linux + 249) 593#define __NR_mknodat (__NR_Linux + 249)
594#define __NR_fchownat (__NR_Linux + 250) 594#define __NR_fchownat (__NR_Linux + 250)
595#define __NR_futimesat (__NR_Linux + 251) 595#define __NR_futimesat (__NR_Linux + 251)
596#define __NR_newfstatat (__NR_Linux + 252) 596#define __NR_fstatat (__NR_Linux + 252)
597#define __NR_unlinkat (__NR_Linux + 253) 597#define __NR_unlinkat (__NR_Linux + 253)
598#define __NR_renameat (__NR_Linux + 254) 598#define __NR_renameat (__NR_Linux + 254)
599#define __NR_linkat (__NR_Linux + 255) 599#define __NR_linkat (__NR_Linux + 255)
@@ -877,7 +877,7 @@
877#define __NR_mknodat (__NR_Linux + 253) 877#define __NR_mknodat (__NR_Linux + 253)
878#define __NR_fchownat (__NR_Linux + 254) 878#define __NR_fchownat (__NR_Linux + 254)
879#define __NR_futimesat (__NR_Linux + 255) 879#define __NR_futimesat (__NR_Linux + 255)
880#define __NR_newfstatat (__NR_Linux + 256) 880#define __NR_fstatat (__NR_Linux + 256)
881#define __NR_unlinkat (__NR_Linux + 257) 881#define __NR_unlinkat (__NR_Linux + 257)
882#define __NR_renameat (__NR_Linux + 258) 882#define __NR_renameat (__NR_Linux + 258)
883#define __NR_linkat (__NR_Linux + 259) 883#define __NR_linkat (__NR_Linux + 259)
@@ -1184,10 +1184,8 @@ type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
1184#define __ARCH_WANT_SYS_SIGPENDING 1184#define __ARCH_WANT_SYS_SIGPENDING
1185#define __ARCH_WANT_SYS_SIGPROCMASK 1185#define __ARCH_WANT_SYS_SIGPROCMASK
1186#define __ARCH_WANT_SYS_RT_SIGACTION 1186#define __ARCH_WANT_SYS_RT_SIGACTION
1187# ifndef __mips64
1188# define __ARCH_WANT_STAT64
1189# endif
1190# ifdef CONFIG_32BIT 1187# ifdef CONFIG_32BIT
1188# define __ARCH_WANT_STAT64
1191# define __ARCH_WANT_SYS_TIME 1189# define __ARCH_WANT_SYS_TIME
1192# endif 1190# endif
1193# ifdef CONFIG_MIPS32_O32 1191# ifdef CONFIG_MIPS32_O32
diff --git a/include/asm-parisc/mman.h b/include/asm-parisc/mman.h
index 736b0abcac05..0ef15ee0f17e 100644
--- a/include/asm-parisc/mman.h
+++ b/include/asm-parisc/mman.h
@@ -38,7 +38,11 @@
38#define MADV_SPACEAVAIL 5 /* insure that resources are reserved */ 38#define MADV_SPACEAVAIL 5 /* insure that resources are reserved */
39#define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */ 39#define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */
40#define MADV_VPS_INHERIT 7 /* Inherit parents page size */ 40#define MADV_VPS_INHERIT 7 /* Inherit parents page size */
41#define MADV_REMOVE 8 /* remove these pages & resources */ 41
42/* common/generic parameters */
43#define MADV_REMOVE 9 /* remove these pages & resources */
44#define MADV_DONTFORK 10 /* don't inherit across fork */
45#define MADV_DOFORK 11 /* do inherit across fork */
42 46
43/* The range 12-64 is reserved for page size specification. */ 47/* The range 12-64 is reserved for page size specification. */
44#define MADV_4K_PAGES 12 /* Use 4K pages */ 48#define MADV_4K_PAGES 12 /* Use 4K pages */
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 64210549f56b..90d005bb4d1c 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -159,9 +159,11 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
159#endif 159#endif
160 160
161/* We need to mark all pages as being coherent if we're SMP or we 161/* We need to mark all pages as being coherent if we're SMP or we
162 * have a 74[45]x and an MPC107 host bridge. 162 * have a 74[45]x and an MPC107 host bridge. Also 83xx requires
163 * it for PCI "streaming/prefetch" to work properly.
163 */ 164 */
164#if defined(CONFIG_SMP) || defined(CONFIG_MPC10X_BRIDGE) 165#if defined(CONFIG_SMP) || defined(CONFIG_MPC10X_BRIDGE) \
166 || defined(CONFIG_PPC_83xx)
165#define CPU_FTR_COMMON CPU_FTR_NEED_COHERENT 167#define CPU_FTR_COMMON CPU_FTR_NEED_COHERENT
166#else 168#else
167#define CPU_FTR_COMMON 0 169#define CPU_FTR_COMMON 0
@@ -277,7 +279,8 @@ enum {
277 CPU_FTRS_G2_LE = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | 279 CPU_FTRS_G2_LE = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
278 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS, 280 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS,
279 CPU_FTRS_E300 = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | 281 CPU_FTRS_E300 = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE |
280 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS, 282 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS |
283 CPU_FTR_COMMON,
281 CPU_FTRS_CLASSIC32 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 284 CPU_FTRS_CLASSIC32 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE |
282 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE, 285 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE,
283 CPU_FTRS_POWER3_32 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 286 CPU_FTRS_POWER3_32 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE |
diff --git a/include/asm-powerpc/mman.h b/include/asm-powerpc/mman.h
index a2e34c21b44f..24cf664a8295 100644
--- a/include/asm-powerpc/mman.h
+++ b/include/asm-powerpc/mman.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_POWERPC_MMAN_H 1#ifndef _ASM_POWERPC_MMAN_H
2#define _ASM_POWERPC_MMAN_H 2#define _ASM_POWERPC_MMAN_H
3 3
4#include <asm-generic/mman.h>
5
4/* 6/*
5 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
@@ -8,19 +10,6 @@
8 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
9 */ 11 */
10 12
11#define PROT_READ 0x1 /* page can be read */
12#define PROT_WRITE 0x2 /* page can be written */
13#define PROT_EXEC 0x4 /* page can be executed */
14#define PROT_SEM 0x8 /* page may be used for atomic ops */
15#define PROT_NONE 0x0 /* page can not be accessed */
16#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
17#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
18
19#define MAP_SHARED 0x01 /* Share changes */
20#define MAP_PRIVATE 0x02 /* Changes are private */
21#define MAP_TYPE 0x0f /* Mask for type of mapping */
22#define MAP_FIXED 0x10 /* Interpret addr exactly */
23#define MAP_ANONYMOUS 0x20 /* don't use a file */
24#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ 13#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */
25#define MAP_NORESERVE 0x40 /* don't reserve swap pages */ 14#define MAP_NORESERVE 0x40 /* don't reserve swap pages */
26#define MAP_LOCKED 0x80 15#define MAP_LOCKED 0x80
@@ -29,25 +18,10 @@
29#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 18#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
30#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 19#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
31 20
32#define MS_ASYNC 1 /* sync memory asynchronously */
33#define MS_INVALIDATE 2 /* invalidate the caches */
34#define MS_SYNC 4 /* synchronous memory sync */
35
36#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ 21#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
37#define MCL_FUTURE 0x4000 /* lock all additions to address space */ 22#define MCL_FUTURE 0x4000 /* lock all additions to address space */
38 23
39#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 24#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
40#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 25#define MAP_NONBLOCK 0x10000 /* do not block on IO */
41 26
42#define MADV_NORMAL 0x0 /* default page-in behavior */
43#define MADV_RANDOM 0x1 /* page-in minimum required */
44#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
45#define MADV_WILLNEED 0x3 /* pre-fault pages */
46#define MADV_DONTNEED 0x4 /* discard these pages */
47#define MADV_REMOVE 0x5 /* remove these pages & resources */
48
49/* compatibility flags */
50#define MAP_ANON MAP_ANONYMOUS
51#define MAP_FILE 0
52
53#endif /* _ASM_POWERPC_MMAN_H */ 27#endif /* _ASM_POWERPC_MMAN_H */
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index d096d9e76ad7..b0b9a3f8cdc2 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -112,6 +112,7 @@ typedef struct {
112} hpte_t; 112} hpte_t;
113 113
114extern hpte_t *htab_address; 114extern hpte_t *htab_address;
115extern unsigned long htab_size_bytes;
115extern unsigned long htab_hash_mask; 116extern unsigned long htab_hash_mask;
116 117
117/* 118/*
diff --git a/include/asm-powerpc/pgalloc.h b/include/asm-powerpc/pgalloc.h
index 9f5b052784a5..a00ee002cd11 100644
--- a/include/asm-powerpc/pgalloc.h
+++ b/include/asm-powerpc/pgalloc.h
@@ -146,7 +146,7 @@ extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf);
146 pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \ 146 pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \
147 PMD_CACHE_NUM, PMD_TABLE_SIZE-1)) 147 PMD_CACHE_NUM, PMD_TABLE_SIZE-1))
148#ifndef CONFIG_PPC_64K_PAGES 148#ifndef CONFIG_PPC_64K_PAGES
149#define __pud_free_tlb(tlb, pmd) \ 149#define __pud_free_tlb(tlb, pud) \
150 pgtable_free_tlb(tlb, pgtable_free_cache(pud, \ 150 pgtable_free_tlb(tlb, pgtable_free_cache(pud, \
151 PUD_CACHE_NUM, PUD_TABLE_SIZE-1)) 151 PUD_CACHE_NUM, PUD_TABLE_SIZE-1))
152#endif /* CONFIG_PPC_64K_PAGES */ 152#endif /* CONFIG_PPC_64K_PAGES */
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index 12ecc9b9f285..72bfe3af0460 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -615,27 +615,9 @@
615#define proc_trap() asm volatile("trap") 615#define proc_trap() asm volatile("trap")
616 616
617#ifdef CONFIG_PPC64 617#ifdef CONFIG_PPC64
618static inline void ppc64_runlatch_on(void) 618
619{ 619extern void ppc64_runlatch_on(void);
620 unsigned long ctrl; 620extern void ppc64_runlatch_off(void);
621
622 if (cpu_has_feature(CPU_FTR_CTRL)) {
623 ctrl = mfspr(SPRN_CTRLF);
624 ctrl |= CTRL_RUNLATCH;
625 mtspr(SPRN_CTRLT, ctrl);
626 }
627}
628
629static inline void ppc64_runlatch_off(void)
630{
631 unsigned long ctrl;
632
633 if (cpu_has_feature(CPU_FTR_CTRL)) {
634 ctrl = mfspr(SPRN_CTRLF);
635 ctrl &= ~CTRL_RUNLATCH;
636 mtspr(SPRN_CTRLT, ctrl);
637 }
638}
639 621
640extern unsigned long scom970_read(unsigned int address); 622extern unsigned long scom970_read(unsigned int address);
641extern void scom970_write(unsigned int address, unsigned long value); 623extern void scom970_write(unsigned int address, unsigned long value);
@@ -645,15 +627,6 @@ extern void scom970_write(unsigned int address, unsigned long value);
645#define __get_SP() ({unsigned long sp; \ 627#define __get_SP() ({unsigned long sp; \
646 asm volatile("mr %0,1": "=r" (sp)); sp;}) 628 asm volatile("mr %0,1": "=r" (sp)); sp;})
647 629
648#else /* __ASSEMBLY__ */
649
650#define RUNLATCH_ON(REG) \
651BEGIN_FTR_SECTION \
652 mfspr (REG),SPRN_CTRLF; \
653 ori (REG),(REG),CTRL_RUNLATCH; \
654 mtspr SPRN_CTRLT,(REG); \
655END_FTR_SECTION_IFSET(CPU_FTR_CTRL)
656
657#endif /* __ASSEMBLY__ */ 630#endif /* __ASSEMBLY__ */
658#endif /* __KERNEL__ */ 631#endif /* __KERNEL__ */
659#endif /* _ASM_POWERPC_REG_H */ 632#endif /* _ASM_POWERPC_REG_H */
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index c044ec16a879..237fc2b72974 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -113,7 +113,7 @@ static inline struct thread_info *current_thread_info(void)
113#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling 113#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
114 TIF_NEED_RESCHED */ 114 TIF_NEED_RESCHED */
115#define TIF_32BIT 5 /* 32 bit binary */ 115#define TIF_32BIT 5 /* 32 bit binary */
116/* #define SPARE 6 */ 116#define TIF_RUNLATCH 6 /* Is the runlatch enabled? */
117#define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */ 117#define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */
118#define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */ 118#define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */
119#define TIF_SINGLESTEP 9 /* singlestepping active */ 119#define TIF_SINGLESTEP 9 /* singlestepping active */
@@ -131,7 +131,7 @@ static inline struct thread_info *current_thread_info(void)
131#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 131#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
132#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 132#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
133#define _TIF_32BIT (1<<TIF_32BIT) 133#define _TIF_32BIT (1<<TIF_32BIT)
134/* #define _SPARE (1<<SPARE) */ 134#define _TIF_RUNLATCH (1<<TIF_RUNLATCH)
135#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 135#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
136#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 136#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
137#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 137#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
diff --git a/include/asm-ppc/machdep.h b/include/asm-ppc/machdep.h
index 39200def8d11..a3e8a45e45a9 100644
--- a/include/asm-ppc/machdep.h
+++ b/include/asm-ppc/machdep.h
@@ -154,19 +154,6 @@ extern char cmd_line[COMMAND_LINE_SIZE];
154 154
155extern void setup_pci_ptrs(void); 155extern void setup_pci_ptrs(void);
156 156
157/*
158 * Power macintoshes have either a CUDA or a PMU controlling
159 * system reset, power, NVRAM, RTC.
160 */
161typedef enum sys_ctrler_kind {
162 SYS_CTRLER_UNKNOWN = 0,
163 SYS_CTRLER_CUDA = 1,
164 SYS_CTRLER_PMU = 2,
165 SYS_CTRLER_SMU = 3,
166} sys_ctrler_t;
167
168extern sys_ctrler_t sys_ctrler;
169
170#ifdef CONFIG_SMP 157#ifdef CONFIG_SMP
171struct smp_ops_t { 158struct smp_ops_t {
172 void (*message_pass)(int target, int msg); 159 void (*message_pass)(int target, int msg);
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index 61232760cc3b..3628899f48bb 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -518,8 +518,8 @@ static inline int __test_bit(unsigned long nr, const volatile unsigned long *ptr
518 518
519static inline int 519static inline int
520__constant_test_bit(unsigned long nr, const volatile unsigned long *addr) { 520__constant_test_bit(unsigned long nr, const volatile unsigned long *addr) {
521 return ((((volatile char *) addr) 521 return (((volatile char *) addr)
522 [(nr^(__BITOPS_WORDSIZE-8))>>3] & (1<<(nr&7)))) != 0; 522 [(nr^(__BITOPS_WORDSIZE-8))>>3] & (1<<(nr&7))) != 0;
523} 523}
524 524
525#define test_bit(nr,addr) \ 525#define test_bit(nr,addr) \
diff --git a/include/asm-s390/dasd.h b/include/asm-s390/dasd.h
index c744ff33b1df..1630c26e8f45 100644
--- a/include/asm-s390/dasd.h
+++ b/include/asm-s390/dasd.h
@@ -204,8 +204,7 @@ typedef struct attrib_data_t {
204 * 204 *
205 * Here ist how the ioctl-nr should be used: 205 * Here ist how the ioctl-nr should be used:
206 * 0 - 31 DASD driver itself 206 * 0 - 31 DASD driver itself
207 * 32 - 229 still open 207 * 32 - 239 still open
208 * 230 - 239 DASD extended error reporting
209 * 240 - 255 reserved for EMC 208 * 240 - 255 reserved for EMC
210 *******************************************************************************/ 209 *******************************************************************************/
211 210
@@ -237,22 +236,12 @@ typedef struct attrib_data_t {
237#define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t) 236#define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)
238/* Get Attributes (cache operations) */ 237/* Get Attributes (cache operations) */
239#define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t) 238#define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t)
240/* retrieve extended error-reporting value */
241#define BIODASDEERGET _IOR(DASD_IOCTL_LETTER,6,int)
242 239
243 240
244/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */ 241/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
245#define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t) 242#define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t)
246/* Set Attributes (cache operations) */ 243/* Set Attributes (cache operations) */
247#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t) 244#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
248/* retrieve extended error-reporting value */
249#define BIODASDEERSET _IOW(DASD_IOCTL_LETTER,3,int)
250
251
252/* remove all records from the eer buffer */
253#define DASD_EER_PURGE _IO(DASD_IOCTL_LETTER,230)
254/* set the number of pages that are used for the internal eer buffer */
255#define DASD_EER_SETBUFSIZE _IOW(DASD_IOCTL_LETTER,230,int)
256 245
257 246
258#endif /* DASD_H */ 247#endif /* DASD_H */
diff --git a/include/asm-s390/mman.h b/include/asm-s390/mman.h
index c8d5409b5d56..7839767d837e 100644
--- a/include/asm-s390/mman.h
+++ b/include/asm-s390/mman.h
@@ -9,19 +9,7 @@
9#ifndef __S390_MMAN_H__ 9#ifndef __S390_MMAN_H__
10#define __S390_MMAN_H__ 10#define __S390_MMAN_H__
11 11
12#define PROT_READ 0x1 /* page can be read */ 12#include <asm-generic/mman.h>
13#define PROT_WRITE 0x2 /* page can be written */
14#define PROT_EXEC 0x4 /* page can be executed */
15#define PROT_SEM 0x8 /* page may be used for atomic ops */
16#define PROT_NONE 0x0 /* page can not be accessed */
17#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
18#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
19
20#define MAP_SHARED 0x01 /* Share changes */
21#define MAP_PRIVATE 0x02 /* Changes are private */
22#define MAP_TYPE 0x0f /* Mask for type of mapping */
23#define MAP_FIXED 0x10 /* Interpret addr exactly */
24#define MAP_ANONYMOUS 0x20 /* don't use a file */
25 13
26#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 14#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
27#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 15#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
@@ -31,22 +19,7 @@
31#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 19#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
32#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 20#define MAP_NONBLOCK 0x10000 /* do not block on IO */
33 21
34#define MS_ASYNC 1 /* sync memory asynchronously */
35#define MS_INVALIDATE 2 /* invalidate the caches */
36#define MS_SYNC 4 /* synchronous memory sync */
37
38#define MCL_CURRENT 1 /* lock all current mappings */ 22#define MCL_CURRENT 1 /* lock all current mappings */
39#define MCL_FUTURE 2 /* lock all future mappings */ 23#define MCL_FUTURE 2 /* lock all future mappings */
40 24
41#define MADV_NORMAL 0x0 /* default page-in behavior */
42#define MADV_RANDOM 0x1 /* page-in minimum required */
43#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
44#define MADV_WILLNEED 0x3 /* pre-fault pages */
45#define MADV_DONTNEED 0x4 /* discard these pages */
46#define MADV_REMOVE 0x5 /* remove these pages & resources */
47
48/* compatibility flags */
49#define MAP_ANON MAP_ANONYMOUS
50#define MAP_FILE 0
51
52#endif /* __S390_MMAN_H__ */ 25#endif /* __S390_MMAN_H__ */
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h
index 348a88137445..da3fd4a7bb32 100644
--- a/include/asm-s390/setup.h
+++ b/include/asm-s390/setup.h
@@ -8,6 +8,8 @@
8#ifndef _ASM_S390_SETUP_H 8#ifndef _ASM_S390_SETUP_H
9#define _ASM_S390_SETUP_H 9#define _ASM_S390_SETUP_H
10 10
11#ifdef __KERNEL__
12
11#include <asm/types.h> 13#include <asm/types.h>
12 14
13#define PARMAREA 0x10400 15#define PARMAREA 0x10400
@@ -114,7 +116,7 @@ extern u16 ipl_devno;
114 IPL_PARMBLOCK_ORIGIN) 116 IPL_PARMBLOCK_ORIGIN)
115#define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.length) 117#define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.length)
116 118
117#else 119#else /* __ASSEMBLY__ */
118 120
119#ifndef __s390x__ 121#ifndef __s390x__
120#define IPL_DEVICE 0x10404 122#define IPL_DEVICE 0x10404
@@ -127,6 +129,6 @@ extern u16 ipl_devno;
127#endif /* __s390x__ */ 129#endif /* __s390x__ */
128#define COMMAND_LINE 0x10480 130#define COMMAND_LINE 0x10480
129 131
130#endif 132#endif /* __ASSEMBLY__ */
131 133#endif /* __KERNEL__ */
132#endif 134#endif /* _ASM_S390_SETUP_H */
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h
index a2ae7628bbaa..444dae5912e6 100644
--- a/include/asm-s390/smp.h
+++ b/include/asm-s390/smp.h
@@ -31,6 +31,7 @@ typedef struct
31 __u16 cpu; 31 __u16 cpu;
32} sigp_info; 32} sigp_info;
33 33
34extern void smp_setup_cpu_possible_map(void);
34extern int smp_call_function_on(void (*func) (void *info), void *info, 35extern int smp_call_function_on(void (*func) (void *info), void *info,
35 int nonatomic, int wait, int cpu); 36 int nonatomic, int wait, int cpu);
36#define NO_PROC_ID 0xFF /* No processor magic marker */ 37#define NO_PROC_ID 0xFF /* No processor magic marker */
@@ -101,8 +102,10 @@ smp_call_function_on(void (*func) (void *info), void *info,
101 func(info); 102 func(info);
102 return 0; 103 return 0;
103} 104}
105#define smp_cpu_not_running(cpu) 1
104#define smp_get_cpu(cpu) ({ 0; }) 106#define smp_get_cpu(cpu) ({ 0; })
105#define smp_put_cpu(cpu) ({ 0; }) 107#define smp_put_cpu(cpu) ({ 0; })
108#define smp_setup_cpu_possible_map()
106#endif 109#endif
107 110
108#endif 111#endif
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index 29a9f357eb9e..657d582e8149 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -285,7 +285,7 @@
285#define __NR_mknodat 290 285#define __NR_mknodat 290
286#define __NR_fchownat 291 286#define __NR_fchownat 291
287#define __NR_futimesat 292 287#define __NR_futimesat 292
288#define __NR_newfstatat 293 288#define __NR_fstatat64 293
289#define __NR_unlinkat 294 289#define __NR_unlinkat 294
290#define __NR_renameat 295 290#define __NR_renameat 295
291#define __NR_linkat 296 291#define __NR_linkat 296
@@ -295,8 +295,9 @@
295#define __NR_faccessat 300 295#define __NR_faccessat 300
296#define __NR_pselect6 301 296#define __NR_pselect6 301
297#define __NR_ppoll 302 297#define __NR_ppoll 302
298#define __NR_unshare 303
298 299
299#define NR_syscalls 303 300#define NR_syscalls 304
300 301
301/* 302/*
302 * There are some system calls that are not present on 64 bit, some 303 * There are some system calls that are not present on 64 bit, some
@@ -358,6 +359,7 @@
358#undef __NR_fcntl64 359#undef __NR_fcntl64
359#undef __NR_sendfile64 360#undef __NR_sendfile64
360#undef __NR_fadvise64_64 361#undef __NR_fadvise64_64
362#undef __NR_fstatat64
361 363
362#define __NR_select 142 364#define __NR_select 142
363#define __NR_getrlimit 191 /* SuS compliant getrlimit */ 365#define __NR_getrlimit 191 /* SuS compliant getrlimit */
@@ -380,6 +382,7 @@
380#define __NR_setgid 214 382#define __NR_setgid 214
381#define __NR_setfsuid 215 383#define __NR_setfsuid 215
382#define __NR_setfsgid 216 384#define __NR_setfsgid 216
385#define __NR_newfstatat 293
383 386
384#endif 387#endif
385 388
diff --git a/include/asm-sh/mman.h b/include/asm-sh/mman.h
index 693bd55a3710..156eb0225cf6 100644
--- a/include/asm-sh/mman.h
+++ b/include/asm-sh/mman.h
@@ -1,19 +1,7 @@
1#ifndef __ASM_SH_MMAN_H 1#ifndef __ASM_SH_MMAN_H
2#define __ASM_SH_MMAN_H 2#define __ASM_SH_MMAN_H
3 3
4#define PROT_READ 0x1 /* page can be read */ 4#include <asm-generic/mman.h>
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_SEM 0x8 /* page may be used for atomic ops */
8#define PROT_NONE 0x0 /* page can not be accessed */
9#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
10#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
11
12#define MAP_SHARED 0x01 /* Share changes */
13#define MAP_PRIVATE 0x02 /* Changes are private */
14#define MAP_TYPE 0x0f /* Mask for type of mapping */
15#define MAP_FIXED 0x10 /* Interpret addr exactly */
16#define MAP_ANONYMOUS 0x20 /* don't use a file */
17 5
18#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
19#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
@@ -23,22 +11,7 @@
23#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */ 11#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */
24#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
25 13
26#define MS_ASYNC 1 /* sync memory asynchronously */
27#define MS_INVALIDATE 2 /* invalidate the caches */
28#define MS_SYNC 4 /* synchronous memory sync */
29
30#define MCL_CURRENT 1 /* lock all current mappings */ 14#define MCL_CURRENT 1 /* lock all current mappings */
31#define MCL_FUTURE 2 /* lock all future mappings */ 15#define MCL_FUTURE 2 /* lock all future mappings */
32 16
33#define MADV_NORMAL 0x0 /* default page-in behavior */
34#define MADV_RANDOM 0x1 /* page-in minimum required */
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
39
40/* compatibility flags */
41#define MAP_ANON MAP_ANONYMOUS
42#define MAP_FILE 0
43
44#endif /* __ASM_SH_MMAN_H */ 17#endif /* __ASM_SH_MMAN_H */
diff --git a/include/asm-sparc/mman.h b/include/asm-sparc/mman.h
index 98435ad8619e..88d1886abf3b 100644
--- a/include/asm-sparc/mman.h
+++ b/include/asm-sparc/mman.h
@@ -2,21 +2,10 @@
2#ifndef __SPARC_MMAN_H__ 2#ifndef __SPARC_MMAN_H__
3#define __SPARC_MMAN_H__ 3#define __SPARC_MMAN_H__
4 4
5#include <asm-generic/mman.h>
6
5/* SunOS'ified... */ 7/* SunOS'ified... */
6 8
7#define PROT_READ 0x1 /* page can be read */
8#define PROT_WRITE 0x2 /* page can be written */
9#define PROT_EXEC 0x4 /* page can be executed */
10#define PROT_SEM 0x8 /* page may be used for atomic ops */
11#define PROT_NONE 0x0 /* page can not be accessed */
12#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
13#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
14
15#define MAP_SHARED 0x01 /* Share changes */
16#define MAP_PRIVATE 0x02 /* Changes are private */
17#define MAP_TYPE 0x0f /* Mask for type of mapping */
18#define MAP_FIXED 0x10 /* Interpret addr exactly */
19#define MAP_ANONYMOUS 0x20 /* don't use a file */
20#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ 9#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */
21#define MAP_NORESERVE 0x40 /* don't reserve swap pages */ 10#define MAP_NORESERVE 0x40 /* don't reserve swap pages */
22#define MAP_INHERIT 0x80 /* SunOS doesn't do this, but... */ 11#define MAP_INHERIT 0x80 /* SunOS doesn't do this, but... */
@@ -27,10 +16,6 @@
27#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 16#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
28#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 17#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
29 18
30#define MS_ASYNC 1 /* sync memory asynchronously */
31#define MS_INVALIDATE 2 /* invalidate the caches */
32#define MS_SYNC 4 /* synchronous memory sync */
33
34#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ 19#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
35#define MCL_FUTURE 0x4000 /* lock all additions to address space */ 20#define MCL_FUTURE 0x4000 /* lock all additions to address space */
36 21
@@ -48,16 +33,6 @@
48#define MC_LOCKAS 5 /* Lock an entire address space of the calling process */ 33#define MC_LOCKAS 5 /* Lock an entire address space of the calling process */
49#define MC_UNLOCKAS 6 /* Unlock entire address space of calling process */ 34#define MC_UNLOCKAS 6 /* Unlock entire address space of calling process */
50 35
51#define MADV_NORMAL 0x0 /* default page-in behavior */
52#define MADV_RANDOM 0x1 /* page-in minimum required */
53#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
54#define MADV_WILLNEED 0x3 /* pre-fault pages */
55#define MADV_DONTNEED 0x4 /* discard these pages */
56#define MADV_FREE 0x5 /* (Solaris) contents can be freed */ 36#define MADV_FREE 0x5 /* (Solaris) contents can be freed */
57#define MADV_REMOVE 0x6 /* remove these pages & resources */
58
59/* compatibility flags */
60#define MAP_ANON MAP_ANONYMOUS
61#define MAP_FILE 0
62 37
63#endif /* __SPARC_MMAN_H__ */ 38#endif /* __SPARC_MMAN_H__ */
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 0615d601a7c6..64ec640a40ee 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -305,7 +305,7 @@
305#define __NR_mknodat 286 305#define __NR_mknodat 286
306#define __NR_fchownat 287 306#define __NR_fchownat 287
307#define __NR_futimesat 288 307#define __NR_futimesat 288
308#define __NR_newfstatat 289 308#define __NR_fstatat64 289
309#define __NR_unlinkat 290 309#define __NR_unlinkat 290
310#define __NR_renameat 291 310#define __NR_renameat 291
311#define __NR_linkat 292 311#define __NR_linkat 292
diff --git a/include/asm-sparc64/mman.h b/include/asm-sparc64/mman.h
index cb4b6156194d..6fd878e61435 100644
--- a/include/asm-sparc64/mman.h
+++ b/include/asm-sparc64/mman.h
@@ -2,21 +2,10 @@
2#ifndef __SPARC64_MMAN_H__ 2#ifndef __SPARC64_MMAN_H__
3#define __SPARC64_MMAN_H__ 3#define __SPARC64_MMAN_H__
4 4
5#include <asm-generic/mman.h>
6
5/* SunOS'ified... */ 7/* SunOS'ified... */
6 8
7#define PROT_READ 0x1 /* page can be read */
8#define PROT_WRITE 0x2 /* page can be written */
9#define PROT_EXEC 0x4 /* page can be executed */
10#define PROT_SEM 0x8 /* page may be used for atomic ops */
11#define PROT_NONE 0x0 /* page can not be accessed */
12#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
13#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
14
15#define MAP_SHARED 0x01 /* Share changes */
16#define MAP_PRIVATE 0x02 /* Changes are private */
17#define MAP_TYPE 0x0f /* Mask for type of mapping */
18#define MAP_FIXED 0x10 /* Interpret addr exactly */
19#define MAP_ANONYMOUS 0x20 /* don't use a file */
20#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ 9#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */
21#define MAP_NORESERVE 0x40 /* don't reserve swap pages */ 10#define MAP_NORESERVE 0x40 /* don't reserve swap pages */
22#define MAP_INHERIT 0x80 /* SunOS doesn't do this, but... */ 11#define MAP_INHERIT 0x80 /* SunOS doesn't do this, but... */
@@ -27,10 +16,6 @@
27#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 16#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
28#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 17#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
29 18
30#define MS_ASYNC 1 /* sync memory asynchronously */
31#define MS_INVALIDATE 2 /* invalidate the caches */
32#define MS_SYNC 4 /* synchronous memory sync */
33
34#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ 19#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
35#define MCL_FUTURE 0x4000 /* lock all additions to address space */ 20#define MCL_FUTURE 0x4000 /* lock all additions to address space */
36 21
@@ -48,16 +33,6 @@
48#define MC_LOCKAS 5 /* Lock an entire address space of the calling process */ 33#define MC_LOCKAS 5 /* Lock an entire address space of the calling process */
49#define MC_UNLOCKAS 6 /* Unlock entire address space of calling process */ 34#define MC_UNLOCKAS 6 /* Unlock entire address space of calling process */
50 35
51#define MADV_NORMAL 0x0 /* default page-in behavior */
52#define MADV_RANDOM 0x1 /* page-in minimum required */
53#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
54#define MADV_WILLNEED 0x3 /* pre-fault pages */
55#define MADV_DONTNEED 0x4 /* discard these pages */
56#define MADV_FREE 0x5 /* (Solaris) contents can be freed */ 36#define MADV_FREE 0x5 /* (Solaris) contents can be freed */
57#define MADV_REMOVE 0x6 /* remove these pages & resources */
58
59/* compatibility flags */
60#define MAP_ANON MAP_ANONYMOUS
61#define MAP_FILE 0
62 37
63#endif /* __SPARC64_MMAN_H__ */ 38#endif /* __SPARC64_MMAN_H__ */
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index c58ba8a096cf..a284986b1541 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -307,7 +307,7 @@
307#define __NR_mknodat 286 307#define __NR_mknodat 286
308#define __NR_fchownat 287 308#define __NR_fchownat 287
309#define __NR_futimesat 288 309#define __NR_futimesat 288
310#define __NR_newfstatat 289 310#define __NR_fstatat64 289
311#define __NR_unlinkat 290 311#define __NR_unlinkat 290
312#define __NR_renameat 291 312#define __NR_renameat 291
313#define __NR_linkat 292 313#define __NR_linkat 292
diff --git a/include/asm-v850/mman.h b/include/asm-v850/mman.h
index edc79965193a..edbf6edbfb37 100644
--- a/include/asm-v850/mman.h
+++ b/include/asm-v850/mman.h
@@ -1,18 +1,7 @@
1#ifndef __V850_MMAN_H__ 1#ifndef __V850_MMAN_H__
2#define __V850_MMAN_H__ 2#define __V850_MMAN_H__
3 3
4#define PROT_READ 0x1 /* page can be read */ 4#include <asm-generic/mman.h>
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_NONE 0x0 /* page can not be accessed */
8#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
9#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
10
11#define MAP_SHARED 0x01 /* Share changes */
12#define MAP_PRIVATE 0x02 /* Changes are private */
13#define MAP_TYPE 0x0f /* Mask for type of mapping */
14#define MAP_FIXED 0x10 /* Interpret addr exactly */
15#define MAP_ANONYMOUS 0x20 /* don't use a file */
16 5
17#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
18#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
@@ -20,22 +9,7 @@
20#define MAP_LOCKED 0x2000 /* pages are locked */ 9#define MAP_LOCKED 0x2000 /* pages are locked */
21#define MAP_NORESERVE 0x4000 /* don't check for reservations */ 10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
22 11
23#define MS_ASYNC 1 /* sync memory asynchronously */
24#define MS_INVALIDATE 2 /* invalidate the caches */
25#define MS_SYNC 4 /* synchronous memory sync */
26
27#define MCL_CURRENT 1 /* lock all current mappings */ 12#define MCL_CURRENT 1 /* lock all current mappings */
28#define MCL_FUTURE 2 /* lock all future mappings */ 13#define MCL_FUTURE 2 /* lock all future mappings */
29 14
30#define MADV_NORMAL 0x0 /* default page-in behavior */
31#define MADV_RANDOM 0x1 /* page-in minimum required */
32#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
33#define MADV_WILLNEED 0x3 /* pre-fault pages */
34#define MADV_DONTNEED 0x4 /* discard these pages */
35#define MADV_REMOVE 0x5 /* remove these pages & resources */
36
37/* compatibility flags */
38#define MAP_ANON MAP_ANONYMOUS
39#define MAP_FILE 0
40
41#endif /* __V850_MMAN_H__ */ 15#endif /* __V850_MMAN_H__ */
diff --git a/include/asm-x86_64/hpet.h b/include/asm-x86_64/hpet.h
index c20c28f5c7a0..08b75c15269a 100644
--- a/include/asm-x86_64/hpet.h
+++ b/include/asm-x86_64/hpet.h
@@ -55,6 +55,8 @@ extern int is_hpet_enabled(void);
55extern int hpet_rtc_timer_init(void); 55extern int hpet_rtc_timer_init(void);
56extern int oem_force_hpet_timer(void); 56extern int oem_force_hpet_timer(void);
57 57
58extern int hpet_use_timer;
59
58#ifdef CONFIG_HPET_EMULATE_RTC 60#ifdef CONFIG_HPET_EMULATE_RTC
59extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask); 61extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
60extern int hpet_set_rtc_irq_bit(unsigned long bit_mask); 62extern int hpet_set_rtc_irq_bit(unsigned long bit_mask);
diff --git a/include/asm-x86_64/ia32_unistd.h b/include/asm-x86_64/ia32_unistd.h
index 20468983d453..eeb2bcd635de 100644
--- a/include/asm-x86_64/ia32_unistd.h
+++ b/include/asm-x86_64/ia32_unistd.h
@@ -305,7 +305,7 @@
305#define __NR_ia32_mknodat 297 305#define __NR_ia32_mknodat 297
306#define __NR_ia32_fchownat 298 306#define __NR_ia32_fchownat 298
307#define __NR_ia32_futimesat 299 307#define __NR_ia32_futimesat 299
308#define __NR_ia32_newfstatat 300 308#define __NR_ia32_fstatat64 300
309#define __NR_ia32_unlinkat 301 309#define __NR_ia32_unlinkat 301
310#define __NR_ia32_renameat 302 310#define __NR_ia32_renameat 302
311#define __NR_ia32_linkat 303 311#define __NR_ia32_linkat 303
diff --git a/include/asm-x86_64/mman.h b/include/asm-x86_64/mman.h
index d0e97b74f735..dd5cb0534d37 100644
--- a/include/asm-x86_64/mman.h
+++ b/include/asm-x86_64/mman.h
@@ -1,19 +1,8 @@
1#ifndef __X8664_MMAN_H__ 1#ifndef __X8664_MMAN_H__
2#define __X8664_MMAN_H__ 2#define __X8664_MMAN_H__
3 3
4#define PROT_READ 0x1 /* page can be read */ 4#include <asm-generic/mman.h>
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_NONE 0x0 /* page can not be accessed */
8#define PROT_SEM 0x8
9#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
10#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
11 5
12#define MAP_SHARED 0x01 /* Share changes */
13#define MAP_PRIVATE 0x02 /* Changes are private */
14#define MAP_TYPE 0x0f /* Mask for type of mapping */
15#define MAP_FIXED 0x10 /* Interpret addr exactly */
16#define MAP_ANONYMOUS 0x20 /* don't use a file */
17#define MAP_32BIT 0x40 /* only give out 32bit addresses */ 6#define MAP_32BIT 0x40 /* only give out 32bit addresses */
18 7
19#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 8#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
@@ -24,22 +13,7 @@
24#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 13#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
25#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 14#define MAP_NONBLOCK 0x10000 /* do not block on IO */
26 15
27#define MS_ASYNC 1 /* sync memory asynchronously */
28#define MS_INVALIDATE 2 /* invalidate the caches */
29#define MS_SYNC 4 /* synchronous memory sync */
30
31#define MCL_CURRENT 1 /* lock all current mappings */ 16#define MCL_CURRENT 1 /* lock all current mappings */
32#define MCL_FUTURE 2 /* lock all future mappings */ 17#define MCL_FUTURE 2 /* lock all future mappings */
33 18
34#define MADV_NORMAL 0x0 /* default page-in behavior */
35#define MADV_RANDOM 0x1 /* page-in minimum required */
36#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
37#define MADV_WILLNEED 0x3 /* pre-fault pages */
38#define MADV_DONTNEED 0x4 /* discard these pages */
39#define MADV_REMOVE 0x5 /* remove these pages & resources */
40
41/* compatibility flags */
42#define MAP_ANON MAP_ANONYMOUS
43#define MAP_FILE 0
44
45#endif 19#endif
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index c99832e7bf3f..eca3f2d633db 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -133,6 +133,7 @@ extern int fix_aperture;
133extern int force_iommu; 133extern int force_iommu;
134 134
135extern int reboot_force; 135extern int reboot_force;
136extern int notsc_setup(char *);
136 137
137extern void smp_local_timer_interrupt(struct pt_regs * regs); 138extern void smp_local_timer_interrupt(struct pt_regs * regs);
138 139
diff --git a/include/asm-xtensa/mman.h b/include/asm-xtensa/mman.h
index 082a7504925e..ba394cbb4807 100644
--- a/include/asm-xtensa/mman.h
+++ b/include/asm-xtensa/mman.h
@@ -67,15 +67,19 @@
67#define MCL_CURRENT 1 /* lock all current mappings */ 67#define MCL_CURRENT 1 /* lock all current mappings */
68#define MCL_FUTURE 2 /* lock all future mappings */ 68#define MCL_FUTURE 2 /* lock all future mappings */
69 69
70#define MADV_NORMAL 0x0 /* default page-in behavior */ 70#define MADV_NORMAL 0 /* no further special treatment */
71#define MADV_RANDOM 0x1 /* page-in minimum required */ 71#define MADV_RANDOM 1 /* expect random page references */
72#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 72#define MADV_SEQUENTIAL 2 /* expect sequential page references */
73#define MADV_WILLNEED 0x3 /* pre-fault pages */ 73#define MADV_WILLNEED 3 /* will need these pages */
74#define MADV_DONTNEED 0x4 /* discard these pages */ 74#define MADV_DONTNEED 4 /* don't need these pages */
75#define MADV_REMOVE 0x5 /* remove these pages & resources */ 75
76/* common parameters: try to keep these consistent across architectures */
77#define MADV_REMOVE 9 /* remove these pages & resources */
78#define MADV_DONTFORK 10 /* don't inherit across fork */
79#define MADV_DOFORK 11 /* do inherit across fork */
76 80
77/* compatibility flags */ 81/* compatibility flags */
78#define MAP_ANON MAP_ANONYMOUS 82#define MAP_ANON MAP_ANONYMOUS
79#define MAP_FILE 0 83#define MAP_FILE 0
80 84
81#endif /* _XTENSA_MMAN_H */ 85#endif /* _XTENSA_MMAN_H */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 84d3d9f034ce..d3bc25e6d27d 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -427,7 +427,8 @@ extern int acpi_mp_config;
427extern struct acpi_table_mcfg_config *pci_mmcfg_config; 427extern struct acpi_table_mcfg_config *pci_mmcfg_config;
428extern int pci_mmcfg_config_num; 428extern int pci_mmcfg_config_num;
429 429
430extern int sbf_port ; 430extern int sbf_port;
431extern unsigned long acpi_video_flags;
431 432
432#else /* !CONFIG_ACPI */ 433#else /* !CONFIG_ACPI */
433 434
diff --git a/include/linux/compat.h b/include/linux/compat.h
index f9ca534787e2..c9ab2a26348c 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -161,5 +161,25 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from);
161int get_compat_sigevent(struct sigevent *event, 161int get_compat_sigevent(struct sigevent *event,
162 const struct compat_sigevent __user *u_event); 162 const struct compat_sigevent __user *u_event);
163 163
164static inline int compat_timeval_compare(struct compat_timeval *lhs,
165 struct compat_timeval *rhs)
166{
167 if (lhs->tv_sec < rhs->tv_sec)
168 return -1;
169 if (lhs->tv_sec > rhs->tv_sec)
170 return 1;
171 return lhs->tv_usec - rhs->tv_usec;
172}
173
174static inline int compat_timespec_compare(struct compat_timespec *lhs,
175 struct compat_timespec *rhs)
176{
177 if (lhs->tv_sec < rhs->tv_sec)
178 return -1;
179 if (lhs->tv_sec > rhs->tv_sec)
180 return 1;
181 return lhs->tv_nsec - rhs->tv_nsec;
182}
183
164#endif /* CONFIG_COMPAT */ 184#endif /* CONFIG_COMPAT */
165#endif /* _LINUX_COMPAT_H */ 185#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 20b446f26ecd..60e56c6e03dd 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -328,7 +328,7 @@ static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
328 * bitmap of size NR_CPUS. 328 * bitmap of size NR_CPUS.
329 * 329 *
330 * #ifdef CONFIG_HOTPLUG_CPU 330 * #ifdef CONFIG_HOTPLUG_CPU
331 * cpu_possible_map - all NR_CPUS bits set 331 * cpu_possible_map - has bit 'cpu' set iff cpu is populatable
332 * cpu_present_map - has bit 'cpu' set iff cpu is populated 332 * cpu_present_map - has bit 'cpu' set iff cpu is populated
333 * 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
334 * #else 334 * #else
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 0fe4aa891ddc..41ee79962bb2 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -498,12 +498,6 @@ struct transaction_s
498 struct journal_head *t_checkpoint_list; 498 struct journal_head *t_checkpoint_list;
499 499
500 /* 500 /*
501 * Doubly-linked circular list of all buffers submitted for IO while
502 * checkpointing. [j_list_lock]
503 */
504 struct journal_head *t_checkpoint_io_list;
505
506 /*
507 * Doubly-linked circular list of temporary buffers currently undergoing 501 * Doubly-linked circular list of temporary buffers currently undergoing
508 * IO in the log [j_list_lock] 502 * IO in the log [j_list_lock]
509 */ 503 */
@@ -852,7 +846,7 @@ extern void journal_commit_transaction(journal_t *);
852 846
853/* Checkpoint list management */ 847/* Checkpoint list management */
854int __journal_clean_checkpoint_list(journal_t *journal); 848int __journal_clean_checkpoint_list(journal_t *journal);
855int __journal_remove_checkpoint(struct journal_head *); 849void __journal_remove_checkpoint(struct journal_head *);
856void __journal_insert_checkpoint(struct journal_head *, transaction_t *); 850void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
857 851
858/* Buffer IO */ 852/* Buffer IO */
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/kernel.h b/include/linux/kernel.h
index b49affa0ac5a..3b507bf05d09 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -326,12 +326,6 @@ struct sysinfo {
326/* Force a compilation error if condition is true */ 326/* Force a compilation error if condition is true */
327#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 327#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
328 328
329#ifdef CONFIG_SYSCTL
330extern int randomize_va_space;
331#else
332#define randomize_va_space 1
333#endif
334
335/* Trap pasters of __FUNCTION__ at compile-time */ 329/* Trap pasters of __FUNCTION__ at compile-time */
336#define __FUNCTION__ (__func__) 330#define __FUNCTION__ (__func__)
337 331
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/kobject.h b/include/linux/kobject.h
index 2a8d8da70961..c374b5fa8d3b 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -41,8 +41,10 @@ enum kobject_action {
41 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */ 41 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */
42 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */ 42 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */
43 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */ 43 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */
44 KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */ 44 KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices (broken) */
45 KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */ 45 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */
46 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */
47 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */
46}; 48};
47 49
48struct kobject { 50struct kobject {
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 6aca67a569a2..f3dec45ef874 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -96,10 +96,16 @@ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
96 ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; }) 96 ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
97 97
98/* convert a timespec to ktime_t format: */ 98/* convert a timespec to ktime_t format: */
99#define timespec_to_ktime(ts) ktime_set((ts).tv_sec, (ts).tv_nsec) 99static inline ktime_t timespec_to_ktime(struct timespec ts)
100{
101 return ktime_set(ts.tv_sec, ts.tv_nsec);
102}
100 103
101/* convert a timeval to ktime_t format: */ 104/* convert a timeval to ktime_t format: */
102#define timeval_to_ktime(tv) ktime_set((tv).tv_sec, (tv).tv_usec * 1000) 105static inline ktime_t timeval_to_ktime(struct timeval tv)
106{
107 return ktime_set(tv.tv_sec, tv.tv_usec * NSEC_PER_USEC);
108}
103 109
104/* Map the ktime_t to timespec conversion to ns_to_timespec function */ 110/* Map the ktime_t to timespec conversion to ns_to_timespec function */
105#define ktime_to_timespec(kt) ns_to_timespec((kt).tv64) 111#define ktime_to_timespec(kt) ns_to_timespec((kt).tv64)
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 9e5db2949c58..c91be5e64ede 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -557,17 +557,29 @@ ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc)
557} 557}
558 558
559static inline struct scatterlist * 559static inline struct scatterlist *
560ata_qc_first_sg(struct ata_queued_cmd *qc)
561{
562 if (qc->n_elem)
563 return qc->__sg;
564 if (qc->pad_len)
565 return &qc->pad_sgent;
566 return NULL;
567}
568
569static inline struct scatterlist *
560ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc) 570ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
561{ 571{
562 if (sg == &qc->pad_sgent) 572 if (sg == &qc->pad_sgent)
563 return NULL; 573 return NULL;
564 if (++sg - qc->__sg < qc->n_elem) 574 if (++sg - qc->__sg < qc->n_elem)
565 return sg; 575 return sg;
566 return qc->pad_len ? &qc->pad_sgent : NULL; 576 if (qc->pad_len)
577 return &qc->pad_sgent;
578 return NULL;
567} 579}
568 580
569#define ata_for_each_sg(sg, qc) \ 581#define ata_for_each_sg(sg, qc) \
570 for (sg = qc->__sg; sg; sg = ata_qc_next_sg(sg, qc)) 582 for (sg = ata_qc_first_sg(qc); sg; sg = ata_qc_next_sg(sg, qc))
571 583
572static inline unsigned int ata_tag_valid(unsigned int tag) 584static inline unsigned int ata_tag_valid(unsigned int tag)
573{ 585{
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 920766cea79c..ef21ed296039 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -149,7 +149,7 @@ struct nlm_rqst * nlmclnt_alloc_call(void);
149int nlmclnt_prepare_block(struct nlm_rqst *req, struct nlm_host *host, struct file_lock *fl); 149int nlmclnt_prepare_block(struct nlm_rqst *req, struct nlm_host *host, struct file_lock *fl);
150void nlmclnt_finish_block(struct nlm_rqst *req); 150void nlmclnt_finish_block(struct nlm_rqst *req);
151long nlmclnt_block(struct nlm_rqst *req, long timeout); 151long nlmclnt_block(struct nlm_rqst *req, long timeout);
152u32 nlmclnt_grant(struct nlm_lock *); 152u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *);
153void nlmclnt_recovery(struct nlm_host *, u32); 153void nlmclnt_recovery(struct nlm_host *, u32);
154int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 154int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
155int nlmclnt_setgrantargs(struct nlm_rqst *, struct nlm_lock *); 155int nlmclnt_setgrantargs(struct nlm_rqst *, struct nlm_lock *);
@@ -204,7 +204,7 @@ nlmsvc_file_inode(struct nlm_file *file)
204 * Compare two host addresses (needs modifying for ipv6) 204 * Compare two host addresses (needs modifying for ipv6)
205 */ 205 */
206static __inline__ int 206static __inline__ int
207nlm_cmp_addr(struct sockaddr_in *sin1, struct sockaddr_in *sin2) 207nlm_cmp_addr(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
208{ 208{
209 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; 209 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
210} 210}
@@ -214,7 +214,7 @@ nlm_cmp_addr(struct sockaddr_in *sin1, struct sockaddr_in *sin2)
214 * When the second lock is of type F_UNLCK, this acts like a wildcard. 214 * When the second lock is of type F_UNLCK, this acts like a wildcard.
215 */ 215 */
216static __inline__ int 216static __inline__ int
217nlm_compare_locks(struct file_lock *fl1, struct file_lock *fl2) 217nlm_compare_locks(const struct file_lock *fl1, const struct file_lock *fl2)
218{ 218{
219 return fl1->fl_pid == fl2->fl_pid 219 return fl1->fl_pid == fl2->fl_pid
220 && fl1->fl_start == fl2->fl_start 220 && fl1->fl_start == fl2->fl_start
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 75e9f0724997..498ff8778fb6 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1051,5 +1051,11 @@ int shrink_slab(unsigned long scanned, gfp_t gfp_mask,
1051void drop_pagecache(void); 1051void drop_pagecache(void);
1052void drop_slab(void); 1052void drop_slab(void);
1053 1053
1054#ifndef CONFIG_MMU
1055#define randomize_va_space 0
1056#else
1057extern int randomize_va_space;
1058#endif
1059
1054#endif /* __KERNEL__ */ 1060#endif /* __KERNEL__ */
1055#endif /* _LINUX_MM_H */ 1061#endif /* _LINUX_MM_H */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index f38872abc126..bdc556d88498 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -49,7 +49,7 @@ struct mmc_command {
49/* 49/*
50 * These are the command types. 50 * These are the command types.
51 */ 51 */
52#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_TYPE) 52#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK)
53 53
54 unsigned int retries; /* max number of retries */ 54 unsigned int retries; /* max number of retries */
55 unsigned int error; /* command error */ 55 unsigned int error; /* command error */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 4cf6088625c1..468896939843 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -184,8 +184,11 @@ static inline int nf_hook_thresh(int pf, unsigned int hook,
184 struct sk_buff **pskb, 184 struct sk_buff **pskb,
185 struct net_device *indev, 185 struct net_device *indev,
186 struct net_device *outdev, 186 struct net_device *outdev,
187 int (*okfn)(struct sk_buff *), int thresh) 187 int (*okfn)(struct sk_buff *), int thresh,
188 int cond)
188{ 189{
190 if (!cond)
191 return 1;
189#ifndef CONFIG_NETFILTER_DEBUG 192#ifndef CONFIG_NETFILTER_DEBUG
190 if (list_empty(&nf_hooks[pf][hook])) 193 if (list_empty(&nf_hooks[pf][hook]))
191 return 1; 194 return 1;
@@ -197,7 +200,7 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
197 struct net_device *indev, struct net_device *outdev, 200 struct net_device *indev, struct net_device *outdev,
198 int (*okfn)(struct sk_buff *)) 201 int (*okfn)(struct sk_buff *))
199{ 202{
200 return nf_hook_thresh(pf, hook, pskb, indev, outdev, okfn, INT_MIN); 203 return nf_hook_thresh(pf, hook, pskb, indev, outdev, okfn, INT_MIN, 1);
201} 204}
202 205
203/* Activate hook; either okfn or kfree_skb called, unless a hook 206/* Activate hook; either okfn or kfree_skb called, unless a hook
@@ -224,7 +227,13 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
224 227
225#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ 228#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \
226({int __ret; \ 229({int __ret; \
227if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1)\ 230if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, thresh, 1)) == 1)\
231 __ret = (okfn)(skb); \
232__ret;})
233
234#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) \
235({int __ret; \
236if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, INT_MIN, cond)) == 1)\
228 __ret = (okfn)(skb); \ 237 __ret = (okfn)(skb); \
229__ret;}) 238__ret;})
230 239
@@ -295,11 +304,13 @@ extern struct proc_dir_entry *proc_net_netfilter;
295 304
296#else /* !CONFIG_NETFILTER */ 305#else /* !CONFIG_NETFILTER */
297#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 306#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
307#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb)
298static inline int nf_hook_thresh(int pf, unsigned int hook, 308static inline int nf_hook_thresh(int pf, unsigned int hook,
299 struct sk_buff **pskb, 309 struct sk_buff **pskb,
300 struct net_device *indev, 310 struct net_device *indev,
301 struct net_device *outdev, 311 struct net_device *outdev,
302 int (*okfn)(struct sk_buff *), int thresh) 312 int (*okfn)(struct sk_buff *), int thresh,
313 int cond)
303{ 314{
304 return okfn(*pskb); 315 return okfn(*pskb);
305} 316}
@@ -307,7 +318,7 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
307 struct net_device *indev, struct net_device *outdev, 318 struct net_device *indev, struct net_device *outdev,
308 int (*okfn)(struct sk_buff *)) 319 int (*okfn)(struct sk_buff *))
309{ 320{
310 return okfn(*pskb); 321 return 1;
311} 322}
312static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 323static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
313struct flowi; 324struct flowi;
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index fdc4a9527343..43c09d790b83 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -79,7 +79,7 @@ enum nf_ip_hook_priorities {
79 79
80#ifdef __KERNEL__ 80#ifdef __KERNEL__
81extern int ip_route_me_harder(struct sk_buff **pskb); 81extern int ip_route_me_harder(struct sk_buff **pskb);
82 82extern int ip_xfrm_me_harder(struct sk_buff **pskb);
83#endif /*__KERNEL__*/ 83#endif /*__KERNEL__*/
84 84
85#endif /*__LINUX_IP_NETFILTER_H*/ 85#endif /*__LINUX_IP_NETFILTER_H*/
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/nfs_fs.h b/include/linux/nfs_fs.h
index 547d649b274e..b4dc6e2e10c9 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -398,7 +398,7 @@ extern struct inode_operations nfs_symlink_inode_operations;
398extern int nfs_register_sysctl(void); 398extern int nfs_register_sysctl(void);
399extern void nfs_unregister_sysctl(void); 399extern void nfs_unregister_sysctl(void);
400#else 400#else
401#define nfs_register_sysctl() do { } while(0) 401#define nfs_register_sysctl() 0
402#define nfs_unregister_sysctl() do { } while(0) 402#define nfs_unregister_sysctl() do { } while(0)
403#endif 403#endif
404 404
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7a61ccdcbc4b..82b83da25d77 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1087,6 +1087,7 @@
1087#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_8X 0x0181 1087#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_8X 0x0181
1088#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440SE_8X 0x0182 1088#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440SE_8X 0x0182
1089#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420_8X 0x0183 1089#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420_8X 0x0183
1090#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_4000 0x0185
1090#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_448_GO 0x0186 1091#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_448_GO 0x0186
1091#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_488_GO 0x0187 1092#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_488_GO 0x0187
1092#define PCI_DEVICE_ID_NVIDIA_QUADRO4_580_XGL 0x0188 1093#define PCI_DEVICE_ID_NVIDIA_QUADRO4_580_XGL 0x0188
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 9d5cd106b344..0d36750fc0f1 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -84,6 +84,7 @@ extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __us
84extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 84extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
85extern int ptrace_attach(struct task_struct *tsk); 85extern int ptrace_attach(struct task_struct *tsk);
86extern int ptrace_detach(struct task_struct *, unsigned int); 86extern int ptrace_detach(struct task_struct *, unsigned int);
87extern void __ptrace_detach(struct task_struct *, unsigned int);
87extern void ptrace_disable(struct task_struct *); 88extern void ptrace_disable(struct task_struct *);
88extern int ptrace_check_attach(struct task_struct *task, int kill); 89extern int ptrace_check_attach(struct task_struct *task, int kill);
89extern int ptrace_request(struct task_struct *child, long request, long addr, long data); 90extern int ptrace_request(struct task_struct *child, long request, long addr, long data);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9c1da0269a18..b6f51e3a38ec 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -697,12 +697,9 @@ struct task_struct {
697 697
698 int lock_depth; /* BKL lock depth */ 698 int lock_depth; /* BKL lock depth */
699 699
700#if defined(CONFIG_SMP) 700#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
701 int last_waker_cpu; /* CPU that last woke this task up */
702#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
703 int oncpu; 701 int oncpu;
704#endif 702#endif
705#endif
706 int prio, static_prio; 703 int prio, static_prio;
707 struct list_head run_list; 704 struct list_head run_list;
708 prio_array_t *array; 705 prio_array_t *array;
diff --git a/include/linux/swap.h b/include/linux/swap.h
index f3e17d5963c3..d572b19afb7d 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -147,7 +147,7 @@ struct swap_list_t {
147#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) 147#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
148 148
149/* linux/mm/oom_kill.c */ 149/* linux/mm/oom_kill.c */
150extern void out_of_memory(gfp_t gfp_mask, int order); 150extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
151 151
152/* linux/mm/memory.c */ 152/* linux/mm/memory.c */
153extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); 153extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 3877209d23c3..d73501ba7e44 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -557,6 +557,8 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
557 int mode); 557 int mode);
558asmlinkage long sys_newfstatat(int dfd, char __user *filename, 558asmlinkage long sys_newfstatat(int dfd, char __user *filename,
559 struct stat __user *statbuf, int flag); 559 struct stat __user *statbuf, int flag);
560asmlinkage long sys_fstatat64(int dfd, char __user *filename,
561 struct stat64 __user *statbuf, int flag);
560asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf, 562asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf,
561 int bufsiz); 563 int bufsiz);
562asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, 564asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename,
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 32a4139c4ad8..0e92bf7ec28e 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -146,6 +146,7 @@ enum
146 KERN_RANDOMIZE=68, /* int: randomize virtual address space */ 146 KERN_RANDOMIZE=68, /* int: randomize virtual address space */
147 KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */ 147 KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
148 KERN_SPIN_RETRY=70, /* int: number of spinlock retries */ 148 KERN_SPIN_RETRY=70, /* int: number of spinlock retries */
149 KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
149}; 150};
150 151
151 152
diff --git a/include/linux/time.h b/include/linux/time.h
index 7b4dc36532bb..d9cdba54b789 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -33,11 +33,34 @@ struct timezone {
33#define NSEC_PER_SEC 1000000000L 33#define NSEC_PER_SEC 1000000000L
34#define NSEC_PER_USEC 1000L 34#define NSEC_PER_USEC 1000L
35 35
36static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) 36static inline int timespec_equal(struct timespec *a, struct timespec *b)
37{ 37{
38 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); 38 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
39} 39}
40 40
41/*
42 * lhs < rhs: return <0
43 * lhs == rhs: return 0
44 * lhs > rhs: return >0
45 */
46static inline int timespec_compare(struct timespec *lhs, struct timespec *rhs)
47{
48 if (lhs->tv_sec < rhs->tv_sec)
49 return -1;
50 if (lhs->tv_sec > rhs->tv_sec)
51 return 1;
52 return lhs->tv_nsec - rhs->tv_nsec;
53}
54
55static inline int timeval_compare(struct timeval *lhs, struct timeval *rhs)
56{
57 if (lhs->tv_sec < rhs->tv_sec)
58 return -1;
59 if (lhs->tv_sec > rhs->tv_sec)
60 return 1;
61 return lhs->tv_usec - rhs->tv_usec;
62}
63
41extern unsigned long mktime(const unsigned int year, const unsigned int mon, 64extern unsigned long mktime(const unsigned int year, const unsigned int mon,
42 const unsigned int day, const unsigned int hour, 65 const unsigned int day, const unsigned int hour,
43 const unsigned int min, const unsigned int sec); 66 const unsigned int min, const unsigned int sec);
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 04a4a8cb4ed3..b7ca1204e42a 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -345,6 +345,9 @@ time_interpolator_reset(void)
345 345
346#endif /* !CONFIG_TIME_INTERPOLATION */ 346#endif /* !CONFIG_TIME_INTERPOLATION */
347 347
348/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
349extern u64 current_tick_length(void);
350
348#endif /* KERNEL */ 351#endif /* KERNEL */
349 352
350#endif /* LINUX_TIMEX_H */ 353#endif /* LINUX_TIMEX_H */
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/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index bbfac86734ec..89d743cfdfdf 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -33,7 +33,7 @@
33#define RFCOMM_DEFAULT_MTU 127 33#define RFCOMM_DEFAULT_MTU 127
34#define RFCOMM_DEFAULT_CREDITS 7 34#define RFCOMM_DEFAULT_CREDITS 7
35 35
36#define RFCOMM_MAX_L2CAP_MTU 1024 36#define RFCOMM_MAX_L2CAP_MTU 1013
37#define RFCOMM_MAX_CREDITS 40 37#define RFCOMM_MAX_CREDITS 40
38 38
39#define RFCOMM_SKB_HEAD_RESERVE 8 39#define RFCOMM_SKB_HEAD_RESERVE 8
diff --git a/include/net/ip.h b/include/net/ip.h
index 8de0697b364c..fab3d5b3ab1c 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -41,6 +41,7 @@ struct inet_skb_parm
41#define IPSKB_XFRM_TUNNEL_SIZE 2 41#define IPSKB_XFRM_TUNNEL_SIZE 2
42#define IPSKB_XFRM_TRANSFORMED 4 42#define IPSKB_XFRM_TRANSFORMED 4
43#define IPSKB_FRAG_COMPLETE 8 43#define IPSKB_FRAG_COMPLETE 8
44#define IPSKB_REROUTED 16
44}; 45};
45 46
46struct ipcm_cookie 47struct ipcm_cookie
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index 05a840837fe7..1880e46ecc9b 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -82,9 +82,9 @@ do { if(!(expr)) { \
82#define IRDA_ASSERT_LABEL(label) 82#define IRDA_ASSERT_LABEL(label)
83#endif /* CONFIG_IRDA_DEBUG */ 83#endif /* CONFIG_IRDA_DEBUG */
84 84
85#define IRDA_WARNING(args...) printk(KERN_WARNING args) 85#define IRDA_WARNING(args...) do { if (net_ratelimit()) printk(KERN_WARNING args); } while (0)
86#define IRDA_MESSAGE(args...) printk(KERN_INFO args) 86#define IRDA_MESSAGE(args...) do { if (net_ratelimit()) printk(KERN_INFO args); } while (0)
87#define IRDA_ERROR(args...) printk(KERN_ERR args) 87#define IRDA_ERROR(args...) do { if (net_ratelimit()) printk(KERN_ERR args); } while (0)
88 88
89/* 89/*
90 * Magic numbers used by Linux-IrDA. Random numbers which must be unique to 90 * Magic numbers used by Linux-IrDA. Random numbers which must be unique to
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/include/net/xfrm.h b/include/net/xfrm.h
index d09ca0e7d139..d6111a2f0a23 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -866,7 +866,6 @@ extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
866extern int xfrm_init_state(struct xfrm_state *x); 866extern int xfrm_init_state(struct xfrm_state *x);
867extern int xfrm4_rcv(struct sk_buff *skb); 867extern int xfrm4_rcv(struct sk_buff *skb);
868extern int xfrm4_output(struct sk_buff *skb); 868extern int xfrm4_output(struct sk_buff *skb);
869extern int xfrm4_output_finish(struct sk_buff *skb);
870extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); 869extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
871extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); 870extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
872extern int xfrm6_rcv_spi(struct sk_buff **pskb, u32 spi); 871extern int xfrm6_rcv_spi(struct sk_buff **pskb, u32 spi);
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 3e5cb5ab2d34..e5618b90996e 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -163,9 +163,6 @@ enum iscsi_param {
163}; 163};
164#define ISCSI_PARAM_MAX 14 164#define ISCSI_PARAM_MAX 14
165 165
166typedef uint64_t iscsi_sessionh_t; /* iSCSI Data-Path session handle */
167typedef uint64_t iscsi_connh_t; /* iSCSI Data-Path connection handle */
168
169#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) 166#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
170#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) 167#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
171#define hostdata_session(_hostdata) (iscsi_ptr(*(unsigned long *)_hostdata)) 168#define hostdata_session(_hostdata) (iscsi_ptr(*(unsigned long *)_hostdata))
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index c60b8ff2f5e4..9c331258bc27 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -433,4 +433,6 @@ struct scsi_lun {
433/* Used to obtain the PCI location of a device */ 433/* Used to obtain the PCI location of a device */
434#define SCSI_IOCTL_GET_PCI 0x5387 434#define SCSI_IOCTL_GET_PCI 0x5387
435 435
436int scsi_execute_in_process_context(void (*fn)(void *data), void *data);
437
436#endif /* _SCSI_SCSI_H */ 438#endif /* _SCSI_SCSI_H */
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 16602a547a63..b41cf077e54b 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -63,25 +63,28 @@ struct iscsi_transport {
63 int max_lun; 63 int max_lun;
64 unsigned int max_conn; 64 unsigned int max_conn;
65 unsigned int max_cmd_len; 65 unsigned int max_cmd_len;
66 struct Scsi_Host *(*create_session) (struct scsi_transport_template *t, 66 struct iscsi_cls_session *(*create_session)
67 uint32_t initial_cmdsn); 67 (struct scsi_transport_template *t, uint32_t sn, uint32_t *sid);
68 void (*destroy_session) (struct Scsi_Host *shost); 68 void (*destroy_session) (struct iscsi_cls_session *session);
69 struct iscsi_cls_conn *(*create_conn) (struct Scsi_Host *shost, 69 struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess,
70 uint32_t cid); 70 uint32_t cid);
71 int (*bind_conn) (iscsi_sessionh_t session, iscsi_connh_t conn, 71 int (*bind_conn) (struct iscsi_cls_session *session,
72 struct iscsi_cls_conn *cls_conn,
72 uint32_t transport_fd, int is_leading); 73 uint32_t transport_fd, int is_leading);
73 int (*start_conn) (iscsi_connh_t conn); 74 int (*start_conn) (struct iscsi_cls_conn *conn);
74 void (*stop_conn) (iscsi_connh_t conn, int flag); 75 void (*stop_conn) (struct iscsi_cls_conn *conn, int flag);
75 void (*destroy_conn) (struct iscsi_cls_conn *conn); 76 void (*destroy_conn) (struct iscsi_cls_conn *conn);
76 int (*set_param) (iscsi_connh_t conn, enum iscsi_param param, 77 int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param,
77 uint32_t value); 78 uint32_t value);
78 int (*get_conn_param) (void *conndata, enum iscsi_param param, 79 int (*get_conn_param) (struct iscsi_cls_conn *conn,
80 enum iscsi_param param,
79 uint32_t *value); 81 uint32_t *value);
80 int (*get_session_param) (struct Scsi_Host *shost, 82 int (*get_session_param) (struct iscsi_cls_session *session,
81 enum iscsi_param param, uint32_t *value); 83 enum iscsi_param param, uint32_t *value);
82 int (*send_pdu) (iscsi_connh_t conn, struct iscsi_hdr *hdr, 84 int (*send_pdu) (struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
83 char *data, uint32_t data_size); 85 char *data, uint32_t data_size);
84 void (*get_stats) (iscsi_connh_t conn, struct iscsi_stats *stats); 86 void (*get_stats) (struct iscsi_cls_conn *conn,
87 struct iscsi_stats *stats);
85}; 88};
86 89
87/* 90/*
@@ -93,15 +96,14 @@ extern int iscsi_unregister_transport(struct iscsi_transport *tt);
93/* 96/*
94 * control plane upcalls 97 * control plane upcalls
95 */ 98 */
96extern void iscsi_conn_error(iscsi_connh_t conn, enum iscsi_err error); 99extern void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error);
97extern int iscsi_recv_pdu(iscsi_connh_t conn, struct iscsi_hdr *hdr, 100extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
98 char *data, uint32_t data_size); 101 char *data, uint32_t data_size);
99 102
100struct iscsi_cls_conn { 103struct iscsi_cls_conn {
101 struct list_head conn_list; /* item in connlist */ 104 struct list_head conn_list; /* item in connlist */
102 void *dd_data; /* LLD private data */ 105 void *dd_data; /* LLD private data */
103 struct iscsi_transport *transport; 106 struct iscsi_transport *transport;
104 iscsi_connh_t connh;
105 int active; /* must be accessed with the connlock */ 107 int active; /* must be accessed with the connlock */
106 struct device dev; /* sysfs transport/container device */ 108 struct device dev; /* sysfs transport/container device */
107 struct mempool_zone *z_error; 109 struct mempool_zone *z_error;
@@ -113,7 +115,7 @@ struct iscsi_cls_conn {
113 container_of(_dev, struct iscsi_cls_conn, dev) 115 container_of(_dev, struct iscsi_cls_conn, dev)
114 116
115struct iscsi_cls_session { 117struct iscsi_cls_session {
116 struct list_head list; /* item in session_list */ 118 struct list_head sess_list; /* item in session_list */
117 struct iscsi_transport *transport; 119 struct iscsi_transport *transport;
118 struct device dev; /* sysfs transport/container device */ 120 struct device dev; /* sysfs transport/container device */
119}; 121};
diff --git a/include/video/neomagic.h b/include/video/neomagic.h
index 1d69049bd4c1..78b1f15a538f 100644
--- a/include/video/neomagic.h
+++ b/include/video/neomagic.h
@@ -159,6 +159,7 @@ struct neofb_par {
159 unsigned char PanelDispCntlReg1; 159 unsigned char PanelDispCntlReg1;
160 unsigned char PanelDispCntlReg2; 160 unsigned char PanelDispCntlReg2;
161 unsigned char PanelDispCntlReg3; 161 unsigned char PanelDispCntlReg3;
162 unsigned char PanelDispCntlRegRead;
162 unsigned char PanelVertCenterReg1; 163 unsigned char PanelVertCenterReg1;
163 unsigned char PanelVertCenterReg2; 164 unsigned char PanelVertCenterReg2;
164 unsigned char PanelVertCenterReg3; 165 unsigned char PanelVertCenterReg3;
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/auditsc.c b/kernel/auditsc.c
index 3e376202dd48..c4394abcd5e6 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -841,7 +841,7 @@ static void audit_log_exit(struct audit_context *context, gfp_t gfp_mask)
841 841
842 for (aux = context->aux; aux; aux = aux->next) { 842 for (aux = context->aux; aux; aux = aux->next) {
843 843
844 ab = audit_log_start(context, GFP_KERNEL, aux->type); 844 ab = audit_log_start(context, gfp_mask, aux->type);
845 if (!ab) 845 if (!ab)
846 continue; /* audit_panic has been called */ 846 continue; /* audit_panic has been called */
847 847
@@ -878,14 +878,14 @@ static void audit_log_exit(struct audit_context *context, gfp_t gfp_mask)
878 } 878 }
879 879
880 if (context->pwd && context->pwdmnt) { 880 if (context->pwd && context->pwdmnt) {
881 ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD); 881 ab = audit_log_start(context, gfp_mask, AUDIT_CWD);
882 if (ab) { 882 if (ab) {
883 audit_log_d_path(ab, "cwd=", context->pwd, context->pwdmnt); 883 audit_log_d_path(ab, "cwd=", context->pwd, context->pwdmnt);
884 audit_log_end(ab); 884 audit_log_end(ab);
885 } 885 }
886 } 886 }
887 for (i = 0; i < context->name_count; i++) { 887 for (i = 0; i < context->name_count; i++) {
888 ab = audit_log_start(context, GFP_KERNEL, AUDIT_PATH); 888 ab = audit_log_start(context, gfp_mask, AUDIT_PATH);
889 if (!ab) 889 if (!ab)
890 continue; /* audit_panic has been called */ 890 continue; /* audit_panic has been called */
891 891
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index ba42b0a76961..12815d3f1a05 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1977,6 +1977,39 @@ void cpuset_fork(struct task_struct *child)
1977 * We don't need to task_lock() this reference to tsk->cpuset, 1977 * We don't need to task_lock() this reference to tsk->cpuset,
1978 * because tsk is already marked PF_EXITING, so attach_task() won't 1978 * because tsk is already marked PF_EXITING, so attach_task() won't
1979 * mess with it, or task is a failed fork, never visible to attach_task. 1979 * mess with it, or task is a failed fork, never visible to attach_task.
1980 *
1981 * Hack:
1982 *
1983 * Set the exiting tasks cpuset to the root cpuset (top_cpuset).
1984 *
1985 * Don't leave a task unable to allocate memory, as that is an
1986 * accident waiting to happen should someone add a callout in
1987 * do_exit() after the cpuset_exit() call that might allocate.
1988 * If a task tries to allocate memory with an invalid cpuset,
1989 * it will oops in cpuset_update_task_memory_state().
1990 *
1991 * We call cpuset_exit() while the task is still competent to
1992 * handle notify_on_release(), then leave the task attached to
1993 * the root cpuset (top_cpuset) for the remainder of its exit.
1994 *
1995 * To do this properly, we would increment the reference count on
1996 * top_cpuset, and near the very end of the kernel/exit.c do_exit()
1997 * code we would add a second cpuset function call, to drop that
1998 * reference. This would just create an unnecessary hot spot on
1999 * the top_cpuset reference count, to no avail.
2000 *
2001 * Normally, holding a reference to a cpuset without bumping its
2002 * count is unsafe. The cpuset could go away, or someone could
2003 * attach us to a different cpuset, decrementing the count on
2004 * the first cpuset that we never incremented. But in this case,
2005 * top_cpuset isn't going away, and either task has PF_EXITING set,
2006 * which wards off any attach_task() attempts, or task is a failed
2007 * fork, never visible to attach_task.
2008 *
2009 * Another way to do this would be to set the cpuset pointer
2010 * to NULL here, and check in cpuset_update_task_memory_state()
2011 * for a NULL pointer. This hack avoids that NULL check, for no
2012 * cost (other than this way too long comment ;).
1980 **/ 2013 **/
1981 2014
1982void cpuset_exit(struct task_struct *tsk) 2015void cpuset_exit(struct task_struct *tsk)
@@ -1984,7 +2017,7 @@ void cpuset_exit(struct task_struct *tsk)
1984 struct cpuset *cs; 2017 struct cpuset *cs;
1985 2018
1986 cs = tsk->cpuset; 2019 cs = tsk->cpuset;
1987 tsk->cpuset = NULL; 2020 tsk->cpuset = &top_cpuset; /* Hack - see comment above */
1988 2021
1989 if (notify_on_release(cs)) { 2022 if (notify_on_release(cs)) {
1990 char *pathbuf = NULL; 2023 char *pathbuf = NULL;
diff --git a/kernel/exit.c b/kernel/exit.c
index 93cee3671332..531aadca5530 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -360,6 +360,9 @@ void daemonize(const char *name, ...)
360 fs = init_task.fs; 360 fs = init_task.fs;
361 current->fs = fs; 361 current->fs = fs;
362 atomic_inc(&fs->count); 362 atomic_inc(&fs->count);
363 exit_namespace(current);
364 current->namespace = init_task.namespace;
365 get_namespace(current->namespace);
363 exit_files(current); 366 exit_files(current);
364 current->files = init_task.files; 367 current->files = init_task.files;
365 atomic_inc(&current->files->count); 368 atomic_inc(&current->files->count);
diff --git a/kernel/fork.c b/kernel/fork.c
index 8e88b374cee9..fbea12d7a943 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1123,8 +1123,8 @@ static task_t *copy_process(unsigned long clone_flags,
1123 p->real_parent = current; 1123 p->real_parent = current;
1124 p->parent = p->real_parent; 1124 p->parent = p->real_parent;
1125 1125
1126 spin_lock(&current->sighand->siglock);
1126 if (clone_flags & CLONE_THREAD) { 1127 if (clone_flags & CLONE_THREAD) {
1127 spin_lock(&current->sighand->siglock);
1128 /* 1128 /*
1129 * Important: if an exit-all has been started then 1129 * Important: if an exit-all has been started then
1130 * do not create this new thread - the whole thread 1130 * do not create this new thread - the whole thread
@@ -1162,8 +1162,6 @@ static task_t *copy_process(unsigned long clone_flags,
1162 */ 1162 */
1163 p->it_prof_expires = jiffies_to_cputime(1); 1163 p->it_prof_expires = jiffies_to_cputime(1);
1164 } 1164 }
1165
1166 spin_unlock(&current->sighand->siglock);
1167 } 1165 }
1168 1166
1169 /* 1167 /*
@@ -1175,8 +1173,6 @@ static task_t *copy_process(unsigned long clone_flags,
1175 if (unlikely(p->ptrace & PT_PTRACED)) 1173 if (unlikely(p->ptrace & PT_PTRACED))
1176 __ptrace_link(p, current->parent); 1174 __ptrace_link(p, current->parent);
1177 1175
1178 attach_pid(p, PIDTYPE_PID, p->pid);
1179 attach_pid(p, PIDTYPE_TGID, p->tgid);
1180 if (thread_group_leader(p)) { 1176 if (thread_group_leader(p)) {
1181 p->signal->tty = current->signal->tty; 1177 p->signal->tty = current->signal->tty;
1182 p->signal->pgrp = process_group(current); 1178 p->signal->pgrp = process_group(current);
@@ -1186,9 +1182,12 @@ static task_t *copy_process(unsigned long clone_flags,
1186 if (p->pid) 1182 if (p->pid)
1187 __get_cpu_var(process_counts)++; 1183 __get_cpu_var(process_counts)++;
1188 } 1184 }
1185 attach_pid(p, PIDTYPE_TGID, p->tgid);
1186 attach_pid(p, PIDTYPE_PID, p->pid);
1189 1187
1190 nr_threads++; 1188 nr_threads++;
1191 total_forks++; 1189 total_forks++;
1190 spin_unlock(&current->sighand->siglock);
1192 write_unlock_irq(&tasklist_lock); 1191 write_unlock_irq(&tasklist_lock);
1193 proc_fork_connector(p); 1192 proc_fork_connector(p);
1194 return p; 1193 return p;
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 2b6e1757aedd..5ae51f1bc7c8 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -418,8 +418,19 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
418 /* Switch the timer base, if necessary: */ 418 /* Switch the timer base, if necessary: */
419 new_base = switch_hrtimer_base(timer, base); 419 new_base = switch_hrtimer_base(timer, base);
420 420
421 if (mode == HRTIMER_REL) 421 if (mode == HRTIMER_REL) {
422 tim = ktime_add(tim, new_base->get_time()); 422 tim = ktime_add(tim, new_base->get_time());
423 /*
424 * CONFIG_TIME_LOW_RES is a temporary way for architectures
425 * to signal that they simply return xtime in
426 * do_gettimeoffset(). In this case we want to round up by
427 * resolution when starting a relative timer, to avoid short
428 * timeouts. This will go away with the GTOD framework.
429 */
430#ifdef CONFIG_TIME_LOW_RES
431 tim = ktime_add(tim, base->resolution);
432#endif
433 }
423 timer->expires = tim; 434 timer->expires = tim;
424 435
425 enqueue_hrtimer(timer, new_base); 436 enqueue_hrtimer(timer, new_base);
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/snapshot.c b/kernel/power/snapshot.c
index 41f66365f0d8..8d5a5986d621 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -91,10 +91,8 @@ static int save_highmem_zone(struct zone *zone)
91 * corrected eventually when the cases giving rise to this 91 * corrected eventually when the cases giving rise to this
92 * are better understood. 92 * are better understood.
93 */ 93 */
94 if (PageReserved(page)) { 94 if (PageReserved(page))
95 printk("highmem reserved page?!\n");
96 continue; 95 continue;
97 }
98 BUG_ON(PageNosave(page)); 96 BUG_ON(PageNosave(page));
99 if (PageNosaveFree(page)) 97 if (PageNosaveFree(page))
100 continue; 98 continue;
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 4e90905f0e87..2d9d08f72f76 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -153,13 +153,11 @@ static int swsusp_swap_check(void) /* This is called before saving image */
153{ 153{
154 int i; 154 int i;
155 155
156 if (!swsusp_resume_device)
157 return -ENODEV;
158 spin_lock(&swap_lock); 156 spin_lock(&swap_lock);
159 for (i = 0; i < MAX_SWAPFILES; i++) { 157 for (i = 0; i < MAX_SWAPFILES; i++) {
160 if (!(swap_info[i].flags & SWP_WRITEOK)) 158 if (!(swap_info[i].flags & SWP_WRITEOK))
161 continue; 159 continue;
162 if (is_resume_device(swap_info + i)) { 160 if (!swsusp_resume_device || is_resume_device(swap_info + i)) {
163 spin_unlock(&swap_lock); 161 spin_unlock(&swap_lock);
164 root_swap = i; 162 root_swap = i;
165 return 0; 163 return 0;
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 5f33cdb6fff5..d95a72c9279d 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -72,8 +72,8 @@ void ptrace_untrace(task_t *child)
72 */ 72 */
73void __ptrace_unlink(task_t *child) 73void __ptrace_unlink(task_t *child)
74{ 74{
75 if (!child->ptrace) 75 BUG_ON(!child->ptrace);
76 BUG(); 76
77 child->ptrace = 0; 77 child->ptrace = 0;
78 if (!list_empty(&child->ptrace_list)) { 78 if (!list_empty(&child->ptrace_list)) {
79 list_del_init(&child->ptrace_list); 79 list_del_init(&child->ptrace_list);
@@ -184,22 +184,27 @@ bad:
184 return retval; 184 return retval;
185} 185}
186 186
187void __ptrace_detach(struct task_struct *child, unsigned int data)
188{
189 child->exit_code = data;
190 /* .. re-parent .. */
191 __ptrace_unlink(child);
192 /* .. and wake it up. */
193 if (child->exit_state != EXIT_ZOMBIE)
194 wake_up_process(child);
195}
196
187int ptrace_detach(struct task_struct *child, unsigned int data) 197int ptrace_detach(struct task_struct *child, unsigned int data)
188{ 198{
189 if (!valid_signal(data)) 199 if (!valid_signal(data))
190 return -EIO; 200 return -EIO;
191 201
192 /* Architecture-specific hardware disable .. */ 202 /* Architecture-specific hardware disable .. */
193 ptrace_disable(child); 203 ptrace_disable(child);
194 204
195 /* .. re-parent .. */
196 child->exit_code = data;
197
198 write_lock_irq(&tasklist_lock); 205 write_lock_irq(&tasklist_lock);
199 __ptrace_unlink(child); 206 if (child->ptrace)
200 /* .. and wake it up. */ 207 __ptrace_detach(child, data);
201 if (child->exit_state != EXIT_ZOMBIE)
202 wake_up_process(child);
203 write_unlock_irq(&tasklist_lock); 208 write_unlock_irq(&tasklist_lock);
204 209
205 return 0; 210 return 0;
@@ -242,8 +247,7 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
242 if (write) { 247 if (write) {
243 copy_to_user_page(vma, page, addr, 248 copy_to_user_page(vma, page, addr,
244 maddr + offset, buf, bytes); 249 maddr + offset, buf, bytes);
245 if (!PageCompound(page)) 250 set_page_dirty_lock(page);
246 set_page_dirty_lock(page);
247 } else { 251 } else {
248 copy_from_user_page(vma, page, addr, 252 copy_from_user_page(vma, page, addr,
249 buf, maddr + offset, bytes); 253 buf, maddr + offset, bytes);
diff --git a/kernel/sched.c b/kernel/sched.c
index bc38804e40dd..12d291bf3379 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
1033 return source_load;
1034}
1035 960
1036static inline unsigned long source_load(int cpu, int type) 961 return min(rq->cpu_load[type-1], load_now);
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
1056 if (running > 1 || (idle == NOT_IDLE && running))
1057 target_load = target_load * rq->prio_bias / running;
1058
1059 return target_load;
1060}
1061 973
1062static inline unsigned long target_load(int cpu, int type) 974 return max(rq->cpu_load[type-1], load_now);
1063{
1064 return __target_load(cpu, type, NOT_IDLE);
1065} 975}
1066 976
1067/* 977/*
@@ -1294,9 +1204,6 @@ static int try_to_wake_up(task_t *p, unsigned int state, int sync)
1294 } 1204 }
1295 } 1205 }
1296 1206
1297 if (p->last_waker_cpu != this_cpu)
1298 goto out_set_cpu;
1299
1300 if (unlikely(!cpu_isset(this_cpu, p->cpus_allowed))) 1207 if (unlikely(!cpu_isset(this_cpu, p->cpus_allowed)))
1301 goto out_set_cpu; 1208 goto out_set_cpu;
1302 1209
@@ -1367,8 +1274,6 @@ out_set_cpu:
1367 cpu = task_cpu(p); 1274 cpu = task_cpu(p);
1368 } 1275 }
1369 1276
1370 p->last_waker_cpu = this_cpu;
1371
1372out_activate: 1277out_activate:
1373#endif /* CONFIG_SMP */ 1278#endif /* CONFIG_SMP */
1374 if (old_state == TASK_UNINTERRUPTIBLE) { 1279 if (old_state == TASK_UNINTERRUPTIBLE) {
@@ -1450,12 +1355,9 @@ void fastcall sched_fork(task_t *p, int clone_flags)
1450#ifdef CONFIG_SCHEDSTATS 1355#ifdef CONFIG_SCHEDSTATS
1451 memset(&p->sched_info, 0, sizeof(p->sched_info)); 1356 memset(&p->sched_info, 0, sizeof(p->sched_info));
1452#endif 1357#endif
1453#if defined(CONFIG_SMP) 1358#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
1454 p->last_waker_cpu = cpu;
1455#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
1456 p->oncpu = 0; 1359 p->oncpu = 0;
1457#endif 1360#endif
1458#endif
1459#ifdef CONFIG_PREEMPT 1361#ifdef CONFIG_PREEMPT
1460 /* Want to start with kernel preemption disabled. */ 1362 /* Want to start with kernel preemption disabled. */
1461 task_thread_info(p)->preempt_count = 1; 1363 task_thread_info(p)->preempt_count = 1;
@@ -1530,7 +1432,7 @@ void fastcall wake_up_new_task(task_t *p, unsigned long clone_flags)
1530 list_add_tail(&p->run_list, &current->run_list); 1432 list_add_tail(&p->run_list, &current->run_list);
1531 p->array = current->array; 1433 p->array = current->array;
1532 p->array->nr_active++; 1434 p->array->nr_active++;
1533 inc_nr_running(p, rq); 1435 rq->nr_running++;
1534 } 1436 }
1535 set_need_resched(); 1437 set_need_resched();
1536 } else 1438 } else
@@ -1875,9 +1777,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) 1777 runqueue_t *this_rq, prio_array_t *this_array, int this_cpu)
1876{ 1778{
1877 dequeue_task(p, src_array); 1779 dequeue_task(p, src_array);
1878 dec_nr_running(p, src_rq); 1780 src_rq->nr_running--;
1879 set_task_cpu(p, this_cpu); 1781 set_task_cpu(p, this_cpu);
1880 inc_nr_running(p, this_rq); 1782 this_rq->nr_running++;
1881 enqueue_task(p, this_array); 1783 enqueue_task(p, this_array);
1882 p->timestamp = (p->timestamp - src_rq->timestamp_last_tick) 1784 p->timestamp = (p->timestamp - src_rq->timestamp_last_tick)
1883 + this_rq->timestamp_last_tick; 1785 + this_rq->timestamp_last_tick;
@@ -2056,9 +1958,9 @@ find_busiest_group(struct sched_domain *sd, int this_cpu,
2056 1958
2057 /* Bias balancing toward cpus of our domain */ 1959 /* Bias balancing toward cpus of our domain */
2058 if (local_group) 1960 if (local_group)
2059 load = __target_load(i, load_idx, idle); 1961 load = target_load(i, load_idx);
2060 else 1962 else
2061 load = __source_load(i, load_idx, idle); 1963 load = source_load(i, load_idx);
2062 1964
2063 avg_load += load; 1965 avg_load += load;
2064 } 1966 }
@@ -2171,7 +2073,7 @@ static runqueue_t *find_busiest_queue(struct sched_group *group,
2171 int i; 2073 int i;
2172 2074
2173 for_each_cpu_mask(i, group->cpumask) { 2075 for_each_cpu_mask(i, group->cpumask) {
2174 load = __source_load(i, 0, idle); 2076 load = source_load(i, 0);
2175 2077
2176 if (load > max_load) { 2078 if (load > max_load) {
2177 max_load = load; 2079 max_load = load;
@@ -3571,10 +3473,8 @@ void set_user_nice(task_t *p, long nice)
3571 goto out_unlock; 3473 goto out_unlock;
3572 } 3474 }
3573 array = p->array; 3475 array = p->array;
3574 if (array) { 3476 if (array)
3575 dequeue_task(p, array); 3477 dequeue_task(p, array);
3576 dec_prio_bias(rq, p->static_prio);
3577 }
3578 3478
3579 old_prio = p->prio; 3479 old_prio = p->prio;
3580 new_prio = NICE_TO_PRIO(nice); 3480 new_prio = NICE_TO_PRIO(nice);
@@ -3584,7 +3484,6 @@ void set_user_nice(task_t *p, long nice)
3584 3484
3585 if (array) { 3485 if (array) {
3586 enqueue_task(p, array); 3486 enqueue_task(p, array);
3587 inc_prio_bias(rq, p->static_prio);
3588 /* 3487 /*
3589 * If the task increased its priority or is running and 3488 * If the task increased its priority or is running and
3590 * lowered its priority, then reschedule its CPU: 3489 * lowered its priority, then reschedule its CPU:
@@ -5159,7 +5058,18 @@ static void init_sched_build_groups(struct sched_group groups[], cpumask_t span,
5159#define MAX_DOMAIN_DISTANCE 32 5058#define MAX_DOMAIN_DISTANCE 32
5160 5059
5161static unsigned long long migration_cost[MAX_DOMAIN_DISTANCE] = 5060static unsigned long long migration_cost[MAX_DOMAIN_DISTANCE] =
5162 { [ 0 ... MAX_DOMAIN_DISTANCE-1 ] = -1LL }; 5061 { [ 0 ... MAX_DOMAIN_DISTANCE-1 ] =
5062/*
5063 * Architectures may override the migration cost and thus avoid
5064 * boot-time calibration. Unit is nanoseconds. Mostly useful for
5065 * virtualized hardware:
5066 */
5067#ifdef CONFIG_DEFAULT_MIGRATION_COST
5068 CONFIG_DEFAULT_MIGRATION_COST
5069#else
5070 -1LL
5071#endif
5072};
5163 5073
5164/* 5074/*
5165 * Allow override of migration cost - in units of microseconds. 5075 * Allow override of migration cost - in units of microseconds.
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 17313b99e53d..1067090db6b1 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -104,6 +104,8 @@ cond_syscall(sys_setreuid16);
104cond_syscall(sys_setuid16); 104cond_syscall(sys_setuid16);
105cond_syscall(sys_vm86old); 105cond_syscall(sys_vm86old);
106cond_syscall(sys_vm86); 106cond_syscall(sys_vm86);
107cond_syscall(compat_sys_ipc);
108cond_syscall(compat_sys_sysctl);
107 109
108/* arch-specific weak syscall entries */ 110/* arch-specific weak syscall entries */
109cond_syscall(sys_pciconfig_read); 111cond_syscall(sys_pciconfig_read);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 71dd6f62efec..c05a2b7125e1 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -44,14 +44,12 @@
44#include <linux/limits.h> 44#include <linux/limits.h>
45#include <linux/dcache.h> 45#include <linux/dcache.h>
46#include <linux/syscalls.h> 46#include <linux/syscalls.h>
47#include <linux/nfs_fs.h>
48#include <linux/acpi.h>
47 49
48#include <asm/uaccess.h> 50#include <asm/uaccess.h>
49#include <asm/processor.h> 51#include <asm/processor.h>
50 52
51#ifdef CONFIG_ROOT_NFS
52#include <linux/nfs_fs.h>
53#endif
54
55#if defined(CONFIG_SYSCTL) 53#if defined(CONFIG_SYSCTL)
56 54
57/* External variables not in a header file. */ 55/* External variables not in a header file. */
@@ -126,8 +124,6 @@ extern int sysctl_hz_timer;
126extern int acct_parm[]; 124extern int acct_parm[];
127#endif 125#endif
128 126
129int randomize_va_space = 1;
130
131static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t, 127static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
132 ctl_table *, void **); 128 ctl_table *, void **);
133static int proc_doutsstring(ctl_table *table, int write, struct file *filp, 129static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
@@ -640,6 +636,7 @@ static ctl_table kern_table[] = {
640 .proc_handler = &proc_dointvec, 636 .proc_handler = &proc_dointvec,
641 }, 637 },
642#endif 638#endif
639#if defined(CONFIG_MMU)
643 { 640 {
644 .ctl_name = KERN_RANDOMIZE, 641 .ctl_name = KERN_RANDOMIZE,
645 .procname = "randomize_va_space", 642 .procname = "randomize_va_space",
@@ -648,6 +645,7 @@ static ctl_table kern_table[] = {
648 .mode = 0644, 645 .mode = 0644,
649 .proc_handler = &proc_dointvec, 646 .proc_handler = &proc_dointvec,
650 }, 647 },
648#endif
651#if defined(CONFIG_S390) && defined(CONFIG_SMP) 649#if defined(CONFIG_S390) && defined(CONFIG_SMP)
652 { 650 {
653 .ctl_name = KERN_SPIN_RETRY, 651 .ctl_name = KERN_SPIN_RETRY,
@@ -658,6 +656,16 @@ static ctl_table kern_table[] = {
658 .proc_handler = &proc_dointvec, 656 .proc_handler = &proc_dointvec,
659 }, 657 },
660#endif 658#endif
659#ifdef CONFIG_ACPI_SLEEP
660 {
661 .ctl_name = KERN_ACPI_VIDEO_FLAGS,
662 .procname = "acpi_video_flags",
663 .data = &acpi_video_flags,
664 .maxlen = sizeof (unsigned long),
665 .mode = 0644,
666 .proc_handler = &proc_dointvec,
667 },
668#endif
661 { .ctl_name = 0 } 669 { .ctl_name = 0 }
662}; 670};
663 671
diff --git a/kernel/timer.c b/kernel/timer.c
index b9dad3994676..fe3a9a9f8328 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -717,12 +717,16 @@ static void second_overflow(void)
717#endif 717#endif
718} 718}
719 719
720/* in the NTP reference this is called "hardclock()" */ 720/*
721static void update_wall_time_one_tick(void) 721 * Returns how many microseconds we need to add to xtime this tick
722 * in doing an adjustment requested with adjtime.
723 */
724static long adjtime_adjustment(void)
722{ 725{
723 long time_adjust_step, delta_nsec; 726 long time_adjust_step;
724 727
725 if ((time_adjust_step = time_adjust) != 0 ) { 728 time_adjust_step = time_adjust;
729 if (time_adjust_step) {
726 /* 730 /*
727 * We are doing an adjtime thing. Prepare time_adjust_step to 731 * We are doing an adjtime thing. Prepare time_adjust_step to
728 * be within bounds. Note that a positive time_adjust means we 732 * be within bounds. Note that a positive time_adjust means we
@@ -733,10 +737,19 @@ static void update_wall_time_one_tick(void)
733 */ 737 */
734 time_adjust_step = min(time_adjust_step, (long)tickadj); 738 time_adjust_step = min(time_adjust_step, (long)tickadj);
735 time_adjust_step = max(time_adjust_step, (long)-tickadj); 739 time_adjust_step = max(time_adjust_step, (long)-tickadj);
740 }
741 return time_adjust_step;
742}
736 743
744/* in the NTP reference this is called "hardclock()" */
745static void update_wall_time_one_tick(void)
746{
747 long time_adjust_step, delta_nsec;
748
749 time_adjust_step = adjtime_adjustment();
750 if (time_adjust_step)
737 /* Reduce by this step the amount of time left */ 751 /* Reduce by this step the amount of time left */
738 time_adjust -= time_adjust_step; 752 time_adjust -= time_adjust_step;
739 }
740 delta_nsec = tick_nsec + time_adjust_step * 1000; 753 delta_nsec = tick_nsec + time_adjust_step * 1000;
741 /* 754 /*
742 * Advance the phase, once it gets to one microsecond, then 755 * Advance the phase, once it gets to one microsecond, then
@@ -759,6 +772,22 @@ static void update_wall_time_one_tick(void)
759} 772}
760 773
761/* 774/*
775 * Return how long ticks are at the moment, that is, how much time
776 * update_wall_time_one_tick will add to xtime next time we call it
777 * (assuming no calls to do_adjtimex in the meantime).
778 * The return value is in fixed-point nanoseconds with SHIFT_SCALE-10
779 * bits to the right of the binary point.
780 * This function has no side-effects.
781 */
782u64 current_tick_length(void)
783{
784 long delta_nsec;
785
786 delta_nsec = tick_nsec + adjtime_adjustment() * 1000;
787 return ((u64) delta_nsec << (SHIFT_SCALE - 10)) + time_adj;
788}
789
790/*
762 * Using a loop looks inefficient, but "ticks" is 791 * Using a loop looks inefficient, but "ticks" is
763 * usually just one (we shouldn't be losing ticks, 792 * usually just one (we shouldn't be losing ticks,
764 * we're doing this this way mainly for interrupt 793 * we're doing this this way mainly for interrupt
diff --git a/lib/iomap_copy.c b/lib/iomap_copy.c
index a6b1e271d53c..351045f4f63c 100644
--- a/lib/iomap_copy.c
+++ b/lib/iomap_copy.c
@@ -15,8 +15,8 @@
15 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 15 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
16 */ 16 */
17 17
18#include <linux/io.h>
19#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/io.h>
20 20
21/** 21/**
22 * __iowrite32_copy - copy data to MMIO space, in 32-bit units 22 * __iowrite32_copy - copy data to MMIO space, in 32-bit units
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 1b1985c136ec..086a0c6e888e 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -38,6 +38,10 @@ static char *action_to_string(enum kobject_action action)
38 return "remove"; 38 return "remove";
39 case KOBJ_CHANGE: 39 case KOBJ_CHANGE:
40 return "change"; 40 return "change";
41 case KOBJ_MOUNT:
42 return "mount";
43 case KOBJ_UMOUNT:
44 return "umount";
41 case KOBJ_OFFLINE: 45 case KOBJ_OFFLINE:
42 return "offline"; 46 return "offline";
43 case KOBJ_ONLINE: 47 case KOBJ_ONLINE:
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index c0bd4a914803..1e5b17dc7e3d 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -752,12 +752,14 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index)
752 */ 752 */
753 nr_cleared_tags = 0; 753 nr_cleared_tags = 0;
754 for (tag = 0; tag < RADIX_TREE_TAGS; tag++) { 754 for (tag = 0; tag < RADIX_TREE_TAGS; tag++) {
755 tags[tag] = 1;
755 if (tag_get(pathp->node, tag, pathp->offset)) { 756 if (tag_get(pathp->node, tag, pathp->offset)) {
756 tag_clear(pathp->node, tag, pathp->offset); 757 tag_clear(pathp->node, tag, pathp->offset);
757 tags[tag] = 0; 758 if (!any_tag_set(pathp->node, tag)) {
758 nr_cleared_tags++; 759 tags[tag] = 0;
759 } else 760 nr_cleared_tags++;
760 tags[tag] = 1; 761 }
762 }
761 } 763 }
762 764
763 for (pathp--; nr_cleared_tags && pathp->node; pathp--) { 765 for (pathp--; nr_cleared_tags && pathp->node; pathp--) {
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 67f29516662a..508707704d2c 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -85,7 +85,7 @@ void free_huge_page(struct page *page)
85 BUG_ON(page_count(page)); 85 BUG_ON(page_count(page));
86 86
87 INIT_LIST_HEAD(&page->lru); 87 INIT_LIST_HEAD(&page->lru);
88 page[1].mapping = NULL; 88 page[1].lru.next = NULL; /* reset dtor */
89 89
90 spin_lock(&hugetlb_lock); 90 spin_lock(&hugetlb_lock);
91 enqueue_huge_page(page); 91 enqueue_huge_page(page);
@@ -105,7 +105,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr)
105 } 105 }
106 spin_unlock(&hugetlb_lock); 106 spin_unlock(&hugetlb_lock);
107 set_page_count(page, 1); 107 set_page_count(page, 1);
108 page[1].mapping = (void *)free_huge_page; 108 page[1].lru.next = (void *)free_huge_page; /* set dtor */
109 for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i) 109 for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
110 clear_user_highpage(&page[i], addr); 110 clear_user_highpage(&page[i], addr);
111 return page; 111 return page;
diff --git a/mm/madvise.c b/mm/madvise.c
index ae0ae3ea299a..af3d573b0141 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -22,16 +22,23 @@ static long madvise_behavior(struct vm_area_struct * vma,
22 struct mm_struct * mm = vma->vm_mm; 22 struct mm_struct * mm = vma->vm_mm;
23 int error = 0; 23 int error = 0;
24 pgoff_t pgoff; 24 pgoff_t pgoff;
25 int new_flags = vma->vm_flags & ~VM_READHINTMASK; 25 int new_flags = vma->vm_flags;
26 26
27 switch (behavior) { 27 switch (behavior) {
28 case MADV_NORMAL:
29 new_flags = new_flags & ~VM_RAND_READ & ~VM_SEQ_READ;
30 break;
28 case MADV_SEQUENTIAL: 31 case MADV_SEQUENTIAL:
29 new_flags |= VM_SEQ_READ; 32 new_flags = (new_flags & ~VM_RAND_READ) | VM_SEQ_READ;
30 break; 33 break;
31 case MADV_RANDOM: 34 case MADV_RANDOM:
32 new_flags |= VM_RAND_READ; 35 new_flags = (new_flags & ~VM_SEQ_READ) | VM_RAND_READ;
33 break; 36 break;
34 default: 37 case MADV_DONTFORK:
38 new_flags |= VM_DONTCOPY;
39 break;
40 case MADV_DOFORK:
41 new_flags &= ~VM_DONTCOPY;
35 break; 42 break;
36 } 43 }
37 44
@@ -177,6 +184,12 @@ madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev,
177 long error; 184 long error;
178 185
179 switch (behavior) { 186 switch (behavior) {
187 case MADV_DOFORK:
188 if (vma->vm_flags & VM_IO) {
189 error = -EINVAL;
190 break;
191 }
192 case MADV_DONTFORK:
180 case MADV_NORMAL: 193 case MADV_NORMAL:
181 case MADV_SEQUENTIAL: 194 case MADV_SEQUENTIAL:
182 case MADV_RANDOM: 195 case MADV_RANDOM:
diff --git a/mm/memory.c b/mm/memory.c
index 2bee1f21aa8a..9abc6008544b 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -82,6 +82,16 @@ EXPORT_SYMBOL(num_physpages);
82EXPORT_SYMBOL(high_memory); 82EXPORT_SYMBOL(high_memory);
83EXPORT_SYMBOL(vmalloc_earlyreserve); 83EXPORT_SYMBOL(vmalloc_earlyreserve);
84 84
85int randomize_va_space __read_mostly = 1;
86
87static int __init disable_randmaps(char *s)
88{
89 randomize_va_space = 0;
90 return 0;
91}
92__setup("norandmaps", disable_randmaps);
93
94
85/* 95/*
86 * If a p?d_bad entry is found while walking page tables, report 96 * If a p?d_bad entry is found while walking page tables, report
87 * the error, before resetting entry to p?d_none. Usually (but 97 * the error, before resetting entry to p?d_none. Usually (but
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 3bd7fb7e4b75..880831bd3003 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -132,19 +132,29 @@ static int mpol_check_policy(int mode, nodemask_t *nodes)
132 } 132 }
133 return nodes_subset(*nodes, node_online_map) ? 0 : -EINVAL; 133 return nodes_subset(*nodes, node_online_map) ? 0 : -EINVAL;
134} 134}
135
135/* Generate a custom zonelist for the BIND policy. */ 136/* Generate a custom zonelist for the BIND policy. */
136static struct zonelist *bind_zonelist(nodemask_t *nodes) 137static struct zonelist *bind_zonelist(nodemask_t *nodes)
137{ 138{
138 struct zonelist *zl; 139 struct zonelist *zl;
139 int num, max, nd; 140 int num, max, nd, k;
140 141
141 max = 1 + MAX_NR_ZONES * nodes_weight(*nodes); 142 max = 1 + MAX_NR_ZONES * nodes_weight(*nodes);
142 zl = kmalloc(sizeof(void *) * max, GFP_KERNEL); 143 zl = kmalloc(sizeof(struct zone *) * max, GFP_KERNEL);
143 if (!zl) 144 if (!zl)
144 return NULL; 145 return NULL;
145 num = 0; 146 num = 0;
146 for_each_node_mask(nd, *nodes) 147 /* First put in the highest zones from all nodes, then all the next
147 zl->zones[num++] = &NODE_DATA(nd)->node_zones[policy_zone]; 148 lower zones etc. Avoid empty zones because the memory allocator
149 doesn't like them. If you implement node hot removal you
150 have to fix that. */
151 for (k = policy_zone; k >= 0; k--) {
152 for_each_node_mask(nd, *nodes) {
153 struct zone *z = &NODE_DATA(nd)->node_zones[k];
154 if (z->present_pages > 0)
155 zl->zones[num++] = z;
156 }
157 }
148 zl->zones[num] = NULL; 158 zl->zones[num] = NULL;
149 return zl; 159 return zl;
150} 160}
@@ -577,7 +587,7 @@ redo:
577 } 587 }
578 list_add(&page->lru, &newlist); 588 list_add(&page->lru, &newlist);
579 nr_pages++; 589 nr_pages++;
580 if (nr_pages > MIGRATE_CHUNK_SIZE); 590 if (nr_pages > MIGRATE_CHUNK_SIZE)
581 break; 591 break;
582 } 592 }
583 err = migrate_pages(pagelist, &newlist, &moved, &failed); 593 err = migrate_pages(pagelist, &newlist, &moved, &failed);
@@ -798,6 +808,8 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask,
798 nodes_clear(*nodes); 808 nodes_clear(*nodes);
799 if (maxnode == 0 || !nmask) 809 if (maxnode == 0 || !nmask)
800 return 0; 810 return 0;
811 if (maxnode > PAGE_SIZE*BITS_PER_BYTE)
812 return -EINVAL;
801 813
802 nlongs = BITS_TO_LONGS(maxnode); 814 nlongs = BITS_TO_LONGS(maxnode);
803 if ((maxnode % BITS_PER_LONG) == 0) 815 if ((maxnode % BITS_PER_LONG) == 0)
diff --git a/mm/nommu.c b/mm/nommu.c
index c10262d68232..99d21020ec9d 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -57,6 +57,8 @@ EXPORT_SYMBOL(vmalloc);
57EXPORT_SYMBOL(vfree); 57EXPORT_SYMBOL(vfree);
58EXPORT_SYMBOL(vmalloc_to_page); 58EXPORT_SYMBOL(vmalloc_to_page);
59EXPORT_SYMBOL(vmalloc_32); 59EXPORT_SYMBOL(vmalloc_32);
60EXPORT_SYMBOL(vmap);
61EXPORT_SYMBOL(vunmap);
60 62
61/* 63/*
62 * Handle all mappings that got truncated by a "truncate()" 64 * Handle all mappings that got truncated by a "truncate()"
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index b05ab8f2a562..8123fad5a485 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -58,15 +58,17 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
58 58
59 /* 59 /*
60 * Processes which fork a lot of child processes are likely 60 * Processes which fork a lot of child processes are likely
61 * a good choice. We add the vmsize of the children if they 61 * a good choice. We add half the vmsize of the children if they
62 * have an own mm. This prevents forking servers to flood the 62 * have an own mm. This prevents forking servers to flood the
63 * machine with an endless amount of children 63 * machine with an endless amount of children. In case a single
64 * child is eating the vast majority of memory, adding only half
65 * to the parents will make the child our kill candidate of choice.
64 */ 66 */
65 list_for_each(tsk, &p->children) { 67 list_for_each(tsk, &p->children) {
66 struct task_struct *chld; 68 struct task_struct *chld;
67 chld = list_entry(tsk, struct task_struct, sibling); 69 chld = list_entry(tsk, struct task_struct, sibling);
68 if (chld->mm != p->mm && chld->mm) 70 if (chld->mm != p->mm && chld->mm)
69 points += chld->mm->total_vm; 71 points += chld->mm->total_vm/2 + 1;
70 } 72 }
71 73
72 /* 74 /*
@@ -131,17 +133,47 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
131} 133}
132 134
133/* 135/*
136 * Types of limitations to the nodes from which allocations may occur
137 */
138#define CONSTRAINT_NONE 1
139#define CONSTRAINT_MEMORY_POLICY 2
140#define CONSTRAINT_CPUSET 3
141
142/*
143 * Determine the type of allocation constraint.
144 */
145static inline int constrained_alloc(struct zonelist *zonelist, gfp_t gfp_mask)
146{
147#ifdef CONFIG_NUMA
148 struct zone **z;
149 nodemask_t nodes = node_online_map;
150
151 for (z = zonelist->zones; *z; z++)
152 if (cpuset_zone_allowed(*z, gfp_mask))
153 node_clear((*z)->zone_pgdat->node_id,
154 nodes);
155 else
156 return CONSTRAINT_CPUSET;
157
158 if (!nodes_empty(nodes))
159 return CONSTRAINT_MEMORY_POLICY;
160#endif
161
162 return CONSTRAINT_NONE;
163}
164
165/*
134 * Simple selection loop. We chose the process with the highest 166 * Simple selection loop. We chose the process with the highest
135 * number of 'points'. We expect the caller will lock the tasklist. 167 * number of 'points'. We expect the caller will lock the tasklist.
136 * 168 *
137 * (not docbooked, we don't want this one cluttering up the manual) 169 * (not docbooked, we don't want this one cluttering up the manual)
138 */ 170 */
139static struct task_struct * select_bad_process(void) 171static struct task_struct *select_bad_process(unsigned long *ppoints)
140{ 172{
141 unsigned long maxpoints = 0;
142 struct task_struct *g, *p; 173 struct task_struct *g, *p;
143 struct task_struct *chosen = NULL; 174 struct task_struct *chosen = NULL;
144 struct timespec uptime; 175 struct timespec uptime;
176 *ppoints = 0;
145 177
146 do_posix_clock_monotonic_gettime(&uptime); 178 do_posix_clock_monotonic_gettime(&uptime);
147 do_each_thread(g, p) { 179 do_each_thread(g, p) {
@@ -169,9 +201,9 @@ static struct task_struct * select_bad_process(void)
169 return p; 201 return p;
170 202
171 points = badness(p, uptime.tv_sec); 203 points = badness(p, uptime.tv_sec);
172 if (points > maxpoints || !chosen) { 204 if (points > *ppoints || !chosen) {
173 chosen = p; 205 chosen = p;
174 maxpoints = points; 206 *ppoints = points;
175 } 207 }
176 } while_each_thread(g, p); 208 } while_each_thread(g, p);
177 return chosen; 209 return chosen;
@@ -182,7 +214,7 @@ static struct task_struct * select_bad_process(void)
182 * CAP_SYS_RAW_IO set, send SIGTERM instead (but it's unlikely that 214 * CAP_SYS_RAW_IO set, send SIGTERM instead (but it's unlikely that
183 * we select a process with CAP_SYS_RAW_IO set). 215 * we select a process with CAP_SYS_RAW_IO set).
184 */ 216 */
185static void __oom_kill_task(task_t *p) 217static void __oom_kill_task(task_t *p, const char *message)
186{ 218{
187 if (p->pid == 1) { 219 if (p->pid == 1) {
188 WARN_ON(1); 220 WARN_ON(1);
@@ -198,8 +230,8 @@ static void __oom_kill_task(task_t *p)
198 return; 230 return;
199 } 231 }
200 task_unlock(p); 232 task_unlock(p);
201 printk(KERN_ERR "Out of Memory: Killed process %d (%s).\n", 233 printk(KERN_ERR "%s: Killed process %d (%s).\n",
202 p->pid, p->comm); 234 message, p->pid, p->comm);
203 235
204 /* 236 /*
205 * We give our sacrificial lamb high priority and access to 237 * We give our sacrificial lamb high priority and access to
@@ -212,7 +244,7 @@ static void __oom_kill_task(task_t *p)
212 force_sig(SIGKILL, p); 244 force_sig(SIGKILL, p);
213} 245}
214 246
215static struct mm_struct *oom_kill_task(task_t *p) 247static struct mm_struct *oom_kill_task(task_t *p, const char *message)
216{ 248{
217 struct mm_struct *mm = get_task_mm(p); 249 struct mm_struct *mm = get_task_mm(p);
218 task_t * g, * q; 250 task_t * g, * q;
@@ -224,35 +256,38 @@ static struct mm_struct *oom_kill_task(task_t *p)
224 return NULL; 256 return NULL;
225 } 257 }
226 258
227 __oom_kill_task(p); 259 __oom_kill_task(p, message);
228 /* 260 /*
229 * kill all processes that share the ->mm (i.e. all threads), 261 * kill all processes that share the ->mm (i.e. all threads),
230 * but are in a different thread group 262 * but are in a different thread group
231 */ 263 */
232 do_each_thread(g, q) 264 do_each_thread(g, q)
233 if (q->mm == mm && q->tgid != p->tgid) 265 if (q->mm == mm && q->tgid != p->tgid)
234 __oom_kill_task(q); 266 __oom_kill_task(q, message);
235 while_each_thread(g, q); 267 while_each_thread(g, q);
236 268
237 return mm; 269 return mm;
238} 270}
239 271
240static struct mm_struct *oom_kill_process(struct task_struct *p) 272static struct mm_struct *oom_kill_process(struct task_struct *p,
273 unsigned long points, const char *message)
241{ 274{
242 struct mm_struct *mm; 275 struct mm_struct *mm;
243 struct task_struct *c; 276 struct task_struct *c;
244 struct list_head *tsk; 277 struct list_head *tsk;
245 278
279 printk(KERN_ERR "Out of Memory: Kill process %d (%s) score %li and "
280 "children.\n", p->pid, p->comm, points);
246 /* Try to kill a child first */ 281 /* Try to kill a child first */
247 list_for_each(tsk, &p->children) { 282 list_for_each(tsk, &p->children) {
248 c = list_entry(tsk, struct task_struct, sibling); 283 c = list_entry(tsk, struct task_struct, sibling);
249 if (c->mm == p->mm) 284 if (c->mm == p->mm)
250 continue; 285 continue;
251 mm = oom_kill_task(c); 286 mm = oom_kill_task(c, message);
252 if (mm) 287 if (mm)
253 return mm; 288 return mm;
254 } 289 }
255 return oom_kill_task(p); 290 return oom_kill_task(p, message);
256} 291}
257 292
258/** 293/**
@@ -263,10 +298,11 @@ static struct mm_struct *oom_kill_process(struct task_struct *p)
263 * OR try to be smart about which process to kill. Note that we 298 * OR try to be smart about which process to kill. Note that we
264 * don't have to be perfect here, we just have to be good. 299 * don't have to be perfect here, we just have to be good.
265 */ 300 */
266void out_of_memory(gfp_t gfp_mask, int order) 301void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
267{ 302{
268 struct mm_struct *mm = NULL; 303 struct mm_struct *mm = NULL;
269 task_t * p; 304 task_t *p;
305 unsigned long points;
270 306
271 if (printk_ratelimit()) { 307 if (printk_ratelimit()) {
272 printk("oom-killer: gfp_mask=0x%x, order=%d\n", 308 printk("oom-killer: gfp_mask=0x%x, order=%d\n",
@@ -277,25 +313,48 @@ void out_of_memory(gfp_t gfp_mask, int order)
277 313
278 cpuset_lock(); 314 cpuset_lock();
279 read_lock(&tasklist_lock); 315 read_lock(&tasklist_lock);
316
317 /*
318 * Check if there were limitations on the allocation (only relevant for
319 * NUMA) that may require different handling.
320 */
321 switch (constrained_alloc(zonelist, gfp_mask)) {
322 case CONSTRAINT_MEMORY_POLICY:
323 mm = oom_kill_process(current, points,
324 "No available memory (MPOL_BIND)");
325 break;
326
327 case CONSTRAINT_CPUSET:
328 mm = oom_kill_process(current, points,
329 "No available memory in cpuset");
330 break;
331
332 case CONSTRAINT_NONE:
280retry: 333retry:
281 p = select_bad_process(); 334 /*
335 * Rambo mode: Shoot down a process and hope it solves whatever
336 * issues we may have.
337 */
338 p = select_bad_process(&points);
282 339
283 if (PTR_ERR(p) == -1UL) 340 if (PTR_ERR(p) == -1UL)
284 goto out; 341 goto out;
285 342
286 /* Found nothing?!?! Either we hang forever, or we panic. */ 343 /* Found nothing?!?! Either we hang forever, or we panic. */
287 if (!p) { 344 if (!p) {
288 read_unlock(&tasklist_lock); 345 read_unlock(&tasklist_lock);
289 cpuset_unlock(); 346 cpuset_unlock();
290 panic("Out of memory and no killable processes...\n"); 347 panic("Out of memory and no killable processes...\n");
291 } 348 }
292 349
293 mm = oom_kill_process(p); 350 mm = oom_kill_process(p, points, "Out of memory");
294 if (!mm) 351 if (!mm)
295 goto retry; 352 goto retry;
353
354 break;
355 }
296 356
297 out: 357out:
298 read_unlock(&tasklist_lock);
299 cpuset_unlock(); 358 cpuset_unlock();
300 if (mm) 359 if (mm)
301 mmput(mm); 360 mmput(mm);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index dde04ff4be31..791690d7d3fa 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -56,6 +56,7 @@ long nr_swap_pages;
56int percpu_pagelist_fraction; 56int percpu_pagelist_fraction;
57 57
58static void fastcall free_hot_cold_page(struct page *page, int cold); 58static void fastcall free_hot_cold_page(struct page *page, int cold);
59static void __free_pages_ok(struct page *page, unsigned int order);
59 60
60/* 61/*
61 * results with 256, 32 in the lowmem_reserve sysctl: 62 * results with 256, 32 in the lowmem_reserve sysctl:
@@ -169,20 +170,23 @@ static void bad_page(struct page *page)
169 * All pages have PG_compound set. All pages have their ->private pointing at 170 * All pages have PG_compound set. All pages have their ->private pointing at
170 * the head page (even the head page has this). 171 * the head page (even the head page has this).
171 * 172 *
172 * The first tail page's ->mapping, if non-zero, holds the address of the 173 * The first tail page's ->lru.next holds the address of the compound page's
173 * compound page's put_page() function. 174 * put_page() function. Its ->lru.prev holds the order of allocation.
174 * 175 * This usage means that zero-order pages may not be compound.
175 * The order of the allocation is stored in the first tail page's ->index
176 * This is only for debug at present. This usage means that zero-order pages
177 * may not be compound.
178 */ 176 */
177
178static void free_compound_page(struct page *page)
179{
180 __free_pages_ok(page, (unsigned long)page[1].lru.prev);
181}
182
179static void prep_compound_page(struct page *page, unsigned long order) 183static void prep_compound_page(struct page *page, unsigned long order)
180{ 184{
181 int i; 185 int i;
182 int nr_pages = 1 << order; 186 int nr_pages = 1 << order;
183 187
184 page[1].mapping = NULL; 188 page[1].lru.next = (void *)free_compound_page; /* set dtor */
185 page[1].index = order; 189 page[1].lru.prev = (void *)order;
186 for (i = 0; i < nr_pages; i++) { 190 for (i = 0; i < nr_pages; i++) {
187 struct page *p = page + i; 191 struct page *p = page + i;
188 192
@@ -196,7 +200,7 @@ static void destroy_compound_page(struct page *page, unsigned long order)
196 int i; 200 int i;
197 int nr_pages = 1 << order; 201 int nr_pages = 1 << order;
198 202
199 if (unlikely(page[1].index != order)) 203 if (unlikely((unsigned long)page[1].lru.prev != order))
200 bad_page(page); 204 bad_page(page);
201 205
202 for (i = 0; i < nr_pages; i++) { 206 for (i = 0; i < nr_pages; i++) {
@@ -1011,7 +1015,7 @@ rebalance:
1011 if (page) 1015 if (page)
1012 goto got_pg; 1016 goto got_pg;
1013 1017
1014 out_of_memory(gfp_mask, order); 1018 out_of_memory(zonelist, gfp_mask, order);
1015 goto restart; 1019 goto restart;
1016 } 1020 }
1017 1021
@@ -1537,29 +1541,29 @@ static int __initdata node_load[MAX_NUMNODES];
1537 */ 1541 */
1538static int __init find_next_best_node(int node, nodemask_t *used_node_mask) 1542static int __init find_next_best_node(int node, nodemask_t *used_node_mask)
1539{ 1543{
1540 int i, n, val; 1544 int n, val;
1541 int min_val = INT_MAX; 1545 int min_val = INT_MAX;
1542 int best_node = -1; 1546 int best_node = -1;
1543 1547
1544 for_each_online_node(i) { 1548 /* Use the local node if we haven't already */
1545 cpumask_t tmp; 1549 if (!node_isset(node, *used_node_mask)) {
1550 node_set(node, *used_node_mask);
1551 return node;
1552 }
1546 1553
1547 /* Start from local node */ 1554 for_each_online_node(n) {
1548 n = (node+i) % num_online_nodes(); 1555 cpumask_t tmp;
1549 1556
1550 /* Don't want a node to appear more than once */ 1557 /* Don't want a node to appear more than once */
1551 if (node_isset(n, *used_node_mask)) 1558 if (node_isset(n, *used_node_mask))
1552 continue; 1559 continue;
1553 1560
1554 /* Use the local node if we haven't already */
1555 if (!node_isset(node, *used_node_mask)) {
1556 best_node = node;
1557 break;
1558 }
1559
1560 /* Use the distance array to find the distance */ 1561 /* Use the distance array to find the distance */
1561 val = node_distance(node, n); 1562 val = node_distance(node, n);
1562 1563
1564 /* Penalize nodes under us ("prefer the next node") */
1565 val += (n < node);
1566
1563 /* Give preference to headless and unused nodes */ 1567 /* Give preference to headless and unused nodes */
1564 tmp = node_to_cpumask(n); 1568 tmp = node_to_cpumask(n);
1565 if (!cpus_empty(tmp)) 1569 if (!cpus_empty(tmp))
diff --git a/mm/shmem.c b/mm/shmem.c
index f7ac7b812f92..7c455fbaff7b 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -45,6 +45,7 @@
45#include <linux/swapops.h> 45#include <linux/swapops.h>
46#include <linux/mempolicy.h> 46#include <linux/mempolicy.h>
47#include <linux/namei.h> 47#include <linux/namei.h>
48#include <linux/ctype.h>
48#include <asm/uaccess.h> 49#include <asm/uaccess.h>
49#include <asm/div64.h> 50#include <asm/div64.h>
50#include <asm/pgtable.h> 51#include <asm/pgtable.h>
@@ -874,6 +875,51 @@ redirty:
874} 875}
875 876
876#ifdef CONFIG_NUMA 877#ifdef CONFIG_NUMA
878static int shmem_parse_mpol(char *value, int *policy, nodemask_t *policy_nodes)
879{
880 char *nodelist = strchr(value, ':');
881 int err = 1;
882
883 if (nodelist) {
884 /* NUL-terminate policy string */
885 *nodelist++ = '\0';
886 if (nodelist_parse(nodelist, *policy_nodes))
887 goto out;
888 }
889 if (!strcmp(value, "default")) {
890 *policy = MPOL_DEFAULT;
891 /* Don't allow a nodelist */
892 if (!nodelist)
893 err = 0;
894 } else if (!strcmp(value, "prefer")) {
895 *policy = MPOL_PREFERRED;
896 /* Insist on a nodelist of one node only */
897 if (nodelist) {
898 char *rest = nodelist;
899 while (isdigit(*rest))
900 rest++;
901 if (!*rest)
902 err = 0;
903 }
904 } else if (!strcmp(value, "bind")) {
905 *policy = MPOL_BIND;
906 /* Insist on a nodelist */
907 if (nodelist)
908 err = 0;
909 } else if (!strcmp(value, "interleave")) {
910 *policy = MPOL_INTERLEAVE;
911 /* Default to nodes online if no nodelist */
912 if (!nodelist)
913 *policy_nodes = node_online_map;
914 err = 0;
915 }
916out:
917 /* Restore string for error message */
918 if (nodelist)
919 *--nodelist = ':';
920 return err;
921}
922
877static struct page *shmem_swapin_async(struct shared_policy *p, 923static struct page *shmem_swapin_async(struct shared_policy *p,
878 swp_entry_t entry, unsigned long idx) 924 swp_entry_t entry, unsigned long idx)
879{ 925{
@@ -926,6 +972,11 @@ shmem_alloc_page(gfp_t gfp, struct shmem_inode_info *info,
926 return page; 972 return page;
927} 973}
928#else 974#else
975static inline int shmem_parse_mpol(char *value, int *policy, nodemask_t *policy_nodes)
976{
977 return 1;
978}
979
929static inline struct page * 980static inline struct page *
930shmem_swapin(struct shmem_inode_info *info,swp_entry_t entry,unsigned long idx) 981shmem_swapin(struct shmem_inode_info *info,swp_entry_t entry,unsigned long idx)
931{ 982{
@@ -1859,7 +1910,23 @@ static int shmem_parse_options(char *options, int *mode, uid_t *uid,
1859{ 1910{
1860 char *this_char, *value, *rest; 1911 char *this_char, *value, *rest;
1861 1912
1862 while ((this_char = strsep(&options, ",")) != NULL) { 1913 while (options != NULL) {
1914 this_char = options;
1915 for (;;) {
1916 /*
1917 * NUL-terminate this option: unfortunately,
1918 * mount options form a comma-separated list,
1919 * but mpol's nodelist may also contain commas.
1920 */
1921 options = strchr(options, ',');
1922 if (options == NULL)
1923 break;
1924 options++;
1925 if (!isdigit(*options)) {
1926 options[-1] = '\0';
1927 break;
1928 }
1929 }
1863 if (!*this_char) 1930 if (!*this_char)
1864 continue; 1931 continue;
1865 if ((value = strchr(this_char,'=')) != NULL) { 1932 if ((value = strchr(this_char,'=')) != NULL) {
@@ -1910,18 +1977,8 @@ static int shmem_parse_options(char *options, int *mode, uid_t *uid,
1910 if (*rest) 1977 if (*rest)
1911 goto bad_val; 1978 goto bad_val;
1912 } else if (!strcmp(this_char,"mpol")) { 1979 } else if (!strcmp(this_char,"mpol")) {
1913 if (!strcmp(value,"default")) 1980 if (shmem_parse_mpol(value,policy,policy_nodes))
1914 *policy = MPOL_DEFAULT;
1915 else if (!strcmp(value,"preferred"))
1916 *policy = MPOL_PREFERRED;
1917 else if (!strcmp(value,"bind"))
1918 *policy = MPOL_BIND;
1919 else if (!strcmp(value,"interleave"))
1920 *policy = MPOL_INTERLEAVE;
1921 else
1922 goto bad_val; 1981 goto bad_val;
1923 } else if (!strcmp(this_char,"mpol_nodelist")) {
1924 nodelist_parse(value, *policy_nodes);
1925 } else { 1982 } else {
1926 printk(KERN_ERR "tmpfs: Bad mount option %s\n", 1983 printk(KERN_ERR "tmpfs: Bad mount option %s\n",
1927 this_char); 1984 this_char);
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/swap.c b/mm/swap.c
index 76247424dea1..cce3dda59c59 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -40,7 +40,7 @@ static void put_compound_page(struct page *page)
40 if (put_page_testzero(page)) { 40 if (put_page_testzero(page)) {
41 void (*dtor)(struct page *page); 41 void (*dtor)(struct page *page);
42 42
43 dtor = (void (*)(struct page *))page[1].mapping; 43 dtor = (void (*)(struct page *))page[1].lru.next;
44 (*dtor)(page); 44 (*dtor)(page);
45 } 45 }
46} 46}
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5a610804cd06..1838c15ca4fd 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -443,6 +443,10 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc)
443 BUG_ON(PageActive(page)); 443 BUG_ON(PageActive(page));
444 444
445 sc->nr_scanned++; 445 sc->nr_scanned++;
446
447 if (!sc->may_swap && page_mapped(page))
448 goto keep_locked;
449
446 /* Double the slab pressure for mapped and swapcache pages */ 450 /* Double the slab pressure for mapped and swapcache pages */
447 if (page_mapped(page) || PageSwapCache(page)) 451 if (page_mapped(page) || PageSwapCache(page))
448 sc->nr_scanned++; 452 sc->nr_scanned++;
@@ -632,7 +636,7 @@ static int swap_page(struct page *page)
632 struct address_space *mapping = page_mapping(page); 636 struct address_space *mapping = page_mapping(page);
633 637
634 if (page_mapped(page) && mapping) 638 if (page_mapped(page) && mapping)
635 if (try_to_unmap(page, 0) != SWAP_SUCCESS) 639 if (try_to_unmap(page, 1) != SWAP_SUCCESS)
636 goto unlock_retry; 640 goto unlock_retry;
637 641
638 if (PageDirty(page)) { 642 if (PageDirty(page)) {
@@ -839,7 +843,7 @@ EXPORT_SYMBOL(migrate_page);
839 * pages are swapped out. 843 * pages are swapped out.
840 * 844 *
841 * The function returns after 10 attempts or if no pages 845 * The function returns after 10 attempts or if no pages
842 * are movable anymore because t has become empty 846 * are movable anymore because to has become empty
843 * or no retryable pages exist anymore. 847 * or no retryable pages exist anymore.
844 * 848 *
845 * Return: Number of pages not migrated when "to" ran empty. 849 * Return: Number of pages not migrated when "to" ran empty.
@@ -928,12 +932,21 @@ redo:
928 goto unlock_both; 932 goto unlock_both;
929 933
930 if (mapping->a_ops->migratepage) { 934 if (mapping->a_ops->migratepage) {
935 /*
936 * Most pages have a mapping and most filesystems
937 * should provide a migration function. Anonymous
938 * pages are part of swap space which also has its
939 * own migration function. This is the most common
940 * path for page migration.
941 */
931 rc = mapping->a_ops->migratepage(newpage, page); 942 rc = mapping->a_ops->migratepage(newpage, page);
932 goto unlock_both; 943 goto unlock_both;
933 } 944 }
934 945
935 /* 946 /*
936 * Trigger writeout if page is dirty 947 * Default handling if a filesystem does not provide
948 * a migration function. We can only migrate clean
949 * pages so try to write out any dirty pages first.
937 */ 950 */
938 if (PageDirty(page)) { 951 if (PageDirty(page)) {
939 switch (pageout(page, mapping)) { 952 switch (pageout(page, mapping)) {
@@ -949,9 +962,10 @@ redo:
949 ; /* try to migrate the page below */ 962 ; /* try to migrate the page below */
950 } 963 }
951 } 964 }
965
952 /* 966 /*
953 * If we have no buffer or can release the buffer 967 * Buffers are managed in a filesystem specific way.
954 * then do a simple migration. 968 * We must have no buffers or drop them.
955 */ 969 */
956 if (!page_has_buffers(page) || 970 if (!page_has_buffers(page) ||
957 try_to_release_page(page, GFP_KERNEL)) { 971 try_to_release_page(page, GFP_KERNEL)) {
@@ -966,6 +980,11 @@ redo:
966 * swap them out. 980 * swap them out.
967 */ 981 */
968 if (pass > 4) { 982 if (pass > 4) {
983 /*
984 * Persistently unable to drop buffers..... As a
985 * measure of last resort we fall back to
986 * swap_page().
987 */
969 unlock_page(newpage); 988 unlock_page(newpage);
970 newpage = NULL; 989 newpage = NULL;
971 rc = swap_page(page); 990 rc = swap_page(page);
@@ -1176,9 +1195,47 @@ refill_inactive_zone(struct zone *zone, struct scan_control *sc)
1176 struct page *page; 1195 struct page *page;
1177 struct pagevec pvec; 1196 struct pagevec pvec;
1178 int reclaim_mapped = 0; 1197 int reclaim_mapped = 0;
1179 long mapped_ratio; 1198
1180 long distress; 1199 if (unlikely(sc->may_swap)) {
1181 long swap_tendency; 1200 long mapped_ratio;
1201 long distress;
1202 long swap_tendency;
1203
1204 /*
1205 * `distress' is a measure of how much trouble we're having
1206 * reclaiming pages. 0 -> no problems. 100 -> great trouble.
1207 */
1208 distress = 100 >> zone->prev_priority;
1209
1210 /*
1211 * The point of this algorithm is to decide when to start
1212 * reclaiming mapped memory instead of just pagecache. Work out
1213 * how much memory
1214 * is mapped.
1215 */
1216 mapped_ratio = (sc->nr_mapped * 100) / total_memory;
1217
1218 /*
1219 * Now decide how much we really want to unmap some pages. The
1220 * mapped ratio is downgraded - just because there's a lot of
1221 * mapped memory doesn't necessarily mean that page reclaim
1222 * isn't succeeding.
1223 *
1224 * The distress ratio is important - we don't want to start
1225 * going oom.
1226 *
1227 * A 100% value of vm_swappiness overrides this algorithm
1228 * altogether.
1229 */
1230 swap_tendency = mapped_ratio / 2 + distress + vm_swappiness;
1231
1232 /*
1233 * Now use this metric to decide whether to start moving mapped
1234 * memory onto the inactive list.
1235 */
1236 if (swap_tendency >= 100)
1237 reclaim_mapped = 1;
1238 }
1182 1239
1183 lru_add_drain(); 1240 lru_add_drain();
1184 spin_lock_irq(&zone->lru_lock); 1241 spin_lock_irq(&zone->lru_lock);
@@ -1188,37 +1245,6 @@ refill_inactive_zone(struct zone *zone, struct scan_control *sc)
1188 zone->nr_active -= pgmoved; 1245 zone->nr_active -= pgmoved;
1189 spin_unlock_irq(&zone->lru_lock); 1246 spin_unlock_irq(&zone->lru_lock);
1190 1247
1191 /*
1192 * `distress' is a measure of how much trouble we're having reclaiming
1193 * pages. 0 -> no problems. 100 -> great trouble.
1194 */
1195 distress = 100 >> zone->prev_priority;
1196
1197 /*
1198 * The point of this algorithm is to decide when to start reclaiming
1199 * mapped memory instead of just pagecache. Work out how much memory
1200 * is mapped.
1201 */
1202 mapped_ratio = (sc->nr_mapped * 100) / total_memory;
1203
1204 /*
1205 * Now decide how much we really want to unmap some pages. The mapped
1206 * ratio is downgraded - just because there's a lot of mapped memory
1207 * doesn't necessarily mean that page reclaim isn't succeeding.
1208 *
1209 * The distress ratio is important - we don't want to start going oom.
1210 *
1211 * A 100% value of vm_swappiness overrides this algorithm altogether.
1212 */
1213 swap_tendency = mapped_ratio / 2 + distress + vm_swappiness;
1214
1215 /*
1216 * Now use this metric to decide whether to start moving mapped memory
1217 * onto the inactive list.
1218 */
1219 if (swap_tendency >= 100)
1220 reclaim_mapped = 1;
1221
1222 while (!list_empty(&l_hold)) { 1248 while (!list_empty(&l_hold)) {
1223 cond_resched(); 1249 cond_resched();
1224 page = lru_to_page(&l_hold); 1250 page = lru_to_page(&l_hold);
@@ -1595,9 +1621,7 @@ scan:
1595 sc.nr_reclaimed = 0; 1621 sc.nr_reclaimed = 0;
1596 sc.priority = priority; 1622 sc.priority = priority;
1597 sc.swap_cluster_max = nr_pages? nr_pages : SWAP_CLUSTER_MAX; 1623 sc.swap_cluster_max = nr_pages? nr_pages : SWAP_CLUSTER_MAX;
1598 atomic_inc(&zone->reclaim_in_progress);
1599 shrink_zone(zone, &sc); 1624 shrink_zone(zone, &sc);
1600 atomic_dec(&zone->reclaim_in_progress);
1601 reclaim_state->reclaimed_slab = 0; 1625 reclaim_state->reclaimed_slab = 0;
1602 nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL, 1626 nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL,
1603 lru_pages); 1627 lru_pages);
diff --git a/net/802/p8023.c b/net/802/p8023.c
index d23e906456eb..53cf05709283 100644
--- a/net/802/p8023.c
+++ b/net/802/p8023.c
@@ -59,3 +59,5 @@ void destroy_8023_client(struct datalink_proto *dl)
59 59
60EXPORT_SYMBOL(destroy_8023_client); 60EXPORT_SYMBOL(destroy_8023_client);
61EXPORT_SYMBOL(make_8023_client); 61EXPORT_SYMBOL(make_8023_client);
62
63MODULE_LICENSE("GPL");
diff --git a/net/atm/signaling.c b/net/atm/signaling.c
index e7211a7f382c..93ad59a28ef5 100644
--- a/net/atm/signaling.c
+++ b/net/atm/signaling.c
@@ -56,7 +56,8 @@ static void sigd_put_skb(struct sk_buff *skb)
56 remove_wait_queue(&sigd_sleep,&wait); 56 remove_wait_queue(&sigd_sleep,&wait);
57#else 57#else
58 if (!sigd) { 58 if (!sigd) {
59 printk(KERN_WARNING "atmsvc: no signaling demon\n"); 59 if (net_ratelimit())
60 printk(KERN_WARNING "atmsvc: no signaling demon\n");
60 kfree_skb(skb); 61 kfree_skb(skb);
61 return; 62 return;
62 } 63 }
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index bdb6458c6bd5..97bdec73d17e 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -143,13 +143,15 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
143static int hci_sock_release(struct socket *sock) 143static int hci_sock_release(struct socket *sock)
144{ 144{
145 struct sock *sk = sock->sk; 145 struct sock *sk = sock->sk;
146 struct hci_dev *hdev = hci_pi(sk)->hdev; 146 struct hci_dev *hdev;
147 147
148 BT_DBG("sock %p sk %p", sock, sk); 148 BT_DBG("sock %p sk %p", sock, sk);
149 149
150 if (!sk) 150 if (!sk)
151 return 0; 151 return 0;
152 152
153 hdev = hci_pi(sk)->hdev;
154
153 bt_sock_unlink(&hci_sk_list, sk); 155 bt_sock_unlink(&hci_sk_list, sk);
154 156
155 if (hdev) { 157 if (hdev) {
@@ -311,14 +313,18 @@ static int hci_sock_getname(struct socket *sock, struct sockaddr *addr, int *add
311{ 313{
312 struct sockaddr_hci *haddr = (struct sockaddr_hci *) addr; 314 struct sockaddr_hci *haddr = (struct sockaddr_hci *) addr;
313 struct sock *sk = sock->sk; 315 struct sock *sk = sock->sk;
316 struct hci_dev *hdev = hci_pi(sk)->hdev;
314 317
315 BT_DBG("sock %p sk %p", sock, sk); 318 BT_DBG("sock %p sk %p", sock, sk);
316 319
320 if (!hdev)
321 return -EBADFD;
322
317 lock_sock(sk); 323 lock_sock(sk);
318 324
319 *addr_len = sizeof(*haddr); 325 *addr_len = sizeof(*haddr);
320 haddr->hci_family = AF_BLUETOOTH; 326 haddr->hci_family = AF_BLUETOOTH;
321 haddr->hci_dev = hci_pi(sk)->hdev->id; 327 haddr->hci_dev = hdev->id;
322 328
323 release_sock(sk); 329 release_sock(sk);
324 return 0; 330 return 0;
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 0d89d6434136..5b4253c61f62 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -46,13 +46,15 @@
46#include <net/bluetooth/l2cap.h> 46#include <net/bluetooth/l2cap.h>
47#include <net/bluetooth/rfcomm.h> 47#include <net/bluetooth/rfcomm.h>
48 48
49#define VERSION "1.6"
50
51#ifndef CONFIG_BT_RFCOMM_DEBUG 49#ifndef CONFIG_BT_RFCOMM_DEBUG
52#undef BT_DBG 50#undef BT_DBG
53#define BT_DBG(D...) 51#define BT_DBG(D...)
54#endif 52#endif
55 53
54#define VERSION "1.7"
55
56static unsigned int l2cap_mtu = RFCOMM_MAX_L2CAP_MTU;
57
56static struct task_struct *rfcomm_thread; 58static struct task_struct *rfcomm_thread;
57 59
58static DECLARE_MUTEX(rfcomm_sem); 60static DECLARE_MUTEX(rfcomm_sem);
@@ -623,7 +625,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst
623 /* Set L2CAP options */ 625 /* Set L2CAP options */
624 sk = sock->sk; 626 sk = sock->sk;
625 lock_sock(sk); 627 lock_sock(sk);
626 l2cap_pi(sk)->imtu = RFCOMM_MAX_L2CAP_MTU; 628 l2cap_pi(sk)->imtu = l2cap_mtu;
627 release_sock(sk); 629 release_sock(sk);
628 630
629 s = rfcomm_session_add(sock, BT_BOUND); 631 s = rfcomm_session_add(sock, BT_BOUND);
@@ -1868,7 +1870,7 @@ static int rfcomm_add_listener(bdaddr_t *ba)
1868 /* Set L2CAP options */ 1870 /* Set L2CAP options */
1869 sk = sock->sk; 1871 sk = sock->sk;
1870 lock_sock(sk); 1872 lock_sock(sk);
1871 l2cap_pi(sk)->imtu = RFCOMM_MAX_L2CAP_MTU; 1873 l2cap_pi(sk)->imtu = l2cap_mtu;
1872 release_sock(sk); 1874 release_sock(sk);
1873 1875
1874 /* Start listening on the socket */ 1876 /* Start listening on the socket */
@@ -2070,6 +2072,9 @@ static void __exit rfcomm_exit(void)
2070module_init(rfcomm_init); 2072module_init(rfcomm_init);
2071module_exit(rfcomm_exit); 2073module_exit(rfcomm_exit);
2072 2074
2075module_param(l2cap_mtu, uint, 0644);
2076MODULE_PARM_DESC(l2cap_mtu, "Default MTU for the L2CAP connection");
2077
2073MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>"); 2078MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>");
2074MODULE_DESCRIPTION("Bluetooth RFCOMM ver " VERSION); 2079MODULE_DESCRIPTION("Bluetooth RFCOMM ver " VERSION);
2075MODULE_VERSION(VERSION); 2080MODULE_VERSION(VERSION);
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..6bb0c7eb1ef0 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
@@ -782,8 +805,8 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb,
782print_error: 805print_error:
783 if (skb->dev != NULL) { 806 if (skb->dev != NULL) {
784 printk("[%s]", skb->dev->name); 807 printk("[%s]", skb->dev->name);
785 if (has_bridge_parent(skb->dev)) 808 if (realoutdev)
786 printk("[%s]", bridge_parent(skb->dev)->name); 809 printk("[%s]", realoutdev->name);
787 } 810 }
788 printk(" head:%p, raw:%p, data:%p\n", skb->head, skb->mac.raw, 811 printk(" head:%p, raw:%p, data:%p\n", skb->head, skb->mac.raw,
789 skb->data); 812 skb->data);
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_stp_if.c b/net/bridge/br_stp_if.c
index cc047f7fb6ef..35cf3a074087 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -67,7 +67,7 @@ void br_stp_disable_bridge(struct net_bridge *br)
67{ 67{
68 struct net_bridge_port *p; 68 struct net_bridge_port *p;
69 69
70 spin_lock(&br->lock); 70 spin_lock_bh(&br->lock);
71 list_for_each_entry(p, &br->port_list, list) { 71 list_for_each_entry(p, &br->port_list, list) {
72 if (p->state != BR_STATE_DISABLED) 72 if (p->state != BR_STATE_DISABLED)
73 br_stp_disable_port(p); 73 br_stp_disable_port(p);
@@ -76,7 +76,7 @@ void br_stp_disable_bridge(struct net_bridge *br)
76 76
77 br->topology_change = 0; 77 br->topology_change = 0;
78 br->topology_change_detected = 0; 78 br->topology_change_detected = 0;
79 spin_unlock(&br->lock); 79 spin_unlock_bh(&br->lock);
80 80
81 del_timer_sync(&br->hello_timer); 81 del_timer_sync(&br->hello_timer);
82 del_timer_sync(&br->topology_change_timer); 82 del_timer_sync(&br->topology_change_timer);
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/datagram.c b/net/core/datagram.c
index f8d322e1ea92..b8ce6bf81188 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -247,49 +247,74 @@ EXPORT_SYMBOL(skb_kill_datagram);
247int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset, 247int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset,
248 struct iovec *to, int len) 248 struct iovec *to, int len)
249{ 249{
250 int i, err, fraglen, end = 0; 250 int start = skb_headlen(skb);
251 struct sk_buff *next = skb_shinfo(skb)->frag_list; 251 int i, copy = start - offset;
252 252
253 if (!len) 253 /* Copy header. */
254 return 0; 254 if (copy > 0) {
255 if (copy > len)
256 copy = len;
257 if (memcpy_toiovec(to, skb->data + offset, copy))
258 goto fault;
259 if ((len -= copy) == 0)
260 return 0;
261 offset += copy;
262 }
255 263
256next_skb: 264 /* Copy paged appendix. Hmm... why does this look so complicated? */
257 fraglen = skb_headlen(skb); 265 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
258 i = -1; 266 int end;
259 267
260 while (1) { 268 BUG_TRAP(start <= offset + len);
261 int start = end;
262 269
263 if ((end += fraglen) > offset) { 270 end = start + skb_shinfo(skb)->frags[i].size;
264 int copy = end - offset, o = offset - start; 271 if ((copy = end - offset) > 0) {
272 int err;
273 u8 *vaddr;
274 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
275 struct page *page = frag->page;
265 276
266 if (copy > len) 277 if (copy > len)
267 copy = len; 278 copy = len;
268 if (i == -1) 279 vaddr = kmap(page);
269 err = memcpy_toiovec(to, skb->data + o, copy); 280 err = memcpy_toiovec(to, vaddr + frag->page_offset +
270 else { 281 offset - start, copy);
271 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 282 kunmap(page);
272 struct page *page = frag->page;
273 void *p = kmap(page) + frag->page_offset + o;
274 err = memcpy_toiovec(to, p, copy);
275 kunmap(page);
276 }
277 if (err) 283 if (err)
278 goto fault; 284 goto fault;
279 if (!(len -= copy)) 285 if (!(len -= copy))
280 return 0; 286 return 0;
281 offset += copy; 287 offset += copy;
282 } 288 }
283 if (++i >= skb_shinfo(skb)->nr_frags) 289 start = end;
284 break;
285 fraglen = skb_shinfo(skb)->frags[i].size;
286 } 290 }
287 if (next) { 291
288 skb = next; 292 if (skb_shinfo(skb)->frag_list) {
289 BUG_ON(skb_shinfo(skb)->frag_list); 293 struct sk_buff *list = skb_shinfo(skb)->frag_list;
290 next = skb->next; 294
291 goto next_skb; 295 for (; list; list = list->next) {
296 int end;
297
298 BUG_TRAP(start <= offset + len);
299
300 end = start + list->len;
301 if ((copy = end - offset) > 0) {
302 if (copy > len)
303 copy = len;
304 if (skb_copy_datagram_iovec(list,
305 offset - start,
306 to, copy))
307 goto fault;
308 if ((len -= copy) == 0)
309 return 0;
310 offset += copy;
311 }
312 start = end;
313 }
292 } 314 }
315 if (!len)
316 return 0;
317
293fault: 318fault:
294 return -EFAULT; 319 return -EFAULT;
295} 320}
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/core/skbuff.c b/net/core/skbuff.c
index 6766f118f070..2144952d1c6c 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -411,6 +411,9 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
411 C(pkt_type); 411 C(pkt_type);
412 C(ip_summed); 412 C(ip_summed);
413 C(priority); 413 C(priority);
414#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
415 C(ipvs_property);
416#endif
414 C(protocol); 417 C(protocol);
415 n->destructor = NULL; 418 n->destructor = NULL;
416#ifdef CONFIG_NETFILTER 419#ifdef CONFIG_NETFILTER
@@ -422,13 +425,6 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
422 C(nfct_reasm); 425 C(nfct_reasm);
423 nf_conntrack_get_reasm(skb->nfct_reasm); 426 nf_conntrack_get_reasm(skb->nfct_reasm);
424#endif 427#endif
425#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
426 C(ipvs_property);
427#endif
428#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
429 C(nfct_reasm);
430 nf_conntrack_get_reasm(skb->nfct_reasm);
431#endif
432#ifdef CONFIG_BRIDGE_NETFILTER 428#ifdef CONFIG_BRIDGE_NETFILTER
433 C(nf_bridge); 429 C(nf_bridge);
434 nf_bridge_get(skb->nf_bridge); 430 nf_bridge_get(skb->nf_bridge);
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/icmp.c b/net/ipv4/icmp.c
index 4d1c40972a4b..e7bbff4340bb 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -192,7 +192,7 @@ int sysctl_icmp_echo_ignore_all;
192int sysctl_icmp_echo_ignore_broadcasts = 1; 192int sysctl_icmp_echo_ignore_broadcasts = 1;
193 193
194/* Control parameter - ignore bogus broadcast responses? */ 194/* Control parameter - ignore bogus broadcast responses? */
195int sysctl_icmp_ignore_bogus_error_responses; 195int sysctl_icmp_ignore_bogus_error_responses = 1;
196 196
197/* 197/*
198 * Configurable global rate limit. 198 * Configurable global rate limit.
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index abe23923e4e7..9981dcd68f11 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -830,7 +830,8 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
830 skb->h.raw = skb->nh.raw; 830 skb->h.raw = skb->nh.raw;
831 skb->nh.raw = skb_push(skb, gre_hlen); 831 skb->nh.raw = skb_push(skb, gre_hlen);
832 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 832 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
833 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE|IPSKB_XFRM_TRANSFORMED); 833 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
834 IPSKB_REROUTED);
834 dst_release(skb->dst); 835 dst_release(skb->dst);
835 skb->dst = &rt->u.dst; 836 skb->dst = &rt->u.dst;
836 837
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 3324fbfe528a..57d290d89ec2 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -207,8 +207,10 @@ static inline int ip_finish_output(struct sk_buff *skb)
207{ 207{
208#if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM) 208#if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM)
209 /* Policy lookup after SNAT yielded a new policy */ 209 /* Policy lookup after SNAT yielded a new policy */
210 if (skb->dst->xfrm != NULL) 210 if (skb->dst->xfrm != NULL) {
211 return xfrm4_output_finish(skb); 211 IPCB(skb)->flags |= IPSKB_REROUTED;
212 return dst_output(skb);
213 }
212#endif 214#endif
213 if (skb->len > dst_mtu(skb->dst) && 215 if (skb->len > dst_mtu(skb->dst) &&
214 !(skb_shinfo(skb)->ufo_size || skb_shinfo(skb)->tso_size)) 216 !(skb_shinfo(skb)->ufo_size || skb_shinfo(skb)->tso_size))
@@ -271,8 +273,9 @@ int ip_mc_output(struct sk_buff *skb)
271 newskb->dev, ip_dev_loopback_xmit); 273 newskb->dev, ip_dev_loopback_xmit);
272 } 274 }
273 275
274 return NF_HOOK(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dev, 276 return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dev,
275 ip_finish_output); 277 ip_finish_output,
278 !(IPCB(skb)->flags & IPSKB_REROUTED));
276} 279}
277 280
278int ip_output(struct sk_buff *skb) 281int ip_output(struct sk_buff *skb)
@@ -284,8 +287,9 @@ int ip_output(struct sk_buff *skb)
284 skb->dev = dev; 287 skb->dev = dev;
285 skb->protocol = htons(ETH_P_IP); 288 skb->protocol = htons(ETH_P_IP);
286 289
287 return NF_HOOK(PF_INET, NF_IP_POST_ROUTING, skb, NULL, dev, 290 return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, dev,
288 ip_finish_output); 291 ip_finish_output,
292 !(IPCB(skb)->flags & IPSKB_REROUTED));
289} 293}
290 294
291int ip_queue_xmit(struct sk_buff *skb, int ipfragok) 295int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index e5cbe72c6b80..03d13742a4b8 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -622,7 +622,8 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
622 skb->h.raw = skb->nh.raw; 622 skb->h.raw = skb->nh.raw;
623 skb->nh.raw = skb_push(skb, sizeof(struct iphdr)); 623 skb->nh.raw = skb_push(skb, sizeof(struct iphdr));
624 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 624 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
625 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE|IPSKB_XFRM_TRANSFORMED); 625 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
626 IPSKB_REROUTED);
626 dst_release(skb->dst); 627 dst_release(skb->dst);
627 skb->dst = &rt->u.dst; 628 skb->dst = &rt->u.dst;
628 629
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index 52a3d7c57907..ed42cdc57cd9 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -78,6 +78,47 @@ int ip_route_me_harder(struct sk_buff **pskb)
78} 78}
79EXPORT_SYMBOL(ip_route_me_harder); 79EXPORT_SYMBOL(ip_route_me_harder);
80 80
81#ifdef CONFIG_XFRM
82int ip_xfrm_me_harder(struct sk_buff **pskb)
83{
84 struct flowi fl;
85 unsigned int hh_len;
86 struct dst_entry *dst;
87
88 if (IPCB(*pskb)->flags & IPSKB_XFRM_TRANSFORMED)
89 return 0;
90 if (xfrm_decode_session(*pskb, &fl, AF_INET) < 0)
91 return -1;
92
93 dst = (*pskb)->dst;
94 if (dst->xfrm)
95 dst = ((struct xfrm_dst *)dst)->route;
96 dst_hold(dst);
97
98 if (xfrm_lookup(&dst, &fl, (*pskb)->sk, 0) < 0)
99 return -1;
100
101 dst_release((*pskb)->dst);
102 (*pskb)->dst = dst;
103
104 /* Change in oif may mean change in hh_len. */
105 hh_len = (*pskb)->dst->dev->hard_header_len;
106 if (skb_headroom(*pskb) < hh_len) {
107 struct sk_buff *nskb;
108
109 nskb = skb_realloc_headroom(*pskb, hh_len);
110 if (!nskb)
111 return -1;
112 if ((*pskb)->sk)
113 skb_set_owner_w(nskb, (*pskb)->sk);
114 kfree_skb(*pskb);
115 *pskb = nskb;
116 }
117 return 0;
118}
119EXPORT_SYMBOL(ip_xfrm_me_harder);
120#endif
121
81void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); 122void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
82EXPORT_SYMBOL(ip_nat_decode_session); 123EXPORT_SYMBOL(ip_nat_decode_session);
83 124
diff --git a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c
index c1a61462507f..1741d555ad0d 100644
--- a/net/ipv4/netfilter/ip_nat_core.c
+++ b/net/ipv4/netfilter/ip_nat_core.c
@@ -434,6 +434,7 @@ int ip_nat_icmp_reply_translation(struct sk_buff **pskb,
434 } *inside; 434 } *inside;
435 struct ip_conntrack_tuple inner, target; 435 struct ip_conntrack_tuple inner, target;
436 int hdrlen = (*pskb)->nh.iph->ihl * 4; 436 int hdrlen = (*pskb)->nh.iph->ihl * 4;
437 unsigned long statusbit;
437 438
438 if (!skb_make_writable(pskb, hdrlen + sizeof(*inside))) 439 if (!skb_make_writable(pskb, hdrlen + sizeof(*inside)))
439 return 0; 440 return 0;
@@ -495,17 +496,16 @@ int ip_nat_icmp_reply_translation(struct sk_buff **pskb,
495 496
496 /* Change outer to look the reply to an incoming packet 497 /* Change outer to look the reply to an incoming packet
497 * (proto 0 means don't invert per-proto part). */ 498 * (proto 0 means don't invert per-proto part). */
499 if (manip == IP_NAT_MANIP_SRC)
500 statusbit = IPS_SRC_NAT;
501 else
502 statusbit = IPS_DST_NAT;
498 503
499 /* Obviously, we need to NAT destination IP, but source IP 504 /* Invert if this is reply dir. */
500 should be NAT'ed only if it is from a NAT'd host. 505 if (dir == IP_CT_DIR_REPLY)
506 statusbit ^= IPS_NAT_MASK;
501 507
502 Explanation: some people use NAT for anonymizing. Also, 508 if (ct->status & statusbit) {
503 CERT recommends dropping all packets from private IP
504 addresses (although ICMP errors from internal links with
505 such addresses are not too uncommon, as Alan Cox points
506 out) */
507 if (manip != IP_NAT_MANIP_SRC
508 || ((*pskb)->nh.iph->saddr == ct->tuplehash[dir].tuple.src.ip)) {
509 invert_tuplepr(&target, &ct->tuplehash[!dir].tuple); 509 invert_tuplepr(&target, &ct->tuplehash[!dir].tuple);
510 if (!manip_pkt(0, pskb, 0, &target, manip)) 510 if (!manip_pkt(0, pskb, 0, &target, manip))
511 return 0; 511 return 0;
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
index 92c54999a19d..ab1f88fa21ec 100644
--- a/net/ipv4/netfilter/ip_nat_standalone.c
+++ b/net/ipv4/netfilter/ip_nat_standalone.c
@@ -200,20 +200,14 @@ ip_nat_in(unsigned int hooknum,
200 const struct net_device *out, 200 const struct net_device *out,
201 int (*okfn)(struct sk_buff *)) 201 int (*okfn)(struct sk_buff *))
202{ 202{
203 struct ip_conntrack *ct;
204 enum ip_conntrack_info ctinfo;
205 unsigned int ret; 203 unsigned int ret;
204 u_int32_t daddr = (*pskb)->nh.iph->daddr;
206 205
207 ret = ip_nat_fn(hooknum, pskb, in, out, okfn); 206 ret = ip_nat_fn(hooknum, pskb, in, out, okfn);
208 if (ret != NF_DROP && ret != NF_STOLEN 207 if (ret != NF_DROP && ret != NF_STOLEN
209 && (ct = ip_conntrack_get(*pskb, &ctinfo)) != NULL) { 208 && daddr != (*pskb)->nh.iph->daddr) {
210 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); 209 dst_release((*pskb)->dst);
211 210 (*pskb)->dst = NULL;
212 if (ct->tuplehash[dir].tuple.dst.ip !=
213 ct->tuplehash[!dir].tuple.src.ip) {
214 dst_release((*pskb)->dst);
215 (*pskb)->dst = NULL;
216 }
217 } 211 }
218 return ret; 212 return ret;
219} 213}
@@ -235,19 +229,19 @@ ip_nat_out(unsigned int hooknum,
235 return NF_ACCEPT; 229 return NF_ACCEPT;
236 230
237 ret = ip_nat_fn(hooknum, pskb, in, out, okfn); 231 ret = ip_nat_fn(hooknum, pskb, in, out, okfn);
232#ifdef CONFIG_XFRM
238 if (ret != NF_DROP && ret != NF_STOLEN 233 if (ret != NF_DROP && ret != NF_STOLEN
239 && (ct = ip_conntrack_get(*pskb, &ctinfo)) != NULL) { 234 && (ct = ip_conntrack_get(*pskb, &ctinfo)) != NULL) {
240 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); 235 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
241 236
242 if (ct->tuplehash[dir].tuple.src.ip != 237 if (ct->tuplehash[dir].tuple.src.ip !=
243 ct->tuplehash[!dir].tuple.dst.ip 238 ct->tuplehash[!dir].tuple.dst.ip
244#ifdef CONFIG_XFRM
245 || ct->tuplehash[dir].tuple.src.u.all != 239 || ct->tuplehash[dir].tuple.src.u.all !=
246 ct->tuplehash[!dir].tuple.dst.u.all 240 ct->tuplehash[!dir].tuple.dst.u.all
247#endif
248 ) 241 )
249 return ip_route_me_harder(pskb) == 0 ? ret : NF_DROP; 242 return ip_xfrm_me_harder(pskb) == 0 ? ret : NF_DROP;
250 } 243 }
244#endif
251 return ret; 245 return ret;
252} 246}
253 247
@@ -276,7 +270,7 @@ ip_nat_local_fn(unsigned int hooknum,
276 ct->tuplehash[!dir].tuple.src.ip 270 ct->tuplehash[!dir].tuple.src.ip
277#ifdef CONFIG_XFRM 271#ifdef CONFIG_XFRM
278 || ct->tuplehash[dir].tuple.dst.u.all != 272 || ct->tuplehash[dir].tuple.dst.u.all !=
279 ct->tuplehash[dir].tuple.src.u.all 273 ct->tuplehash[!dir].tuple.src.u.all
280#endif 274#endif
281 ) 275 )
282 return ip_route_me_harder(pskb) == 0 ? ret : NF_DROP; 276 return ip_route_me_harder(pskb) == 0 ? ret : NF_DROP;
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index 167619f638c6..6c8624a54933 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -529,15 +529,10 @@ static int init_or_cleanup(int init)
529 goto cleanup_localinops; 529 goto cleanup_localinops;
530 } 530 }
531#endif 531#endif
532
533 /* For use by REJECT target */
534 ip_ct_attach = __nf_conntrack_attach;
535
536 return ret; 532 return ret;
537 533
538 cleanup: 534 cleanup:
539 synchronize_net(); 535 synchronize_net();
540 ip_ct_attach = NULL;
541#ifdef CONFIG_SYSCTL 536#ifdef CONFIG_SYSCTL
542 unregister_sysctl_table(nf_ct_ipv4_sysctl_header); 537 unregister_sysctl_table(nf_ct_ipv4_sysctl_header);
543 cleanup_localinops: 538 cleanup_localinops:
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_output.c b/net/ipv4/xfrm4_output.c
index d4df0ddd424b..32ad229b4fed 100644
--- a/net/ipv4/xfrm4_output.c
+++ b/net/ipv4/xfrm4_output.c
@@ -152,10 +152,16 @@ error_nolock:
152 goto out_exit; 152 goto out_exit;
153} 153}
154 154
155int xfrm4_output_finish(struct sk_buff *skb) 155static int xfrm4_output_finish(struct sk_buff *skb)
156{ 156{
157 int err; 157 int err;
158 158
159#ifdef CONFIG_NETFILTER
160 if (!skb->dst->xfrm) {
161 IPCB(skb)->flags |= IPSKB_REROUTED;
162 return dst_output(skb);
163 }
164#endif
159 while (likely((err = xfrm4_output_one(skb)) == 0)) { 165 while (likely((err = xfrm4_output_one(skb)) == 0)) {
160 nf_reset(skb); 166 nf_reset(skb);
161 167
@@ -178,6 +184,7 @@ int xfrm4_output_finish(struct sk_buff *skb)
178 184
179int xfrm4_output(struct sk_buff *skb) 185int xfrm4_output(struct sk_buff *skb)
180{ 186{
181 return NF_HOOK(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev, 187 return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev,
182 xfrm4_output_finish); 188 xfrm4_output_finish,
189 !(IPCB(skb)->flags & IPSKB_REROUTED));
183} 190}
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index fcf883183cef..21eb725e885f 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -42,6 +42,7 @@
42#include <linux/net.h> 42#include <linux/net.h>
43#include <linux/skbuff.h> 43#include <linux/skbuff.h>
44#include <linux/init.h> 44#include <linux/init.h>
45#include <linux/netfilter.h>
45 46
46#ifdef CONFIG_SYSCTL 47#ifdef CONFIG_SYSCTL
47#include <linux/sysctl.h> 48#include <linux/sysctl.h>
@@ -255,6 +256,7 @@ out:
255struct icmpv6_msg { 256struct icmpv6_msg {
256 struct sk_buff *skb; 257 struct sk_buff *skb;
257 int offset; 258 int offset;
259 uint8_t type;
258}; 260};
259 261
260static int icmpv6_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb) 262static int icmpv6_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb)
@@ -266,6 +268,8 @@ static int icmpv6_getfrag(void *from, char *to, int offset, int len, int odd, st
266 csum = skb_copy_and_csum_bits(org_skb, msg->offset + offset, 268 csum = skb_copy_and_csum_bits(org_skb, msg->offset + offset,
267 to, len, csum); 269 to, len, csum);
268 skb->csum = csum_block_add(skb->csum, csum, odd); 270 skb->csum = csum_block_add(skb->csum, csum, odd);
271 if (!(msg->type & ICMPV6_INFOMSG_MASK))
272 nf_ct_attach(skb, org_skb);
269 return 0; 273 return 0;
270} 274}
271 275
@@ -403,6 +407,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
403 407
404 msg.skb = skb; 408 msg.skb = skb;
405 msg.offset = skb->nh.raw - skb->data; 409 msg.offset = skb->nh.raw - skb->data;
410 msg.type = type;
406 411
407 len = skb->len - msg.offset; 412 len = skb->len - msg.offset;
408 len = min_t(unsigned int, len, IPV6_MIN_MTU - sizeof(struct ipv6hdr) -sizeof(struct icmp6hdr)); 413 len = min_t(unsigned int, len, IPV6_MIN_MTU - sizeof(struct ipv6hdr) -sizeof(struct icmp6hdr));
@@ -500,6 +505,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
500 505
501 msg.skb = skb; 506 msg.skb = skb;
502 msg.offset = 0; 507 msg.offset = 0;
508 msg.type = ICMPV6_ECHO_REPLY;
503 509
504 err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr), 510 err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr),
505 sizeof(struct icmp6hdr), hlimit, tclass, NULL, &fl, 511 sizeof(struct icmp6hdr), hlimit, tclass, NULL, &fl,
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 92ead3cf956b..faea8a120ee2 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -458,7 +458,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
458 mtu = IPV6_MIN_MTU; 458 mtu = IPV6_MIN_MTU;
459 t->dev->mtu = mtu; 459 t->dev->mtu = mtu;
460 460
461 if ((len = sizeof (*ipv6h) + ipv6h->payload_len) > mtu) { 461 if ((len = sizeof (*ipv6h) + ntohs(ipv6h->payload_len)) > mtu) {
462 rel_type = ICMPV6_PKT_TOOBIG; 462 rel_type = ICMPV6_PKT_TOOBIG;
463 rel_code = 0; 463 rel_code = 0;
464 rel_info = mtu; 464 rel_info = mtu;
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index c745717b4ce2..0e6d1d4bbd5c 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -160,6 +160,8 @@ static void send_reset(struct sk_buff *oldskb)
160 csum_partial((char *)tcph, 160 csum_partial((char *)tcph,
161 sizeof(struct tcphdr), 0)); 161 sizeof(struct tcphdr), 0));
162 162
163 nf_ct_attach(nskb, oldskb);
164
163 NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, nskb, NULL, nskb->dst->dev, 165 NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, nskb, NULL, nskb->dst->dev,
164 dst_output); 166 dst_output);
165} 167}
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 738376cf0c51..ae20a0ec9bd8 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -803,10 +803,7 @@ back_from_confirm:
803 err = rawv6_push_pending_frames(sk, &fl, rp); 803 err = rawv6_push_pending_frames(sk, &fl, rp);
804 } 804 }
805done: 805done:
806 ip6_dst_store(sk, dst, 806 dst_release(dst);
807 ipv6_addr_equal(&fl.fl6_dst, &np->daddr) ?
808 &np->daddr : NULL);
809
810 release_sock(sk); 807 release_sock(sk);
811out: 808out:
812 fl6_sock_release(flowlabel); 809 fl6_sock_release(flowlabel);
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/netfilter/Kconfig b/net/netfilter/Kconfig
index 99c0a0fa4a97..a8e5544da93e 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -102,8 +102,6 @@ config NF_CT_NETLINK
102 help 102 help
103 This option enables support for a netlink-based userspace interface 103 This option enables support for a netlink-based userspace interface
104 104
105endmenu
106
107config NETFILTER_XTABLES 105config NETFILTER_XTABLES
108 tristate "Netfilter Xtables support (required for ip_tables)" 106 tristate "Netfilter Xtables support (required for ip_tables)"
109 help 107 help
@@ -128,7 +126,7 @@ config NETFILTER_XT_TARGET_CONNMARK
128 tristate '"CONNMARK" target support' 126 tristate '"CONNMARK" target support'
129 depends on NETFILTER_XTABLES 127 depends on NETFILTER_XTABLES
130 depends on IP_NF_MANGLE || IP6_NF_MANGLE 128 depends on IP_NF_MANGLE || IP6_NF_MANGLE
131 depends on (IP_NF_CONNTRACK && IP_NF_CONNTRACK_MARK) || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4) 129 depends on (IP_NF_CONNTRACK && IP_NF_CONNTRACK_MARK) || (NF_CONNTRACK_MARK && NF_CONNTRACK)
132 help 130 help
133 This option adds a `CONNMARK' target, which allows one to manipulate 131 This option adds a `CONNMARK' target, which allows one to manipulate
134 the connection mark value. Similar to the MARK target, but 132 the connection mark value. Similar to the MARK target, but
@@ -189,7 +187,7 @@ config NETFILTER_XT_MATCH_COMMENT
189config NETFILTER_XT_MATCH_CONNBYTES 187config NETFILTER_XT_MATCH_CONNBYTES
190 tristate '"connbytes" per-connection counter match support' 188 tristate '"connbytes" per-connection counter match support'
191 depends on NETFILTER_XTABLES 189 depends on NETFILTER_XTABLES
192 depends on (IP_NF_CONNTRACK && IP_NF_CT_ACCT) || NF_CT_ACCT 190 depends on (IP_NF_CONNTRACK && IP_NF_CT_ACCT) || (NF_CT_ACCT && NF_CONNTRACK)
193 help 191 help
194 This option adds a `connbytes' match, which allows you to match the 192 This option adds a `connbytes' match, which allows you to match the
195 number of bytes and/or packets for each direction within a connection. 193 number of bytes and/or packets for each direction within a connection.
@@ -200,7 +198,7 @@ config NETFILTER_XT_MATCH_CONNBYTES
200config NETFILTER_XT_MATCH_CONNMARK 198config NETFILTER_XT_MATCH_CONNMARK
201 tristate '"connmark" connection mark match support' 199 tristate '"connmark" connection mark match support'
202 depends on NETFILTER_XTABLES 200 depends on NETFILTER_XTABLES
203 depends on (IP_NF_CONNTRACK && IP_NF_CONNTRACK_MARK) || NF_CONNTRACK_MARK 201 depends on (IP_NF_CONNTRACK && IP_NF_CONNTRACK_MARK) || (NF_CONNTRACK_MARK && NF_CONNTRACK)
204 help 202 help
205 This option adds a `connmark' match, which allows you to match the 203 This option adds a `connmark' match, which allows you to match the
206 connection mark value previously set for the session by `CONNMARK'. 204 connection mark value previously set for the session by `CONNMARK'.
@@ -361,3 +359,5 @@ config NETFILTER_XT_MATCH_TCPMSS
361 359
362 To compile it as a module, choose M here. If unsure, say N. 360 To compile it as a module, choose M here. If unsure, say N.
363 361
362endmenu
363
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 0ce337a1d974..d622ddf08bb0 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1556,6 +1556,8 @@ void nf_conntrack_cleanup(void)
1556{ 1556{
1557 int i; 1557 int i;
1558 1558
1559 ip_ct_attach = NULL;
1560
1559 /* This makes sure all current packets have passed through 1561 /* This makes sure all current packets have passed through
1560 netfilter framework. Roll on, two-stage module 1562 netfilter framework. Roll on, two-stage module
1561 delete... */ 1563 delete... */
@@ -1715,6 +1717,9 @@ int __init nf_conntrack_init(void)
1715 nf_ct_l3protos[i] = &nf_conntrack_generic_l3proto; 1717 nf_ct_l3protos[i] = &nf_conntrack_generic_l3proto;
1716 write_unlock_bh(&nf_conntrack_lock); 1718 write_unlock_bh(&nf_conntrack_lock);
1717 1719
1720 /* For use by REJECT target */
1721 ip_ct_attach = __nf_conntrack_attach;
1722
1718 /* Set up fake conntrack: 1723 /* Set up fake conntrack:
1719 - to never be deleted, not in any hashes */ 1724 - to never be deleted, not in any hashes */
1720 atomic_set(&nf_conntrack_untracked.ct_general.use, 1); 1725 atomic_set(&nf_conntrack_untracked.ct_general.use, 1);
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index df99138c3b3b..6492ed66fb3c 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -864,7 +864,9 @@ static int csum6(const struct sk_buff *skb, unsigned int dataoff)
864{ 864{
865 return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr, 865 return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
866 skb->len - dataoff, IPPROTO_TCP, 866 skb->len - dataoff, IPPROTO_TCP,
867 skb->ip_summed == CHECKSUM_HW ? skb->csum 867 skb->ip_summed == CHECKSUM_HW
868 ? csum_sub(skb->csum,
869 skb_checksum(skb, 0, dataoff, 0))
868 : skb_checksum(skb, dataoff, skb->len - dataoff, 870 : skb_checksum(skb, dataoff, skb->len - dataoff,
869 0)); 871 0));
870} 872}
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
index 4264dd079a16..831d206344e0 100644
--- a/net/netfilter/nf_conntrack_proto_udp.c
+++ b/net/netfilter/nf_conntrack_proto_udp.c
@@ -161,7 +161,9 @@ static int csum6(const struct sk_buff *skb, unsigned int dataoff)
161{ 161{
162 return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr, 162 return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
163 skb->len - dataoff, IPPROTO_UDP, 163 skb->len - dataoff, IPPROTO_UDP,
164 skb->ip_summed == CHECKSUM_HW ? skb->csum 164 skb->ip_summed == CHECKSUM_HW
165 ? csum_sub(skb->csum,
166 skb_checksum(skb, 0, dataoff, 0))
165 : skb_checksum(skb, dataoff, skb->len - dataoff, 167 : skb_checksum(skb, dataoff, skb->len - dataoff,
166 0)); 168 0));
167} 169}
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/netlink/genetlink.c b/net/netlink/genetlink.c
index 4ae1538c54a9..43e72419c868 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -238,7 +238,7 @@ int genl_register_family(struct genl_family *family)
238 sizeof(struct nlattr *), GFP_KERNEL); 238 sizeof(struct nlattr *), GFP_KERNEL);
239 if (family->attrbuf == NULL) { 239 if (family->attrbuf == NULL) {
240 err = -ENOMEM; 240 err = -ENOMEM;
241 goto errout; 241 goto errout_locked;
242 } 242 }
243 } else 243 } else
244 family->attrbuf = NULL; 244 family->attrbuf = NULL;
@@ -288,7 +288,7 @@ int genl_unregister_family(struct genl_family *family)
288 return -ENOENT; 288 return -ENOENT;
289} 289}
290 290
291static inline int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, 291static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
292 int *errp) 292 int *errp)
293{ 293{
294 struct genl_ops *ops; 294 struct genl_ops *ops;
@@ -375,7 +375,7 @@ static void genl_rcv(struct sock *sk, int len)
375 do { 375 do {
376 if (genl_trylock()) 376 if (genl_trylock())
377 return; 377 return;
378 netlink_run_queue(sk, &qlen, &genl_rcv_msg); 378 netlink_run_queue(sk, &qlen, genl_rcv_msg);
379 genl_unlock(); 379 genl_unlock();
380 } while (qlen && genl_sock && genl_sock->sk_receive_queue.qlen); 380 } while (qlen && genl_sock && genl_sock->sk_receive_queue.qlen);
381} 381}
@@ -549,10 +549,8 @@ static int __init genl_init(void)
549 netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV); 549 netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV);
550 genl_sock = netlink_kernel_create(NETLINK_GENERIC, GENL_MAX_ID, 550 genl_sock = netlink_kernel_create(NETLINK_GENERIC, GENL_MAX_ID,
551 genl_rcv, THIS_MODULE); 551 genl_rcv, THIS_MODULE);
552 if (genl_sock == NULL) { 552 if (genl_sock == NULL)
553 panic("GENL: Cannot initialize generic netlink\n"); 553 panic("GENL: Cannot initialize generic netlink\n");
554 return -ENOMEM;
555 }
556 554
557 return 0; 555 return 0;
558 556
@@ -560,7 +558,6 @@ errout_register:
560 genl_unregister_family(&genl_ctrl); 558 genl_unregister_family(&genl_ctrl);
561errout: 559errout:
562 panic("GENL: Cannot register controller: %d\n", err); 560 panic("GENL: Cannot register controller: %d\n", err);
563 return err;
564} 561}
565 562
566subsys_initcall(genl_init); 563subsys_initcall(genl_init);
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index dbf4620768d6..5e6b05ac1260 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -885,11 +885,11 @@ restart:
885 * We can't enlist stable bundles either. 885 * We can't enlist stable bundles either.
886 */ 886 */
887 write_unlock_bh(&policy->lock); 887 write_unlock_bh(&policy->lock);
888
889 xfrm_pol_put(policy);
890 if (dst) 888 if (dst)
891 dst_free(dst); 889 dst_free(dst);
892 goto restart; 890
891 err = -EHOSTUNREACH;
892 goto error;
893 } 893 }
894 dst->next = policy->bundles; 894 dst->next = policy->bundles;
895 policy->bundles = dst; 895 policy->bundles = dst;
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c
index 418c6d4e5daf..a529b62972b4 100644
--- a/sound/core/control_compat.c
+++ b/sound/core/control_compat.c
@@ -167,7 +167,7 @@ static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id,
167 int *countp) 167 int *countp)
168{ 168{
169 struct snd_kcontrol *kctl; 169 struct snd_kcontrol *kctl;
170 struct snd_ctl_elem_info info; 170 struct snd_ctl_elem_info *info;
171 int err; 171 int err;
172 172
173 down_read(&card->controls_rwsem); 173 down_read(&card->controls_rwsem);
@@ -176,13 +176,19 @@ static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id,
176 up_read(&card->controls_rwsem); 176 up_read(&card->controls_rwsem);
177 return -ENXIO; 177 return -ENXIO;
178 } 178 }
179 info.id = *id; 179 info = kzalloc(sizeof(*info), GFP_KERNEL);
180 err = kctl->info(kctl, &info); 180 if (info == NULL) {
181 up_read(&card->controls_rwsem);
182 return -ENOMEM;
183 }
184 info->id = *id;
185 err = kctl->info(kctl, info);
181 up_read(&card->controls_rwsem); 186 up_read(&card->controls_rwsem);
182 if (err >= 0) { 187 if (err >= 0) {
183 err = info.type; 188 err = info->type;
184 *countp = info.count; 189 *countp = info->count;
185 } 190 }
191 kfree(info);
186 return err; 192 return err;
187} 193}
188 194