aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/uio-howto.tmpl4
-rw-r--r--Documentation/fb/pvr2fb.txt22
-rw-r--r--Documentation/i386/zero-page.txt10
-rw-r--r--Documentation/kbuild/kconfig-language.txt9
-rw-r--r--Documentation/kernel-parameters.txt24
-rw-r--r--Documentation/lguest/Makefile4
-rw-r--r--Documentation/memory-hotplug.txt322
-rw-r--r--Documentation/sched-design-CFS.txt2
-rw-r--r--Documentation/sched-nice-design.txt108
-rw-r--r--Documentation/sysrq.txt4
-rw-r--r--Documentation/thinkpad-acpi.txt4
-rw-r--r--Documentation/vm/slabinfo.c2
-rw-r--r--MAINTAINERS31
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/kernel/sys_titan.c27
-rw-r--r--arch/arm/configs/iop13xx_defconfig306
-rw-r--r--arch/arm/configs/iop32x_defconfig382
-rw-r--r--arch/arm/configs/iop33x_defconfig313
-rw-r--r--arch/arm/configs/rpc_defconfig791
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c2
-rw-r--r--arch/avr32/boards/atngw100/setup.c18
-rw-r--r--arch/avr32/boards/atstk1000/Kconfig26
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c62
-rw-r--r--arch/blackfin/kernel/init_task.c1
-rw-r--r--arch/blackfin/kernel/process.c2
-rw-r--r--arch/blackfin/kernel/sys_bfin.c1
-rw-r--r--arch/blackfin/kernel/traps.c1
-rw-r--r--arch/cris/Kconfig2
-rw-r--r--arch/frv/kernel/entry.S1
-rw-r--r--arch/i386/boot/edd.c54
-rw-r--r--arch/i386/boot/video.c2
-rw-r--r--arch/i386/kernel/alternative.c37
-rw-r--r--arch/i386/kernel/apic.c10
-rw-r--r--arch/i386/kernel/cpu/amd.c7
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c41
-rw-r--r--arch/i386/kernel/doublefault.c13
-rw-r--r--arch/i386/kernel/head.S4
-rw-r--r--arch/i386/kernel/io_apic.c7
-rw-r--r--arch/i386/kernel/paravirt.c52
-rw-r--r--arch/i386/kernel/vmi.c35
-rw-r--r--arch/i386/mm/pageattr.c2
-rw-r--r--arch/i386/pci/common.c23
-rw-r--r--arch/i386/pci/fixup.c6
-rw-r--r--arch/i386/pci/irq.c5
-rw-r--r--arch/i386/pci/legacy.c2
-rw-r--r--arch/i386/pci/mmconfig.c14
-rw-r--r--arch/i386/pci/numa.c15
-rw-r--r--arch/i386/pci/pci.h43
-rw-r--r--arch/i386/pci/visws.c4
-rw-r--r--arch/i386/xen/enlighten.c12
-rw-r--r--arch/powerpc/boot/flatdevtree.c18
-rw-r--r--arch/powerpc/configs/ps3_defconfig200
-rw-r--r--arch/powerpc/kernel/Makefile1
-rw-r--r--arch/powerpc/kernel/entry_64.S3
-rw-r--r--arch/powerpc/kernel/head_64.S16
-rw-r--r--arch/powerpc/kernel/misc_32.S12
-rw-r--r--arch/powerpc/kernel/pci_32.c5
-rw-r--r--arch/powerpc/kernel/pci_64.c1
-rw-r--r--arch/powerpc/kernel/smp.c9
-rw-r--r--arch/powerpc/mm/hash_low_64.S6
-rw-r--r--arch/powerpc/mm/hash_utils_64.c4
-rw-r--r--arch/powerpc/mm/numa.c4
-rw-r--r--arch/powerpc/mm/slb.c69
-rw-r--r--arch/powerpc/mm/slice.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_rdb.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_mds.c1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c1
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c141
-rw-r--r--arch/powerpc/platforms/cell/spu_manage.c163
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c1
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c3
-rw-r--r--arch/powerpc/platforms/powermac/feature.c6
-rw-r--r--arch/powerpc/platforms/ps3/Kconfig10
-rw-r--r--arch/powerpc/platforms/ps3/device-init.c39
-rw-r--r--arch/powerpc/platforms/ps3/setup.c2
-rw-r--r--arch/powerpc/platforms/ps3/spu.c6
-rw-r--r--arch/ppc/kernel/misc.S12
-rw-r--r--arch/s390/Kconfig4
-rw-r--r--arch/s390/hypfs/inode.c12
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c9
-rw-r--r--arch/sh/configs/hs7751rvoip_defconfig2
-rw-r--r--arch/sh/configs/landisk_defconfig2
-rw-r--r--arch/sh/configs/lboxre2_defconfig2
-rw-r--r--arch/sh/configs/rts7751r2d_defconfig8
-rw-r--r--arch/sh/configs/snapgear_defconfig587
-rw-r--r--arch/sh/configs/systemh_defconfig2
-rw-r--r--arch/sh/configs/titan_defconfig2
-rw-r--r--arch/sh/kernel/cpu/sh3/entry.S3
-rw-r--r--arch/sh/kernel/traps.c5
-rw-r--r--arch/sh/mm/Makefile4
-rw-r--r--arch/sh/mm/fault-nommu.c47
-rw-r--r--arch/sh/mm/fault.c3
-rw-r--r--arch/sparc/kernel/ebus.c1
-rw-r--r--arch/sparc/kernel/entry.S7
-rw-r--r--arch/sparc/kernel/irq.c84
-rw-r--r--arch/sparc/kernel/prom.c15
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c1
-rw-r--r--arch/sparc/mm/init.c3
-rw-r--r--arch/sparc/mm/io-unit.c18
-rw-r--r--arch/sparc/mm/iommu.c12
-rw-r--r--arch/sparc/mm/sun4c.c2
-rw-r--r--arch/sparc64/kernel/cpu.c36
-rw-r--r--arch/sparc64/kernel/head.S123
-rw-r--r--arch/sparc64/kernel/hvtramp.S7
-rw-r--r--arch/sparc64/kernel/irq.c74
-rw-r--r--arch/sparc64/kernel/mdesc.c62
-rw-r--r--arch/sparc64/kernel/prom.c15
-rw-r--r--arch/sparc64/kernel/smp.c5
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c1
-rw-r--r--arch/sparc64/kernel/trampoline.S14
-rw-r--r--arch/sparc64/kernel/vio.c19
-rw-r--r--arch/sparc64/lib/GENbzero.S160
-rw-r--r--arch/sparc64/lib/GENcopy_from_user.S34
-rw-r--r--arch/sparc64/lib/GENcopy_to_user.S38
-rw-r--r--arch/sparc64/lib/GENmemcpy.S121
-rw-r--r--arch/sparc64/lib/GENpage.S77
-rw-r--r--arch/sparc64/lib/GENpatch.S33
-rw-r--r--arch/sparc64/lib/Makefile6
-rw-r--r--arch/sparc64/lib/NG2copy_from_user.S40
-rw-r--r--arch/sparc64/lib/NG2copy_to_user.S49
-rw-r--r--arch/sparc64/lib/NG2memcpy.S520
-rw-r--r--arch/sparc64/lib/NG2page.S61
-rw-r--r--arch/sparc64/lib/NG2patch.S33
-rw-r--r--arch/sparc64/lib/NGpage.S1
-rw-r--r--arch/x86_64/boot/compressed/head.S7
-rw-r--r--arch/x86_64/kernel/apic.c6
-rw-r--r--arch/x86_64/kernel/io_apic.c7
-rw-r--r--arch/x86_64/kernel/pci-calgary.c13
-rw-r--r--arch/x86_64/lib/memcpy.S4
-rw-r--r--arch/x86_64/mm/pageattr.c3
-rw-r--r--arch/x86_64/pci/mmconfig.c12
-rw-r--r--arch/x86_64/vdso/.gitignore1
-rw-r--r--block/bsg.c10
-rw-r--r--block/ll_rw_blk.c4
-rw-r--r--crypto/ablkcipher.c2
-rw-r--r--crypto/blkcipher.c2
-rw-r--r--crypto/cipher.c2
-rw-r--r--crypto/hash.c2
-rw-r--r--drivers/acpi/asus_acpi.c1
-rw-r--r--drivers/acpi/battery.c47
-rw-r--r--drivers/acpi/bay.c2
-rw-r--r--drivers/acpi/dock.c6
-rw-r--r--drivers/acpi/ec.c106
-rw-r--r--drivers/acpi/event.c2
-rw-r--r--drivers/acpi/processor_idle.c14
-rw-r--r--drivers/acpi/processor_perflib.c6
-rw-r--r--drivers/acpi/resources/rsxface.c2
-rw-r--r--drivers/acpi/sbs.c6
-rw-r--r--drivers/acpi/tables/tbxface.c23
-rw-r--r--drivers/acpi/thermal.c143
-rw-r--r--drivers/ata/ata_piix.c9
-rw-r--r--drivers/ata/libata-core.c2
-rw-r--r--drivers/ata/pata_artop.c19
-rw-r--r--drivers/ata/pata_hpt37x.c20
-rw-r--r--drivers/ata/pata_hpt3x2n.c8
-rw-r--r--drivers/ata/pata_icside.c28
-rw-r--r--drivers/ata/pata_isapnp.c2
-rw-r--r--drivers/ata/sata_mv.c3
-rw-r--r--drivers/atm/fore200e.c2
-rw-r--r--drivers/atm/iphase.c12
-rw-r--r--drivers/atm/lanai.c1
-rw-r--r--drivers/block/cciss.c16
-rw-r--r--drivers/block/cpqarray.c78
-rw-r--r--drivers/block/viodasd.c1
-rw-r--r--drivers/block/xsysace.c29
-rw-r--r--drivers/char/drm/i915_dma.c14
-rw-r--r--drivers/char/drm/i915_drv.h1
-rw-r--r--drivers/char/hvc_lguest.c1
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c5
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c2
-rw-r--r--drivers/char/sonypi.c7
-rw-r--r--drivers/char/tty_io.c56
-rw-r--r--drivers/dma/ioatdma.c7
-rw-r--r--drivers/dma/ioatdma.h3
-rw-r--r--drivers/firewire/fw-ohci.c20
-rw-r--r--drivers/firewire/fw-sbp2.c5
-rw-r--r--drivers/firewire/fw-transaction.c4
-rw-r--r--drivers/firewire/fw-transaction.h2
-rw-r--r--drivers/i2c/busses/i2c-i801.c4
-rw-r--r--drivers/i2c/busses/i2c-iop3xx.c1
-rw-r--r--drivers/i2c/busses/i2c-mpc.c11
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c31
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c4
-rw-r--r--drivers/i2c/chips/isp1301_omap.c42
-rw-r--r--drivers/i2c/chips/menelaus.c3
-rw-r--r--drivers/ieee1394/Kconfig2
-rw-r--r--drivers/ieee1394/sbp2.c5
-rw-r--r--drivers/kvm/x86_emulate.c2
-rw-r--r--drivers/lguest/Kconfig2
-rw-r--r--drivers/lguest/core.c5
-rw-r--r--drivers/lguest/interrupts_and_traps.c9
-rw-r--r--drivers/lguest/lguest.c18
-rw-r--r--drivers/lguest/lguest_bus.c1
-rw-r--r--drivers/lguest/segments.c62
-rw-r--r--drivers/lguest/switcher.S15
-rw-r--r--drivers/md/dm.c4
-rw-r--r--drivers/message/fusion/mptbase.c17
-rw-r--r--drivers/message/fusion/mptsas.c126
-rw-r--r--drivers/misc/Kconfig22
-rw-r--r--drivers/misc/sony-laptop.c7
-rw-r--r--drivers/misc/thinkpad_acpi.c10
-rw-r--r--drivers/misc/thinkpad_acpi.h2
-rw-r--r--drivers/mmc/card/queue.c14
-rw-r--r--drivers/mmc/host/at91_mci.c8
-rw-r--r--drivers/mmc/host/wbsd.c10
-rw-r--r--drivers/mtd/Makefile2
-rw-r--r--drivers/mtd/mtdchar.c1
-rw-r--r--drivers/mtd/mtdpart.c4
-rw-r--r--drivers/net/3c59x.c1
-rw-r--r--drivers/net/atl1/atl1_main.c4
-rw-r--r--drivers/net/ax88796.c5
-rw-r--r--drivers/net/bnx2.c12
-rw-r--r--drivers/net/bonding/bond_main.c34
-rw-r--r--drivers/net/e1000/e1000_ethtool.c2
-rw-r--r--drivers/net/e1000/e1000_hw.c5
-rw-r--r--drivers/net/e1000/e1000_hw.h3
-rw-r--r--drivers/net/e1000/e1000_main.c4
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c44
-rw-r--r--drivers/net/ibmveth.c27
-rw-r--r--drivers/net/ibmveth.h3
-rw-r--r--drivers/net/irda/irda-usb.c24
-rw-r--r--drivers/net/myri10ge/myri10ge.c25
-rw-r--r--drivers/net/natsemi.c3
-rw-r--r--drivers/net/phy/phy.c4
-rw-r--r--drivers/net/r8169.c24
-rw-r--r--drivers/net/s2io.c9
-rw-r--r--drivers/net/sis190.c3
-rw-r--r--drivers/net/smc91x.h4
-rw-r--r--drivers/net/tg3.c17
-rw-r--r--drivers/net/ucc_geth_ethtool.c1
-rw-r--r--drivers/net/ucc_geth_mii.c3
-rw-r--r--drivers/net/via-rhine.c6
-rw-r--r--drivers/net/wan/hdlc_fr.c3
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c2
-rw-r--r--drivers/net/wireless/rtl8187_dev.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c2
-rw-r--r--drivers/net/xen-netfront.c7
-rw-r--r--drivers/power/Kconfig2
-rw-r--r--drivers/s390/char/monwriter.c6
-rw-r--r--drivers/s390/char/vmur.c176
-rw-r--r--drivers/s390/char/vmur.h5
-rw-r--r--drivers/s390/cio/css.c1
-rw-r--r--drivers/s390/cio/qdio.c92
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c5
-rw-r--r--drivers/s390/scsi/zfcp_qdio.c41
-rw-r--r--drivers/scsi/aacraid/linit.c4
-rw-r--r--drivers/scsi/aha152x.c169
-rw-r--r--drivers/scsi/aha152x.h2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c22
-rw-r--r--drivers/scsi/dpt_i2o.c132
-rw-r--r--drivers/scsi/dpti.h9
-rw-r--r--drivers/scsi/esp_scsi.h2
-rw-r--r--drivers/scsi/gdth.c48
-rw-r--r--drivers/scsi/gdth.h6
-rw-r--r--drivers/scsi/hosts.c2
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c39
-rw-r--r--drivers/scsi/libsas/Kconfig3
-rw-r--r--drivers/scsi/lpfc/lpfc.h72
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c423
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h28
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c243
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c595
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c679
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c539
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h14
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c284
-rw-r--r--drivers/scsi/lpfc/lpfc_logmsg.h10
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c20
-rw-r--r--drivers/scsi/lpfc/lpfc_mem.c32
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c162
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c413
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c423
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.h10
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h4
-rw-r--r--drivers/scsi/lpfc/lpfc_vport.c164
-rw-r--r--drivers/scsi/lpfc/lpfc_vport.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c14
-rw-r--r--drivers/scsi/qlogicpti.c50
-rw-r--r--drivers/scsi/scsi_lib.c17
-rw-r--r--drivers/scsi/sd.c14
-rw-r--r--drivers/scsi/st.c16
-rw-r--r--drivers/scsi/st.h3
-rw-r--r--drivers/serial/8250.c2
-rw-r--r--drivers/serial/8250_early.c2
-rw-r--r--drivers/spi/spi_mpc83xx.c25
-rw-r--r--drivers/spi/spidev.c4
-rw-r--r--drivers/video/cg6.c5
-rw-r--r--drivers/video/console/fbcon.c14
-rw-r--r--drivers/video/matrox/g450_pll.c23
-rw-r--r--drivers/video/matrox/matroxfb_DAC1064.h15
-rw-r--r--drivers/video/matrox/matroxfb_base.h1
-rw-r--r--drivers/video/matrox/matroxfb_misc.c1
-rw-r--r--drivers/video/pvr2fb.c16
-rw-r--r--drivers/video/stifb.c19
-rw-r--r--fs/cifs/CHANGES5
-rw-r--r--fs/cifs/README13
-rw-r--r--fs/cifs/TODO3
-rw-r--r--fs/cifs/file.c33
-rw-r--r--fs/cifs/sess.c4
-rw-r--r--fs/compat_ioctl.c3
-rw-r--r--fs/direct-io.c1
-rw-r--r--fs/dlm/lock.c69
-rw-r--r--fs/dlm/lowcomms.c24
-rw-r--r--fs/dlm/member.c4
-rw-r--r--fs/dlm/rcom.c7
-rw-r--r--fs/ecryptfs/inode.c4
-rw-r--r--fs/ecryptfs/main.c18
-rw-r--r--fs/exec.c13
-rw-r--r--fs/gfs2/lops.c6
-rw-r--r--fs/gfs2/mount.c25
-rw-r--r--fs/gfs2/ops_address.c3
-rw-r--r--fs/gfs2/ops_file.c29
-rw-r--r--fs/gfs2/rgrp.c16
-rw-r--r--fs/nfs/delegation.c21
-rw-r--r--fs/nfs/inode.c24
-rw-r--r--fs/nfs/namespace.c6
-rw-r--r--fs/nfs/nfs4proc.c16
-rw-r--r--fs/nfs/nfs4renewd.c5
-rw-r--r--fs/nfs/nfs4state.c5
-rw-r--r--fs/ocfs2/alloc.c4
-rw-r--r--fs/ocfs2/cluster/tcp.c24
-rw-r--r--fs/ocfs2/file.c28
-rw-r--r--fs/ocfs2/namei.c16
-rw-r--r--fs/ocfs2/ocfs2.h8
-rw-r--r--fs/ocfs2/super.c69
-rw-r--r--fs/ocfs2/super.h2
-rw-r--r--include/acpi/processor.h2
-rw-r--r--include/asm-alpha/fcntl.h1
-rw-r--r--include/asm-arm/pgtable-nommu.h1
-rw-r--r--include/asm-avr32/io.h2
-rw-r--r--include/asm-avr32/pgalloc.h30
-rw-r--r--include/asm-avr32/pgtable.h4
-rw-r--r--include/asm-frv/unistd.h3
-rw-r--r--include/asm-generic/pgtable.h73
-rw-r--r--include/asm-i386/apic.h2
-rw-r--r--include/asm-i386/cpufeature.h2
-rw-r--r--include/asm-i386/paravirt.h16
-rw-r--r--include/asm-i386/pci.h3
-rw-r--r--include/asm-powerpc/dma-mapping.h2
-rw-r--r--include/asm-powerpc/mmu-hash64.h1
-rw-r--r--include/asm-powerpc/pgtable-64k.h8
-rw-r--r--include/asm-powerpc/spu_priv1.h7
-rw-r--r--include/asm-sh/rts7751r2d.h2
-rw-r--r--include/asm-sparc/fcntl.h1
-rw-r--r--include/asm-sparc/floppy.h20
-rw-r--r--include/asm-sparc/irq.h7
-rw-r--r--include/asm-sparc/prom.h1
-rw-r--r--include/asm-sparc/sbus.h1
-rw-r--r--include/asm-sparc/sfp-machine.h6
-rw-r--r--include/asm-sparc64/dma-mapping.h19
-rw-r--r--include/asm-sparc64/elf.h10
-rw-r--r--include/asm-sparc64/fcntl.h2
-rw-r--r--include/asm-sparc64/oplib.h7
-rw-r--r--include/asm-sparc64/prom.h1
-rw-r--r--include/asm-sparc64/sfp-machine.h2
-rw-r--r--include/asm-sparc64/spitfire.h7
-rw-r--r--include/asm-sparc64/xor.h6
-rw-r--r--include/asm-x86_64/pci.h2
-rw-r--r--include/linux/bio.h3
-rw-r--r--include/linux/blktrace_api.h3
-rw-r--r--include/linux/bsg.h13
-rw-r--r--include/linux/clockchips.h1
-rw-r--r--include/linux/cpu.h2
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/init.h2
-rw-r--r--include/linux/kernel.h4
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/netfilter/Kbuild1
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/proc_fs.h1
-rw-r--r--include/linux/rcupdate.h1
-rw-r--r--include/linux/sched.h20
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/math-emu/op-common.h5
-rw-r--r--include/math-emu/soft-fp.h7
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_ipv4.h2
-rw-r--r--include/net/sctp/sctp.h10
-rw-r--r--include/net/tcp.h2
-rw-r--r--include/scsi/scsi_driver.h2
-rw-r--r--include/scsi/sd.h2
-rw-r--r--kernel/auditsc.c22
-rw-r--r--kernel/exit.c8
-rw-r--r--kernel/irq/chip.c5
-rw-r--r--kernel/irq/resend.c12
-rw-r--r--kernel/kprobes.c5
-rw-r--r--kernel/power/snapshot.c3
-rw-r--r--kernel/printk.c2
-rw-r--r--kernel/profile.c4
-rw-r--r--kernel/sched.c402
-rw-r--r--kernel/sched_debug.c30
-rw-r--r--kernel/sched_fair.c225
-rw-r--r--kernel/sched_idletask.c10
-rw-r--r--kernel/sched_rt.c48
-rw-r--r--kernel/signal.c4
-rw-r--r--kernel/sysctl.c2
-rw-r--r--kernel/time/clockevents.c10
-rw-r--r--lib/hexdump.c6
-rw-r--r--mm/filemap.c22
-rw-r--r--mm/slub.c68
-rw-r--r--net/8021q/vlanproc.c2
-rw-r--r--net/atm/lec.c1
-rw-r--r--net/ax25/ax25_iface.c2
-rw-r--r--net/bridge/br_device.c2
-rw-r--r--net/bridge/br_if.c36
-rw-r--r--net/bridge/br_stp_if.c2
-rw-r--r--net/bridge/br_sysfs_br.c24
-rw-r--r--net/core/dev.c39
-rw-r--r--net/core/ethtool.c1
-rw-r--r--net/core/utils.c1
-rw-r--r--net/dccp/ccid.c1
-rw-r--r--net/dccp/feat.c14
-rw-r--r--net/econet/af_econet.c3
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_wx.c11
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/ip_output.c1
-rw-r--r--net/ipv4/ipconfig.c6
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c3
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c1
-rw-r--r--net/ipv4/netfilter/ipt_recent.c7
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c6
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c5
-rw-r--r--net/ipv4/netfilter/nf_nat_sip.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_standalone.c2
-rw-r--r--net/ipv4/raw.c4
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/tcp.c3
-rw-r--r--net/ipv4/tcp_htcp.c4
-rw-r--r--net/ipv4/tcp_input.c37
-rw-r--r--net/ipv4/tcp_ipv4.c1
-rw-r--r--net/ipv6/af_inet6.c2
-rw-r--r--net/ipv6/ipv6_sockglue.c2
-rw-r--r--net/ipv6/tcp_ipv6.c2
-rw-r--r--net/key/af_key.c3
-rw-r--r--net/mac80211/debugfs_netdev.c8
-rw-r--r--net/mac80211/debugfs_sta.c2
-rw-r--r--net/mac80211/ieee80211.c2
-rw-r--r--net/mac80211/ieee80211_ioctl.c19
-rw-r--r--net/mac80211/ieee80211_sta.c6
-rw-r--r--net/netfilter/nf_conntrack_expect.c5
-rw-r--r--net/netfilter/nf_conntrack_netlink.c17
-rw-r--r--net/netfilter/nf_conntrack_sip.c8
-rw-r--r--net/netfilter/xt_u32.c2
-rw-r--r--net/netlabel/netlabel_domainhash.c10
-rw-r--r--net/sched/act_police.c1
-rw-r--r--net/sctp/input.c2
-rw-r--r--net/sctp/ipv6.c2
-rw-r--r--net/sctp/sm_make_chunk.c6
-rw-r--r--net/sctp/sm_statefuns.c103
-rw-r--r--net/sctp/socket.c45
-rw-r--r--net/sctp/tsnmap.c14
-rw-r--r--net/socket.c2
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c9
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c1
-rw-r--r--net/sunrpc/cache.c3
-rw-r--r--net/sunrpc/rpc_pipe.c3
-rw-r--r--net/sunrpc/sched.c57
-rw-r--r--net/tipc/link.c2
-rw-r--r--net/tipc/name_table.c2
-rw-r--r--net/tipc/node.c2
-rw-r--r--net/tipc/port.c1
-rw-r--r--net/wanrouter/wanmain.c1
-rw-r--r--net/xfrm/xfrm_policy.c3
-rw-r--r--net/xfrm/xfrm_state.c3
-rwxr-xr-xscripts/checkpatch.pl102
-rw-r--r--sound/sparc/cs4231.c42
469 files changed, 9149 insertions, 5926 deletions
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl
index e3bb29a8d8dd..c119484258b8 100644
--- a/Documentation/DocBook/uio-howto.tmpl
+++ b/Documentation/DocBook/uio-howto.tmpl
@@ -133,10 +133,6 @@ interested in translating it, please email me
133 <para>updates of your driver can take place without recompiling 133 <para>updates of your driver can take place without recompiling
134 the kernel.</para> 134 the kernel.</para>
135</listitem> 135</listitem>
136<listitem>
137 <para>if you need to keep some parts of your driver closed source,
138 you can do so without violating the GPL license on the kernel.</para>
139</listitem>
140</itemizedlist> 136</itemizedlist>
141 137
142<sect1 id="how_uio_works"> 138<sect1 id="how_uio_works">
diff --git a/Documentation/fb/pvr2fb.txt b/Documentation/fb/pvr2fb.txt
index 2bf6c2321c2d..36bdeff585e2 100644
--- a/Documentation/fb/pvr2fb.txt
+++ b/Documentation/fb/pvr2fb.txt
@@ -9,14 +9,13 @@ one found in the Dreamcast.
9Advantages: 9Advantages:
10 10
11 * It provides a nice large console (128 cols + 48 lines with 1024x768) 11 * It provides a nice large console (128 cols + 48 lines with 1024x768)
12 without using tiny, unreadable fonts. 12 without using tiny, unreadable fonts (NOT on the Dreamcast)
13 * You can run XF86_FBDev on top of /dev/fb0 13 * You can run XF86_FBDev on top of /dev/fb0
14 * Most important: boot logo :-) 14 * Most important: boot logo :-)
15 15
16Disadvantages: 16Disadvantages:
17 17
18 * Driver is currently limited to the Dreamcast PowerVR 2 implementation 18 * Driver is largely untested on non-Dreamcast systems.
19 at the time of this writing.
20 19
21Configuration 20Configuration
22============= 21=============
@@ -29,11 +28,16 @@ Accepted options:
29font:X - default font to use. All fonts are supported, including the 28font:X - default font to use. All fonts are supported, including the
30 SUN12x22 font which is very nice at high resolutions. 29 SUN12x22 font which is very nice at high resolutions.
31 30
32mode:X - default video mode. The following video modes are supported:
33 640x240-60, 640x480-60.
34 31
32mode:X - default video mode with format [xres]x[yres]-<bpp>@<refresh rate>
33 The following video modes are supported:
34 640x640-16@60, 640x480-24@60, 640x480-32@60. The Dreamcast
35 defaults to 640x480-16@60. At the time of writing the
36 24bpp and 32bpp modes function poorly. Work to fix that is
37 ongoing
38
35 Note: the 640x240 mode is currently broken, and should not be 39 Note: the 640x240 mode is currently broken, and should not be
36 used for any reason. It is only mentioned as a reference. 40 used for any reason. It is only mentioned here as a reference.
37 41
38inverse - invert colors on screen (for LCD displays) 42inverse - invert colors on screen (for LCD displays)
39 43
@@ -52,10 +56,10 @@ output:X - output type. This can be any of the following: pal, ntsc, and
52X11 56X11
53=== 57===
54 58
55XF86_FBDev should work, in theory. At the time of this writing it is 59XF86_FBDev has been shown to work on the Dreamcast in the past - though not yet
56totally untested and may or may not even portray the beginnings of 60on any 2.6 series kernel.
57working. If you end up testing this, please let me know!
58 61
59-- 62--
60Paul Mundt <lethal@linuxdc.org> 63Paul Mundt <lethal@linuxdc.org>
64Updated by Adrian McMenamin <adrian@mcmen.demon.co.uk>
61 65
diff --git a/Documentation/i386/zero-page.txt b/Documentation/i386/zero-page.txt
index 75b3680c41eb..6c0817c45683 100644
--- a/Documentation/i386/zero-page.txt
+++ b/Documentation/i386/zero-page.txt
@@ -1,3 +1,13 @@
1---------------------------------------------------------------------------
2!!!!!!!!!!!!!!!WARNING!!!!!!!!
3The zero page is a kernel internal data structure, not a stable ABI. It might change
4without warning and the kernel has no way to detect old version of it.
5If you're writing some external code like a boot loader you should only use
6the stable versioned real mode boot protocol described in boot.txt. Otherwise the kernel
7might break you at any time.
8!!!!!!!!!!!!!WARNING!!!!!!!!!!!
9----------------------------------------------------------------------------
10
1Summary of boot_params layout (kernel point of view) 11Summary of boot_params layout (kernel point of view)
2 ( collected by Hans Lermen and Martin Mares ) 12 ( collected by Hans Lermen and Martin Mares )
3 13
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index 536d5bfbdb8d..fe8b0c4892cf 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -98,6 +98,15 @@ applicable everywhere (see syntax).
98 times, the limit is set to the largest selection. 98 times, the limit is set to the largest selection.
99 Reverse dependencies can only be used with boolean or tristate 99 Reverse dependencies can only be used with boolean or tristate
100 symbols. 100 symbols.
101 Note:
102 select is evil.... select will by brute force set a symbol
103 equal to 'y' without visiting the dependencies. So abusing
104 select you are able to select a symbol FOO even if FOO depends
105 on BAR that is not set. In general use select only for
106 non-visible symbols (no promts anywhere) and for symbols with
107 no dependencies. That will limit the usefulness but on the
108 other hand avoid the illegal configurations all over. kconfig
109 should one day warn about such things.
101 110
102- numerical ranges: "range" <symbol> <symbol> ["if" <expr>] 111- numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
103 This allows to limit the range of possible input values for int 112 This allows to limit the range of possible input values for int
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index efdb42fd3fb8..975f029be25c 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -163,6 +163,8 @@ and is between 256 and 4096 characters. It is defined in the file
163 acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA 163 acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA
164 Format: <irq>,<irq>... 164 Format: <irq>,<irq>...
165 165
166 acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT
167
166 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS 168 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS
167 Format: To spoof as Windows 98: ="Microsoft Windows" 169 Format: To spoof as Windows 98: ="Microsoft Windows"
168 170
@@ -1820,6 +1822,26 @@ and is between 256 and 4096 characters. It is defined in the file
1820 thash_entries= [KNL,NET] 1822 thash_entries= [KNL,NET]
1821 Set number of hash buckets for TCP connection 1823 Set number of hash buckets for TCP connection
1822 1824
1825 thermal.act= [HW,ACPI]
1826 -1: disable all active trip points in all thermal zones
1827 <degrees C>: override all lowest active trip points
1828
1829 thermal.nocrt= [HW,ACPI]
1830 Set to disable actions on ACPI thermal zone
1831 critical and hot trip points.
1832
1833 thermal.off= [HW,ACPI]
1834 1: disable ACPI thermal control
1835
1836 thermal.psv= [HW,ACPI]
1837 -1: disable all passive trip points
1838 <degrees C>: override all passive trip points to this value
1839
1840 thermal.tzp= [HW,ACPI]
1841 Specify global default ACPI thermal zone polling rate
1842 <deci-seconds>: poll all this frequency
1843 0: no polling (default)
1844
1823 time Show timing data prefixed to each printk message line 1845 time Show timing data prefixed to each printk message line
1824 [deprecated, see 'printk.time'] 1846 [deprecated, see 'printk.time']
1825 1847
@@ -1922,7 +1944,7 @@ and is between 256 and 4096 characters. It is defined in the file
1922 See header of drivers/scsi/wd7000.c. 1944 See header of drivers/scsi/wd7000.c.
1923 1945
1924 wdt= [WDT] Watchdog 1946 wdt= [WDT] Watchdog
1925 See Documentation/watchdog/watchdog.txt. 1947 See Documentation/watchdog/wdt.txt.
1926 1948
1927 xd= [HW,XT] Original XT pre-IDE (RLL encoded) disks. 1949 xd= [HW,XT] Original XT pre-IDE (RLL encoded) disks.
1928 xd_geo= See header of drivers/block/xd.c. 1950 xd_geo= See header of drivers/block/xd.c.
diff --git a/Documentation/lguest/Makefile b/Documentation/lguest/Makefile
index 31e794ef5f98..c0b7a4556390 100644
--- a/Documentation/lguest/Makefile
+++ b/Documentation/lguest/Makefile
@@ -13,7 +13,9 @@ LGUEST_GUEST_TOP := ($(CONFIG_PAGE_OFFSET) - 0x08000000)
13 13
14CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -Wl,-T,lguest.lds 14CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -Wl,-T,lguest.lds
15LDLIBS:=-lz 15LDLIBS:=-lz
16 16# Removing this works for some versions of ld.so (eg. Ubuntu Feisty) and
17# not others (eg. FC7).
18LDFLAGS+=-static
17all: lguest.lds lguest 19all: lguest.lds lguest
18 20
19# The linker script on x86 is so complex the only way of creating one 21# The linker script on x86 is so complex the only way of creating one
diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt
new file mode 100644
index 000000000000..5fbcc22c98e9
--- /dev/null
+++ b/Documentation/memory-hotplug.txt
@@ -0,0 +1,322 @@
1==============
2Memory Hotplug
3==============
4
5Last Updated: Jul 28 2007
6
7This document is about memory hotplug including how-to-use and current status.
8Because Memory Hotplug is still under development, contents of this text will
9be changed often.
10
111. Introduction
12 1.1 purpose of memory hotplug
13 1.2. Phases of memory hotplug
14 1.3. Unit of Memory online/offline operation
152. Kernel Configuration
163. sysfs files for memory hotplug
174. Physical memory hot-add phase
18 4.1 Hardware(Firmware) Support
19 4.2 Notify memory hot-add event by hand
205. Logical Memory hot-add phase
21 5.1. State of memory
22 5.2. How to online memory
236. Logical memory remove
24 6.1 Memory offline and ZONE_MOVABLE
25 6.2. How to offline memory
267. Physical memory remove
278. Future Work List
28
29Note(1): x86_64's has special implementation for memory hotplug.
30 This text does not describe it.
31Note(2): This text assumes that sysfs is mounted at /sys.
32
33
34---------------
351. Introduction
36---------------
37
381.1 purpose of memory hotplug
39------------
40Memory Hotplug allows users to increase/decrease the amount of memory.
41Generally, there are two purposes.
42
43(A) For changing the amount of memory.
44 This is to allow a feature like capacity on demand.
45(B) For installing/removing DIMMs or NUMA-nodes physically.
46 This is to exchange DIMMs/NUMA-nodes, reduce power consumption, etc.
47
48(A) is required by highly virtualized environments and (B) is required by
49hardware which supports memory power management.
50
51Linux memory hotplug is designed for both purpose.
52
53
541.2. Phases of memory hotplug
55---------------
56There are 2 phases in Memory Hotplug.
57 1) Physical Memory Hotplug phase
58 2) Logical Memory Hotplug phase.
59
60The First phase is to communicate hardware/firmware and make/erase
61environment for hotplugged memory. Basically, this phase is necessary
62for the purpose (B), but this is good phase for communication between
63highly virtualized environments too.
64
65When memory is hotplugged, the kernel recognizes new memory, makes new memory
66management tables, and makes sysfs files for new memory's operation.
67
68If firmware supports notification of connection of new memory to OS,
69this phase is triggered automatically. ACPI can notify this event. If not,
70"probe" operation by system administration is used instead.
71(see Section 4.).
72
73Logical Memory Hotplug phase is to change memory state into
74avaiable/unavailable for users. Amount of memory from user's view is
75changed by this phase. The kernel makes all memory in it as free pages
76when a memory range is available.
77
78In this document, this phase is described as online/offline.
79
80Logical Memory Hotplug phase is triggred by write of sysfs file by system
81administrator. For the hot-add case, it must be executed after Physical Hotplug
82phase by hand.
83(However, if you writes udev's hotplug scripts for memory hotplug, these
84 phases can be execute in seamless way.)
85
86
871.3. Unit of Memory online/offline operation
88------------
89Memory hotplug uses SPARSEMEM memory model. SPARSEMEM divides the whole memory
90into chunks of the same size. The chunk is called a "section". The size of
91a section is architecture dependent. For example, power uses 16MiB, ia64 uses
921GiB. The unit of online/offline operation is "one section". (see Section 3.)
93
94To determine the size of sections, please read this file:
95
96/sys/devices/system/memory/block_size_bytes
97
98This file shows the size of sections in byte.
99
100-----------------------
1012. Kernel Configuration
102-----------------------
103To use memory hotplug feature, kernel must be compiled with following
104config options.
105
106- For all memory hotplug
107 Memory model -> Sparse Memory (CONFIG_SPARSEMEM)
108 Allow for memory hot-add (CONFIG_MEMORY_HOTPLUG)
109
110- To enable memory removal, the followings are also necessary
111 Allow for memory hot remove (CONFIG_MEMORY_HOTREMOVE)
112 Page Migration (CONFIG_MIGRATION)
113
114- For ACPI memory hotplug, the followings are also necessary
115 Memory hotplug (under ACPI Support menu) (CONFIG_ACPI_HOTPLUG_MEMORY)
116 This option can be kernel module.
117
118- As a related configuration, if your box has a feature of NUMA-node hotplug
119 via ACPI, then this option is necessary too.
120 ACPI0004,PNP0A05 and PNP0A06 Container Driver (under ACPI Support menu)
121 (CONFIG_ACPI_CONTAINER).
122 This option can be kernel module too.
123
124--------------------------------
1253 sysfs files for memory hotplug
126--------------------------------
127All sections have their device information under /sys/devices/system/memory as
128
129/sys/devices/system/memory/memoryXXX
130(XXX is section id.)
131
132Now, XXX is defined as start_address_of_section / section_size.
133
134For example, assume 1GiB section size. A device for a memory starting at
1350x100000000 is /sys/device/system/memory/memory4
136(0x100000000 / 1Gib = 4)
137This device covers address range [0x100000000 ... 0x140000000)
138
139Under each section, you can see 3 files.
140
141/sys/devices/system/memory/memoryXXX/phys_index
142/sys/devices/system/memory/memoryXXX/phys_device
143/sys/devices/system/memory/memoryXXX/state
144
145'phys_index' : read-only and contains section id, same as XXX.
146'state' : read-write
147 at read: contains online/offline state of memory.
148 at write: user can specify "online", "offline" command
149'phys_device': read-only: designed to show the name of physical memory device.
150 This is not well implemented now.
151
152NOTE:
153 These directories/files appear after physical memory hotplug phase.
154
155
156--------------------------------
1574. Physical memory hot-add phase
158--------------------------------
159
1604.1 Hardware(Firmware) Support
161------------
162On x86_64/ia64 platform, memory hotplug by ACPI is supported.
163
164In general, the firmware (ACPI) which supports memory hotplug defines
165memory class object of _HID "PNP0C80". When a notify is asserted to PNP0C80,
166Linux's ACPI handler does hot-add memory to the system and calls a hotplug udev
167script. This will be done automatically.
168
169But scripts for memory hotplug are not contained in generic udev package(now).
170You may have to write it by yourself or online/offline memory by hand.
171Please see "How to online memory", "How to offline memory" in this text.
172
173If firmware supports NUMA-node hotplug, and defines an object _HID "ACPI0004",
174"PNP0A05", or "PNP0A06", notification is asserted to it, and ACPI handler
175calls hotplug code for all of objects which are defined in it.
176If memory device is found, memory hotplug code will be called.
177
178
1794.2 Notify memory hot-add event by hand
180------------
181In some environments, especially virtualized environment, firmware will not
182notify memory hotplug event to the kernel. For such environment, "probe"
183interface is supported. This interface depends on CONFIG_ARCH_MEMORY_PROBE.
184
185Now, CONFIG_ARCH_MEMORY_PROBE is supported only by powerpc but it does not
186contain highly architecture codes. Please add config if you need "probe"
187interface.
188
189Probe interface is located at
190/sys/devices/system/memory/probe
191
192You can tell the physical address of new memory to the kernel by
193
194% echo start_address_of_new_memory > /sys/devices/system/memory/probe
195
196Then, [start_address_of_new_memory, start_address_of_new_memory + section_size)
197memory range is hot-added. In this case, hotplug script is not called (in
198current implementation). You'll have to online memory by yourself.
199Please see "How to online memory" in this text.
200
201
202
203------------------------------
2045. Logical Memory hot-add phase
205------------------------------
206
2075.1. State of memory
208------------
209To see (online/offline) state of memory section, read 'state' file.
210
211% cat /sys/device/system/memory/memoryXXX/state
212
213
214If the memory section is online, you'll read "online".
215If the memory section is offline, you'll read "offline".
216
217
2185.2. How to online memory
219------------
220Even if the memory is hot-added, it is not at ready-to-use state.
221For using newly added memory, you have to "online" the memory section.
222
223For onlining, you have to write "online" to the section's state file as:
224
225% echo online > /sys/devices/system/memory/memoryXXX/state
226
227After this, section memoryXXX's state will be 'online' and the amount of
228available memory will be increased.
229
230Currently, newly added memory is added as ZONE_NORMAL (for powerpc, ZONE_DMA).
231This may be changed in future.
232
233
234
235------------------------
2366. Logical memory remove
237------------------------
238
2396.1 Memory offline and ZONE_MOVABLE
240------------
241Memory offlining is more complicated than memory online. Because memory offline
242has to make the whole memory section be unused, memory offline can fail if
243the section includes memory which cannot be freed.
244
245In general, memory offline can use 2 techniques.
246
247(1) reclaim and free all memory in the section.
248(2) migrate all pages in the section.
249
250In the current implementation, Linux's memory offline uses method (2), freeing
251all pages in the section by page migration. But not all pages are
252migratable. Under current Linux, migratable pages are anonymous pages and
253page caches. For offlining a section by migration, the kernel has to guarantee
254that the section contains only migratable pages.
255
256Now, a boot option for making a section which consists of migratable pages is
257supported. By specifying "kernelcore=" or "movablecore=" boot option, you can
258create ZONE_MOVABLE...a zone which is just used for movable pages.
259(See also Documentation/kernel-parameters.txt)
260
261Assume the system has "TOTAL" amount of memory at boot time, this boot option
262creates ZONE_MOVABLE as following.
263
2641) When kernelcore=YYYY boot option is used,
265 Size of memory not for movable pages (not for offline) is YYYY.
266 Size of memory for movable pages (for offline) is TOTAL-YYYY.
267
2682) When movablecore=ZZZZ boot option is used,
269 Size of memory not for movable pages (not for offline) is TOTAL - ZZZZ.
270 Size of memory for movable pages (for offline) is ZZZZ.
271
272
273Note) Unfortunately, there is no information to show which section belongs
274to ZONE_MOVABLE. This is TBD.
275
276
2776.2. How to offline memory
278------------
279You can offline a section by using the same sysfs interface that was used in
280memory onlining.
281
282% echo offline > /sys/devices/system/memory/memoryXXX/state
283
284If offline succeeds, the state of the memory section is changed to be "offline".
285If it fails, some error core (like -EBUSY) will be returned by the kernel.
286Even if a section does not belong to ZONE_MOVABLE, you can try to offline it.
287If it doesn't contain 'unmovable' memory, you'll get success.
288
289A section under ZONE_MOVABLE is considered to be able to be offlined easily.
290But under some busy state, it may return -EBUSY. Even if a memory section
291cannot be offlined due to -EBUSY, you can retry offlining it and may be able to
292offline it (or not).
293(For example, a page is referred to by some kernel internal call and released
294 soon.)
295
296Consideration:
297Memory hotplug's design direction is to make the possibility of memory offlining
298higher and to guarantee unplugging memory under any situation. But it needs
299more work. Returning -EBUSY under some situation may be good because the user
300can decide to retry more or not by himself. Currently, memory offlining code
301does some amount of retry with 120 seconds timeout.
302
303-------------------------
3047. Physical memory remove
305-------------------------
306Need more implementation yet....
307 - Notification completion of remove works by OS to firmware.
308 - Guard from remove if not yet.
309
310--------------
3118. Future Work
312--------------
313 - allowing memory hot-add to ZONE_MOVABLE. maybe we need some switch like
314 sysctl or new control file.
315 - showing memory section and physical device relationship.
316 - showing memory section and node relationship (maybe good for NUMA)
317 - showing memory section is under ZONE_MOVABLE or not
318 - test and make it better memory offlining.
319 - support HugeTLB page migration and offlining.
320 - memmap removing at memory offline.
321 - physical remove memory.
322
diff --git a/Documentation/sched-design-CFS.txt b/Documentation/sched-design-CFS.txt
index 16feebb7bdc0..84901e7c0508 100644
--- a/Documentation/sched-design-CFS.txt
+++ b/Documentation/sched-design-CFS.txt
@@ -83,7 +83,7 @@ Some implementation details:
83 CFS uses nanosecond granularity accounting and does not rely on any 83 CFS uses nanosecond granularity accounting and does not rely on any
84 jiffies or other HZ detail. Thus the CFS scheduler has no notion of 84 jiffies or other HZ detail. Thus the CFS scheduler has no notion of
85 'timeslices' and has no heuristics whatsoever. There is only one 85 'timeslices' and has no heuristics whatsoever. There is only one
86 central tunable: 86 central tunable (you have to switch on CONFIG_SCHED_DEBUG):
87 87
88 /proc/sys/kernel/sched_granularity_ns 88 /proc/sys/kernel/sched_granularity_ns
89 89
diff --git a/Documentation/sched-nice-design.txt b/Documentation/sched-nice-design.txt
new file mode 100644
index 000000000000..e2bae5a577e3
--- /dev/null
+++ b/Documentation/sched-nice-design.txt
@@ -0,0 +1,108 @@
1This document explains the thinking about the revamped and streamlined
2nice-levels implementation in the new Linux scheduler.
3
4Nice levels were always pretty weak under Linux and people continuously
5pestered us to make nice +19 tasks use up much less CPU time.
6
7Unfortunately that was not that easy to implement under the old
8scheduler, (otherwise we'd have done it long ago) because nice level
9support was historically coupled to timeslice length, and timeslice
10units were driven by the HZ tick, so the smallest timeslice was 1/HZ.
11
12In the O(1) scheduler (in 2003) we changed negative nice levels to be
13much stronger than they were before in 2.4 (and people were happy about
14that change), and we also intentionally calibrated the linear timeslice
15rule so that nice +19 level would be _exactly_ 1 jiffy. To better
16understand it, the timeslice graph went like this (cheesy ASCII art
17alert!):
18
19
20 A
21 \ | [timeslice length]
22 \ |
23 \ |
24 \ |
25 \ |
26 \|___100msecs
27 |^ . _
28 | ^ . _
29 | ^ . _
30 -*----------------------------------*-----> [nice level]
31 -20 | +19
32 |
33 |
34
35So that if someone wanted to really renice tasks, +19 would give a much
36bigger hit than the normal linear rule would do. (The solution of
37changing the ABI to extend priorities was discarded early on.)
38
39This approach worked to some degree for some time, but later on with
40HZ=1000 it caused 1 jiffy to be 1 msec, which meant 0.1% CPU usage which
41we felt to be a bit excessive. Excessive _not_ because it's too small of
42a CPU utilization, but because it causes too frequent (once per
43millisec) rescheduling. (and would thus trash the cache, etc. Remember,
44this was long ago when hardware was weaker and caches were smaller, and
45people were running number crunching apps at nice +19.)
46
47So for HZ=1000 we changed nice +19 to 5msecs, because that felt like the
48right minimal granularity - and this translates to 5% CPU utilization.
49But the fundamental HZ-sensitive property for nice+19 still remained,
50and we never got a single complaint about nice +19 being too _weak_ in
51terms of CPU utilization, we only got complaints about it (still) being
52too _strong_ :-)
53
54To sum it up: we always wanted to make nice levels more consistent, but
55within the constraints of HZ and jiffies and their nasty design level
56coupling to timeslices and granularity it was not really viable.
57
58The second (less frequent but still periodically occuring) complaint
59about Linux's nice level support was its assymetry around the origo
60(which you can see demonstrated in the picture above), or more
61accurately: the fact that nice level behavior depended on the _absolute_
62nice level as well, while the nice API itself is fundamentally
63"relative":
64
65 int nice(int inc);
66
67 asmlinkage long sys_nice(int increment)
68
69(the first one is the glibc API, the second one is the syscall API.)
70Note that the 'inc' is relative to the current nice level. Tools like
71bash's "nice" command mirror this relative API.
72
73With the old scheduler, if you for example started a niced task with +1
74and another task with +2, the CPU split between the two tasks would
75depend on the nice level of the parent shell - if it was at nice -10 the
76CPU split was different than if it was at +5 or +10.
77
78A third complaint against Linux's nice level support was that negative
79nice levels were not 'punchy enough', so lots of people had to resort to
80run audio (and other multimedia) apps under RT priorities such as
81SCHED_FIFO. But this caused other problems: SCHED_FIFO is not starvation
82proof, and a buggy SCHED_FIFO app can also lock up the system for good.
83
84The new scheduler in v2.6.23 addresses all three types of complaints:
85
86To address the first complaint (of nice levels being not "punchy"
87enough), the scheduler was decoupled from 'time slice' and HZ concepts
88(and granularity was made a separate concept from nice levels) and thus
89it was possible to implement better and more consistent nice +19
90support: with the new scheduler nice +19 tasks get a HZ-independent
911.5%, instead of the variable 3%-5%-9% range they got in the old
92scheduler.
93
94To address the second complaint (of nice levels not being consistent),
95the new scheduler makes nice(1) have the same CPU utilization effect on
96tasks, regardless of their absolute nice levels. So on the new
97scheduler, running a nice +10 and a nice 11 task has the same CPU
98utilization "split" between them as running a nice -5 and a nice -4
99task. (one will get 55% of the CPU, the other 45%.) That is why nice
100levels were changed to be "multiplicative" (or exponential) - that way
101it does not matter which nice level you start out from, the 'relative
102result' will always be the same.
103
104The third complaint (of negative nice levels not being "punchy" enough
105and forcing audio apps to run under the more dangerous SCHED_FIFO
106scheduling policy) is addressed by the new scheduler almost
107automatically: stronger negative nice levels are an automatic
108side-effect of the recalibrated dynamic range of nice levels.
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index ba328f255417..ef19142896ca 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -1,6 +1,6 @@
1Linux Magic System Request Key Hacks 1Linux Magic System Request Key Hacks
2Documentation for sysrq.c 2Documentation for sysrq.c
3Last update: 2007-MAR-14 3Last update: 2007-AUG-04
4 4
5* What is the magic SysRq key? 5* What is the magic SysRq key?
6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -78,7 +78,7 @@ On all - write a character to /proc/sysrq-trigger. e.g.:
78'g' - Used by kgdb on ppc and sh platforms. 78'g' - Used by kgdb on ppc and sh platforms.
79 79
80'h' - Will display help (actually any other key than those listed 80'h' - Will display help (actually any other key than those listed
81 above will display help. but 'h' is easy to remember :-) 81 here will display help. but 'h' is easy to remember :-)
82 82
83'i' - Send a SIGKILL to all processes, except for init. 83'i' - Send a SIGKILL to all processes, except for init.
84 84
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index 6711fbcf4080..eb2f5986e1eb 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -105,10 +105,10 @@ The version of thinkpad-acpi's sysfs interface is exported by the driver
105as a driver attribute (see below). 105as a driver attribute (see below).
106 106
107Sysfs driver attributes are on the driver's sysfs attribute space, 107Sysfs driver attributes are on the driver's sysfs attribute space,
108for 2.6.20 this is /sys/bus/platform/drivers/thinkpad-acpi/. 108for 2.6.20 this is /sys/bus/platform/drivers/thinkpad_acpi/.
109 109
110Sysfs device attributes are on the driver's sysfs attribute space, 110Sysfs device attributes are on the driver's sysfs attribute space,
111for 2.6.20 this is /sys/devices/platform/thinkpad-acpi/. 111for 2.6.20 this is /sys/devices/platform/thinkpad_acpi/.
112 112
113Driver version 113Driver version
114-------------- 114--------------
diff --git a/Documentation/vm/slabinfo.c b/Documentation/vm/slabinfo.c
index d4f21ffd1404..1af7bd5a2183 100644
--- a/Documentation/vm/slabinfo.c
+++ b/Documentation/vm/slabinfo.c
@@ -396,7 +396,7 @@ void report(struct slabinfo *s)
396 if (strcmp(s->name, "*") == 0) 396 if (strcmp(s->name, "*") == 0)
397 return; 397 return;
398 398
399 printf("\nSlabcache: %-20s Aliases: %2d Order : %2d Objects: %d\n", 399 printf("\nSlabcache: %-20s Aliases: %2d Order : %2d Objects: %lu\n",
400 s->name, s->aliases, s->order, s->objects); 400 s->name, s->aliases, s->order, s->objects);
401 if (s->hwcache_align) 401 if (s->hwcache_align)
402 printf("** Hardware cacheline aligned\n"); 402 printf("** Hardware cacheline aligned\n");
diff --git a/MAINTAINERS b/MAINTAINERS
index e65e96a14bec..371fe67a4eef 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -97,6 +97,12 @@ M: philb@gnu.org
97L: netdev@vger.kernel.org 97L: netdev@vger.kernel.org
98S: Maintained 98S: Maintained
99 99
1003C59X NETWORK DRIVER
101P: Steffen Klassert
102M: klassert@mathematik.tu-chemnitz.de
103L: netdev@vger.kernel.org
104S: Maintained
105
1003CR990 NETWORK DRIVER 1063CR990 NETWORK DRIVER
101P: David Dillow 107P: David Dillow
102M: dave@thedillows.org 108M: dave@thedillows.org
@@ -612,6 +618,15 @@ W: http://sourceforge.net/projects/acpi4asus
612W: http://xf.iksaif.net/acpi4asus 618W: http://xf.iksaif.net/acpi4asus
613S: Maintained 619S: Maintained
614 620
621ASYNCHRONOUS TRANSFERS/TRANSFORMS API
622P: Dan Williams
623M: dan.j.williams@intel.com
624P: Shannon Nelson
625M: shannon.nelson@intel.com
626L: linux-kernel@vger.kernel.org
627W: http://sourceforge.net/projects/xscaleiop
628S: Supported
629
615ATA OVER ETHERNET DRIVER 630ATA OVER ETHERNET DRIVER
616P: Ed L. Cashin 631P: Ed L. Cashin
617M: ecashin@coraid.com 632M: ecashin@coraid.com
@@ -664,7 +679,7 @@ S: Maintained
664AUDIT SUBSYSTEM 679AUDIT SUBSYSTEM
665P: David Woodhouse 680P: David Woodhouse
666M: dwmw2@infradead.org 681M: dwmw2@infradead.org
667L: linux-audit@redhat.com 682L: linux-audit@redhat.com (subscribers-only)
668W: http://people.redhat.com/sgrubb/audit/ 683W: http://people.redhat.com/sgrubb/audit/
669T: git kernel.org:/pub/scm/linux/kernel/git/dwmw2/audit-2.6.git 684T: git kernel.org:/pub/scm/linux/kernel/git/dwmw2/audit-2.6.git
670S: Maintained 685S: Maintained
@@ -994,7 +1009,7 @@ P: Steve French
994M: sfrench@samba.org 1009M: sfrench@samba.org
995L: linux-cifs-client@lists.samba.org 1010L: linux-cifs-client@lists.samba.org
996L: samba-technical@lists.samba.org 1011L: samba-technical@lists.samba.org
997W: http://us1.samba.org/samba/Linux_CIFS_client.html 1012W: http://linux-cifs.samba.org/
998T: git kernel.org:/pub/scm/linux/kernel/git/sfrench/cifs-2.6.git 1013T: git kernel.org:/pub/scm/linux/kernel/git/sfrench/cifs-2.6.git
999S: Supported 1014S: Supported
1000 1015
@@ -1277,11 +1292,13 @@ M: tori@unhappy.mine.nu
1277L: netdev@vger.kernel.org 1292L: netdev@vger.kernel.org
1278S: Maintained 1293S: Maintained
1279 1294
1280DMA GENERIC MEMCPY SUBSYSTEM 1295DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
1281P: Shannon Nelson 1296P: Shannon Nelson
1282M: shannon.nelson@intel.com 1297M: shannon.nelson@intel.com
1298P: Dan Williams
1299M: dan.j.williams@intel.com
1283L: linux-kernel@vger.kernel.org 1300L: linux-kernel@vger.kernel.org
1284S: Maintained 1301S: Supported
1285 1302
1286DME1737 HARDWARE MONITOR DRIVER 1303DME1737 HARDWARE MONITOR DRIVER
1287P: Juerg Haefliger 1304P: Juerg Haefliger
@@ -1958,6 +1975,12 @@ M: shannon.nelson@intel.com
1958L: linux-kernel@vger.kernel.org 1975L: linux-kernel@vger.kernel.org
1959S: Supported 1976S: Supported
1960 1977
1978INTEL IOP-ADMA DMA DRIVER
1979P: Dan Williams
1980M: dan.j.williams@intel.com
1981L: linux-kernel@vger.kernel.org
1982S: Supported
1983
1961INTEL IXP4XX RANDOM NUMBER GENERATOR SUPPORT 1984INTEL IXP4XX RANDOM NUMBER GENERATOR SUPPORT
1962P: Deepak Saxena 1985P: Deepak Saxena
1963M: dsaxena@plexity.net 1986M: dsaxena@plexity.net
diff --git a/Makefile b/Makefile
index dfe3d1610a7b..f3229a4945bf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 23 3SUBLEVEL = 23
4EXTRAVERSION =-rc1 4EXTRAVERSION =-rc3
5NAME = Holy Dancing Manatees, Batman! 5NAME = Holy Dancing Manatees, Batman!
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 1d3c1398c428..52c91ccc1648 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -271,6 +271,19 @@ titan_dispatch_irqs(u64 mask)
271 * Titan Family 271 * Titan Family
272 */ 272 */
273static void __init 273static void __init
274titan_request_irq(unsigned int irq, irq_handler_t handler,
275 unsigned long irqflags, const char *devname,
276 void *dev_id)
277{
278 int err;
279 err = request_irq(irq, handler, irqflags, devname, dev_id);
280 if (err) {
281 printk("titan_request_irq for IRQ %d returned %d; ignoring\n",
282 irq, err);
283 }
284}
285
286static void __init
274titan_late_init(void) 287titan_late_init(void)
275{ 288{
276 /* 289 /*
@@ -278,15 +291,15 @@ titan_late_init(void)
278 * all reported to the kernel as machine checks, so the handler 291 * all reported to the kernel as machine checks, so the handler
279 * is a nop so it can be called to count the individual events. 292 * is a nop so it can be called to count the individual events.
280 */ 293 */
281 request_irq(63+16, titan_intr_nop, IRQF_DISABLED, 294 titan_request_irq(63+16, titan_intr_nop, IRQF_DISABLED,
282 "CChip Error", NULL); 295 "CChip Error", NULL);
283 request_irq(62+16, titan_intr_nop, IRQF_DISABLED, 296 titan_request_irq(62+16, titan_intr_nop, IRQF_DISABLED,
284 "PChip 0 H_Error", NULL); 297 "PChip 0 H_Error", NULL);
285 request_irq(61+16, titan_intr_nop, IRQF_DISABLED, 298 titan_request_irq(61+16, titan_intr_nop, IRQF_DISABLED,
286 "PChip 1 H_Error", NULL); 299 "PChip 1 H_Error", NULL);
287 request_irq(60+16, titan_intr_nop, IRQF_DISABLED, 300 titan_request_irq(60+16, titan_intr_nop, IRQF_DISABLED,
288 "PChip 0 C_Error", NULL); 301 "PChip 0 C_Error", NULL);
289 request_irq(59+16, titan_intr_nop, IRQF_DISABLED, 302 titan_request_irq(59+16, titan_intr_nop, IRQF_DISABLED,
290 "PChip 1 C_Error", NULL); 303 "PChip 1 C_Error", NULL);
291 304
292 /* 305 /*
@@ -345,9 +358,9 @@ privateer_init_pci(void)
345 * Hook a couple of extra err interrupts that the 358 * Hook a couple of extra err interrupts that the
346 * common titan code won't. 359 * common titan code won't.
347 */ 360 */
348 request_irq(53+16, titan_intr_nop, IRQF_DISABLED, 361 titan_request_irq(53+16, titan_intr_nop, IRQF_DISABLED,
349 "NMI", NULL); 362 "NMI", NULL);
350 request_irq(50+16, titan_intr_nop, IRQF_DISABLED, 363 titan_request_irq(50+16, titan_intr_nop, IRQF_DISABLED,
351 "Temperature Warning", NULL); 364 "Temperature Warning", NULL);
352 365
353 /* 366 /*
diff --git a/arch/arm/configs/iop13xx_defconfig b/arch/arm/configs/iop13xx_defconfig
index 43c4a37e9247..add03c9e5553 100644
--- a/arch/arm/configs/iop13xx_defconfig
+++ b/arch/arm/configs/iop13xx_defconfig
@@ -1,12 +1,18 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc1-git5 3# Linux kernel version: 2.6.22
4# Tue Dec 19 21:38:01 2006 4# Thu Jul 19 15:57:52 2007
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
7# CONFIG_GENERIC_TIME is not set 9# CONFIG_GENERIC_TIME is not set
10# CONFIG_GENERIC_CLOCKEVENTS is not set
8CONFIG_MMU=y 11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
9CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
10CONFIG_TRACE_IRQFLAGS_SUPPORT=y 16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
11CONFIG_HARDIRQS_SW_RESEND=y 17CONFIG_HARDIRQS_SW_RESEND=y
12CONFIG_GENERIC_IRQ_PROBE=y 18CONFIG_GENERIC_IRQ_PROBE=y
@@ -15,6 +21,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
15# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
16CONFIG_GENERIC_HWEIGHT=y 22CONFIG_GENERIC_HWEIGHT=y
17CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
18CONFIG_VECTORS_BASE=0xffff0000 25CONFIG_VECTORS_BASE=0xffff0000
19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
20 27
@@ -32,17 +39,19 @@ CONFIG_LOCALVERSION=""
32# CONFIG_LOCALVERSION_AUTO is not set 39# CONFIG_LOCALVERSION_AUTO is not set
33CONFIG_SWAP=y 40CONFIG_SWAP=y
34CONFIG_SYSVIPC=y 41CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set 42CONFIG_SYSVIPC_SYSCTL=y
36CONFIG_POSIX_MQUEUE=y 43CONFIG_POSIX_MQUEUE=y
37CONFIG_BSD_PROCESS_ACCT=y 44CONFIG_BSD_PROCESS_ACCT=y
38# CONFIG_BSD_PROCESS_ACCT_V3 is not set 45# CONFIG_BSD_PROCESS_ACCT_V3 is not set
39# CONFIG_TASKSTATS is not set 46# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 47# CONFIG_USER_NS is not set
41# CONFIG_AUDIT is not set 48# CONFIG_AUDIT is not set
42CONFIG_IKCONFIG=y 49CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 50CONFIG_IKCONFIG_PROC=y
51CONFIG_LOG_BUF_SHIFT=14
44CONFIG_SYSFS_DEPRECATED=y 52CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set 53# CONFIG_RELAY is not set
54CONFIG_BLK_DEV_INITRD=y
46CONFIG_INITRAMFS_SOURCE="" 55CONFIG_INITRAMFS_SOURCE=""
47# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 56# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
48CONFIG_SYSCTL=y 57CONFIG_SYSCTL=y
@@ -57,32 +66,30 @@ CONFIG_BUG=y
57CONFIG_ELF_CORE=y 66CONFIG_ELF_CORE=y
58CONFIG_BASE_FULL=y 67CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y 68CONFIG_FUTEX=y
69CONFIG_ANON_INODES=y
60CONFIG_EPOLL=y 70CONFIG_EPOLL=y
71CONFIG_SIGNALFD=y
72CONFIG_TIMERFD=y
73CONFIG_EVENTFD=y
61CONFIG_SHMEM=y 74CONFIG_SHMEM=y
62CONFIG_SLAB=y
63CONFIG_VM_EVENT_COUNTERS=y 75CONFIG_VM_EVENT_COUNTERS=y
76CONFIG_SLAB=y
77# CONFIG_SLUB is not set
78# CONFIG_SLOB is not set
64CONFIG_RT_MUTEXES=y 79CONFIG_RT_MUTEXES=y
65# CONFIG_TINY_SHMEM is not set 80# CONFIG_TINY_SHMEM is not set
66CONFIG_BASE_SMALL=0 81CONFIG_BASE_SMALL=0
67# CONFIG_SLOB is not set
68
69#
70# Loadable module support
71#
72CONFIG_MODULES=y 82CONFIG_MODULES=y
73CONFIG_MODULE_UNLOAD=y 83CONFIG_MODULE_UNLOAD=y
74# CONFIG_MODULE_FORCE_UNLOAD is not set 84# CONFIG_MODULE_FORCE_UNLOAD is not set
75CONFIG_MODVERSIONS=y 85CONFIG_MODVERSIONS=y
76# CONFIG_MODULE_SRCVERSION_ALL is not set 86# CONFIG_MODULE_SRCVERSION_ALL is not set
77CONFIG_KMOD=y 87CONFIG_KMOD=y
78
79#
80# Block layer
81#
82CONFIG_BLOCK=y 88CONFIG_BLOCK=y
83# CONFIG_LBD is not set 89# CONFIG_LBD is not set
84# CONFIG_BLK_DEV_IO_TRACE is not set 90# CONFIG_BLK_DEV_IO_TRACE is not set
85# CONFIG_LSF is not set 91# CONFIG_LSF is not set
92# CONFIG_BLK_DEV_BSG is not set
86 93
87# 94#
88# IO Schedulers 95# IO Schedulers
@@ -114,13 +121,15 @@ CONFIG_DEFAULT_IOSCHED="deadline"
114# CONFIG_ARCH_NETX is not set 121# CONFIG_ARCH_NETX is not set
115# CONFIG_ARCH_H720X is not set 122# CONFIG_ARCH_H720X is not set
116# CONFIG_ARCH_IMX is not set 123# CONFIG_ARCH_IMX is not set
124CONFIG_ARCH_IOP13XX=y
117# CONFIG_ARCH_IOP32X is not set 125# CONFIG_ARCH_IOP32X is not set
118# CONFIG_ARCH_IOP33X is not set 126# CONFIG_ARCH_IOP33X is not set
119CONFIG_ARCH_IOP13XX=y
120# CONFIG_ARCH_IXP4XX is not set
121# CONFIG_ARCH_IXP2000 is not set
122# CONFIG_ARCH_IXP23XX is not set 127# CONFIG_ARCH_IXP23XX is not set
128# CONFIG_ARCH_IXP2000 is not set
129# CONFIG_ARCH_IXP4XX is not set
123# CONFIG_ARCH_L7200 is not set 130# CONFIG_ARCH_L7200 is not set
131# CONFIG_ARCH_KS8695 is not set
132# CONFIG_ARCH_NS9XXX is not set
124# CONFIG_ARCH_PNX4008 is not set 133# CONFIG_ARCH_PNX4008 is not set
125# CONFIG_ARCH_PXA is not set 134# CONFIG_ARCH_PXA is not set
126# CONFIG_ARCH_RPC is not set 135# CONFIG_ARCH_RPC is not set
@@ -128,6 +137,7 @@ CONFIG_ARCH_IOP13XX=y
128# CONFIG_ARCH_S3C2410 is not set 137# CONFIG_ARCH_S3C2410 is not set
129# CONFIG_ARCH_SHARK is not set 138# CONFIG_ARCH_SHARK is not set
130# CONFIG_ARCH_LH7A40X is not set 139# CONFIG_ARCH_LH7A40X is not set
140# CONFIG_ARCH_DAVINCI is not set
131# CONFIG_ARCH_OMAP is not set 141# CONFIG_ARCH_OMAP is not set
132 142
133# 143#
@@ -141,6 +151,12 @@ CONFIG_MACH_IQ81340SC=y
141CONFIG_MACH_IQ81340MC=y 151CONFIG_MACH_IQ81340MC=y
142 152
143# 153#
154# IOP13XX IMU Support
155#
156# CONFIG_IOP_IMU is not set
157CONFIG_PLAT_IOP=y
158
159#
144# Processor Type 160# Processor Type
145# 161#
146CONFIG_CPU_32=y 162CONFIG_CPU_32=y
@@ -159,13 +175,16 @@ CONFIG_IO_36=y
159CONFIG_ARM_THUMB=y 175CONFIG_ARM_THUMB=y
160# CONFIG_CPU_DCACHE_DISABLE is not set 176# CONFIG_CPU_DCACHE_DISABLE is not set
161# CONFIG_CPU_BPREDICT_DISABLE is not set 177# CONFIG_CPU_BPREDICT_DISABLE is not set
178# CONFIG_OUTER_CACHE is not set
162# CONFIG_IWMMXT is not set 179# CONFIG_IWMMXT is not set
163 180
164# 181#
165# Bus support 182# Bus support
166# 183#
167CONFIG_PCI=y 184CONFIG_PCI=y
168# CONFIG_PCI_MULTITHREAD_PROBE is not set 185CONFIG_PCI_SYSCALL=y
186CONFIG_ARCH_SUPPORTS_MSI=y
187# CONFIG_PCI_MSI is not set
169 188
170# 189#
171# PCCARD (PCMCIA/CardBus) support 190# PCCARD (PCMCIA/CardBus) support
@@ -175,6 +194,7 @@ CONFIG_PCI=y
175# 194#
176# Kernel Features 195# Kernel Features
177# 196#
197# CONFIG_TICK_ONESHOT is not set
178# CONFIG_PREEMPT is not set 198# CONFIG_PREEMPT is not set
179# CONFIG_NO_IDLE_HZ is not set 199# CONFIG_NO_IDLE_HZ is not set
180CONFIG_HZ=100 200CONFIG_HZ=100
@@ -189,6 +209,9 @@ CONFIG_FLAT_NODE_MEM_MAP=y
189# CONFIG_SPARSEMEM_STATIC is not set 209# CONFIG_SPARSEMEM_STATIC is not set
190CONFIG_SPLIT_PTLOCK_CPUS=4096 210CONFIG_SPLIT_PTLOCK_CPUS=4096
191# CONFIG_RESOURCES_64BIT is not set 211# CONFIG_RESOURCES_64BIT is not set
212CONFIG_ZONE_DMA_FLAG=1
213CONFIG_BOUNCE=y
214CONFIG_VIRT_TO_BUS=y
192CONFIG_ALIGNMENT_TRAP=y 215CONFIG_ALIGNMENT_TRAP=y
193 216
194# 217#
@@ -198,6 +221,7 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
198CONFIG_ZBOOT_ROM_BSS=0x0 221CONFIG_ZBOOT_ROM_BSS=0x0
199CONFIG_CMDLINE="ip=bootp root=nfs console=ttyS0,115200 nfsroot=,tcp,v3,wsize=8192,rsize=8192" 222CONFIG_CMDLINE="ip=bootp root=nfs console=ttyS0,115200 nfsroot=,tcp,v3,wsize=8192,rsize=8192"
200# CONFIG_XIP_KERNEL is not set 223# CONFIG_XIP_KERNEL is not set
224# CONFIG_KEXEC is not set
201 225
202# 226#
203# Floating point emulation 227# Floating point emulation
@@ -222,7 +246,6 @@ CONFIG_BINFMT_AOUT=y
222# Power management options 246# Power management options
223# 247#
224# CONFIG_PM is not set 248# CONFIG_PM is not set
225# CONFIG_APM is not set
226 249
227# 250#
228# Networking 251# Networking
@@ -232,14 +255,15 @@ CONFIG_NET=y
232# 255#
233# Networking options 256# Networking options
234# 257#
235# CONFIG_NETDEBUG is not set
236CONFIG_PACKET=y 258CONFIG_PACKET=y
237CONFIG_PACKET_MMAP=y 259CONFIG_PACKET_MMAP=y
238CONFIG_UNIX=y 260CONFIG_UNIX=y
239CONFIG_XFRM=y 261CONFIG_XFRM=y
240# CONFIG_XFRM_USER is not set 262# CONFIG_XFRM_USER is not set
241# CONFIG_XFRM_SUB_POLICY is not set 263# CONFIG_XFRM_SUB_POLICY is not set
264# CONFIG_XFRM_MIGRATE is not set
242CONFIG_NET_KEY=y 265CONFIG_NET_KEY=y
266# CONFIG_NET_KEY_MIGRATE is not set
243CONFIG_INET=y 267CONFIG_INET=y
244CONFIG_IP_MULTICAST=y 268CONFIG_IP_MULTICAST=y
245# CONFIG_IP_ADVANCED_ROUTER is not set 269# CONFIG_IP_ADVANCED_ROUTER is not set
@@ -270,6 +294,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
270CONFIG_IPV6=y 294CONFIG_IPV6=y
271# CONFIG_IPV6_PRIVACY is not set 295# CONFIG_IPV6_PRIVACY is not set
272# CONFIG_IPV6_ROUTER_PREF is not set 296# CONFIG_IPV6_ROUTER_PREF is not set
297# CONFIG_IPV6_OPTIMISTIC_DAD is not set
273# CONFIG_INET6_AH is not set 298# CONFIG_INET6_AH is not set
274# CONFIG_INET6_ESP is not set 299# CONFIG_INET6_ESP is not set
275# CONFIG_INET6_IPCOMP is not set 300# CONFIG_INET6_IPCOMP is not set
@@ -285,20 +310,8 @@ CONFIG_IPV6=y
285# CONFIG_IPV6_MULTIPLE_TABLES is not set 310# CONFIG_IPV6_MULTIPLE_TABLES is not set
286# CONFIG_NETWORK_SECMARK is not set 311# CONFIG_NETWORK_SECMARK is not set
287# CONFIG_NETFILTER is not set 312# CONFIG_NETFILTER is not set
288
289#
290# DCCP Configuration (EXPERIMENTAL)
291#
292# CONFIG_IP_DCCP is not set 313# CONFIG_IP_DCCP is not set
293
294#
295# SCTP Configuration (EXPERIMENTAL)
296#
297# CONFIG_IP_SCTP is not set 314# CONFIG_IP_SCTP is not set
298
299#
300# TIPC Configuration (EXPERIMENTAL)
301#
302# CONFIG_TIPC is not set 315# CONFIG_TIPC is not set
303# CONFIG_ATM is not set 316# CONFIG_ATM is not set
304# CONFIG_BRIDGE is not set 317# CONFIG_BRIDGE is not set
@@ -324,7 +337,17 @@ CONFIG_IPV6=y
324# CONFIG_HAMRADIO is not set 337# CONFIG_HAMRADIO is not set
325# CONFIG_IRDA is not set 338# CONFIG_IRDA is not set
326# CONFIG_BT is not set 339# CONFIG_BT is not set
340# CONFIG_AF_RXRPC is not set
341
342#
343# Wireless
344#
345# CONFIG_CFG80211 is not set
346# CONFIG_WIRELESS_EXT is not set
347# CONFIG_MAC80211 is not set
327# CONFIG_IEEE80211 is not set 348# CONFIG_IEEE80211 is not set
349# CONFIG_RFKILL is not set
350# CONFIG_NET_9P is not set
328 351
329# 352#
330# Device Drivers 353# Device Drivers
@@ -337,15 +360,7 @@ CONFIG_STANDALONE=y
337CONFIG_PREVENT_FIRMWARE_BUILD=y 360CONFIG_PREVENT_FIRMWARE_BUILD=y
338# CONFIG_FW_LOADER is not set 361# CONFIG_FW_LOADER is not set
339# CONFIG_SYS_HYPERVISOR is not set 362# CONFIG_SYS_HYPERVISOR is not set
340
341#
342# Connector - unified userspace <-> kernelspace linker
343#
344# CONFIG_CONNECTOR is not set 363# CONFIG_CONNECTOR is not set
345
346#
347# Memory Technology Devices (MTD)
348#
349CONFIG_MTD=y 364CONFIG_MTD=y
350# CONFIG_MTD_DEBUG is not set 365# CONFIG_MTD_DEBUG is not set
351# CONFIG_MTD_CONCAT is not set 366# CONFIG_MTD_CONCAT is not set
@@ -361,6 +376,7 @@ CONFIG_MTD_REDBOOT_PARTS_READONLY=y
361# User Modules And Translation Layers 376# User Modules And Translation Layers
362# 377#
363# CONFIG_MTD_CHAR is not set 378# CONFIG_MTD_CHAR is not set
379CONFIG_MTD_BLKDEVS=y
364CONFIG_MTD_BLOCK=y 380CONFIG_MTD_BLOCK=y
365# CONFIG_FTL is not set 381# CONFIG_FTL is not set
366# CONFIG_NFTL is not set 382# CONFIG_NFTL is not set
@@ -397,7 +413,6 @@ CONFIG_MTD_CFI_UTIL=y
397# CONFIG_MTD_RAM is not set 413# CONFIG_MTD_RAM is not set
398# CONFIG_MTD_ROM is not set 414# CONFIG_MTD_ROM is not set
399# CONFIG_MTD_ABSENT is not set 415# CONFIG_MTD_ABSENT is not set
400# CONFIG_MTD_OBSOLETE_CHIPS is not set
401 416
402# 417#
403# Mapping drivers for chip access 418# Mapping drivers for chip access
@@ -425,42 +440,27 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
425# CONFIG_MTD_DOC2000 is not set 440# CONFIG_MTD_DOC2000 is not set
426# CONFIG_MTD_DOC2001 is not set 441# CONFIG_MTD_DOC2001 is not set
427# CONFIG_MTD_DOC2001PLUS is not set 442# CONFIG_MTD_DOC2001PLUS is not set
428
429#
430# NAND Flash Device Drivers
431#
432# CONFIG_MTD_NAND is not set 443# CONFIG_MTD_NAND is not set
433
434#
435# OneNAND Flash Device Drivers
436#
437# CONFIG_MTD_ONENAND is not set 444# CONFIG_MTD_ONENAND is not set
438 445
439# 446#
440# Parallel port support 447# UBI - Unsorted block images
441# 448#
449# CONFIG_MTD_UBI is not set
442# CONFIG_PARPORT is not set 450# CONFIG_PARPORT is not set
443 451CONFIG_BLK_DEV=y
444#
445# Plug and Play support
446#
447
448#
449# Block devices
450#
451# CONFIG_BLK_CPQ_DA is not set 452# CONFIG_BLK_CPQ_DA is not set
452# CONFIG_BLK_CPQ_CISS_DA is not set 453# CONFIG_BLK_CPQ_CISS_DA is not set
453# CONFIG_BLK_DEV_DAC960 is not set 454# CONFIG_BLK_DEV_DAC960 is not set
454# CONFIG_BLK_DEV_UMEM is not set 455# CONFIG_BLK_DEV_UMEM is not set
455# CONFIG_BLK_DEV_COW_COMMON is not set 456# CONFIG_BLK_DEV_COW_COMMON is not set
456# CONFIG_BLK_DEV_LOOP is not set 457# CONFIG_BLK_DEV_LOOP is not set
457CONFIG_BLK_DEV_NBD=y 458# CONFIG_BLK_DEV_NBD is not set
458# CONFIG_BLK_DEV_SX8 is not set 459# CONFIG_BLK_DEV_SX8 is not set
459CONFIG_BLK_DEV_RAM=y 460CONFIG_BLK_DEV_RAM=y
460CONFIG_BLK_DEV_RAM_COUNT=2 461CONFIG_BLK_DEV_RAM_COUNT=2
461CONFIG_BLK_DEV_RAM_SIZE=8192 462CONFIG_BLK_DEV_RAM_SIZE=8192
462CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 463CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
463CONFIG_BLK_DEV_INITRD=y
464# CONFIG_CDROM_PKTCDVD is not set 464# CONFIG_CDROM_PKTCDVD is not set
465# CONFIG_ATA_OVER_ETH is not set 465# CONFIG_ATA_OVER_ETH is not set
466 466
@@ -469,6 +469,7 @@ CONFIG_BLK_DEV_INITRD=y
469# 469#
470# CONFIG_RAID_ATTRS is not set 470# CONFIG_RAID_ATTRS is not set
471CONFIG_SCSI=y 471CONFIG_SCSI=y
472CONFIG_SCSI_DMA=y
472# CONFIG_SCSI_TGT is not set 473# CONFIG_SCSI_TGT is not set
473# CONFIG_SCSI_NETLINK is not set 474# CONFIG_SCSI_NETLINK is not set
474CONFIG_SCSI_PROC_FS=y 475CONFIG_SCSI_PROC_FS=y
@@ -490,6 +491,7 @@ CONFIG_CHR_DEV_SG=y
490CONFIG_SCSI_CONSTANTS=y 491CONFIG_SCSI_CONSTANTS=y
491# CONFIG_SCSI_LOGGING is not set 492# CONFIG_SCSI_LOGGING is not set
492# CONFIG_SCSI_SCAN_ASYNC is not set 493# CONFIG_SCSI_SCAN_ASYNC is not set
494CONFIG_SCSI_WAIT_SCAN=m
493 495
494# 496#
495# SCSI Transports 497# SCSI Transports
@@ -534,15 +536,7 @@ CONFIG_SCSI_SAS_ATTRS=y
534# CONFIG_SCSI_NSP32 is not set 536# CONFIG_SCSI_NSP32 is not set
535# CONFIG_SCSI_DEBUG is not set 537# CONFIG_SCSI_DEBUG is not set
536# CONFIG_SCSI_SRP is not set 538# CONFIG_SCSI_SRP is not set
537
538#
539# Serial ATA (prod) and Parallel ATA (experimental) drivers
540#
541# CONFIG_ATA is not set 539# CONFIG_ATA is not set
542
543#
544# Multi-device support (RAID and LVM)
545#
546CONFIG_MD=y 540CONFIG_MD=y
547CONFIG_BLK_DEV_MD=y 541CONFIG_BLK_DEV_MD=y
548# CONFIG_MD_LINEAR is not set 542# CONFIG_MD_LINEAR is not set
@@ -560,6 +554,7 @@ CONFIG_BLK_DEV_DM=y
560# CONFIG_DM_MIRROR is not set 554# CONFIG_DM_MIRROR is not set
561# CONFIG_DM_ZERO is not set 555# CONFIG_DM_ZERO is not set
562# CONFIG_DM_MULTIPATH is not set 556# CONFIG_DM_MULTIPATH is not set
557# CONFIG_DM_DELAY is not set
563 558
564# 559#
565# Fusion MPT device support 560# Fusion MPT device support
@@ -572,39 +567,19 @@ CONFIG_BLK_DEV_DM=y
572# 567#
573# IEEE 1394 (FireWire) support 568# IEEE 1394 (FireWire) support
574# 569#
570# CONFIG_FIREWIRE is not set
575# CONFIG_IEEE1394 is not set 571# CONFIG_IEEE1394 is not set
576
577#
578# I2O device support
579#
580# CONFIG_I2O is not set 572# CONFIG_I2O is not set
581
582#
583# Network device support
584#
585CONFIG_NETDEVICES=y 573CONFIG_NETDEVICES=y
574# CONFIG_NETDEVICES_MULTIQUEUE is not set
586# CONFIG_DUMMY is not set 575# CONFIG_DUMMY is not set
587# CONFIG_BONDING is not set 576# CONFIG_BONDING is not set
577# CONFIG_MACVLAN is not set
588# CONFIG_EQUALIZER is not set 578# CONFIG_EQUALIZER is not set
589# CONFIG_TUN is not set 579# CONFIG_TUN is not set
590
591#
592# ARCnet devices
593#
594# CONFIG_ARCNET is not set 580# CONFIG_ARCNET is not set
595
596#
597# PHY device support
598#
599
600#
601# Ethernet (10 or 100Mbit)
602#
603# CONFIG_NET_ETHERNET is not set 581# CONFIG_NET_ETHERNET is not set
604 582CONFIG_NETDEV_1000=y
605#
606# Ethernet (1000 Mbit)
607#
608# CONFIG_ACENIC is not set 583# CONFIG_ACENIC is not set
609# CONFIG_DL2K is not set 584# CONFIG_DL2K is not set
610CONFIG_E1000=y 585CONFIG_E1000=y
@@ -617,33 +592,26 @@ CONFIG_E1000_NAPI=y
617# CONFIG_SIS190 is not set 592# CONFIG_SIS190 is not set
618# CONFIG_SKGE is not set 593# CONFIG_SKGE is not set
619# CONFIG_SKY2 is not set 594# CONFIG_SKY2 is not set
620# CONFIG_SK98LIN is not set 595# CONFIG_VIA_VELOCITY is not set
621# CONFIG_TIGON3 is not set 596# CONFIG_TIGON3 is not set
622# CONFIG_BNX2 is not set 597# CONFIG_BNX2 is not set
623# CONFIG_QLA3XXX is not set 598# CONFIG_QLA3XXX is not set
624 599# CONFIG_ATL1 is not set
625# 600CONFIG_NETDEV_10000=y
626# Ethernet (10000 Mbit)
627#
628# CONFIG_CHELSIO_T1 is not set 601# CONFIG_CHELSIO_T1 is not set
602# CONFIG_CHELSIO_T3 is not set
629# CONFIG_IXGB is not set 603# CONFIG_IXGB is not set
630# CONFIG_S2IO is not set 604# CONFIG_S2IO is not set
631# CONFIG_MYRI10GE is not set 605# CONFIG_MYRI10GE is not set
632# CONFIG_NETXEN_NIC is not set 606# CONFIG_NETXEN_NIC is not set
633 607# CONFIG_MLX4_CORE is not set
634#
635# Token Ring devices
636#
637# CONFIG_TR is not set 608# CONFIG_TR is not set
638 609
639# 610#
640# Wireless LAN (non-hamradio) 611# Wireless LAN
641#
642# CONFIG_NET_RADIO is not set
643
644#
645# Wan interfaces
646# 612#
613# CONFIG_WLAN_PRE80211 is not set
614# CONFIG_WLAN_80211 is not set
647# CONFIG_WAN is not set 615# CONFIG_WAN is not set
648# CONFIG_FDDI is not set 616# CONFIG_FDDI is not set
649# CONFIG_HIPPI is not set 617# CONFIG_HIPPI is not set
@@ -654,10 +622,6 @@ CONFIG_E1000_NAPI=y
654# CONFIG_NETCONSOLE is not set 622# CONFIG_NETCONSOLE is not set
655# CONFIG_NETPOLL is not set 623# CONFIG_NETPOLL is not set
656# CONFIG_NET_POLL_CONTROLLER is not set 624# CONFIG_NET_POLL_CONTROLLER is not set
657
658#
659# ISDN subsystem
660#
661# CONFIG_ISDN is not set 625# CONFIG_ISDN is not set
662 626
663# 627#
@@ -665,6 +629,7 @@ CONFIG_E1000_NAPI=y
665# 629#
666CONFIG_INPUT=y 630CONFIG_INPUT=y
667# CONFIG_INPUT_FF_MEMLESS is not set 631# CONFIG_INPUT_FF_MEMLESS is not set
632# CONFIG_INPUT_POLLDEV is not set
668 633
669# 634#
670# Userland interfaces 635# Userland interfaces
@@ -684,6 +649,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
684# CONFIG_INPUT_KEYBOARD is not set 649# CONFIG_INPUT_KEYBOARD is not set
685# CONFIG_INPUT_MOUSE is not set 650# CONFIG_INPUT_MOUSE is not set
686# CONFIG_INPUT_JOYSTICK is not set 651# CONFIG_INPUT_JOYSTICK is not set
652# CONFIG_INPUT_TABLET is not set
687# CONFIG_INPUT_TOUCHSCREEN is not set 653# CONFIG_INPUT_TOUCHSCREEN is not set
688# CONFIG_INPUT_MISC is not set 654# CONFIG_INPUT_MISC is not set
689 655
@@ -721,33 +687,18 @@ CONFIG_SERIAL_CORE_CONSOLE=y
721CONFIG_UNIX98_PTYS=y 687CONFIG_UNIX98_PTYS=y
722CONFIG_LEGACY_PTYS=y 688CONFIG_LEGACY_PTYS=y
723CONFIG_LEGACY_PTY_COUNT=256 689CONFIG_LEGACY_PTY_COUNT=256
724
725#
726# IPMI
727#
728# CONFIG_IPMI_HANDLER is not set 690# CONFIG_IPMI_HANDLER is not set
729
730#
731# Watchdog Cards
732#
733# CONFIG_WATCHDOG is not set 691# CONFIG_WATCHDOG is not set
734CONFIG_HW_RANDOM=y 692CONFIG_HW_RANDOM=y
735# CONFIG_NVRAM is not set 693# CONFIG_NVRAM is not set
736# CONFIG_DTLK is not set
737# CONFIG_R3964 is not set 694# CONFIG_R3964 is not set
738# CONFIG_APPLICOM is not set 695# CONFIG_APPLICOM is not set
739# CONFIG_DRM is not set 696# CONFIG_DRM is not set
740# CONFIG_RAW_DRIVER is not set 697# CONFIG_RAW_DRIVER is not set
741
742#
743# TPM devices
744#
745# CONFIG_TCG_TPM is not set 698# CONFIG_TCG_TPM is not set
746 699CONFIG_DEVPORT=y
747#
748# I2C support
749#
750CONFIG_I2C=y 700CONFIG_I2C=y
701CONFIG_I2C_BOARDINFO=y
751# CONFIG_I2C_CHARDEV is not set 702# CONFIG_I2C_CHARDEV is not set
752 703
753# 704#
@@ -774,25 +725,28 @@ CONFIG_I2C_IOP3XX=y
774# CONFIG_I2C_PARPORT_LIGHT is not set 725# CONFIG_I2C_PARPORT_LIGHT is not set
775# CONFIG_I2C_PROSAVAGE is not set 726# CONFIG_I2C_PROSAVAGE is not set
776# CONFIG_I2C_SAVAGE4 is not set 727# CONFIG_I2C_SAVAGE4 is not set
728# CONFIG_I2C_SIMTEC is not set
777# CONFIG_I2C_SIS5595 is not set 729# CONFIG_I2C_SIS5595 is not set
778# CONFIG_I2C_SIS630 is not set 730# CONFIG_I2C_SIS630 is not set
779# CONFIG_I2C_SIS96X is not set 731# CONFIG_I2C_SIS96X is not set
732# CONFIG_I2C_TAOS_EVM is not set
780# CONFIG_I2C_STUB is not set 733# CONFIG_I2C_STUB is not set
781# CONFIG_I2C_VIA is not set 734# CONFIG_I2C_VIA is not set
782# CONFIG_I2C_VIAPRO is not set 735# CONFIG_I2C_VIAPRO is not set
783# CONFIG_I2C_VOODOO3 is not set 736# CONFIG_I2C_VOODOO3 is not set
784# CONFIG_I2C_PCA_ISA is not set
785 737
786# 738#
787# Miscellaneous I2C Chip support 739# Miscellaneous I2C Chip support
788# 740#
789# CONFIG_SENSORS_DS1337 is not set 741# CONFIG_SENSORS_DS1337 is not set
790# CONFIG_SENSORS_DS1374 is not set 742# CONFIG_SENSORS_DS1374 is not set
743# CONFIG_DS1682 is not set
791# CONFIG_SENSORS_EEPROM is not set 744# CONFIG_SENSORS_EEPROM is not set
792# CONFIG_SENSORS_PCF8574 is not set 745# CONFIG_SENSORS_PCF8574 is not set
793# CONFIG_SENSORS_PCA9539 is not set 746# CONFIG_SENSORS_PCA9539 is not set
794# CONFIG_SENSORS_PCF8591 is not set 747# CONFIG_SENSORS_PCF8591 is not set
795# CONFIG_SENSORS_MAX6875 is not set 748# CONFIG_SENSORS_MAX6875 is not set
749# CONFIG_SENSORS_TSL2550 is not set
796# CONFIG_I2C_DEBUG_CORE is not set 750# CONFIG_I2C_DEBUG_CORE is not set
797# CONFIG_I2C_DEBUG_ALGO is not set 751# CONFIG_I2C_DEBUG_ALGO is not set
798# CONFIG_I2C_DEBUG_BUS is not set 752# CONFIG_I2C_DEBUG_BUS is not set
@@ -803,21 +757,15 @@ CONFIG_I2C_IOP3XX=y
803# 757#
804# CONFIG_SPI is not set 758# CONFIG_SPI is not set
805# CONFIG_SPI_MASTER is not set 759# CONFIG_SPI_MASTER is not set
806
807#
808# Dallas's 1-wire bus
809#
810# CONFIG_W1 is not set 760# CONFIG_W1 is not set
811
812#
813# Hardware Monitoring support
814#
815CONFIG_HWMON=y 761CONFIG_HWMON=y
816# CONFIG_HWMON_VID is not set 762# CONFIG_HWMON_VID is not set
817# CONFIG_SENSORS_ABITUGURU is not set 763# CONFIG_SENSORS_ABITUGURU is not set
764# CONFIG_SENSORS_AD7418 is not set
818# CONFIG_SENSORS_ADM1021 is not set 765# CONFIG_SENSORS_ADM1021 is not set
819# CONFIG_SENSORS_ADM1025 is not set 766# CONFIG_SENSORS_ADM1025 is not set
820# CONFIG_SENSORS_ADM1026 is not set 767# CONFIG_SENSORS_ADM1026 is not set
768# CONFIG_SENSORS_ADM1029 is not set
821# CONFIG_SENSORS_ADM1031 is not set 769# CONFIG_SENSORS_ADM1031 is not set
822# CONFIG_SENSORS_ADM9240 is not set 770# CONFIG_SENSORS_ADM9240 is not set
823# CONFIG_SENSORS_ASB100 is not set 771# CONFIG_SENSORS_ASB100 is not set
@@ -840,6 +788,7 @@ CONFIG_HWMON=y
840# CONFIG_SENSORS_LM90 is not set 788# CONFIG_SENSORS_LM90 is not set
841# CONFIG_SENSORS_LM92 is not set 789# CONFIG_SENSORS_LM92 is not set
842# CONFIG_SENSORS_MAX1619 is not set 790# CONFIG_SENSORS_MAX1619 is not set
791# CONFIG_SENSORS_MAX6650 is not set
843# CONFIG_SENSORS_PC87360 is not set 792# CONFIG_SENSORS_PC87360 is not set
844# CONFIG_SENSORS_PC87427 is not set 793# CONFIG_SENSORS_PC87427 is not set
845# CONFIG_SENSORS_SIS5595 is not set 794# CONFIG_SENSORS_SIS5595 is not set
@@ -857,12 +806,16 @@ CONFIG_HWMON=y
857# CONFIG_SENSORS_W83627HF is not set 806# CONFIG_SENSORS_W83627HF is not set
858# CONFIG_SENSORS_W83627EHF is not set 807# CONFIG_SENSORS_W83627EHF is not set
859# CONFIG_HWMON_DEBUG_CHIP is not set 808# CONFIG_HWMON_DEBUG_CHIP is not set
809CONFIG_MISC_DEVICES=y
810# CONFIG_PHANTOM is not set
811# CONFIG_EEPROM_93CX6 is not set
812# CONFIG_SGI_IOC4 is not set
813# CONFIG_TIFM_CORE is not set
860 814
861# 815#
862# Misc devices 816# Multifunction device drivers
863# 817#
864# CONFIG_SGI_IOC4 is not set 818# CONFIG_MFD_SM501 is not set
865# CONFIG_TIFM_CORE is not set
866 819
867# 820#
868# LED devices 821# LED devices
@@ -881,16 +834,19 @@ CONFIG_HWMON=y
881# Multimedia devices 834# Multimedia devices
882# 835#
883# CONFIG_VIDEO_DEV is not set 836# CONFIG_VIDEO_DEV is not set
837# CONFIG_DVB_CORE is not set
838CONFIG_DAB=y
884 839
885# 840#
886# Digital Video Broadcasting Devices 841# Graphics support
887# 842#
888# CONFIG_DVB is not set 843# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
889 844
890# 845#
891# Graphics support 846# Display device support
892# 847#
893CONFIG_FIRMWARE_EDID=y 848# CONFIG_DISPLAY_SUPPORT is not set
849# CONFIG_VGASTATE is not set
894# CONFIG_FB is not set 850# CONFIG_FB is not set
895 851
896# 852#
@@ -898,21 +854,15 @@ CONFIG_FIRMWARE_EDID=y
898# 854#
899# CONFIG_VGA_CONSOLE is not set 855# CONFIG_VGA_CONSOLE is not set
900CONFIG_DUMMY_CONSOLE=y 856CONFIG_DUMMY_CONSOLE=y
901# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
902 857
903# 858#
904# Sound 859# Sound
905# 860#
906# CONFIG_SOUND is not set 861# CONFIG_SOUND is not set
907 862CONFIG_HID_SUPPORT=y
908#
909# HID Devices
910#
911CONFIG_HID=y 863CONFIG_HID=y
912 864# CONFIG_HID_DEBUG is not set
913# 865CONFIG_USB_SUPPORT=y
914# USB support
915#
916CONFIG_USB_ARCH_HAS_HCD=y 866CONFIG_USB_ARCH_HAS_HCD=y
917CONFIG_USB_ARCH_HAS_OHCI=y 867CONFIG_USB_ARCH_HAS_OHCI=y
918CONFIG_USB_ARCH_HAS_EHCI=y 868CONFIG_USB_ARCH_HAS_EHCI=y
@@ -926,10 +876,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
926# USB Gadget Support 876# USB Gadget Support
927# 877#
928# CONFIG_USB_GADGET is not set 878# CONFIG_USB_GADGET is not set
929
930#
931# MMC/SD Card support
932#
933# CONFIG_MMC is not set 879# CONFIG_MMC is not set
934 880
935# 881#
@@ -939,6 +885,22 @@ CONFIG_RTC_LIB=y
939# CONFIG_RTC_CLASS is not set 885# CONFIG_RTC_CLASS is not set
940 886
941# 887#
888# DMA Engine support
889#
890CONFIG_DMA_ENGINE=y
891
892#
893# DMA Clients
894#
895# CONFIG_NET_DMA is not set
896
897#
898# DMA Devices
899#
900# CONFIG_INTEL_IOATDMA is not set
901CONFIG_INTEL_IOP_ADMA=y
902
903#
942# File systems 904# File systems
943# 905#
944CONFIG_EXT2_FS=y 906CONFIG_EXT2_FS=y
@@ -1004,7 +966,6 @@ CONFIG_ECRYPT_FS=y
1004# CONFIG_BEFS_FS is not set 966# CONFIG_BEFS_FS is not set
1005# CONFIG_BFS_FS is not set 967# CONFIG_BFS_FS is not set
1006# CONFIG_EFS_FS is not set 968# CONFIG_EFS_FS is not set
1007# CONFIG_JFFS_FS is not set
1008CONFIG_JFFS2_FS=y 969CONFIG_JFFS2_FS=y
1009CONFIG_JFFS2_FS_DEBUG=0 970CONFIG_JFFS2_FS_DEBUG=0
1010CONFIG_JFFS2_FS_WRITEBUFFER=y 971CONFIG_JFFS2_FS_WRITEBUFFER=y
@@ -1014,7 +975,7 @@ CONFIG_JFFS2_FS_WRITEBUFFER=y
1014CONFIG_JFFS2_ZLIB=y 975CONFIG_JFFS2_ZLIB=y
1015CONFIG_JFFS2_RTIME=y 976CONFIG_JFFS2_RTIME=y
1016# CONFIG_JFFS2_RUBIN is not set 977# CONFIG_JFFS2_RUBIN is not set
1017# CONFIG_CRAMFS is not set 978CONFIG_CRAMFS=y
1018# CONFIG_VXFS_FS is not set 979# CONFIG_VXFS_FS is not set
1019# CONFIG_HPFS_FS is not set 980# CONFIG_HPFS_FS is not set
1020# CONFIG_QNX4FS_FS is not set 981# CONFIG_QNX4FS_FS is not set
@@ -1040,6 +1001,7 @@ CONFIG_LOCKD_V4=y
1040CONFIG_EXPORTFS=y 1001CONFIG_EXPORTFS=y
1041CONFIG_NFS_COMMON=y 1002CONFIG_NFS_COMMON=y
1042CONFIG_SUNRPC=y 1003CONFIG_SUNRPC=y
1004# CONFIG_SUNRPC_BIND34 is not set
1043# CONFIG_RPCSEC_GSS_KRB5 is not set 1005# CONFIG_RPCSEC_GSS_KRB5 is not set
1044# CONFIG_RPCSEC_GSS_SPKM3 is not set 1006# CONFIG_RPCSEC_GSS_SPKM3 is not set
1045CONFIG_SMB_FS=m 1007CONFIG_SMB_FS=m
@@ -1053,7 +1015,6 @@ CONFIG_CIFS=m
1053# CONFIG_NCP_FS is not set 1015# CONFIG_NCP_FS is not set
1054# CONFIG_CODA_FS is not set 1016# CONFIG_CODA_FS is not set
1055# CONFIG_AFS_FS is not set 1017# CONFIG_AFS_FS is not set
1056# CONFIG_9P_FS is not set
1057 1018
1058# 1019#
1059# Partition Types 1020# Partition Types
@@ -1075,6 +1036,7 @@ CONFIG_MSDOS_PARTITION=y
1075# CONFIG_SUN_PARTITION is not set 1036# CONFIG_SUN_PARTITION is not set
1076# CONFIG_KARMA_PARTITION is not set 1037# CONFIG_KARMA_PARTITION is not set
1077# CONFIG_EFI_PARTITION is not set 1038# CONFIG_EFI_PARTITION is not set
1039# CONFIG_SYSV68_PARTITION is not set
1078 1040
1079# 1041#
1080# Native Language Support 1042# Native Language Support
@@ -1140,7 +1102,6 @@ CONFIG_ENABLE_MUST_CHECK=y
1140# CONFIG_DEBUG_FS is not set 1102# CONFIG_DEBUG_FS is not set
1141# CONFIG_HEADERS_CHECK is not set 1103# CONFIG_HEADERS_CHECK is not set
1142# CONFIG_DEBUG_KERNEL is not set 1104# CONFIG_DEBUG_KERNEL is not set
1143CONFIG_LOG_BUF_SHIFT=14
1144CONFIG_DEBUG_BUGVERBOSE=y 1105CONFIG_DEBUG_BUGVERBOSE=y
1145CONFIG_FRAME_POINTER=y 1106CONFIG_FRAME_POINTER=y
1146CONFIG_DEBUG_USER=y 1107CONFIG_DEBUG_USER=y
@@ -1151,10 +1112,10 @@ CONFIG_DEBUG_USER=y
1151CONFIG_KEYS=y 1112CONFIG_KEYS=y
1152CONFIG_KEYS_DEBUG_PROC_KEYS=y 1113CONFIG_KEYS_DEBUG_PROC_KEYS=y
1153# CONFIG_SECURITY is not set 1114# CONFIG_SECURITY is not set
1154 1115CONFIG_XOR_BLOCKS=y
1155# 1116CONFIG_ASYNC_CORE=y
1156# Cryptographic options 1117CONFIG_ASYNC_MEMCPY=y
1157# 1118CONFIG_ASYNC_XOR=y
1158CONFIG_CRYPTO=y 1119CONFIG_CRYPTO=y
1159CONFIG_CRYPTO_ALGAPI=y 1120CONFIG_CRYPTO_ALGAPI=y
1160CONFIG_CRYPTO_BLKCIPHER=y 1121CONFIG_CRYPTO_BLKCIPHER=y
@@ -1173,8 +1134,11 @@ CONFIG_CRYPTO_TGR192=y
1173CONFIG_CRYPTO_GF128MUL=y 1134CONFIG_CRYPTO_GF128MUL=y
1174CONFIG_CRYPTO_ECB=y 1135CONFIG_CRYPTO_ECB=y
1175CONFIG_CRYPTO_CBC=y 1136CONFIG_CRYPTO_CBC=y
1137CONFIG_CRYPTO_PCBC=m
1176CONFIG_CRYPTO_LRW=y 1138CONFIG_CRYPTO_LRW=y
1139# CONFIG_CRYPTO_CRYPTD is not set
1177CONFIG_CRYPTO_DES=y 1140CONFIG_CRYPTO_DES=y
1141# CONFIG_CRYPTO_FCRYPT is not set
1178CONFIG_CRYPTO_BLOWFISH=y 1142CONFIG_CRYPTO_BLOWFISH=y
1179CONFIG_CRYPTO_TWOFISH=y 1143CONFIG_CRYPTO_TWOFISH=y
1180CONFIG_CRYPTO_TWOFISH_COMMON=y 1144CONFIG_CRYPTO_TWOFISH_COMMON=y
@@ -1189,11 +1153,9 @@ CONFIG_CRYPTO_ANUBIS=y
1189CONFIG_CRYPTO_DEFLATE=y 1153CONFIG_CRYPTO_DEFLATE=y
1190CONFIG_CRYPTO_MICHAEL_MIC=y 1154CONFIG_CRYPTO_MICHAEL_MIC=y
1191CONFIG_CRYPTO_CRC32C=y 1155CONFIG_CRYPTO_CRC32C=y
1156# CONFIG_CRYPTO_CAMELLIA is not set
1192# CONFIG_CRYPTO_TEST is not set 1157# CONFIG_CRYPTO_TEST is not set
1193 1158CONFIG_CRYPTO_HW=y
1194#
1195# Hardware crypto devices
1196#
1197 1159
1198# 1160#
1199# Library routines 1161# Library routines
@@ -1201,9 +1163,13 @@ CONFIG_CRYPTO_CRC32C=y
1201CONFIG_BITREVERSE=y 1163CONFIG_BITREVERSE=y
1202CONFIG_CRC_CCITT=y 1164CONFIG_CRC_CCITT=y
1203# CONFIG_CRC16 is not set 1165# CONFIG_CRC16 is not set
1166# CONFIG_CRC_ITU_T is not set
1204CONFIG_CRC32=y 1167CONFIG_CRC32=y
1168# CONFIG_CRC7 is not set
1205CONFIG_LIBCRC32C=y 1169CONFIG_LIBCRC32C=y
1206CONFIG_ZLIB_INFLATE=y 1170CONFIG_ZLIB_INFLATE=y
1207CONFIG_ZLIB_DEFLATE=y 1171CONFIG_ZLIB_DEFLATE=y
1208CONFIG_PLIST=y 1172CONFIG_PLIST=y
1209CONFIG_IOMAP_COPY=y 1173CONFIG_HAS_IOMEM=y
1174CONFIG_HAS_IOPORT=y
1175CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/iop32x_defconfig b/arch/arm/configs/iop32x_defconfig
index 7909a555706d..027aef22b4d1 100644
--- a/arch/arm/configs/iop32x_defconfig
+++ b/arch/arm/configs/iop32x_defconfig
@@ -1,12 +1,18 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc1-git5 3# Linux kernel version: 2.6.22
4# Tue Dec 19 21:37:52 2006 4# Thu Jul 19 16:00:36 2007
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
7# CONFIG_GENERIC_TIME is not set 9# CONFIG_GENERIC_TIME is not set
10# CONFIG_GENERIC_CLOCKEVENTS is not set
8CONFIG_MMU=y 11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
9CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
10CONFIG_TRACE_IRQFLAGS_SUPPORT=y 16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
11CONFIG_HARDIRQS_SW_RESEND=y 17CONFIG_HARDIRQS_SW_RESEND=y
12CONFIG_GENERIC_IRQ_PROBE=y 18CONFIG_GENERIC_IRQ_PROBE=y
@@ -15,6 +21,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
15# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
16CONFIG_GENERIC_HWEIGHT=y 22CONFIG_GENERIC_HWEIGHT=y
17CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
18CONFIG_VECTORS_BASE=0xffff0000 25CONFIG_VECTORS_BASE=0xffff0000
19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
20 27
@@ -32,16 +39,18 @@ CONFIG_LOCALVERSION=""
32CONFIG_LOCALVERSION_AUTO=y 39CONFIG_LOCALVERSION_AUTO=y
33CONFIG_SWAP=y 40CONFIG_SWAP=y
34CONFIG_SYSVIPC=y 41CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set 42CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 43# CONFIG_POSIX_MQUEUE is not set
37CONFIG_BSD_PROCESS_ACCT=y 44CONFIG_BSD_PROCESS_ACCT=y
38# CONFIG_BSD_PROCESS_ACCT_V3 is not set 45# CONFIG_BSD_PROCESS_ACCT_V3 is not set
39# CONFIG_TASKSTATS is not set 46# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 47# CONFIG_USER_NS is not set
41# CONFIG_AUDIT is not set 48# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 49# CONFIG_IKCONFIG is not set
50CONFIG_LOG_BUF_SHIFT=14
43CONFIG_SYSFS_DEPRECATED=y 51CONFIG_SYSFS_DEPRECATED=y
44# CONFIG_RELAY is not set 52# CONFIG_RELAY is not set
53CONFIG_BLK_DEV_INITRD=y
45CONFIG_INITRAMFS_SOURCE="" 54CONFIG_INITRAMFS_SOURCE=""
46CONFIG_CC_OPTIMIZE_FOR_SIZE=y 55CONFIG_CC_OPTIMIZE_FOR_SIZE=y
47CONFIG_SYSCTL=y 56CONFIG_SYSCTL=y
@@ -57,32 +66,30 @@ CONFIG_BUG=y
57CONFIG_ELF_CORE=y 66CONFIG_ELF_CORE=y
58CONFIG_BASE_FULL=y 67CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y 68CONFIG_FUTEX=y
69CONFIG_ANON_INODES=y
60CONFIG_EPOLL=y 70CONFIG_EPOLL=y
71CONFIG_SIGNALFD=y
72CONFIG_TIMERFD=y
73CONFIG_EVENTFD=y
61CONFIG_SHMEM=y 74CONFIG_SHMEM=y
62CONFIG_SLAB=y
63CONFIG_VM_EVENT_COUNTERS=y 75CONFIG_VM_EVENT_COUNTERS=y
76CONFIG_SLAB=y
77# CONFIG_SLUB is not set
78# CONFIG_SLOB is not set
64CONFIG_RT_MUTEXES=y 79CONFIG_RT_MUTEXES=y
65# CONFIG_TINY_SHMEM is not set 80# CONFIG_TINY_SHMEM is not set
66CONFIG_BASE_SMALL=0 81CONFIG_BASE_SMALL=0
67# CONFIG_SLOB is not set
68
69#
70# Loadable module support
71#
72CONFIG_MODULES=y 82CONFIG_MODULES=y
73CONFIG_MODULE_UNLOAD=y 83CONFIG_MODULE_UNLOAD=y
74# CONFIG_MODULE_FORCE_UNLOAD is not set 84# CONFIG_MODULE_FORCE_UNLOAD is not set
75# CONFIG_MODVERSIONS is not set 85# CONFIG_MODVERSIONS is not set
76# CONFIG_MODULE_SRCVERSION_ALL is not set 86# CONFIG_MODULE_SRCVERSION_ALL is not set
77CONFIG_KMOD=y 87CONFIG_KMOD=y
78
79#
80# Block layer
81#
82CONFIG_BLOCK=y 88CONFIG_BLOCK=y
83# CONFIG_LBD is not set 89# CONFIG_LBD is not set
84# CONFIG_BLK_DEV_IO_TRACE is not set 90# CONFIG_BLK_DEV_IO_TRACE is not set
85# CONFIG_LSF is not set 91# CONFIG_LSF is not set
92# CONFIG_BLK_DEV_BSG is not set
86 93
87# 94#
88# IO Schedulers 95# IO Schedulers
@@ -114,13 +121,15 @@ CONFIG_DEFAULT_IOSCHED="cfq"
114# CONFIG_ARCH_NETX is not set 121# CONFIG_ARCH_NETX is not set
115# CONFIG_ARCH_H720X is not set 122# CONFIG_ARCH_H720X is not set
116# CONFIG_ARCH_IMX is not set 123# CONFIG_ARCH_IMX is not set
124# CONFIG_ARCH_IOP13XX is not set
117CONFIG_ARCH_IOP32X=y 125CONFIG_ARCH_IOP32X=y
118# CONFIG_ARCH_IOP33X is not set 126# CONFIG_ARCH_IOP33X is not set
119# CONFIG_ARCH_IOP13XX is not set
120# CONFIG_ARCH_IXP4XX is not set
121# CONFIG_ARCH_IXP2000 is not set
122# CONFIG_ARCH_IXP23XX is not set 127# CONFIG_ARCH_IXP23XX is not set
128# CONFIG_ARCH_IXP2000 is not set
129# CONFIG_ARCH_IXP4XX is not set
123# CONFIG_ARCH_L7200 is not set 130# CONFIG_ARCH_L7200 is not set
131# CONFIG_ARCH_KS8695 is not set
132# CONFIG_ARCH_NS9XXX is not set
124# CONFIG_ARCH_PNX4008 is not set 133# CONFIG_ARCH_PNX4008 is not set
125# CONFIG_ARCH_PXA is not set 134# CONFIG_ARCH_PXA is not set
126# CONFIG_ARCH_RPC is not set 135# CONFIG_ARCH_RPC is not set
@@ -128,6 +137,7 @@ CONFIG_ARCH_IOP32X=y
128# CONFIG_ARCH_S3C2410 is not set 137# CONFIG_ARCH_S3C2410 is not set
129# CONFIG_ARCH_SHARK is not set 138# CONFIG_ARCH_SHARK is not set
130# CONFIG_ARCH_LH7A40X is not set 139# CONFIG_ARCH_LH7A40X is not set
140# CONFIG_ARCH_DAVINCI is not set
131# CONFIG_ARCH_OMAP is not set 141# CONFIG_ARCH_OMAP is not set
132 142
133# 143#
@@ -137,10 +147,12 @@ CONFIG_ARCH_IOP32X=y
137# 147#
138# IOP32x Platform Types 148# IOP32x Platform Types
139# 149#
150CONFIG_MACH_EP80219=y
140CONFIG_MACH_GLANTANK=y 151CONFIG_MACH_GLANTANK=y
141CONFIG_ARCH_IQ80321=y 152CONFIG_ARCH_IQ80321=y
142CONFIG_ARCH_IQ31244=y 153CONFIG_ARCH_IQ31244=y
143CONFIG_MACH_N2100=y 154CONFIG_MACH_N2100=y
155CONFIG_IOP3XX_ATU=y
144CONFIG_PLAT_IOP=y 156CONFIG_PLAT_IOP=y
145 157
146# 158#
@@ -160,6 +172,7 @@ CONFIG_CPU_CP15_MMU=y
160# 172#
161# CONFIG_ARM_THUMB is not set 173# CONFIG_ARM_THUMB is not set
162# CONFIG_CPU_DCACHE_DISABLE is not set 174# CONFIG_CPU_DCACHE_DISABLE is not set
175# CONFIG_OUTER_CACHE is not set
163# CONFIG_IWMMXT is not set 176# CONFIG_IWMMXT is not set
164CONFIG_XSCALE_PMU=y 177CONFIG_XSCALE_PMU=y
165 178
@@ -167,7 +180,8 @@ CONFIG_XSCALE_PMU=y
167# Bus support 180# Bus support
168# 181#
169CONFIG_PCI=y 182CONFIG_PCI=y
170# CONFIG_PCI_MULTITHREAD_PROBE is not set 183CONFIG_PCI_SYSCALL=y
184# CONFIG_ARCH_SUPPORTS_MSI is not set
171# CONFIG_PCI_DEBUG is not set 185# CONFIG_PCI_DEBUG is not set
172 186
173# 187#
@@ -178,6 +192,7 @@ CONFIG_PCI=y
178# 192#
179# Kernel Features 193# Kernel Features
180# 194#
195# CONFIG_TICK_ONESHOT is not set
181# CONFIG_PREEMPT is not set 196# CONFIG_PREEMPT is not set
182# CONFIG_NO_IDLE_HZ is not set 197# CONFIG_NO_IDLE_HZ is not set
183CONFIG_HZ=100 198CONFIG_HZ=100
@@ -192,6 +207,9 @@ CONFIG_FLAT_NODE_MEM_MAP=y
192# CONFIG_SPARSEMEM_STATIC is not set 207# CONFIG_SPARSEMEM_STATIC is not set
193CONFIG_SPLIT_PTLOCK_CPUS=4096 208CONFIG_SPLIT_PTLOCK_CPUS=4096
194# CONFIG_RESOURCES_64BIT is not set 209# CONFIG_RESOURCES_64BIT is not set
210CONFIG_ZONE_DMA_FLAG=1
211CONFIG_BOUNCE=y
212CONFIG_VIRT_TO_BUS=y
195CONFIG_ALIGNMENT_TRAP=y 213CONFIG_ALIGNMENT_TRAP=y
196 214
197# 215#
@@ -199,8 +217,9 @@ CONFIG_ALIGNMENT_TRAP=y
199# 217#
200CONFIG_ZBOOT_ROM_TEXT=0x0 218CONFIG_ZBOOT_ROM_TEXT=0x0
201CONFIG_ZBOOT_ROM_BSS=0x0 219CONFIG_ZBOOT_ROM_BSS=0x0
202CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp" 220CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp cachepolicy=writealloc"
203# CONFIG_XIP_KERNEL is not set 221# CONFIG_XIP_KERNEL is not set
222# CONFIG_KEXEC is not set
204 223
205# 224#
206# Floating point emulation 225# Floating point emulation
@@ -225,7 +244,6 @@ CONFIG_BINFMT_AOUT=y
225# Power management options 244# Power management options
226# 245#
227# CONFIG_PM is not set 246# CONFIG_PM is not set
228# CONFIG_APM is not set
229 247
230# 248#
231# Networking 249# Networking
@@ -235,13 +253,13 @@ CONFIG_NET=y
235# 253#
236# Networking options 254# Networking options
237# 255#
238# CONFIG_NETDEBUG is not set
239CONFIG_PACKET=y 256CONFIG_PACKET=y
240CONFIG_PACKET_MMAP=y 257CONFIG_PACKET_MMAP=y
241CONFIG_UNIX=y 258CONFIG_UNIX=y
242CONFIG_XFRM=y 259CONFIG_XFRM=y
243# CONFIG_XFRM_USER is not set 260# CONFIG_XFRM_USER is not set
244# CONFIG_XFRM_SUB_POLICY is not set 261# CONFIG_XFRM_SUB_POLICY is not set
262# CONFIG_XFRM_MIGRATE is not set
245# CONFIG_NET_KEY is not set 263# CONFIG_NET_KEY is not set
246CONFIG_INET=y 264CONFIG_INET=y
247CONFIG_IP_MULTICAST=y 265CONFIG_IP_MULTICAST=y
@@ -273,6 +291,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
273CONFIG_IPV6=y 291CONFIG_IPV6=y
274# CONFIG_IPV6_PRIVACY is not set 292# CONFIG_IPV6_PRIVACY is not set
275# CONFIG_IPV6_ROUTER_PREF is not set 293# CONFIG_IPV6_ROUTER_PREF is not set
294# CONFIG_IPV6_OPTIMISTIC_DAD is not set
276# CONFIG_INET6_AH is not set 295# CONFIG_INET6_AH is not set
277# CONFIG_INET6_ESP is not set 296# CONFIG_INET6_ESP is not set
278# CONFIG_INET6_IPCOMP is not set 297# CONFIG_INET6_IPCOMP is not set
@@ -288,20 +307,8 @@ CONFIG_IPV6=y
288# CONFIG_IPV6_MULTIPLE_TABLES is not set 307# CONFIG_IPV6_MULTIPLE_TABLES is not set
289# CONFIG_NETWORK_SECMARK is not set 308# CONFIG_NETWORK_SECMARK is not set
290# CONFIG_NETFILTER is not set 309# CONFIG_NETFILTER is not set
291
292#
293# DCCP Configuration (EXPERIMENTAL)
294#
295# CONFIG_IP_DCCP is not set 310# CONFIG_IP_DCCP is not set
296
297#
298# SCTP Configuration (EXPERIMENTAL)
299#
300# CONFIG_IP_SCTP is not set 311# CONFIG_IP_SCTP is not set
301
302#
303# TIPC Configuration (EXPERIMENTAL)
304#
305# CONFIG_TIPC is not set 312# CONFIG_TIPC is not set
306# CONFIG_ATM is not set 313# CONFIG_ATM is not set
307# CONFIG_BRIDGE is not set 314# CONFIG_BRIDGE is not set
@@ -327,7 +334,17 @@ CONFIG_IPV6=y
327# CONFIG_HAMRADIO is not set 334# CONFIG_HAMRADIO is not set
328# CONFIG_IRDA is not set 335# CONFIG_IRDA is not set
329# CONFIG_BT is not set 336# CONFIG_BT is not set
337# CONFIG_AF_RXRPC is not set
338
339#
340# Wireless
341#
342# CONFIG_CFG80211 is not set
343# CONFIG_WIRELESS_EXT is not set
344# CONFIG_MAC80211 is not set
330# CONFIG_IEEE80211 is not set 345# CONFIG_IEEE80211 is not set
346# CONFIG_RFKILL is not set
347# CONFIG_NET_9P is not set
331 348
332# 349#
333# Device Drivers 350# Device Drivers
@@ -340,16 +357,9 @@ CONFIG_STANDALONE=y
340CONFIG_PREVENT_FIRMWARE_BUILD=y 357CONFIG_PREVENT_FIRMWARE_BUILD=y
341# CONFIG_FW_LOADER is not set 358# CONFIG_FW_LOADER is not set
342# CONFIG_DEBUG_DRIVER is not set 359# CONFIG_DEBUG_DRIVER is not set
360# CONFIG_DEBUG_DEVRES is not set
343# CONFIG_SYS_HYPERVISOR is not set 361# CONFIG_SYS_HYPERVISOR is not set
344
345#
346# Connector - unified userspace <-> kernelspace linker
347#
348# CONFIG_CONNECTOR is not set 362# CONFIG_CONNECTOR is not set
349
350#
351# Memory Technology Devices (MTD)
352#
353CONFIG_MTD=y 363CONFIG_MTD=y
354# CONFIG_MTD_DEBUG is not set 364# CONFIG_MTD_DEBUG is not set
355# CONFIG_MTD_CONCAT is not set 365# CONFIG_MTD_CONCAT is not set
@@ -365,6 +375,7 @@ CONFIG_MTD_REDBOOT_PARTS_READONLY=y
365# User Modules And Translation Layers 375# User Modules And Translation Layers
366# 376#
367CONFIG_MTD_CHAR=y 377CONFIG_MTD_CHAR=y
378CONFIG_MTD_BLKDEVS=y
368CONFIG_MTD_BLOCK=y 379CONFIG_MTD_BLOCK=y
369# CONFIG_FTL is not set 380# CONFIG_FTL is not set
370# CONFIG_NFTL is not set 381# CONFIG_NFTL is not set
@@ -396,7 +407,6 @@ CONFIG_MTD_CFI_UTIL=y
396# CONFIG_MTD_RAM is not set 407# CONFIG_MTD_RAM is not set
397# CONFIG_MTD_ROM is not set 408# CONFIG_MTD_ROM is not set
398# CONFIG_MTD_ABSENT is not set 409# CONFIG_MTD_ABSENT is not set
399# CONFIG_MTD_OBSOLETE_CHIPS is not set
400 410
401# 411#
402# Mapping drivers for chip access 412# Mapping drivers for chip access
@@ -424,29 +434,15 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=1
424# CONFIG_MTD_DOC2000 is not set 434# CONFIG_MTD_DOC2000 is not set
425# CONFIG_MTD_DOC2001 is not set 435# CONFIG_MTD_DOC2001 is not set
426# CONFIG_MTD_DOC2001PLUS is not set 436# CONFIG_MTD_DOC2001PLUS is not set
427
428#
429# NAND Flash Device Drivers
430#
431# CONFIG_MTD_NAND is not set 437# CONFIG_MTD_NAND is not set
432
433#
434# OneNAND Flash Device Drivers
435#
436# CONFIG_MTD_ONENAND is not set 438# CONFIG_MTD_ONENAND is not set
437 439
438# 440#
439# Parallel port support 441# UBI - Unsorted block images
440# 442#
443# CONFIG_MTD_UBI is not set
441# CONFIG_PARPORT is not set 444# CONFIG_PARPORT is not set
442 445CONFIG_BLK_DEV=y
443#
444# Plug and Play support
445#
446
447#
448# Block devices
449#
450# CONFIG_BLK_CPQ_DA is not set 446# CONFIG_BLK_CPQ_DA is not set
451# CONFIG_BLK_CPQ_CISS_DA is not set 447# CONFIG_BLK_CPQ_CISS_DA is not set
452# CONFIG_BLK_DEV_DAC960 is not set 448# CONFIG_BLK_DEV_DAC960 is not set
@@ -461,13 +457,8 @@ CONFIG_BLK_DEV_RAM=y
461CONFIG_BLK_DEV_RAM_COUNT=16 457CONFIG_BLK_DEV_RAM_COUNT=16
462CONFIG_BLK_DEV_RAM_SIZE=8192 458CONFIG_BLK_DEV_RAM_SIZE=8192
463CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 459CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
464CONFIG_BLK_DEV_INITRD=y
465# CONFIG_CDROM_PKTCDVD is not set 460# CONFIG_CDROM_PKTCDVD is not set
466# CONFIG_ATA_OVER_ETH is not set 461# CONFIG_ATA_OVER_ETH is not set
467
468#
469# ATA/ATAPI/MFM/RLL support
470#
471# CONFIG_IDE is not set 462# CONFIG_IDE is not set
472 463
473# 464#
@@ -475,6 +466,7 @@ CONFIG_BLK_DEV_INITRD=y
475# 466#
476# CONFIG_RAID_ATTRS is not set 467# CONFIG_RAID_ATTRS is not set
477CONFIG_SCSI=y 468CONFIG_SCSI=y
469CONFIG_SCSI_DMA=y
478# CONFIG_SCSI_TGT is not set 470# CONFIG_SCSI_TGT is not set
479# CONFIG_SCSI_NETLINK is not set 471# CONFIG_SCSI_NETLINK is not set
480CONFIG_SCSI_PROC_FS=y 472CONFIG_SCSI_PROC_FS=y
@@ -496,6 +488,7 @@ CONFIG_CHR_DEV_SG=y
496# CONFIG_SCSI_CONSTANTS is not set 488# CONFIG_SCSI_CONSTANTS is not set
497# CONFIG_SCSI_LOGGING is not set 489# CONFIG_SCSI_LOGGING is not set
498# CONFIG_SCSI_SCAN_ASYNC is not set 490# CONFIG_SCSI_SCAN_ASYNC is not set
491CONFIG_SCSI_WAIT_SCAN=m
499 492
500# 493#
501# SCSI Transports 494# SCSI Transports
@@ -541,11 +534,8 @@ CONFIG_CHR_DEV_SG=y
541# CONFIG_SCSI_NSP32 is not set 534# CONFIG_SCSI_NSP32 is not set
542# CONFIG_SCSI_DEBUG is not set 535# CONFIG_SCSI_DEBUG is not set
543# CONFIG_SCSI_SRP is not set 536# CONFIG_SCSI_SRP is not set
544
545#
546# Serial ATA (prod) and Parallel ATA (experimental) drivers
547#
548CONFIG_ATA=y 537CONFIG_ATA=y
538# CONFIG_ATA_NONSTANDARD is not set
549# CONFIG_SATA_AHCI is not set 539# CONFIG_SATA_AHCI is not set
550# CONFIG_SATA_SVW is not set 540# CONFIG_SATA_SVW is not set
551# CONFIG_ATA_PIIX is not set 541# CONFIG_ATA_PIIX is not set
@@ -560,11 +550,13 @@ CONFIG_SATA_SIL=y
560# CONFIG_SATA_SIS is not set 550# CONFIG_SATA_SIS is not set
561# CONFIG_SATA_ULI is not set 551# CONFIG_SATA_ULI is not set
562# CONFIG_SATA_VIA is not set 552# CONFIG_SATA_VIA is not set
563# CONFIG_SATA_VITESSE is not set 553CONFIG_SATA_VITESSE=y
554# CONFIG_SATA_INIC162X is not set
564# CONFIG_PATA_ALI is not set 555# CONFIG_PATA_ALI is not set
565# CONFIG_PATA_AMD is not set 556# CONFIG_PATA_AMD is not set
566# CONFIG_PATA_ARTOP is not set 557# CONFIG_PATA_ARTOP is not set
567# CONFIG_PATA_ATIIXP is not set 558# CONFIG_PATA_ATIIXP is not set
559# CONFIG_PATA_CMD640_PCI is not set
568# CONFIG_PATA_CMD64X is not set 560# CONFIG_PATA_CMD64X is not set
569# CONFIG_PATA_CS5520 is not set 561# CONFIG_PATA_CS5520 is not set
570# CONFIG_PATA_CS5530 is not set 562# CONFIG_PATA_CS5530 is not set
@@ -576,6 +568,7 @@ CONFIG_SATA_SIL=y
576# CONFIG_PATA_HPT3X2N is not set 568# CONFIG_PATA_HPT3X2N is not set
577# CONFIG_PATA_HPT3X3 is not set 569# CONFIG_PATA_HPT3X3 is not set
578# CONFIG_PATA_IT821X is not set 570# CONFIG_PATA_IT821X is not set
571# CONFIG_PATA_IT8213 is not set
579# CONFIG_PATA_JMICRON is not set 572# CONFIG_PATA_JMICRON is not set
580# CONFIG_PATA_TRIFLEX is not set 573# CONFIG_PATA_TRIFLEX is not set
581# CONFIG_PATA_MARVELL is not set 574# CONFIG_PATA_MARVELL is not set
@@ -595,17 +588,14 @@ CONFIG_SATA_SIL=y
595# CONFIG_PATA_SIS is not set 588# CONFIG_PATA_SIS is not set
596# CONFIG_PATA_VIA is not set 589# CONFIG_PATA_VIA is not set
597# CONFIG_PATA_WINBOND is not set 590# CONFIG_PATA_WINBOND is not set
598
599#
600# Multi-device support (RAID and LVM)
601#
602CONFIG_MD=y 591CONFIG_MD=y
603CONFIG_BLK_DEV_MD=y 592CONFIG_BLK_DEV_MD=y
604# CONFIG_MD_LINEAR is not set 593# CONFIG_MD_LINEAR is not set
605CONFIG_MD_RAID0=y 594CONFIG_MD_RAID0=y
606CONFIG_MD_RAID1=y 595CONFIG_MD_RAID1=y
607# CONFIG_MD_RAID10 is not set 596CONFIG_MD_RAID10=y
608# CONFIG_MD_RAID456 is not set 597CONFIG_MD_RAID456=y
598# CONFIG_MD_RAID5_RESHAPE is not set
609# CONFIG_MD_MULTIPATH is not set 599# CONFIG_MD_MULTIPATH is not set
610# CONFIG_MD_FAULTY is not set 600# CONFIG_MD_FAULTY is not set
611CONFIG_BLK_DEV_DM=y 601CONFIG_BLK_DEV_DM=y
@@ -615,6 +605,7 @@ CONFIG_BLK_DEV_DM=y
615# CONFIG_DM_MIRROR is not set 605# CONFIG_DM_MIRROR is not set
616# CONFIG_DM_ZERO is not set 606# CONFIG_DM_ZERO is not set
617# CONFIG_DM_MULTIPATH is not set 607# CONFIG_DM_MULTIPATH is not set
608# CONFIG_DM_DELAY is not set
618 609
619# 610#
620# Fusion MPT device support 611# Fusion MPT device support
@@ -627,47 +618,27 @@ CONFIG_BLK_DEV_DM=y
627# 618#
628# IEEE 1394 (FireWire) support 619# IEEE 1394 (FireWire) support
629# 620#
621# CONFIG_FIREWIRE is not set
630# CONFIG_IEEE1394 is not set 622# CONFIG_IEEE1394 is not set
631
632#
633# I2O device support
634#
635# CONFIG_I2O is not set 623# CONFIG_I2O is not set
636
637#
638# Network device support
639#
640CONFIG_NETDEVICES=y 624CONFIG_NETDEVICES=y
625# CONFIG_NETDEVICES_MULTIQUEUE is not set
641# CONFIG_DUMMY is not set 626# CONFIG_DUMMY is not set
642# CONFIG_BONDING is not set 627# CONFIG_BONDING is not set
628# CONFIG_MACVLAN is not set
643# CONFIG_EQUALIZER is not set 629# CONFIG_EQUALIZER is not set
644# CONFIG_TUN is not set 630# CONFIG_TUN is not set
645
646#
647# ARCnet devices
648#
649# CONFIG_ARCNET is not set 631# CONFIG_ARCNET is not set
650
651#
652# PHY device support
653#
654# CONFIG_PHYLIB is not set 632# CONFIG_PHYLIB is not set
655
656#
657# Ethernet (10 or 100Mbit)
658#
659CONFIG_NET_ETHERNET=y 633CONFIG_NET_ETHERNET=y
660CONFIG_MII=y 634CONFIG_MII=y
635# CONFIG_AX88796 is not set
661# CONFIG_HAPPYMEAL is not set 636# CONFIG_HAPPYMEAL is not set
662# CONFIG_SUNGEM is not set 637# CONFIG_SUNGEM is not set
663# CONFIG_CASSINI is not set 638# CONFIG_CASSINI is not set
664# CONFIG_NET_VENDOR_3COM is not set 639# CONFIG_NET_VENDOR_3COM is not set
665# CONFIG_SMC91X is not set 640# CONFIG_SMC91X is not set
666# CONFIG_DM9000 is not set 641# CONFIG_DM9000 is not set
667
668#
669# Tulip family network device support
670#
671# CONFIG_NET_TULIP is not set 642# CONFIG_NET_TULIP is not set
672# CONFIG_HP100 is not set 643# CONFIG_HP100 is not set
673CONFIG_NET_PCI=y 644CONFIG_NET_PCI=y
@@ -689,10 +660,8 @@ CONFIG_E100=y
689# CONFIG_SUNDANCE is not set 660# CONFIG_SUNDANCE is not set
690# CONFIG_TLAN is not set 661# CONFIG_TLAN is not set
691# CONFIG_VIA_RHINE is not set 662# CONFIG_VIA_RHINE is not set
692 663# CONFIG_SC92031 is not set
693# 664CONFIG_NETDEV_1000=y
694# Ethernet (1000 Mbit)
695#
696# CONFIG_ACENIC is not set 665# CONFIG_ACENIC is not set
697# CONFIG_DL2K is not set 666# CONFIG_DL2K is not set
698CONFIG_E1000=y 667CONFIG_E1000=y
@@ -706,34 +675,36 @@ CONFIG_R8169=y
706# CONFIG_SIS190 is not set 675# CONFIG_SIS190 is not set
707# CONFIG_SKGE is not set 676# CONFIG_SKGE is not set
708# CONFIG_SKY2 is not set 677# CONFIG_SKY2 is not set
709# CONFIG_SK98LIN is not set
710# CONFIG_VIA_VELOCITY is not set 678# CONFIG_VIA_VELOCITY is not set
711# CONFIG_TIGON3 is not set 679# CONFIG_TIGON3 is not set
712# CONFIG_BNX2 is not set 680# CONFIG_BNX2 is not set
713# CONFIG_QLA3XXX is not set 681# CONFIG_QLA3XXX is not set
714 682# CONFIG_ATL1 is not set
715# 683CONFIG_NETDEV_10000=y
716# Ethernet (10000 Mbit)
717#
718# CONFIG_CHELSIO_T1 is not set 684# CONFIG_CHELSIO_T1 is not set
685# CONFIG_CHELSIO_T3 is not set
719# CONFIG_IXGB is not set 686# CONFIG_IXGB is not set
720# CONFIG_S2IO is not set 687# CONFIG_S2IO is not set
721# CONFIG_MYRI10GE is not set 688# CONFIG_MYRI10GE is not set
722# CONFIG_NETXEN_NIC is not set 689# CONFIG_NETXEN_NIC is not set
723 690# CONFIG_MLX4_CORE is not set
724#
725# Token Ring devices
726#
727# CONFIG_TR is not set 691# CONFIG_TR is not set
728 692
729# 693#
730# Wireless LAN (non-hamradio) 694# Wireless LAN
731# 695#
732# CONFIG_NET_RADIO is not set 696# CONFIG_WLAN_PRE80211 is not set
697# CONFIG_WLAN_80211 is not set
733 698
734# 699#
735# Wan interfaces 700# USB Network Adapters
736# 701#
702# CONFIG_USB_CATC is not set
703# CONFIG_USB_KAWETH is not set
704# CONFIG_USB_PEGASUS is not set
705# CONFIG_USB_RTL8150 is not set
706# CONFIG_USB_USBNET_MII is not set
707# CONFIG_USB_USBNET is not set
737# CONFIG_WAN is not set 708# CONFIG_WAN is not set
738# CONFIG_FDDI is not set 709# CONFIG_FDDI is not set
739# CONFIG_HIPPI is not set 710# CONFIG_HIPPI is not set
@@ -744,10 +715,6 @@ CONFIG_R8169=y
744# CONFIG_NETCONSOLE is not set 715# CONFIG_NETCONSOLE is not set
745# CONFIG_NETPOLL is not set 716# CONFIG_NETPOLL is not set
746# CONFIG_NET_POLL_CONTROLLER is not set 717# CONFIG_NET_POLL_CONTROLLER is not set
747
748#
749# ISDN subsystem
750#
751# CONFIG_ISDN is not set 718# CONFIG_ISDN is not set
752 719
753# 720#
@@ -755,6 +722,7 @@ CONFIG_R8169=y
755# 722#
756CONFIG_INPUT=y 723CONFIG_INPUT=y
757# CONFIG_INPUT_FF_MEMLESS is not set 724# CONFIG_INPUT_FF_MEMLESS is not set
725# CONFIG_INPUT_POLLDEV is not set
758 726
759# 727#
760# Userland interfaces 728# Userland interfaces
@@ -774,6 +742,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
774# CONFIG_INPUT_KEYBOARD is not set 742# CONFIG_INPUT_KEYBOARD is not set
775# CONFIG_INPUT_MOUSE is not set 743# CONFIG_INPUT_MOUSE is not set
776# CONFIG_INPUT_JOYSTICK is not set 744# CONFIG_INPUT_JOYSTICK is not set
745# CONFIG_INPUT_TABLET is not set
777# CONFIG_INPUT_TOUCHSCREEN is not set 746# CONFIG_INPUT_TOUCHSCREEN is not set
778# CONFIG_INPUT_MISC is not set 747# CONFIG_INPUT_MISC is not set
779 748
@@ -811,33 +780,18 @@ CONFIG_SERIAL_CORE_CONSOLE=y
811CONFIG_UNIX98_PTYS=y 780CONFIG_UNIX98_PTYS=y
812CONFIG_LEGACY_PTYS=y 781CONFIG_LEGACY_PTYS=y
813CONFIG_LEGACY_PTY_COUNT=256 782CONFIG_LEGACY_PTY_COUNT=256
814
815#
816# IPMI
817#
818# CONFIG_IPMI_HANDLER is not set 783# CONFIG_IPMI_HANDLER is not set
819
820#
821# Watchdog Cards
822#
823# CONFIG_WATCHDOG is not set 784# CONFIG_WATCHDOG is not set
824CONFIG_HW_RANDOM=y 785CONFIG_HW_RANDOM=y
825# CONFIG_NVRAM is not set 786# CONFIG_NVRAM is not set
826# CONFIG_DTLK is not set
827# CONFIG_R3964 is not set 787# CONFIG_R3964 is not set
828# CONFIG_APPLICOM is not set 788# CONFIG_APPLICOM is not set
829# CONFIG_DRM is not set 789# CONFIG_DRM is not set
830# CONFIG_RAW_DRIVER is not set 790# CONFIG_RAW_DRIVER is not set
831
832#
833# TPM devices
834#
835# CONFIG_TCG_TPM is not set 791# CONFIG_TCG_TPM is not set
836 792CONFIG_DEVPORT=y
837#
838# I2C support
839#
840CONFIG_I2C=y 793CONFIG_I2C=y
794CONFIG_I2C_BOARDINFO=y
841CONFIG_I2C_CHARDEV=y 795CONFIG_I2C_CHARDEV=y
842 796
843# 797#
@@ -864,25 +818,29 @@ CONFIG_I2C_IOP3XX=y
864# CONFIG_I2C_PARPORT_LIGHT is not set 818# CONFIG_I2C_PARPORT_LIGHT is not set
865# CONFIG_I2C_PROSAVAGE is not set 819# CONFIG_I2C_PROSAVAGE is not set
866# CONFIG_I2C_SAVAGE4 is not set 820# CONFIG_I2C_SAVAGE4 is not set
821# CONFIG_I2C_SIMTEC is not set
867# CONFIG_I2C_SIS5595 is not set 822# CONFIG_I2C_SIS5595 is not set
868# CONFIG_I2C_SIS630 is not set 823# CONFIG_I2C_SIS630 is not set
869# CONFIG_I2C_SIS96X is not set 824# CONFIG_I2C_SIS96X is not set
825# CONFIG_I2C_TAOS_EVM is not set
870# CONFIG_I2C_STUB is not set 826# CONFIG_I2C_STUB is not set
827# CONFIG_I2C_TINY_USB is not set
871# CONFIG_I2C_VIA is not set 828# CONFIG_I2C_VIA is not set
872# CONFIG_I2C_VIAPRO is not set 829# CONFIG_I2C_VIAPRO is not set
873# CONFIG_I2C_VOODOO3 is not set 830# CONFIG_I2C_VOODOO3 is not set
874# CONFIG_I2C_PCA_ISA is not set
875 831
876# 832#
877# Miscellaneous I2C Chip support 833# Miscellaneous I2C Chip support
878# 834#
879# CONFIG_SENSORS_DS1337 is not set 835# CONFIG_SENSORS_DS1337 is not set
880# CONFIG_SENSORS_DS1374 is not set 836# CONFIG_SENSORS_DS1374 is not set
837# CONFIG_DS1682 is not set
881# CONFIG_SENSORS_EEPROM is not set 838# CONFIG_SENSORS_EEPROM is not set
882# CONFIG_SENSORS_PCF8574 is not set 839# CONFIG_SENSORS_PCF8574 is not set
883# CONFIG_SENSORS_PCA9539 is not set 840# CONFIG_SENSORS_PCA9539 is not set
884# CONFIG_SENSORS_PCF8591 is not set 841# CONFIG_SENSORS_PCF8591 is not set
885# CONFIG_SENSORS_MAX6875 is not set 842# CONFIG_SENSORS_MAX6875 is not set
843# CONFIG_SENSORS_TSL2550 is not set
886# CONFIG_I2C_DEBUG_CORE is not set 844# CONFIG_I2C_DEBUG_CORE is not set
887# CONFIG_I2C_DEBUG_ALGO is not set 845# CONFIG_I2C_DEBUG_ALGO is not set
888# CONFIG_I2C_DEBUG_BUS is not set 846# CONFIG_I2C_DEBUG_BUS is not set
@@ -893,21 +851,15 @@ CONFIG_I2C_IOP3XX=y
893# 851#
894# CONFIG_SPI is not set 852# CONFIG_SPI is not set
895# CONFIG_SPI_MASTER is not set 853# CONFIG_SPI_MASTER is not set
896
897#
898# Dallas's 1-wire bus
899#
900# CONFIG_W1 is not set 854# CONFIG_W1 is not set
901
902#
903# Hardware Monitoring support
904#
905CONFIG_HWMON=y 855CONFIG_HWMON=y
906# CONFIG_HWMON_VID is not set 856# CONFIG_HWMON_VID is not set
907# CONFIG_SENSORS_ABITUGURU is not set 857# CONFIG_SENSORS_ABITUGURU is not set
858# CONFIG_SENSORS_AD7418 is not set
908# CONFIG_SENSORS_ADM1021 is not set 859# CONFIG_SENSORS_ADM1021 is not set
909# CONFIG_SENSORS_ADM1025 is not set 860# CONFIG_SENSORS_ADM1025 is not set
910# CONFIG_SENSORS_ADM1026 is not set 861# CONFIG_SENSORS_ADM1026 is not set
862# CONFIG_SENSORS_ADM1029 is not set
911# CONFIG_SENSORS_ADM1031 is not set 863# CONFIG_SENSORS_ADM1031 is not set
912# CONFIG_SENSORS_ADM9240 is not set 864# CONFIG_SENSORS_ADM9240 is not set
913# CONFIG_SENSORS_ASB100 is not set 865# CONFIG_SENSORS_ASB100 is not set
@@ -930,6 +882,7 @@ CONFIG_HWMON=y
930# CONFIG_SENSORS_LM90 is not set 882# CONFIG_SENSORS_LM90 is not set
931# CONFIG_SENSORS_LM92 is not set 883# CONFIG_SENSORS_LM92 is not set
932# CONFIG_SENSORS_MAX1619 is not set 884# CONFIG_SENSORS_MAX1619 is not set
885# CONFIG_SENSORS_MAX6650 is not set
933# CONFIG_SENSORS_PC87360 is not set 886# CONFIG_SENSORS_PC87360 is not set
934# CONFIG_SENSORS_PC87427 is not set 887# CONFIG_SENSORS_PC87427 is not set
935# CONFIG_SENSORS_SIS5595 is not set 888# CONFIG_SENSORS_SIS5595 is not set
@@ -947,12 +900,16 @@ CONFIG_HWMON=y
947# CONFIG_SENSORS_W83627HF is not set 900# CONFIG_SENSORS_W83627HF is not set
948# CONFIG_SENSORS_W83627EHF is not set 901# CONFIG_SENSORS_W83627EHF is not set
949# CONFIG_HWMON_DEBUG_CHIP is not set 902# CONFIG_HWMON_DEBUG_CHIP is not set
903CONFIG_MISC_DEVICES=y
904# CONFIG_PHANTOM is not set
905# CONFIG_EEPROM_93CX6 is not set
906# CONFIG_SGI_IOC4 is not set
907# CONFIG_TIFM_CORE is not set
950 908
951# 909#
952# Misc devices 910# Multifunction device drivers
953# 911#
954# CONFIG_SGI_IOC4 is not set 912# CONFIG_MFD_SM501 is not set
955# CONFIG_TIFM_CORE is not set
956 913
957# 914#
958# LED devices 915# LED devices
@@ -971,17 +928,20 @@ CONFIG_HWMON=y
971# Multimedia devices 928# Multimedia devices
972# 929#
973# CONFIG_VIDEO_DEV is not set 930# CONFIG_VIDEO_DEV is not set
931# CONFIG_DVB_CORE is not set
932CONFIG_DAB=y
933# CONFIG_USB_DABUSB is not set
974 934
975# 935#
976# Digital Video Broadcasting Devices 936# Graphics support
977# 937#
978# CONFIG_DVB is not set 938# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
979# CONFIG_USB_DABUSB is not set
980 939
981# 940#
982# Graphics support 941# Display device support
983# 942#
984CONFIG_FIRMWARE_EDID=y 943# CONFIG_DISPLAY_SUPPORT is not set
944# CONFIG_VGASTATE is not set
985# CONFIG_FB is not set 945# CONFIG_FB is not set
986 946
987# 947#
@@ -989,21 +949,26 @@ CONFIG_FIRMWARE_EDID=y
989# 949#
990# CONFIG_VGA_CONSOLE is not set 950# CONFIG_VGA_CONSOLE is not set
991CONFIG_DUMMY_CONSOLE=y 951CONFIG_DUMMY_CONSOLE=y
992# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
993 952
994# 953#
995# Sound 954# Sound
996# 955#
997# CONFIG_SOUND is not set 956# CONFIG_SOUND is not set
957CONFIG_HID_SUPPORT=y
958CONFIG_HID=y
959# CONFIG_HID_DEBUG is not set
998 960
999# 961#
1000# HID Devices 962# USB Input Devices
1001# 963#
1002CONFIG_HID=y 964# CONFIG_USB_HID is not set
1003 965
1004# 966#
1005# USB support 967# USB HID Boot Protocol drivers
1006# 968#
969# CONFIG_USB_KBD is not set
970# CONFIG_USB_MOUSE is not set
971CONFIG_USB_SUPPORT=y
1007CONFIG_USB_ARCH_HAS_HCD=y 972CONFIG_USB_ARCH_HAS_HCD=y
1008CONFIG_USB_ARCH_HAS_OHCI=y 973CONFIG_USB_ARCH_HAS_OHCI=y
1009CONFIG_USB_ARCH_HAS_EHCI=y 974CONFIG_USB_ARCH_HAS_EHCI=y
@@ -1014,9 +979,8 @@ CONFIG_USB=y
1014# Miscellaneous USB options 979# Miscellaneous USB options
1015# 980#
1016# CONFIG_USB_DEVICEFS is not set 981# CONFIG_USB_DEVICEFS is not set
1017# CONFIG_USB_BANDWIDTH is not set 982CONFIG_USB_DEVICE_CLASS=y
1018# CONFIG_USB_DYNAMIC_MINORS is not set 983# CONFIG_USB_DYNAMIC_MINORS is not set
1019# CONFIG_USB_MULTITHREAD_PROBE is not set
1020# CONFIG_USB_OTG is not set 984# CONFIG_USB_OTG is not set
1021 985
1022# 986#
@@ -1030,6 +994,7 @@ CONFIG_USB_EHCI_TT_NEWSCHED=y
1030# CONFIG_USB_OHCI_HCD is not set 994# CONFIG_USB_OHCI_HCD is not set
1031CONFIG_USB_UHCI_HCD=y 995CONFIG_USB_UHCI_HCD=y
1032# CONFIG_USB_SL811_HCD is not set 996# CONFIG_USB_SL811_HCD is not set
997# CONFIG_USB_R8A66597_HCD is not set
1033 998
1034# 999#
1035# USB Device Class drivers 1000# USB Device Class drivers
@@ -1058,43 +1023,10 @@ CONFIG_USB_STORAGE=y
1058# CONFIG_USB_LIBUSUAL is not set 1023# CONFIG_USB_LIBUSUAL is not set
1059 1024
1060# 1025#
1061# USB Input Devices
1062#
1063# CONFIG_USB_HID is not set
1064
1065#
1066# USB HID Boot Protocol drivers
1067#
1068# CONFIG_USB_KBD is not set
1069# CONFIG_USB_MOUSE is not set
1070# CONFIG_USB_AIPTEK is not set
1071# CONFIG_USB_WACOM is not set
1072# CONFIG_USB_ACECAD is not set
1073# CONFIG_USB_KBTAB is not set
1074# CONFIG_USB_POWERMATE is not set
1075# CONFIG_USB_TOUCHSCREEN is not set
1076# CONFIG_USB_YEALINK is not set
1077# CONFIG_USB_XPAD is not set
1078# CONFIG_USB_ATI_REMOTE is not set
1079# CONFIG_USB_ATI_REMOTE2 is not set
1080# CONFIG_USB_KEYSPAN_REMOTE is not set
1081# CONFIG_USB_APPLETOUCH is not set
1082
1083#
1084# USB Imaging devices 1026# USB Imaging devices
1085# 1027#
1086# CONFIG_USB_MDC800 is not set 1028# CONFIG_USB_MDC800 is not set
1087# CONFIG_USB_MICROTEK is not set 1029# CONFIG_USB_MICROTEK is not set
1088
1089#
1090# USB Network Adapters
1091#
1092# CONFIG_USB_CATC is not set
1093# CONFIG_USB_KAWETH is not set
1094# CONFIG_USB_PEGASUS is not set
1095# CONFIG_USB_RTL8150 is not set
1096# CONFIG_USB_USBNET_MII is not set
1097# CONFIG_USB_USBNET is not set
1098CONFIG_USB_MON=y 1030CONFIG_USB_MON=y
1099 1031
1100# 1032#
@@ -1116,6 +1048,7 @@ CONFIG_USB_MON=y
1116# CONFIG_USB_RIO500 is not set 1048# CONFIG_USB_RIO500 is not set
1117# CONFIG_USB_LEGOTOWER is not set 1049# CONFIG_USB_LEGOTOWER is not set
1118# CONFIG_USB_LCD is not set 1050# CONFIG_USB_LCD is not set
1051# CONFIG_USB_BERRY_CHARGE is not set
1119# CONFIG_USB_LED is not set 1052# CONFIG_USB_LED is not set
1120# CONFIG_USB_CYPRESS_CY7C63 is not set 1053# CONFIG_USB_CYPRESS_CY7C63 is not set
1121# CONFIG_USB_CYTHERM is not set 1054# CONFIG_USB_CYTHERM is not set
@@ -1126,6 +1059,7 @@ CONFIG_USB_MON=y
1126# CONFIG_USB_SISUSBVGA is not set 1059# CONFIG_USB_SISUSBVGA is not set
1127# CONFIG_USB_LD is not set 1060# CONFIG_USB_LD is not set
1128# CONFIG_USB_TRANCEVIBRATOR is not set 1061# CONFIG_USB_TRANCEVIBRATOR is not set
1062# CONFIG_USB_IOWARRIOR is not set
1129 1063
1130# 1064#
1131# USB DSL modem support 1065# USB DSL modem support
@@ -1135,10 +1069,6 @@ CONFIG_USB_MON=y
1135# USB Gadget Support 1069# USB Gadget Support
1136# 1070#
1137# CONFIG_USB_GADGET is not set 1071# CONFIG_USB_GADGET is not set
1138
1139#
1140# MMC/SD Card support
1141#
1142# CONFIG_MMC is not set 1072# CONFIG_MMC is not set
1143 1073
1144# 1074#
@@ -1148,6 +1078,22 @@ CONFIG_RTC_LIB=y
1148# CONFIG_RTC_CLASS is not set 1078# CONFIG_RTC_CLASS is not set
1149 1079
1150# 1080#
1081# DMA Engine support
1082#
1083CONFIG_DMA_ENGINE=y
1084
1085#
1086# DMA Clients
1087#
1088CONFIG_NET_DMA=y
1089
1090#
1091# DMA Devices
1092#
1093# CONFIG_INTEL_IOATDMA is not set
1094CONFIG_INTEL_IOP_ADMA=y
1095
1096#
1151# File systems 1097# File systems
1152# 1098#
1153CONFIG_EXT2_FS=y 1099CONFIG_EXT2_FS=y
@@ -1164,11 +1110,7 @@ CONFIG_FS_MBCACHE=y
1164# CONFIG_REISERFS_FS is not set 1110# CONFIG_REISERFS_FS is not set
1165# CONFIG_JFS_FS is not set 1111# CONFIG_JFS_FS is not set
1166# CONFIG_FS_POSIX_ACL is not set 1112# CONFIG_FS_POSIX_ACL is not set
1167CONFIG_XFS_FS=y 1113# CONFIG_XFS_FS is not set
1168# CONFIG_XFS_QUOTA is not set
1169CONFIG_XFS_SECURITY=y
1170CONFIG_XFS_POSIX_ACL=y
1171# CONFIG_XFS_RT is not set
1172# CONFIG_GFS2_FS is not set 1114# CONFIG_GFS2_FS is not set
1173# CONFIG_OCFS2_FS is not set 1115# CONFIG_OCFS2_FS is not set
1174# CONFIG_MINIX_FS is not set 1116# CONFIG_MINIX_FS is not set
@@ -1217,7 +1159,6 @@ CONFIG_ECRYPT_FS=y
1217# CONFIG_BEFS_FS is not set 1159# CONFIG_BEFS_FS is not set
1218# CONFIG_BFS_FS is not set 1160# CONFIG_BFS_FS is not set
1219# CONFIG_EFS_FS is not set 1161# CONFIG_EFS_FS is not set
1220# CONFIG_JFFS_FS is not set
1221CONFIG_JFFS2_FS=y 1162CONFIG_JFFS2_FS=y
1222CONFIG_JFFS2_FS_DEBUG=0 1163CONFIG_JFFS2_FS_DEBUG=0
1223CONFIG_JFFS2_FS_WRITEBUFFER=y 1164CONFIG_JFFS2_FS_WRITEBUFFER=y
@@ -1227,7 +1168,7 @@ CONFIG_JFFS2_FS_WRITEBUFFER=y
1227CONFIG_JFFS2_ZLIB=y 1168CONFIG_JFFS2_ZLIB=y
1228CONFIG_JFFS2_RTIME=y 1169CONFIG_JFFS2_RTIME=y
1229# CONFIG_JFFS2_RUBIN is not set 1170# CONFIG_JFFS2_RUBIN is not set
1230# CONFIG_CRAMFS is not set 1171CONFIG_CRAMFS=y
1231# CONFIG_VXFS_FS is not set 1172# CONFIG_VXFS_FS is not set
1232# CONFIG_HPFS_FS is not set 1173# CONFIG_HPFS_FS is not set
1233# CONFIG_QNX4FS_FS is not set 1174# CONFIG_QNX4FS_FS is not set
@@ -1253,6 +1194,7 @@ CONFIG_LOCKD_V4=y
1253CONFIG_EXPORTFS=y 1194CONFIG_EXPORTFS=y
1254CONFIG_NFS_COMMON=y 1195CONFIG_NFS_COMMON=y
1255CONFIG_SUNRPC=y 1196CONFIG_SUNRPC=y
1197# CONFIG_SUNRPC_BIND34 is not set
1256# CONFIG_RPCSEC_GSS_KRB5 is not set 1198# CONFIG_RPCSEC_GSS_KRB5 is not set
1257# CONFIG_RPCSEC_GSS_SPKM3 is not set 1199# CONFIG_RPCSEC_GSS_SPKM3 is not set
1258# CONFIG_SMB_FS is not set 1200# CONFIG_SMB_FS is not set
@@ -1260,7 +1202,6 @@ CONFIG_SUNRPC=y
1260# CONFIG_NCP_FS is not set 1202# CONFIG_NCP_FS is not set
1261# CONFIG_CODA_FS is not set 1203# CONFIG_CODA_FS is not set
1262# CONFIG_AFS_FS is not set 1204# CONFIG_AFS_FS is not set
1263# CONFIG_9P_FS is not set
1264 1205
1265# 1206#
1266# Partition Types 1207# Partition Types
@@ -1282,6 +1223,7 @@ CONFIG_MSDOS_PARTITION=y
1282# CONFIG_SUN_PARTITION is not set 1223# CONFIG_SUN_PARTITION is not set
1283# CONFIG_KARMA_PARTITION is not set 1224# CONFIG_KARMA_PARTITION is not set
1284# CONFIG_EFI_PARTITION is not set 1225# CONFIG_EFI_PARTITION is not set
1226# CONFIG_SYSV68_PARTITION is not set
1285 1227
1286# 1228#
1287# Native Language Support 1229# Native Language Support
@@ -1308,15 +1250,19 @@ CONFIG_MAGIC_SYSRQ=y
1308# CONFIG_DEBUG_FS is not set 1250# CONFIG_DEBUG_FS is not set
1309# CONFIG_HEADERS_CHECK is not set 1251# CONFIG_HEADERS_CHECK is not set
1310CONFIG_DEBUG_KERNEL=y 1252CONFIG_DEBUG_KERNEL=y
1311CONFIG_LOG_BUF_SHIFT=14 1253# CONFIG_DEBUG_SHIRQ is not set
1312CONFIG_DETECT_SOFTLOCKUP=y 1254CONFIG_DETECT_SOFTLOCKUP=y
1255CONFIG_SCHED_DEBUG=y
1313# CONFIG_SCHEDSTATS is not set 1256# CONFIG_SCHEDSTATS is not set
1257# CONFIG_TIMER_STATS is not set
1314# CONFIG_DEBUG_SLAB is not set 1258# CONFIG_DEBUG_SLAB is not set
1315# CONFIG_DEBUG_RT_MUTEXES is not set 1259# CONFIG_DEBUG_RT_MUTEXES is not set
1316# CONFIG_RT_MUTEX_TESTER is not set 1260# CONFIG_RT_MUTEX_TESTER is not set
1317# CONFIG_DEBUG_SPINLOCK is not set 1261# CONFIG_DEBUG_SPINLOCK is not set
1318# CONFIG_DEBUG_MUTEXES is not set 1262# CONFIG_DEBUG_MUTEXES is not set
1319# CONFIG_DEBUG_RWSEMS is not set 1263# CONFIG_DEBUG_LOCK_ALLOC is not set
1264# CONFIG_PROVE_LOCKING is not set
1265# CONFIG_LOCK_STAT is not set
1320# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1266# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1321# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1267# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1322# CONFIG_DEBUG_KOBJECT is not set 1268# CONFIG_DEBUG_KOBJECT is not set
@@ -1327,6 +1273,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1327CONFIG_FRAME_POINTER=y 1273CONFIG_FRAME_POINTER=y
1328# CONFIG_FORCED_INLINING is not set 1274# CONFIG_FORCED_INLINING is not set
1329# CONFIG_RCU_TORTURE_TEST is not set 1275# CONFIG_RCU_TORTURE_TEST is not set
1276# CONFIG_FAULT_INJECTION is not set
1330CONFIG_DEBUG_USER=y 1277CONFIG_DEBUG_USER=y
1331# CONFIG_DEBUG_ERRORS is not set 1278# CONFIG_DEBUG_ERRORS is not set
1332CONFIG_DEBUG_LL=y 1279CONFIG_DEBUG_LL=y
@@ -1338,10 +1285,10 @@ CONFIG_DEBUG_LL=y
1338CONFIG_KEYS=y 1285CONFIG_KEYS=y
1339CONFIG_KEYS_DEBUG_PROC_KEYS=y 1286CONFIG_KEYS_DEBUG_PROC_KEYS=y
1340# CONFIG_SECURITY is not set 1287# CONFIG_SECURITY is not set
1341 1288CONFIG_XOR_BLOCKS=y
1342# 1289CONFIG_ASYNC_CORE=y
1343# Cryptographic options 1290CONFIG_ASYNC_MEMCPY=y
1344# 1291CONFIG_ASYNC_XOR=y
1345CONFIG_CRYPTO=y 1292CONFIG_CRYPTO=y
1346CONFIG_CRYPTO_ALGAPI=y 1293CONFIG_CRYPTO_ALGAPI=y
1347CONFIG_CRYPTO_BLKCIPHER=y 1294CONFIG_CRYPTO_BLKCIPHER=y
@@ -1360,8 +1307,11 @@ CONFIG_CRYPTO_TGR192=y
1360CONFIG_CRYPTO_GF128MUL=y 1307CONFIG_CRYPTO_GF128MUL=y
1361CONFIG_CRYPTO_ECB=y 1308CONFIG_CRYPTO_ECB=y
1362CONFIG_CRYPTO_CBC=y 1309CONFIG_CRYPTO_CBC=y
1310CONFIG_CRYPTO_PCBC=m
1363CONFIG_CRYPTO_LRW=y 1311CONFIG_CRYPTO_LRW=y
1312# CONFIG_CRYPTO_CRYPTD is not set
1364CONFIG_CRYPTO_DES=y 1313CONFIG_CRYPTO_DES=y
1314# CONFIG_CRYPTO_FCRYPT is not set
1365CONFIG_CRYPTO_BLOWFISH=y 1315CONFIG_CRYPTO_BLOWFISH=y
1366CONFIG_CRYPTO_TWOFISH=y 1316CONFIG_CRYPTO_TWOFISH=y
1367CONFIG_CRYPTO_TWOFISH_COMMON=y 1317CONFIG_CRYPTO_TWOFISH_COMMON=y
@@ -1376,11 +1326,9 @@ CONFIG_CRYPTO_ANUBIS=y
1376CONFIG_CRYPTO_DEFLATE=y 1326CONFIG_CRYPTO_DEFLATE=y
1377CONFIG_CRYPTO_MICHAEL_MIC=y 1327CONFIG_CRYPTO_MICHAEL_MIC=y
1378CONFIG_CRYPTO_CRC32C=y 1328CONFIG_CRYPTO_CRC32C=y
1329# CONFIG_CRYPTO_CAMELLIA is not set
1379# CONFIG_CRYPTO_TEST is not set 1330# CONFIG_CRYPTO_TEST is not set
1380 1331CONFIG_CRYPTO_HW=y
1381#
1382# Hardware crypto devices
1383#
1384 1332
1385# 1333#
1386# Library routines 1334# Library routines
@@ -1388,9 +1336,13 @@ CONFIG_CRYPTO_CRC32C=y
1388CONFIG_BITREVERSE=y 1336CONFIG_BITREVERSE=y
1389# CONFIG_CRC_CCITT is not set 1337# CONFIG_CRC_CCITT is not set
1390# CONFIG_CRC16 is not set 1338# CONFIG_CRC16 is not set
1339# CONFIG_CRC_ITU_T is not set
1391CONFIG_CRC32=y 1340CONFIG_CRC32=y
1341# CONFIG_CRC7 is not set
1392CONFIG_LIBCRC32C=y 1342CONFIG_LIBCRC32C=y
1393CONFIG_ZLIB_INFLATE=y 1343CONFIG_ZLIB_INFLATE=y
1394CONFIG_ZLIB_DEFLATE=y 1344CONFIG_ZLIB_DEFLATE=y
1395CONFIG_PLIST=y 1345CONFIG_PLIST=y
1396CONFIG_IOMAP_COPY=y 1346CONFIG_HAS_IOMEM=y
1347CONFIG_HAS_IOPORT=y
1348CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/iop33x_defconfig b/arch/arm/configs/iop33x_defconfig
index fa271bce8ff7..721ee64a13f7 100644
--- a/arch/arm/configs/iop33x_defconfig
+++ b/arch/arm/configs/iop33x_defconfig
@@ -1,12 +1,18 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc1 3# Linux kernel version: 2.6.22
4# Sat Dec 16 06:05:34 2006 4# Thu Jul 19 16:05:59 2007
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
7# CONFIG_GENERIC_TIME is not set 9# CONFIG_GENERIC_TIME is not set
10# CONFIG_GENERIC_CLOCKEVENTS is not set
8CONFIG_MMU=y 11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
9CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
10CONFIG_TRACE_IRQFLAGS_SUPPORT=y 16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
11CONFIG_HARDIRQS_SW_RESEND=y 17CONFIG_HARDIRQS_SW_RESEND=y
12CONFIG_GENERIC_IRQ_PROBE=y 18CONFIG_GENERIC_IRQ_PROBE=y
@@ -15,6 +21,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
15# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
16CONFIG_GENERIC_HWEIGHT=y 22CONFIG_GENERIC_HWEIGHT=y
17CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
18CONFIG_VECTORS_BASE=0xffff0000 25CONFIG_VECTORS_BASE=0xffff0000
19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
20 27
@@ -32,16 +39,18 @@ CONFIG_LOCALVERSION=""
32CONFIG_LOCALVERSION_AUTO=y 39CONFIG_LOCALVERSION_AUTO=y
33CONFIG_SWAP=y 40CONFIG_SWAP=y
34CONFIG_SYSVIPC=y 41CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set 42CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 43# CONFIG_POSIX_MQUEUE is not set
37CONFIG_BSD_PROCESS_ACCT=y 44CONFIG_BSD_PROCESS_ACCT=y
38# CONFIG_BSD_PROCESS_ACCT_V3 is not set 45# CONFIG_BSD_PROCESS_ACCT_V3 is not set
39# CONFIG_TASKSTATS is not set 46# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 47# CONFIG_USER_NS is not set
41# CONFIG_AUDIT is not set 48# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 49# CONFIG_IKCONFIG is not set
50CONFIG_LOG_BUF_SHIFT=14
43CONFIG_SYSFS_DEPRECATED=y 51CONFIG_SYSFS_DEPRECATED=y
44# CONFIG_RELAY is not set 52# CONFIG_RELAY is not set
53CONFIG_BLK_DEV_INITRD=y
45CONFIG_INITRAMFS_SOURCE="" 54CONFIG_INITRAMFS_SOURCE=""
46CONFIG_CC_OPTIMIZE_FOR_SIZE=y 55CONFIG_CC_OPTIMIZE_FOR_SIZE=y
47CONFIG_SYSCTL=y 56CONFIG_SYSCTL=y
@@ -57,32 +66,30 @@ CONFIG_BUG=y
57CONFIG_ELF_CORE=y 66CONFIG_ELF_CORE=y
58CONFIG_BASE_FULL=y 67CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y 68CONFIG_FUTEX=y
69CONFIG_ANON_INODES=y
60CONFIG_EPOLL=y 70CONFIG_EPOLL=y
71CONFIG_SIGNALFD=y
72CONFIG_TIMERFD=y
73CONFIG_EVENTFD=y
61CONFIG_SHMEM=y 74CONFIG_SHMEM=y
62CONFIG_SLAB=y
63CONFIG_VM_EVENT_COUNTERS=y 75CONFIG_VM_EVENT_COUNTERS=y
76CONFIG_SLAB=y
77# CONFIG_SLUB is not set
78# CONFIG_SLOB is not set
64CONFIG_RT_MUTEXES=y 79CONFIG_RT_MUTEXES=y
65# CONFIG_TINY_SHMEM is not set 80# CONFIG_TINY_SHMEM is not set
66CONFIG_BASE_SMALL=0 81CONFIG_BASE_SMALL=0
67# CONFIG_SLOB is not set
68
69#
70# Loadable module support
71#
72CONFIG_MODULES=y 82CONFIG_MODULES=y
73CONFIG_MODULE_UNLOAD=y 83CONFIG_MODULE_UNLOAD=y
74# CONFIG_MODULE_FORCE_UNLOAD is not set 84# CONFIG_MODULE_FORCE_UNLOAD is not set
75# CONFIG_MODVERSIONS is not set 85# CONFIG_MODVERSIONS is not set
76# CONFIG_MODULE_SRCVERSION_ALL is not set 86# CONFIG_MODULE_SRCVERSION_ALL is not set
77CONFIG_KMOD=y 87CONFIG_KMOD=y
78
79#
80# Block layer
81#
82CONFIG_BLOCK=y 88CONFIG_BLOCK=y
83# CONFIG_LBD is not set 89# CONFIG_LBD is not set
84# CONFIG_BLK_DEV_IO_TRACE is not set 90# CONFIG_BLK_DEV_IO_TRACE is not set
85# CONFIG_LSF is not set 91# CONFIG_LSF is not set
92# CONFIG_BLK_DEV_BSG is not set
86 93
87# 94#
88# IO Schedulers 95# IO Schedulers
@@ -114,13 +121,15 @@ CONFIG_DEFAULT_IOSCHED="cfq"
114# CONFIG_ARCH_NETX is not set 121# CONFIG_ARCH_NETX is not set
115# CONFIG_ARCH_H720X is not set 122# CONFIG_ARCH_H720X is not set
116# CONFIG_ARCH_IMX is not set 123# CONFIG_ARCH_IMX is not set
124# CONFIG_ARCH_IOP13XX is not set
117# CONFIG_ARCH_IOP32X is not set 125# CONFIG_ARCH_IOP32X is not set
118CONFIG_ARCH_IOP33X=y 126CONFIG_ARCH_IOP33X=y
119# CONFIG_ARCH_IOP13XX is not set
120# CONFIG_ARCH_IXP4XX is not set
121# CONFIG_ARCH_IXP2000 is not set
122# CONFIG_ARCH_IXP23XX is not set 127# CONFIG_ARCH_IXP23XX is not set
128# CONFIG_ARCH_IXP2000 is not set
129# CONFIG_ARCH_IXP4XX is not set
123# CONFIG_ARCH_L7200 is not set 130# CONFIG_ARCH_L7200 is not set
131# CONFIG_ARCH_KS8695 is not set
132# CONFIG_ARCH_NS9XXX is not set
124# CONFIG_ARCH_PNX4008 is not set 133# CONFIG_ARCH_PNX4008 is not set
125# CONFIG_ARCH_PXA is not set 134# CONFIG_ARCH_PXA is not set
126# CONFIG_ARCH_RPC is not set 135# CONFIG_ARCH_RPC is not set
@@ -128,7 +137,9 @@ CONFIG_ARCH_IOP33X=y
128# CONFIG_ARCH_S3C2410 is not set 137# CONFIG_ARCH_S3C2410 is not set
129# CONFIG_ARCH_SHARK is not set 138# CONFIG_ARCH_SHARK is not set
130# CONFIG_ARCH_LH7A40X is not set 139# CONFIG_ARCH_LH7A40X is not set
140# CONFIG_ARCH_DAVINCI is not set
131# CONFIG_ARCH_OMAP is not set 141# CONFIG_ARCH_OMAP is not set
142CONFIG_IOP3XX_ATU=y
132 143
133# 144#
134# IOP33x Implementation Options 145# IOP33x Implementation Options
@@ -158,6 +169,7 @@ CONFIG_CPU_CP15_MMU=y
158# 169#
159# CONFIG_ARM_THUMB is not set 170# CONFIG_ARM_THUMB is not set
160# CONFIG_CPU_DCACHE_DISABLE is not set 171# CONFIG_CPU_DCACHE_DISABLE is not set
172# CONFIG_OUTER_CACHE is not set
161# CONFIG_IWMMXT is not set 173# CONFIG_IWMMXT is not set
162CONFIG_XSCALE_PMU=y 174CONFIG_XSCALE_PMU=y
163 175
@@ -165,7 +177,8 @@ CONFIG_XSCALE_PMU=y
165# Bus support 177# Bus support
166# 178#
167CONFIG_PCI=y 179CONFIG_PCI=y
168# CONFIG_PCI_MULTITHREAD_PROBE is not set 180CONFIG_PCI_SYSCALL=y
181# CONFIG_ARCH_SUPPORTS_MSI is not set
169# CONFIG_PCI_DEBUG is not set 182# CONFIG_PCI_DEBUG is not set
170 183
171# 184#
@@ -176,6 +189,7 @@ CONFIG_PCI=y
176# 189#
177# Kernel Features 190# Kernel Features
178# 191#
192# CONFIG_TICK_ONESHOT is not set
179# CONFIG_PREEMPT is not set 193# CONFIG_PREEMPT is not set
180# CONFIG_NO_IDLE_HZ is not set 194# CONFIG_NO_IDLE_HZ is not set
181CONFIG_HZ=100 195CONFIG_HZ=100
@@ -190,6 +204,9 @@ CONFIG_FLAT_NODE_MEM_MAP=y
190# CONFIG_SPARSEMEM_STATIC is not set 204# CONFIG_SPARSEMEM_STATIC is not set
191CONFIG_SPLIT_PTLOCK_CPUS=4096 205CONFIG_SPLIT_PTLOCK_CPUS=4096
192# CONFIG_RESOURCES_64BIT is not set 206# CONFIG_RESOURCES_64BIT is not set
207CONFIG_ZONE_DMA_FLAG=1
208CONFIG_BOUNCE=y
209CONFIG_VIRT_TO_BUS=y
193CONFIG_ALIGNMENT_TRAP=y 210CONFIG_ALIGNMENT_TRAP=y
194 211
195# 212#
@@ -197,8 +214,9 @@ CONFIG_ALIGNMENT_TRAP=y
197# 214#
198CONFIG_ZBOOT_ROM_TEXT=0x0 215CONFIG_ZBOOT_ROM_TEXT=0x0
199CONFIG_ZBOOT_ROM_BSS=0x0 216CONFIG_ZBOOT_ROM_BSS=0x0
200CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp" 217CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp cachepolicy=writealloc"
201# CONFIG_XIP_KERNEL is not set 218# CONFIG_XIP_KERNEL is not set
219# CONFIG_KEXEC is not set
202 220
203# 221#
204# Floating point emulation 222# Floating point emulation
@@ -223,7 +241,6 @@ CONFIG_BINFMT_AOUT=y
223# Power management options 241# Power management options
224# 242#
225# CONFIG_PM is not set 243# CONFIG_PM is not set
226# CONFIG_APM is not set
227 244
228# 245#
229# Networking 246# Networking
@@ -233,13 +250,13 @@ CONFIG_NET=y
233# 250#
234# Networking options 251# Networking options
235# 252#
236# CONFIG_NETDEBUG is not set
237CONFIG_PACKET=y 253CONFIG_PACKET=y
238CONFIG_PACKET_MMAP=y 254CONFIG_PACKET_MMAP=y
239CONFIG_UNIX=y 255CONFIG_UNIX=y
240CONFIG_XFRM=y 256CONFIG_XFRM=y
241# CONFIG_XFRM_USER is not set 257# CONFIG_XFRM_USER is not set
242# CONFIG_XFRM_SUB_POLICY is not set 258# CONFIG_XFRM_SUB_POLICY is not set
259# CONFIG_XFRM_MIGRATE is not set
243# CONFIG_NET_KEY is not set 260# CONFIG_NET_KEY is not set
244CONFIG_INET=y 261CONFIG_INET=y
245CONFIG_IP_MULTICAST=y 262CONFIG_IP_MULTICAST=y
@@ -271,6 +288,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
271CONFIG_IPV6=y 288CONFIG_IPV6=y
272# CONFIG_IPV6_PRIVACY is not set 289# CONFIG_IPV6_PRIVACY is not set
273# CONFIG_IPV6_ROUTER_PREF is not set 290# CONFIG_IPV6_ROUTER_PREF is not set
291# CONFIG_IPV6_OPTIMISTIC_DAD is not set
274# CONFIG_INET6_AH is not set 292# CONFIG_INET6_AH is not set
275# CONFIG_INET6_ESP is not set 293# CONFIG_INET6_ESP is not set
276# CONFIG_INET6_IPCOMP is not set 294# CONFIG_INET6_IPCOMP is not set
@@ -286,20 +304,8 @@ CONFIG_IPV6=y
286# CONFIG_IPV6_MULTIPLE_TABLES is not set 304# CONFIG_IPV6_MULTIPLE_TABLES is not set
287# CONFIG_NETWORK_SECMARK is not set 305# CONFIG_NETWORK_SECMARK is not set
288# CONFIG_NETFILTER is not set 306# CONFIG_NETFILTER is not set
289
290#
291# DCCP Configuration (EXPERIMENTAL)
292#
293# CONFIG_IP_DCCP is not set 307# CONFIG_IP_DCCP is not set
294
295#
296# SCTP Configuration (EXPERIMENTAL)
297#
298# CONFIG_IP_SCTP is not set 308# CONFIG_IP_SCTP is not set
299
300#
301# TIPC Configuration (EXPERIMENTAL)
302#
303# CONFIG_TIPC is not set 309# CONFIG_TIPC is not set
304# CONFIG_ATM is not set 310# CONFIG_ATM is not set
305# CONFIG_BRIDGE is not set 311# CONFIG_BRIDGE is not set
@@ -325,7 +331,17 @@ CONFIG_IPV6=y
325# CONFIG_HAMRADIO is not set 331# CONFIG_HAMRADIO is not set
326# CONFIG_IRDA is not set 332# CONFIG_IRDA is not set
327# CONFIG_BT is not set 333# CONFIG_BT is not set
334# CONFIG_AF_RXRPC is not set
335
336#
337# Wireless
338#
339# CONFIG_CFG80211 is not set
340# CONFIG_WIRELESS_EXT is not set
341# CONFIG_MAC80211 is not set
328# CONFIG_IEEE80211 is not set 342# CONFIG_IEEE80211 is not set
343# CONFIG_RFKILL is not set
344# CONFIG_NET_9P is not set
329 345
330# 346#
331# Device Drivers 347# Device Drivers
@@ -338,16 +354,9 @@ CONFIG_STANDALONE=y
338CONFIG_PREVENT_FIRMWARE_BUILD=y 354CONFIG_PREVENT_FIRMWARE_BUILD=y
339# CONFIG_FW_LOADER is not set 355# CONFIG_FW_LOADER is not set
340# CONFIG_DEBUG_DRIVER is not set 356# CONFIG_DEBUG_DRIVER is not set
357# CONFIG_DEBUG_DEVRES is not set
341# CONFIG_SYS_HYPERVISOR is not set 358# CONFIG_SYS_HYPERVISOR is not set
342
343#
344# Connector - unified userspace <-> kernelspace linker
345#
346# CONFIG_CONNECTOR is not set 359# CONFIG_CONNECTOR is not set
347
348#
349# Memory Technology Devices (MTD)
350#
351CONFIG_MTD=y 360CONFIG_MTD=y
352# CONFIG_MTD_DEBUG is not set 361# CONFIG_MTD_DEBUG is not set
353# CONFIG_MTD_CONCAT is not set 362# CONFIG_MTD_CONCAT is not set
@@ -363,6 +372,7 @@ CONFIG_MTD_REDBOOT_PARTS_READONLY=y
363# User Modules And Translation Layers 372# User Modules And Translation Layers
364# 373#
365CONFIG_MTD_CHAR=y 374CONFIG_MTD_CHAR=y
375CONFIG_MTD_BLKDEVS=y
366CONFIG_MTD_BLOCK=y 376CONFIG_MTD_BLOCK=y
367# CONFIG_FTL is not set 377# CONFIG_FTL is not set
368# CONFIG_NFTL is not set 378# CONFIG_NFTL is not set
@@ -399,7 +409,6 @@ CONFIG_MTD_CFI_UTIL=y
399# CONFIG_MTD_RAM is not set 409# CONFIG_MTD_RAM is not set
400# CONFIG_MTD_ROM is not set 410# CONFIG_MTD_ROM is not set
401# CONFIG_MTD_ABSENT is not set 411# CONFIG_MTD_ABSENT is not set
402# CONFIG_MTD_OBSOLETE_CHIPS is not set
403 412
404# 413#
405# Mapping drivers for chip access 414# Mapping drivers for chip access
@@ -427,29 +436,15 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=1
427# CONFIG_MTD_DOC2000 is not set 436# CONFIG_MTD_DOC2000 is not set
428# CONFIG_MTD_DOC2001 is not set 437# CONFIG_MTD_DOC2001 is not set
429# CONFIG_MTD_DOC2001PLUS is not set 438# CONFIG_MTD_DOC2001PLUS is not set
430
431#
432# NAND Flash Device Drivers
433#
434# CONFIG_MTD_NAND is not set 439# CONFIG_MTD_NAND is not set
435
436#
437# OneNAND Flash Device Drivers
438#
439# CONFIG_MTD_ONENAND is not set 440# CONFIG_MTD_ONENAND is not set
440 441
441# 442#
442# Parallel port support 443# UBI - Unsorted block images
443# 444#
445# CONFIG_MTD_UBI is not set
444# CONFIG_PARPORT is not set 446# CONFIG_PARPORT is not set
445 447CONFIG_BLK_DEV=y
446#
447# Plug and Play support
448#
449
450#
451# Block devices
452#
453# CONFIG_BLK_CPQ_DA is not set 448# CONFIG_BLK_CPQ_DA is not set
454# CONFIG_BLK_CPQ_CISS_DA is not set 449# CONFIG_BLK_CPQ_CISS_DA is not set
455# CONFIG_BLK_DEV_DAC960 is not set 450# CONFIG_BLK_DEV_DAC960 is not set
@@ -462,13 +457,8 @@ CONFIG_BLK_DEV_RAM=y
462CONFIG_BLK_DEV_RAM_COUNT=16 457CONFIG_BLK_DEV_RAM_COUNT=16
463CONFIG_BLK_DEV_RAM_SIZE=8192 458CONFIG_BLK_DEV_RAM_SIZE=8192
464CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 459CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
465CONFIG_BLK_DEV_INITRD=y
466# CONFIG_CDROM_PKTCDVD is not set 460# CONFIG_CDROM_PKTCDVD is not set
467# CONFIG_ATA_OVER_ETH is not set 461# CONFIG_ATA_OVER_ETH is not set
468
469#
470# ATA/ATAPI/MFM/RLL support
471#
472# CONFIG_IDE is not set 462# CONFIG_IDE is not set
473 463
474# 464#
@@ -476,6 +466,7 @@ CONFIG_BLK_DEV_INITRD=y
476# 466#
477# CONFIG_RAID_ATTRS is not set 467# CONFIG_RAID_ATTRS is not set
478CONFIG_SCSI=y 468CONFIG_SCSI=y
469CONFIG_SCSI_DMA=y
479# CONFIG_SCSI_TGT is not set 470# CONFIG_SCSI_TGT is not set
480# CONFIG_SCSI_NETLINK is not set 471# CONFIG_SCSI_NETLINK is not set
481CONFIG_SCSI_PROC_FS=y 472CONFIG_SCSI_PROC_FS=y
@@ -497,6 +488,7 @@ CONFIG_CHR_DEV_SG=y
497# CONFIG_SCSI_CONSTANTS is not set 488# CONFIG_SCSI_CONSTANTS is not set
498# CONFIG_SCSI_LOGGING is not set 489# CONFIG_SCSI_LOGGING is not set
499# CONFIG_SCSI_SCAN_ASYNC is not set 490# CONFIG_SCSI_SCAN_ASYNC is not set
491CONFIG_SCSI_WAIT_SCAN=m
500 492
501# 493#
502# SCSI Transports 494# SCSI Transports
@@ -541,22 +533,15 @@ CONFIG_CHR_DEV_SG=y
541# CONFIG_SCSI_NSP32 is not set 533# CONFIG_SCSI_NSP32 is not set
542# CONFIG_SCSI_DEBUG is not set 534# CONFIG_SCSI_DEBUG is not set
543# CONFIG_SCSI_SRP is not set 535# CONFIG_SCSI_SRP is not set
544
545#
546# Serial ATA (prod) and Parallel ATA (experimental) drivers
547#
548# CONFIG_ATA is not set 536# CONFIG_ATA is not set
549
550#
551# Multi-device support (RAID and LVM)
552#
553CONFIG_MD=y 537CONFIG_MD=y
554CONFIG_BLK_DEV_MD=y 538CONFIG_BLK_DEV_MD=y
555CONFIG_MD_LINEAR=y 539CONFIG_MD_LINEAR=y
556CONFIG_MD_RAID0=y 540CONFIG_MD_RAID0=y
557CONFIG_MD_RAID1=y 541CONFIG_MD_RAID1=y
558# CONFIG_MD_RAID10 is not set 542# CONFIG_MD_RAID10 is not set
559# CONFIG_MD_RAID456 is not set 543CONFIG_MD_RAID456=y
544# CONFIG_MD_RAID5_RESHAPE is not set
560# CONFIG_MD_MULTIPATH is not set 545# CONFIG_MD_MULTIPATH is not set
561# CONFIG_MD_FAULTY is not set 546# CONFIG_MD_FAULTY is not set
562CONFIG_BLK_DEV_DM=y 547CONFIG_BLK_DEV_DM=y
@@ -566,6 +551,7 @@ CONFIG_BLK_DEV_DM=y
566# CONFIG_DM_MIRROR is not set 551# CONFIG_DM_MIRROR is not set
567# CONFIG_DM_ZERO is not set 552# CONFIG_DM_ZERO is not set
568# CONFIG_DM_MULTIPATH is not set 553# CONFIG_DM_MULTIPATH is not set
554# CONFIG_DM_DELAY is not set
569 555
570# 556#
571# Fusion MPT device support 557# Fusion MPT device support
@@ -578,39 +564,19 @@ CONFIG_BLK_DEV_DM=y
578# 564#
579# IEEE 1394 (FireWire) support 565# IEEE 1394 (FireWire) support
580# 566#
567# CONFIG_FIREWIRE is not set
581# CONFIG_IEEE1394 is not set 568# CONFIG_IEEE1394 is not set
582
583#
584# I2O device support
585#
586# CONFIG_I2O is not set 569# CONFIG_I2O is not set
587
588#
589# Network device support
590#
591CONFIG_NETDEVICES=y 570CONFIG_NETDEVICES=y
571# CONFIG_NETDEVICES_MULTIQUEUE is not set
592# CONFIG_DUMMY is not set 572# CONFIG_DUMMY is not set
593# CONFIG_BONDING is not set 573# CONFIG_BONDING is not set
574# CONFIG_MACVLAN is not set
594# CONFIG_EQUALIZER is not set 575# CONFIG_EQUALIZER is not set
595# CONFIG_TUN is not set 576# CONFIG_TUN is not set
596
597#
598# ARCnet devices
599#
600# CONFIG_ARCNET is not set 577# CONFIG_ARCNET is not set
601
602#
603# PHY device support
604#
605
606#
607# Ethernet (10 or 100Mbit)
608#
609# CONFIG_NET_ETHERNET is not set 578# CONFIG_NET_ETHERNET is not set
610 579CONFIG_NETDEV_1000=y
611#
612# Ethernet (1000 Mbit)
613#
614# CONFIG_ACENIC is not set 580# CONFIG_ACENIC is not set
615# CONFIG_DL2K is not set 581# CONFIG_DL2K is not set
616CONFIG_E1000=y 582CONFIG_E1000=y
@@ -623,33 +589,26 @@ CONFIG_E1000_NAPI=y
623# CONFIG_SIS190 is not set 589# CONFIG_SIS190 is not set
624# CONFIG_SKGE is not set 590# CONFIG_SKGE is not set
625# CONFIG_SKY2 is not set 591# CONFIG_SKY2 is not set
626# CONFIG_SK98LIN is not set 592# CONFIG_VIA_VELOCITY is not set
627# CONFIG_TIGON3 is not set 593# CONFIG_TIGON3 is not set
628# CONFIG_BNX2 is not set 594# CONFIG_BNX2 is not set
629# CONFIG_QLA3XXX is not set 595# CONFIG_QLA3XXX is not set
630 596# CONFIG_ATL1 is not set
631# 597CONFIG_NETDEV_10000=y
632# Ethernet (10000 Mbit)
633#
634# CONFIG_CHELSIO_T1 is not set 598# CONFIG_CHELSIO_T1 is not set
599# CONFIG_CHELSIO_T3 is not set
635# CONFIG_IXGB is not set 600# CONFIG_IXGB is not set
636# CONFIG_S2IO is not set 601# CONFIG_S2IO is not set
637# CONFIG_MYRI10GE is not set 602# CONFIG_MYRI10GE is not set
638# CONFIG_NETXEN_NIC is not set 603# CONFIG_NETXEN_NIC is not set
639 604# CONFIG_MLX4_CORE is not set
640#
641# Token Ring devices
642#
643# CONFIG_TR is not set 605# CONFIG_TR is not set
644 606
645# 607#
646# Wireless LAN (non-hamradio) 608# Wireless LAN
647#
648# CONFIG_NET_RADIO is not set
649
650#
651# Wan interfaces
652# 609#
610# CONFIG_WLAN_PRE80211 is not set
611# CONFIG_WLAN_80211 is not set
653# CONFIG_WAN is not set 612# CONFIG_WAN is not set
654# CONFIG_FDDI is not set 613# CONFIG_FDDI is not set
655# CONFIG_HIPPI is not set 614# CONFIG_HIPPI is not set
@@ -660,10 +619,6 @@ CONFIG_E1000_NAPI=y
660# CONFIG_NETCONSOLE is not set 619# CONFIG_NETCONSOLE is not set
661# CONFIG_NETPOLL is not set 620# CONFIG_NETPOLL is not set
662# CONFIG_NET_POLL_CONTROLLER is not set 621# CONFIG_NET_POLL_CONTROLLER is not set
663
664#
665# ISDN subsystem
666#
667# CONFIG_ISDN is not set 622# CONFIG_ISDN is not set
668 623
669# 624#
@@ -671,6 +626,7 @@ CONFIG_E1000_NAPI=y
671# 626#
672CONFIG_INPUT=y 627CONFIG_INPUT=y
673# CONFIG_INPUT_FF_MEMLESS is not set 628# CONFIG_INPUT_FF_MEMLESS is not set
629# CONFIG_INPUT_POLLDEV is not set
674 630
675# 631#
676# Userland interfaces 632# Userland interfaces
@@ -690,6 +646,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
690# CONFIG_INPUT_KEYBOARD is not set 646# CONFIG_INPUT_KEYBOARD is not set
691# CONFIG_INPUT_MOUSE is not set 647# CONFIG_INPUT_MOUSE is not set
692# CONFIG_INPUT_JOYSTICK is not set 648# CONFIG_INPUT_JOYSTICK is not set
649# CONFIG_INPUT_TABLET is not set
693# CONFIG_INPUT_TOUCHSCREEN is not set 650# CONFIG_INPUT_TOUCHSCREEN is not set
694# CONFIG_INPUT_MISC is not set 651# CONFIG_INPUT_MISC is not set
695 652
@@ -727,33 +684,18 @@ CONFIG_SERIAL_CORE_CONSOLE=y
727CONFIG_UNIX98_PTYS=y 684CONFIG_UNIX98_PTYS=y
728CONFIG_LEGACY_PTYS=y 685CONFIG_LEGACY_PTYS=y
729CONFIG_LEGACY_PTY_COUNT=256 686CONFIG_LEGACY_PTY_COUNT=256
730
731#
732# IPMI
733#
734# CONFIG_IPMI_HANDLER is not set 687# CONFIG_IPMI_HANDLER is not set
735
736#
737# Watchdog Cards
738#
739# CONFIG_WATCHDOG is not set 688# CONFIG_WATCHDOG is not set
740CONFIG_HW_RANDOM=y 689CONFIG_HW_RANDOM=y
741# CONFIG_NVRAM is not set 690# CONFIG_NVRAM is not set
742# CONFIG_DTLK is not set
743# CONFIG_R3964 is not set 691# CONFIG_R3964 is not set
744# CONFIG_APPLICOM is not set 692# CONFIG_APPLICOM is not set
745# CONFIG_DRM is not set 693# CONFIG_DRM is not set
746# CONFIG_RAW_DRIVER is not set 694# CONFIG_RAW_DRIVER is not set
747
748#
749# TPM devices
750#
751# CONFIG_TCG_TPM is not set 695# CONFIG_TCG_TPM is not set
752 696CONFIG_DEVPORT=y
753#
754# I2C support
755#
756CONFIG_I2C=y 697CONFIG_I2C=y
698CONFIG_I2C_BOARDINFO=y
757CONFIG_I2C_CHARDEV=y 699CONFIG_I2C_CHARDEV=y
758 700
759# 701#
@@ -780,25 +722,28 @@ CONFIG_I2C_IOP3XX=y
780# CONFIG_I2C_PARPORT_LIGHT is not set 722# CONFIG_I2C_PARPORT_LIGHT is not set
781# CONFIG_I2C_PROSAVAGE is not set 723# CONFIG_I2C_PROSAVAGE is not set
782# CONFIG_I2C_SAVAGE4 is not set 724# CONFIG_I2C_SAVAGE4 is not set
725# CONFIG_I2C_SIMTEC is not set
783# CONFIG_I2C_SIS5595 is not set 726# CONFIG_I2C_SIS5595 is not set
784# CONFIG_I2C_SIS630 is not set 727# CONFIG_I2C_SIS630 is not set
785# CONFIG_I2C_SIS96X is not set 728# CONFIG_I2C_SIS96X is not set
729# CONFIG_I2C_TAOS_EVM is not set
786# CONFIG_I2C_STUB is not set 730# CONFIG_I2C_STUB is not set
787# CONFIG_I2C_VIA is not set 731# CONFIG_I2C_VIA is not set
788# CONFIG_I2C_VIAPRO is not set 732# CONFIG_I2C_VIAPRO is not set
789# CONFIG_I2C_VOODOO3 is not set 733# CONFIG_I2C_VOODOO3 is not set
790# CONFIG_I2C_PCA_ISA is not set
791 734
792# 735#
793# Miscellaneous I2C Chip support 736# Miscellaneous I2C Chip support
794# 737#
795# CONFIG_SENSORS_DS1337 is not set 738# CONFIG_SENSORS_DS1337 is not set
796# CONFIG_SENSORS_DS1374 is not set 739# CONFIG_SENSORS_DS1374 is not set
740# CONFIG_DS1682 is not set
797# CONFIG_SENSORS_EEPROM is not set 741# CONFIG_SENSORS_EEPROM is not set
798# CONFIG_SENSORS_PCF8574 is not set 742# CONFIG_SENSORS_PCF8574 is not set
799# CONFIG_SENSORS_PCA9539 is not set 743# CONFIG_SENSORS_PCA9539 is not set
800# CONFIG_SENSORS_PCF8591 is not set 744# CONFIG_SENSORS_PCF8591 is not set
801# CONFIG_SENSORS_MAX6875 is not set 745# CONFIG_SENSORS_MAX6875 is not set
746# CONFIG_SENSORS_TSL2550 is not set
802# CONFIG_I2C_DEBUG_CORE is not set 747# CONFIG_I2C_DEBUG_CORE is not set
803# CONFIG_I2C_DEBUG_ALGO is not set 748# CONFIG_I2C_DEBUG_ALGO is not set
804# CONFIG_I2C_DEBUG_BUS is not set 749# CONFIG_I2C_DEBUG_BUS is not set
@@ -809,21 +754,15 @@ CONFIG_I2C_IOP3XX=y
809# 754#
810# CONFIG_SPI is not set 755# CONFIG_SPI is not set
811# CONFIG_SPI_MASTER is not set 756# CONFIG_SPI_MASTER is not set
812
813#
814# Dallas's 1-wire bus
815#
816# CONFIG_W1 is not set 757# CONFIG_W1 is not set
817
818#
819# Hardware Monitoring support
820#
821CONFIG_HWMON=y 758CONFIG_HWMON=y
822# CONFIG_HWMON_VID is not set 759# CONFIG_HWMON_VID is not set
823# CONFIG_SENSORS_ABITUGURU is not set 760# CONFIG_SENSORS_ABITUGURU is not set
761# CONFIG_SENSORS_AD7418 is not set
824# CONFIG_SENSORS_ADM1021 is not set 762# CONFIG_SENSORS_ADM1021 is not set
825# CONFIG_SENSORS_ADM1025 is not set 763# CONFIG_SENSORS_ADM1025 is not set
826# CONFIG_SENSORS_ADM1026 is not set 764# CONFIG_SENSORS_ADM1026 is not set
765# CONFIG_SENSORS_ADM1029 is not set
827# CONFIG_SENSORS_ADM1031 is not set 766# CONFIG_SENSORS_ADM1031 is not set
828# CONFIG_SENSORS_ADM9240 is not set 767# CONFIG_SENSORS_ADM9240 is not set
829# CONFIG_SENSORS_ASB100 is not set 768# CONFIG_SENSORS_ASB100 is not set
@@ -846,6 +785,7 @@ CONFIG_HWMON=y
846# CONFIG_SENSORS_LM90 is not set 785# CONFIG_SENSORS_LM90 is not set
847# CONFIG_SENSORS_LM92 is not set 786# CONFIG_SENSORS_LM92 is not set
848# CONFIG_SENSORS_MAX1619 is not set 787# CONFIG_SENSORS_MAX1619 is not set
788# CONFIG_SENSORS_MAX6650 is not set
849# CONFIG_SENSORS_PC87360 is not set 789# CONFIG_SENSORS_PC87360 is not set
850# CONFIG_SENSORS_PC87427 is not set 790# CONFIG_SENSORS_PC87427 is not set
851# CONFIG_SENSORS_SIS5595 is not set 791# CONFIG_SENSORS_SIS5595 is not set
@@ -863,12 +803,16 @@ CONFIG_HWMON=y
863# CONFIG_SENSORS_W83627HF is not set 803# CONFIG_SENSORS_W83627HF is not set
864# CONFIG_SENSORS_W83627EHF is not set 804# CONFIG_SENSORS_W83627EHF is not set
865# CONFIG_HWMON_DEBUG_CHIP is not set 805# CONFIG_HWMON_DEBUG_CHIP is not set
806CONFIG_MISC_DEVICES=y
807# CONFIG_PHANTOM is not set
808# CONFIG_EEPROM_93CX6 is not set
809# CONFIG_SGI_IOC4 is not set
810# CONFIG_TIFM_CORE is not set
866 811
867# 812#
868# Misc devices 813# Multifunction device drivers
869# 814#
870# CONFIG_SGI_IOC4 is not set 815# CONFIG_MFD_SM501 is not set
871# CONFIG_TIFM_CORE is not set
872 816
873# 817#
874# LED devices 818# LED devices
@@ -887,16 +831,19 @@ CONFIG_HWMON=y
887# Multimedia devices 831# Multimedia devices
888# 832#
889# CONFIG_VIDEO_DEV is not set 833# CONFIG_VIDEO_DEV is not set
834# CONFIG_DVB_CORE is not set
835CONFIG_DAB=y
890 836
891# 837#
892# Digital Video Broadcasting Devices 838# Graphics support
893# 839#
894# CONFIG_DVB is not set 840# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
895 841
896# 842#
897# Graphics support 843# Display device support
898# 844#
899CONFIG_FIRMWARE_EDID=y 845# CONFIG_DISPLAY_SUPPORT is not set
846# CONFIG_VGASTATE is not set
900# CONFIG_FB is not set 847# CONFIG_FB is not set
901 848
902# 849#
@@ -904,21 +851,15 @@ CONFIG_FIRMWARE_EDID=y
904# 851#
905# CONFIG_VGA_CONSOLE is not set 852# CONFIG_VGA_CONSOLE is not set
906CONFIG_DUMMY_CONSOLE=y 853CONFIG_DUMMY_CONSOLE=y
907# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
908 854
909# 855#
910# Sound 856# Sound
911# 857#
912# CONFIG_SOUND is not set 858# CONFIG_SOUND is not set
913 859CONFIG_HID_SUPPORT=y
914#
915# HID Devices
916#
917CONFIG_HID=y 860CONFIG_HID=y
918 861# CONFIG_HID_DEBUG is not set
919# 862CONFIG_USB_SUPPORT=y
920# USB support
921#
922CONFIG_USB_ARCH_HAS_HCD=y 863CONFIG_USB_ARCH_HAS_HCD=y
923CONFIG_USB_ARCH_HAS_OHCI=y 864CONFIG_USB_ARCH_HAS_OHCI=y
924CONFIG_USB_ARCH_HAS_EHCI=y 865CONFIG_USB_ARCH_HAS_EHCI=y
@@ -932,10 +873,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
932# USB Gadget Support 873# USB Gadget Support
933# 874#
934# CONFIG_USB_GADGET is not set 875# CONFIG_USB_GADGET is not set
935
936#
937# MMC/SD Card support
938#
939# CONFIG_MMC is not set 876# CONFIG_MMC is not set
940 877
941# 878#
@@ -945,6 +882,22 @@ CONFIG_RTC_LIB=y
945# CONFIG_RTC_CLASS is not set 882# CONFIG_RTC_CLASS is not set
946 883
947# 884#
885# DMA Engine support
886#
887CONFIG_DMA_ENGINE=y
888
889#
890# DMA Clients
891#
892CONFIG_NET_DMA=y
893
894#
895# DMA Devices
896#
897# CONFIG_INTEL_IOATDMA is not set
898CONFIG_INTEL_IOP_ADMA=y
899
900#
948# File systems 901# File systems
949# 902#
950CONFIG_EXT2_FS=y 903CONFIG_EXT2_FS=y
@@ -961,11 +914,7 @@ CONFIG_FS_MBCACHE=y
961# CONFIG_REISERFS_FS is not set 914# CONFIG_REISERFS_FS is not set
962# CONFIG_JFS_FS is not set 915# CONFIG_JFS_FS is not set
963# CONFIG_FS_POSIX_ACL is not set 916# CONFIG_FS_POSIX_ACL is not set
964CONFIG_XFS_FS=y 917# CONFIG_XFS_FS is not set
965# CONFIG_XFS_QUOTA is not set
966CONFIG_XFS_SECURITY=y
967CONFIG_XFS_POSIX_ACL=y
968# CONFIG_XFS_RT is not set
969# CONFIG_GFS2_FS is not set 918# CONFIG_GFS2_FS is not set
970# CONFIG_OCFS2_FS is not set 919# CONFIG_OCFS2_FS is not set
971# CONFIG_MINIX_FS is not set 920# CONFIG_MINIX_FS is not set
@@ -1013,9 +962,8 @@ CONFIG_RAMFS=y
1013# CONFIG_BEFS_FS is not set 962# CONFIG_BEFS_FS is not set
1014# CONFIG_BFS_FS is not set 963# CONFIG_BFS_FS is not set
1015# CONFIG_EFS_FS is not set 964# CONFIG_EFS_FS is not set
1016# CONFIG_JFFS_FS is not set
1017# CONFIG_JFFS2_FS is not set 965# CONFIG_JFFS2_FS is not set
1018# CONFIG_CRAMFS is not set 966CONFIG_CRAMFS=y
1019# CONFIG_VXFS_FS is not set 967# CONFIG_VXFS_FS is not set
1020# CONFIG_HPFS_FS is not set 968# CONFIG_HPFS_FS is not set
1021# CONFIG_QNX4FS_FS is not set 969# CONFIG_QNX4FS_FS is not set
@@ -1041,6 +989,7 @@ CONFIG_LOCKD_V4=y
1041CONFIG_EXPORTFS=y 989CONFIG_EXPORTFS=y
1042CONFIG_NFS_COMMON=y 990CONFIG_NFS_COMMON=y
1043CONFIG_SUNRPC=y 991CONFIG_SUNRPC=y
992# CONFIG_SUNRPC_BIND34 is not set
1044# CONFIG_RPCSEC_GSS_KRB5 is not set 993# CONFIG_RPCSEC_GSS_KRB5 is not set
1045# CONFIG_RPCSEC_GSS_SPKM3 is not set 994# CONFIG_RPCSEC_GSS_SPKM3 is not set
1046# CONFIG_SMB_FS is not set 995# CONFIG_SMB_FS is not set
@@ -1048,7 +997,6 @@ CONFIG_SUNRPC=y
1048# CONFIG_NCP_FS is not set 997# CONFIG_NCP_FS is not set
1049# CONFIG_CODA_FS is not set 998# CONFIG_CODA_FS is not set
1050# CONFIG_AFS_FS is not set 999# CONFIG_AFS_FS is not set
1051# CONFIG_9P_FS is not set
1052 1000
1053# 1001#
1054# Partition Types 1002# Partition Types
@@ -1070,6 +1018,7 @@ CONFIG_MSDOS_PARTITION=y
1070# CONFIG_SUN_PARTITION is not set 1018# CONFIG_SUN_PARTITION is not set
1071# CONFIG_KARMA_PARTITION is not set 1019# CONFIG_KARMA_PARTITION is not set
1072# CONFIG_EFI_PARTITION is not set 1020# CONFIG_EFI_PARTITION is not set
1021# CONFIG_SYSV68_PARTITION is not set
1073 1022
1074# 1023#
1075# Native Language Support 1024# Native Language Support
@@ -1096,15 +1045,19 @@ CONFIG_MAGIC_SYSRQ=y
1096# CONFIG_DEBUG_FS is not set 1045# CONFIG_DEBUG_FS is not set
1097# CONFIG_HEADERS_CHECK is not set 1046# CONFIG_HEADERS_CHECK is not set
1098CONFIG_DEBUG_KERNEL=y 1047CONFIG_DEBUG_KERNEL=y
1099CONFIG_LOG_BUF_SHIFT=14 1048# CONFIG_DEBUG_SHIRQ is not set
1100CONFIG_DETECT_SOFTLOCKUP=y 1049CONFIG_DETECT_SOFTLOCKUP=y
1050CONFIG_SCHED_DEBUG=y
1101# CONFIG_SCHEDSTATS is not set 1051# CONFIG_SCHEDSTATS is not set
1052# CONFIG_TIMER_STATS is not set
1102# CONFIG_DEBUG_SLAB is not set 1053# CONFIG_DEBUG_SLAB is not set
1103# CONFIG_DEBUG_RT_MUTEXES is not set 1054# CONFIG_DEBUG_RT_MUTEXES is not set
1104# CONFIG_RT_MUTEX_TESTER is not set 1055# CONFIG_RT_MUTEX_TESTER is not set
1105# CONFIG_DEBUG_SPINLOCK is not set 1056# CONFIG_DEBUG_SPINLOCK is not set
1106# CONFIG_DEBUG_MUTEXES is not set 1057# CONFIG_DEBUG_MUTEXES is not set
1107# CONFIG_DEBUG_RWSEMS is not set 1058# CONFIG_DEBUG_LOCK_ALLOC is not set
1059# CONFIG_PROVE_LOCKING is not set
1060# CONFIG_LOCK_STAT is not set
1108# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1061# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1109# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1062# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1110# CONFIG_DEBUG_KOBJECT is not set 1063# CONFIG_DEBUG_KOBJECT is not set
@@ -1115,6 +1068,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1115CONFIG_FRAME_POINTER=y 1068CONFIG_FRAME_POINTER=y
1116# CONFIG_FORCED_INLINING is not set 1069# CONFIG_FORCED_INLINING is not set
1117# CONFIG_RCU_TORTURE_TEST is not set 1070# CONFIG_RCU_TORTURE_TEST is not set
1071# CONFIG_FAULT_INJECTION is not set
1118CONFIG_DEBUG_USER=y 1072CONFIG_DEBUG_USER=y
1119# CONFIG_DEBUG_ERRORS is not set 1073# CONFIG_DEBUG_ERRORS is not set
1120CONFIG_DEBUG_LL=y 1074CONFIG_DEBUG_LL=y
@@ -1125,10 +1079,10 @@ CONFIG_DEBUG_LL=y
1125# 1079#
1126# CONFIG_KEYS is not set 1080# CONFIG_KEYS is not set
1127# CONFIG_SECURITY is not set 1081# CONFIG_SECURITY is not set
1128 1082CONFIG_XOR_BLOCKS=y
1129# 1083CONFIG_ASYNC_CORE=y
1130# Cryptographic options 1084CONFIG_ASYNC_MEMCPY=y
1131# 1085CONFIG_ASYNC_XOR=y
1132# CONFIG_CRYPTO is not set 1086# CONFIG_CRYPTO is not set
1133 1087
1134# 1088#
@@ -1136,7 +1090,12 @@ CONFIG_DEBUG_LL=y
1136# 1090#
1137# CONFIG_CRC_CCITT is not set 1091# CONFIG_CRC_CCITT is not set
1138# CONFIG_CRC16 is not set 1092# CONFIG_CRC16 is not set
1093# CONFIG_CRC_ITU_T is not set
1139# CONFIG_CRC32 is not set 1094# CONFIG_CRC32 is not set
1095# CONFIG_CRC7 is not set
1140# CONFIG_LIBCRC32C is not set 1096# CONFIG_LIBCRC32C is not set
1097CONFIG_ZLIB_INFLATE=y
1141CONFIG_PLIST=y 1098CONFIG_PLIST=y
1142CONFIG_IOMAP_COPY=y 1099CONFIG_HAS_IOMEM=y
1100CONFIG_HAS_IOPORT=y
1101CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/rpc_defconfig b/arch/arm/configs/rpc_defconfig
index 8452dc8c7cc3..5ddecb9ddf01 100644
--- a/arch/arm/configs/rpc_defconfig
+++ b/arch/arm/configs/rpc_defconfig
@@ -1,87 +1,150 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11 3# Linux kernel version: 2.6.23-rc2
4# Wed Mar 9 14:41:48 2005 4# Mon Aug 6 16:47:24 2007
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
9# CONFIG_GENERIC_TIME is not set
10# CONFIG_GENERIC_CLOCKEVENTS is not set
7CONFIG_MMU=y 11CONFIG_MMU=y
8CONFIG_UID16=y 12CONFIG_NO_IOPORT=y
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y 19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
11CONFIG_GENERIC_IOMAP=y 24CONFIG_ARCH_MAY_HAVE_PC_FDC=y
25CONFIG_ZONE_DMA=y
12CONFIG_FIQ=y 26CONFIG_FIQ=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
13 29
14# 30#
15# Code maturity level options 31# General setup
16# 32#
17CONFIG_EXPERIMENTAL=y 33CONFIG_EXPERIMENTAL=y
18CONFIG_CLEAN_COMPILE=y
19CONFIG_BROKEN_ON_SMP=y 34CONFIG_BROKEN_ON_SMP=y
20 35CONFIG_INIT_ENV_ARG_LIMIT=32
21#
22# General setup
23#
24CONFIG_LOCALVERSION="" 36CONFIG_LOCALVERSION=""
37# CONFIG_LOCALVERSION_AUTO is not set
25CONFIG_SWAP=y 38CONFIG_SWAP=y
26CONFIG_SYSVIPC=y 39CONFIG_SYSVIPC=y
40CONFIG_SYSVIPC_SYSCTL=y
27# CONFIG_POSIX_MQUEUE is not set 41# CONFIG_POSIX_MQUEUE is not set
28# CONFIG_BSD_PROCESS_ACCT is not set 42# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y 43# CONFIG_TASKSTATS is not set
44# CONFIG_USER_NS is not set
30# CONFIG_AUDIT is not set 45# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32# CONFIG_HOTPLUG is not set
33CONFIG_KOBJECT_UEVENT=y
34# CONFIG_IKCONFIG is not set 46# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14
48CONFIG_SYSFS_DEPRECATED=y
49# CONFIG_RELAY is not set
50CONFIG_BLK_DEV_INITRD=y
51CONFIG_INITRAMFS_SOURCE=""
52CONFIG_CC_OPTIMIZE_FOR_SIZE=y
53CONFIG_SYSCTL=y
35# CONFIG_EMBEDDED is not set 54# CONFIG_EMBEDDED is not set
55CONFIG_UID16=y
56CONFIG_SYSCTL_SYSCALL=y
36CONFIG_KALLSYMS=y 57CONFIG_KALLSYMS=y
37# CONFIG_KALLSYMS_ALL is not set 58# CONFIG_KALLSYMS_ALL is not set
38# CONFIG_KALLSYMS_EXTRA_PASS is not set 59# CONFIG_KALLSYMS_EXTRA_PASS is not set
60CONFIG_HOTPLUG=y
61CONFIG_PRINTK=y
62CONFIG_BUG=y
63CONFIG_ELF_CORE=y
39CONFIG_BASE_FULL=y 64CONFIG_BASE_FULL=y
40CONFIG_FUTEX=y 65CONFIG_FUTEX=y
66CONFIG_ANON_INODES=y
41CONFIG_EPOLL=y 67CONFIG_EPOLL=y
42CONFIG_CC_OPTIMIZE_FOR_SIZE=y 68CONFIG_SIGNALFD=y
69CONFIG_TIMERFD=y
70CONFIG_EVENTFD=y
43CONFIG_SHMEM=y 71CONFIG_SHMEM=y
44CONFIG_CC_ALIGN_FUNCTIONS=0 72CONFIG_VM_EVENT_COUNTERS=y
45CONFIG_CC_ALIGN_LABELS=0 73CONFIG_SLAB=y
46CONFIG_CC_ALIGN_LOOPS=0 74# CONFIG_SLUB is not set
47CONFIG_CC_ALIGN_JUMPS=0 75# CONFIG_SLOB is not set
76CONFIG_RT_MUTEXES=y
48# CONFIG_TINY_SHMEM is not set 77# CONFIG_TINY_SHMEM is not set
49CONFIG_BASE_SMALL=0 78CONFIG_BASE_SMALL=0
50
51#
52# Loadable module support
53#
54CONFIG_MODULES=y 79CONFIG_MODULES=y
55CONFIG_MODULE_UNLOAD=y 80CONFIG_MODULE_UNLOAD=y
56# CONFIG_MODULE_FORCE_UNLOAD is not set 81# CONFIG_MODULE_FORCE_UNLOAD is not set
57CONFIG_OBSOLETE_MODPARM=y
58# CONFIG_MODVERSIONS is not set 82# CONFIG_MODVERSIONS is not set
59# CONFIG_MODULE_SRCVERSION_ALL is not set 83# CONFIG_MODULE_SRCVERSION_ALL is not set
60CONFIG_KMOD=y 84CONFIG_KMOD=y
85CONFIG_BLOCK=y
86# CONFIG_LBD is not set
87# CONFIG_BLK_DEV_IO_TRACE is not set
88# CONFIG_LSF is not set
89# CONFIG_BLK_DEV_BSG is not set
90
91#
92# IO Schedulers
93#
94CONFIG_IOSCHED_NOOP=y
95CONFIG_IOSCHED_AS=y
96CONFIG_IOSCHED_DEADLINE=y
97CONFIG_IOSCHED_CFQ=y
98# CONFIG_DEFAULT_AS is not set
99# CONFIG_DEFAULT_DEADLINE is not set
100CONFIG_DEFAULT_CFQ=y
101# CONFIG_DEFAULT_NOOP is not set
102CONFIG_DEFAULT_IOSCHED="cfq"
61 103
62# 104#
63# System Type 105# System Type
64# 106#
107# CONFIG_ARCH_AAEC2000 is not set
108# CONFIG_ARCH_INTEGRATOR is not set
109# CONFIG_ARCH_REALVIEW is not set
110# CONFIG_ARCH_VERSATILE is not set
111# CONFIG_ARCH_AT91 is not set
65# CONFIG_ARCH_CLPS7500 is not set 112# CONFIG_ARCH_CLPS7500 is not set
66# CONFIG_ARCH_CLPS711X is not set 113# CONFIG_ARCH_CLPS711X is not set
67# CONFIG_ARCH_CO285 is not set 114# CONFIG_ARCH_CO285 is not set
68# CONFIG_ARCH_EBSA110 is not set 115# CONFIG_ARCH_EBSA110 is not set
116# CONFIG_ARCH_EP93XX is not set
69# CONFIG_ARCH_FOOTBRIDGE is not set 117# CONFIG_ARCH_FOOTBRIDGE is not set
70# CONFIG_ARCH_INTEGRATOR is not set 118# CONFIG_ARCH_NETX is not set
71# CONFIG_ARCH_IOP3XX is not set 119# CONFIG_ARCH_H720X is not set
72# CONFIG_ARCH_IXP4XX is not set 120# CONFIG_ARCH_IMX is not set
121# CONFIG_ARCH_IOP13XX is not set
122# CONFIG_ARCH_IOP32X is not set
123# CONFIG_ARCH_IOP33X is not set
124# CONFIG_ARCH_IXP23XX is not set
73# CONFIG_ARCH_IXP2000 is not set 125# CONFIG_ARCH_IXP2000 is not set
126# CONFIG_ARCH_IXP4XX is not set
74# CONFIG_ARCH_L7200 is not set 127# CONFIG_ARCH_L7200 is not set
128# CONFIG_ARCH_KS8695 is not set
129# CONFIG_ARCH_NS9XXX is not set
130# CONFIG_ARCH_MXC is not set
131# CONFIG_ARCH_PNX4008 is not set
75# CONFIG_ARCH_PXA is not set 132# CONFIG_ARCH_PXA is not set
76CONFIG_ARCH_RPC=y 133CONFIG_ARCH_RPC=y
77# CONFIG_ARCH_SA1100 is not set 134# CONFIG_ARCH_SA1100 is not set
78# CONFIG_ARCH_S3C2410 is not set 135# CONFIG_ARCH_S3C2410 is not set
79# CONFIG_ARCH_SHARK is not set 136# CONFIG_ARCH_SHARK is not set
80# CONFIG_ARCH_LH7A40X is not set 137# CONFIG_ARCH_LH7A40X is not set
138# CONFIG_ARCH_DAVINCI is not set
81# CONFIG_ARCH_OMAP is not set 139# CONFIG_ARCH_OMAP is not set
82# CONFIG_ARCH_VERSATILE is not set 140
83# CONFIG_ARCH_IMX is not set 141#
84# CONFIG_ARCH_H720X is not set 142# Boot options
143#
144
145#
146# Power management
147#
85CONFIG_ARCH_ACORN=y 148CONFIG_ARCH_ACORN=y
86 149
87# 150#
@@ -100,15 +163,22 @@ CONFIG_CPU_COPY_V3=y
100CONFIG_CPU_COPY_V4WB=y 163CONFIG_CPU_COPY_V4WB=y
101CONFIG_CPU_TLB_V3=y 164CONFIG_CPU_TLB_V3=y
102CONFIG_CPU_TLB_V4WB=y 165CONFIG_CPU_TLB_V4WB=y
166CONFIG_CPU_CP15=y
167CONFIG_CPU_CP15_MMU=y
103 168
104# 169#
105# Processor Features 170# Processor Features
106# 171#
172# CONFIG_CPU_DCACHE_DISABLE is not set
173# CONFIG_OUTER_CACHE is not set
107CONFIG_TIMER_ACORN=y 174CONFIG_TIMER_ACORN=y
108 175
109# 176#
110# Bus support 177# Bus support
111# 178#
179CONFIG_ISA_DMA_API=y
180# CONFIG_PCI_SYSCALL is not set
181# CONFIG_ARCH_SUPPORTS_MSI is not set
112 182
113# 183#
114# PCCARD (PCMCIA/CardBus) support 184# PCCARD (PCMCIA/CardBus) support
@@ -116,13 +186,26 @@ CONFIG_TIMER_ACORN=y
116# CONFIG_PCCARD is not set 186# CONFIG_PCCARD is not set
117 187
118# 188#
119# PC-card bridges
120#
121
122#
123# Kernel Features 189# Kernel Features
124# 190#
191# CONFIG_TICK_ONESHOT is not set
125# CONFIG_PREEMPT is not set 192# CONFIG_PREEMPT is not set
193# CONFIG_NO_IDLE_HZ is not set
194CONFIG_HZ=100
195# CONFIG_AEABI is not set
196# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
197CONFIG_SELECT_MEMORY_MODEL=y
198CONFIG_FLATMEM_MANUAL=y
199# CONFIG_DISCONTIGMEM_MANUAL is not set
200# CONFIG_SPARSEMEM_MANUAL is not set
201CONFIG_FLATMEM=y
202CONFIG_FLAT_NODE_MEM_MAP=y
203# CONFIG_SPARSEMEM_STATIC is not set
204CONFIG_SPLIT_PTLOCK_CPUS=4096
205# CONFIG_RESOURCES_64BIT is not set
206CONFIG_ZONE_DMA_FLAG=1
207CONFIG_BOUNCE=y
208CONFIG_VIRT_TO_BUS=y
126CONFIG_ALIGNMENT_TRAP=y 209CONFIG_ALIGNMENT_TRAP=y
127 210
128# 211#
@@ -132,6 +215,7 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
132CONFIG_ZBOOT_ROM_BSS=0x0 215CONFIG_ZBOOT_ROM_BSS=0x0
133CONFIG_CMDLINE="" 216CONFIG_CMDLINE=""
134# CONFIG_XIP_KERNEL is not set 217# CONFIG_XIP_KERNEL is not set
218# CONFIG_KEXEC is not set
135 219
136# 220#
137# Floating point emulation 221# Floating point emulation
@@ -157,41 +241,122 @@ CONFIG_BINFMT_AOUT=y
157# CONFIG_PM is not set 241# CONFIG_PM is not set
158 242
159# 243#
160# Device Drivers 244# Networking
161# 245#
246CONFIG_NET=y
162 247
163# 248#
164# Generic Driver Options 249# Networking options
165# 250#
166CONFIG_STANDALONE=y 251CONFIG_PACKET=y
167CONFIG_PREVENT_FIRMWARE_BUILD=y 252CONFIG_PACKET_MMAP=y
168# CONFIG_FW_LOADER is not set 253CONFIG_UNIX=y
169# CONFIG_DEBUG_DRIVER is not set 254# CONFIG_NET_KEY is not set
255CONFIG_INET=y
256CONFIG_IP_MULTICAST=y
257# CONFIG_IP_ADVANCED_ROUTER is not set
258CONFIG_IP_FIB_HASH=y
259# CONFIG_IP_PNP is not set
260# CONFIG_NET_IPIP is not set
261# CONFIG_NET_IPGRE is not set
262# CONFIG_IP_MROUTE is not set
263# CONFIG_ARPD is not set
264# CONFIG_SYN_COOKIES is not set
265# CONFIG_INET_AH is not set
266# CONFIG_INET_ESP is not set
267# CONFIG_INET_IPCOMP is not set
268# CONFIG_INET_XFRM_TUNNEL is not set
269CONFIG_INET_TUNNEL=m
270# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
271# CONFIG_INET_XFRM_MODE_TUNNEL is not set
272# CONFIG_INET_XFRM_MODE_BEET is not set
273CONFIG_INET_DIAG=y
274CONFIG_INET_TCP_DIAG=y
275# CONFIG_TCP_CONG_ADVANCED is not set
276CONFIG_TCP_CONG_CUBIC=y
277CONFIG_DEFAULT_TCP_CONG="cubic"
278# CONFIG_TCP_MD5SIG is not set
279CONFIG_IPV6=m
280# CONFIG_IPV6_PRIVACY is not set
281# CONFIG_IPV6_ROUTER_PREF is not set
282# CONFIG_IPV6_OPTIMISTIC_DAD is not set
283# CONFIG_INET6_AH is not set
284# CONFIG_INET6_ESP is not set
285# CONFIG_INET6_IPCOMP is not set
286# CONFIG_IPV6_MIP6 is not set
287# CONFIG_INET6_XFRM_TUNNEL is not set
288# CONFIG_INET6_TUNNEL is not set
289# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
290# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
291# CONFIG_INET6_XFRM_MODE_BEET is not set
292# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
293CONFIG_IPV6_SIT=m
294# CONFIG_IPV6_TUNNEL is not set
295# CONFIG_IPV6_MULTIPLE_TABLES is not set
296# CONFIG_NETWORK_SECMARK is not set
297# CONFIG_NETFILTER is not set
298# CONFIG_IP_DCCP is not set
299# CONFIG_IP_SCTP is not set
300# CONFIG_TIPC is not set
301# CONFIG_ATM is not set
302# CONFIG_BRIDGE is not set
303# CONFIG_VLAN_8021Q is not set
304# CONFIG_DECNET is not set
305# CONFIG_LLC2 is not set
306# CONFIG_IPX is not set
307# CONFIG_ATALK is not set
308# CONFIG_X25 is not set
309# CONFIG_LAPB is not set
310# CONFIG_ECONET is not set
311# CONFIG_WAN_ROUTER is not set
170 312
171# 313#
172# Memory Technology Devices (MTD) 314# QoS and/or fair queueing
173# 315#
174# CONFIG_MTD is not set 316# CONFIG_NET_SCHED is not set
175 317
176# 318#
177# Parallel port support 319# Network testing
178# 320#
179CONFIG_PARPORT=y 321# CONFIG_NET_PKTGEN is not set
180CONFIG_PARPORT_PC=y 322# CONFIG_HAMRADIO is not set
181CONFIG_PARPORT_PC_CML1=y 323# CONFIG_IRDA is not set
182CONFIG_PARPORT_PC_FIFO=y 324# CONFIG_BT is not set
183# CONFIG_PARPORT_PC_SUPERIO is not set 325# CONFIG_AF_RXRPC is not set
184# CONFIG_PARPORT_ARC is not set 326
185# CONFIG_PARPORT_OTHER is not set 327#
186# CONFIG_PARPORT_1284 is not set 328# Wireless
329#
330# CONFIG_CFG80211 is not set
331# CONFIG_WIRELESS_EXT is not set
332# CONFIG_MAC80211 is not set
333# CONFIG_IEEE80211 is not set
334# CONFIG_RFKILL is not set
335# CONFIG_NET_9P is not set
187 336
188# 337#
189# Plug and Play support 338# Device Drivers
190# 339#
191 340
192# 341#
193# Block devices 342# Generic Driver Options
194# 343#
344CONFIG_STANDALONE=y
345CONFIG_PREVENT_FIRMWARE_BUILD=y
346# CONFIG_FW_LOADER is not set
347# CONFIG_DEBUG_DRIVER is not set
348# CONFIG_DEBUG_DEVRES is not set
349# CONFIG_SYS_HYPERVISOR is not set
350# CONFIG_CONNECTOR is not set
351# CONFIG_MTD is not set
352CONFIG_PARPORT=y
353CONFIG_PARPORT_PC=y
354CONFIG_PARPORT_PC_FIFO=y
355# CONFIG_PARPORT_PC_SUPERIO is not set
356# CONFIG_PARPORT_GSC is not set
357# CONFIG_PARPORT_AX88796 is not set
358# CONFIG_PARPORT_1284 is not set
359CONFIG_BLK_DEV=y
195CONFIG_BLK_DEV_FD=y 360CONFIG_BLK_DEV_FD=y
196# CONFIG_PARIDE is not set 361# CONFIG_PARIDE is not set
197# CONFIG_BLK_DEV_COW_COMMON is not set 362# CONFIG_BLK_DEV_COW_COMMON is not set
@@ -201,59 +366,19 @@ CONFIG_BLK_DEV_LOOP=m
201CONFIG_BLK_DEV_RAM=y 366CONFIG_BLK_DEV_RAM=y
202CONFIG_BLK_DEV_RAM_COUNT=16 367CONFIG_BLK_DEV_RAM_COUNT=16
203CONFIG_BLK_DEV_RAM_SIZE=4096 368CONFIG_BLK_DEV_RAM_SIZE=4096
204CONFIG_BLK_DEV_INITRD=y 369CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
205CONFIG_INITRAMFS_SOURCE=""
206# CONFIG_CDROM_PKTCDVD is not set 370# CONFIG_CDROM_PKTCDVD is not set
207
208#
209# IO Schedulers
210#
211CONFIG_IOSCHED_NOOP=y
212CONFIG_IOSCHED_AS=y
213CONFIG_IOSCHED_DEADLINE=y
214CONFIG_IOSCHED_CFQ=y
215# CONFIG_ATA_OVER_ETH is not set 371# CONFIG_ATA_OVER_ETH is not set
216 372# CONFIG_IDE is not set
217#
218# Acorn-specific block devices
219#
220
221#
222# ATA/ATAPI/MFM/RLL support
223#
224CONFIG_IDE=y
225CONFIG_BLK_DEV_IDE=y
226
227#
228# Please see Documentation/ide.txt for help/info on IDE drives
229#
230# CONFIG_BLK_DEV_IDE_SATA is not set
231CONFIG_BLK_DEV_IDEDISK=y
232CONFIG_IDEDISK_MULTI_MODE=y
233CONFIG_BLK_DEV_IDECD=y
234# CONFIG_BLK_DEV_IDETAPE is not set
235# CONFIG_BLK_DEV_IDEFLOPPY is not set
236# CONFIG_BLK_DEV_IDESCSI is not set
237# CONFIG_IDE_TASK_IOCTL is not set
238
239#
240# IDE chipset support/bugfixes
241#
242CONFIG_IDE_GENERIC=y
243CONFIG_IDE_ARM=y
244CONFIG_BLK_DEV_IDE_ICSIDE=y
245CONFIG_BLK_DEV_IDEDMA_ICS=y
246CONFIG_IDEDMA_ICS_AUTO=y
247CONFIG_BLK_DEV_IDE_RAPIDE=y
248CONFIG_BLK_DEV_IDEDMA=y
249# CONFIG_IDEDMA_IVB is not set
250CONFIG_IDEDMA_AUTO=y
251# CONFIG_BLK_DEV_HD is not set
252 373
253# 374#
254# SCSI device support 375# SCSI device support
255# 376#
377# CONFIG_RAID_ATTRS is not set
256CONFIG_SCSI=y 378CONFIG_SCSI=y
379CONFIG_SCSI_DMA=y
380# CONFIG_SCSI_TGT is not set
381# CONFIG_SCSI_NETLINK is not set
257CONFIG_SCSI_PROC_FS=y 382CONFIG_SCSI_PROC_FS=y
258 383
259# 384#
@@ -265,6 +390,7 @@ CONFIG_CHR_DEV_ST=m
265CONFIG_BLK_DEV_SR=y 390CONFIG_BLK_DEV_SR=y
266CONFIG_BLK_DEV_SR_VENDOR=y 391CONFIG_BLK_DEV_SR_VENDOR=y
267CONFIG_CHR_DEV_SG=y 392CONFIG_CHR_DEV_SG=y
393# CONFIG_CHR_DEV_SCH is not set
268 394
269# 395#
270# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 396# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -272,26 +398,23 @@ CONFIG_CHR_DEV_SG=y
272# CONFIG_SCSI_MULTI_LUN is not set 398# CONFIG_SCSI_MULTI_LUN is not set
273CONFIG_SCSI_CONSTANTS=y 399CONFIG_SCSI_CONSTANTS=y
274CONFIG_SCSI_LOGGING=y 400CONFIG_SCSI_LOGGING=y
401# CONFIG_SCSI_SCAN_ASYNC is not set
402CONFIG_SCSI_WAIT_SCAN=m
275 403
276# 404#
277# SCSI Transport Attributes 405# SCSI Transports
278# 406#
279# CONFIG_SCSI_SPI_ATTRS is not set 407CONFIG_SCSI_SPI_ATTRS=m
280# CONFIG_SCSI_FC_ATTRS is not set 408# CONFIG_SCSI_FC_ATTRS is not set
281# CONFIG_SCSI_ISCSI_ATTRS is not set 409# CONFIG_SCSI_ISCSI_ATTRS is not set
282 410# CONFIG_SCSI_SAS_LIBSAS is not set
283# 411CONFIG_SCSI_LOWLEVEL=y
284# SCSI low-level drivers 412# CONFIG_ISCSI_TCP is not set
285# 413# CONFIG_SCSI_PPA is not set
286# CONFIG_SCSI_SATA is not set 414# CONFIG_SCSI_IMM is not set
287CONFIG_SCSI_PPA=m
288CONFIG_SCSI_IMM=m
289# CONFIG_SCSI_IZIP_EPP16 is not set 415# CONFIG_SCSI_IZIP_EPP16 is not set
290# CONFIG_SCSI_IZIP_SLOW_CTR is not set 416# CONFIG_SCSI_IZIP_SLOW_CTR is not set
291# CONFIG_SCSI_DEBUG is not set 417# CONFIG_SCSI_DEBUG is not set
292CONFIG_SCSI_ACORNSCSI_3=m
293CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE=y
294CONFIG_SCSI_ACORNSCSI_SYNC=y
295CONFIG_SCSI_ARXESCSI=m 418CONFIG_SCSI_ARXESCSI=m
296CONFIG_SCSI_CUMANA_2=m 419CONFIG_SCSI_CUMANA_2=m
297CONFIG_SCSI_EESOXSCSI=m 420CONFIG_SCSI_EESOXSCSI=m
@@ -302,129 +425,36 @@ CONFIG_SCSI_POWERTECSCSI=y
302# 425#
303CONFIG_SCSI_CUMANA_1=m 426CONFIG_SCSI_CUMANA_1=m
304CONFIG_SCSI_OAK1=m 427CONFIG_SCSI_OAK1=m
305 428CONFIG_ATA=y
306# 429# CONFIG_ATA_NONSTANDARD is not set
307# Multi-device support (RAID and LVM) 430CONFIG_PATA_PLATFORM=y
308# 431CONFIG_PATA_ICSIDE=y
309# CONFIG_MD is not set 432# CONFIG_MD is not set
310
311#
312# Fusion MPT device support
313#
314
315#
316# IEEE 1394 (FireWire) support
317#
318
319#
320# I2O device support
321#
322
323#
324# Networking support
325#
326CONFIG_NET=y
327
328#
329# Networking options
330#
331# CONFIG_PACKET is not set
332CONFIG_NETLINK_DEV=y
333CONFIG_UNIX=y
334# CONFIG_NET_KEY is not set
335CONFIG_INET=y
336CONFIG_IP_MULTICAST=y
337# CONFIG_IP_ADVANCED_ROUTER is not set
338# CONFIG_IP_PNP is not set
339# CONFIG_NET_IPIP is not set
340# CONFIG_NET_IPGRE is not set
341# CONFIG_IP_MROUTE is not set
342# CONFIG_ARPD is not set
343# CONFIG_SYN_COOKIES is not set
344# CONFIG_INET_AH is not set
345# CONFIG_INET_ESP is not set
346# CONFIG_INET_IPCOMP is not set
347# CONFIG_INET_TUNNEL is not set
348# CONFIG_IP_TCPDIAG is not set
349# CONFIG_IP_TCPDIAG_IPV6 is not set
350CONFIG_IPV6=m
351# CONFIG_IPV6_PRIVACY is not set
352# CONFIG_INET6_AH is not set
353# CONFIG_INET6_ESP is not set
354# CONFIG_INET6_IPCOMP is not set
355# CONFIG_INET6_TUNNEL is not set
356# CONFIG_IPV6_TUNNEL is not set
357# CONFIG_NETFILTER is not set
358
359#
360# SCTP Configuration (EXPERIMENTAL)
361#
362# CONFIG_IP_SCTP is not set
363# CONFIG_ATM is not set
364# CONFIG_BRIDGE is not set
365# CONFIG_VLAN_8021Q is not set
366# CONFIG_DECNET is not set
367# CONFIG_LLC2 is not set
368# CONFIG_IPX is not set
369# CONFIG_ATALK is not set
370# CONFIG_X25 is not set
371# CONFIG_LAPB is not set
372# CONFIG_NET_DIVERT is not set
373# CONFIG_ECONET is not set
374# CONFIG_WAN_ROUTER is not set
375
376#
377# QoS and/or fair queueing
378#
379# CONFIG_NET_SCHED is not set
380# CONFIG_NET_CLS_ROUTE is not set
381
382#
383# Network testing
384#
385# CONFIG_NET_PKTGEN is not set
386# CONFIG_NETPOLL is not set
387# CONFIG_NET_POLL_CONTROLLER is not set
388# CONFIG_HAMRADIO is not set
389# CONFIG_IRDA is not set
390# CONFIG_BT is not set
391CONFIG_NETDEVICES=y 433CONFIG_NETDEVICES=y
434# CONFIG_NETDEVICES_MULTIQUEUE is not set
392# CONFIG_DUMMY is not set 435# CONFIG_DUMMY is not set
393# CONFIG_BONDING is not set 436# CONFIG_BONDING is not set
437# CONFIG_MACVLAN is not set
394# CONFIG_EQUALIZER is not set 438# CONFIG_EQUALIZER is not set
395# CONFIG_TUN is not set 439# CONFIG_TUN is not set
396# CONFIG_ETHERTAP is not set 440# CONFIG_PHYLIB is not set
397
398#
399# Ethernet (10 or 100Mbit)
400#
401CONFIG_NET_ETHERNET=y 441CONFIG_NET_ETHERNET=y
402# CONFIG_MII is not set 442# CONFIG_MII is not set
403CONFIG_ARM_ETHER1=y 443CONFIG_ARM_ETHER1=y
404CONFIG_ARM_ETHER3=y 444CONFIG_ARM_ETHER3=y
405CONFIG_ARM_ETHERH=y 445CONFIG_ARM_ETHERH=y
446# CONFIG_AX88796 is not set
406# CONFIG_SMC91X is not set 447# CONFIG_SMC91X is not set
448# CONFIG_DM9000 is not set
449# CONFIG_NET_POCKET is not set
450# CONFIG_NETDEV_1000 is not set
451# CONFIG_NETDEV_10000 is not set
407 452
408# 453#
409# Ethernet (1000 Mbit) 454# Wireless LAN
410#
411
412#
413# Ethernet (10000 Mbit)
414#
415
416#
417# Token Ring devices
418#
419
420#
421# Wireless LAN (non-hamradio)
422#
423# CONFIG_NET_RADIO is not set
424
425#
426# Wan interfaces
427# 455#
456# CONFIG_WLAN_PRE80211 is not set
457# CONFIG_WLAN_80211 is not set
428# CONFIG_WAN is not set 458# CONFIG_WAN is not set
429# CONFIG_PLIP is not set 459# CONFIG_PLIP is not set
430CONFIG_PPP=m 460CONFIG_PPP=m
@@ -434,20 +464,23 @@ CONFIG_PPP=m
434# CONFIG_PPP_SYNC_TTY is not set 464# CONFIG_PPP_SYNC_TTY is not set
435# CONFIG_PPP_DEFLATE is not set 465# CONFIG_PPP_DEFLATE is not set
436# CONFIG_PPP_BSDCOMP is not set 466# CONFIG_PPP_BSDCOMP is not set
467# CONFIG_PPP_MPPE is not set
437CONFIG_PPPOE=m 468CONFIG_PPPOE=m
469# CONFIG_PPPOL2TP is not set
438# CONFIG_SLIP is not set 470# CONFIG_SLIP is not set
471CONFIG_SLHC=m
439# CONFIG_SHAPER is not set 472# CONFIG_SHAPER is not set
440# CONFIG_NETCONSOLE is not set 473# CONFIG_NETCONSOLE is not set
441 474# CONFIG_NETPOLL is not set
442# 475# CONFIG_NET_POLL_CONTROLLER is not set
443# ISDN subsystem
444#
445# CONFIG_ISDN is not set 476# CONFIG_ISDN is not set
446 477
447# 478#
448# Input device support 479# Input device support
449# 480#
450CONFIG_INPUT=y 481CONFIG_INPUT=y
482# CONFIG_INPUT_FF_MEMLESS is not set
483# CONFIG_INPUT_POLLDEV is not set
451 484
452# 485#
453# Userland interfaces 486# Userland interfaces
@@ -462,19 +495,6 @@ CONFIG_INPUT_EVDEV=y
462# CONFIG_INPUT_EVBUG is not set 495# CONFIG_INPUT_EVBUG is not set
463 496
464# 497#
465# Input I/O drivers
466#
467# CONFIG_GAMEPORT is not set
468CONFIG_SOUND_GAMEPORT=y
469CONFIG_SERIO=y
470# CONFIG_SERIO_SERPORT is not set
471# CONFIG_SERIO_CT82C710 is not set
472# CONFIG_SERIO_PARKBD is not set
473CONFIG_SERIO_RPCKBD=y
474CONFIG_SERIO_LIBPS2=y
475# CONFIG_SERIO_RAW is not set
476
477#
478# Input Device Drivers 498# Input Device Drivers
479# 499#
480CONFIG_INPUT_KEYBOARD=y 500CONFIG_INPUT_KEYBOARD=y
@@ -483,21 +503,35 @@ CONFIG_KEYBOARD_ATKBD=y
483# CONFIG_KEYBOARD_LKKBD is not set 503# CONFIG_KEYBOARD_LKKBD is not set
484# CONFIG_KEYBOARD_XTKBD is not set 504# CONFIG_KEYBOARD_XTKBD is not set
485# CONFIG_KEYBOARD_NEWTON is not set 505# CONFIG_KEYBOARD_NEWTON is not set
506# CONFIG_KEYBOARD_STOWAWAY is not set
486CONFIG_INPUT_MOUSE=y 507CONFIG_INPUT_MOUSE=y
487# CONFIG_MOUSE_PS2 is not set 508# CONFIG_MOUSE_PS2 is not set
488# CONFIG_MOUSE_SERIAL is not set 509# CONFIG_MOUSE_SERIAL is not set
489CONFIG_MOUSE_RISCPC=y 510CONFIG_MOUSE_RISCPC=y
490# CONFIG_MOUSE_VSXXXAA is not set 511# CONFIG_MOUSE_VSXXXAA is not set
491# CONFIG_INPUT_JOYSTICK is not set 512# CONFIG_INPUT_JOYSTICK is not set
513# CONFIG_INPUT_TABLET is not set
492# CONFIG_INPUT_TOUCHSCREEN is not set 514# CONFIG_INPUT_TOUCHSCREEN is not set
493# CONFIG_INPUT_MISC is not set 515# CONFIG_INPUT_MISC is not set
494 516
495# 517#
518# Hardware I/O ports
519#
520CONFIG_SERIO=y
521# CONFIG_SERIO_SERPORT is not set
522# CONFIG_SERIO_PARKBD is not set
523CONFIG_SERIO_RPCKBD=y
524CONFIG_SERIO_LIBPS2=y
525# CONFIG_SERIO_RAW is not set
526# CONFIG_GAMEPORT is not set
527
528#
496# Character devices 529# Character devices
497# 530#
498CONFIG_VT=y 531CONFIG_VT=y
499CONFIG_VT_CONSOLE=y 532CONFIG_VT_CONSOLE=y
500CONFIG_HW_CONSOLE=y 533CONFIG_HW_CONSOLE=y
534# CONFIG_VT_HW_CONSOLE_BINDING is not set
501# CONFIG_SERIAL_NONSTANDARD is not set 535# CONFIG_SERIAL_NONSTANDARD is not set
502 536
503# 537#
@@ -506,12 +540,13 @@ CONFIG_HW_CONSOLE=y
506CONFIG_SERIAL_8250=y 540CONFIG_SERIAL_8250=y
507CONFIG_SERIAL_8250_CONSOLE=y 541CONFIG_SERIAL_8250_CONSOLE=y
508CONFIG_SERIAL_8250_NR_UARTS=16 542CONFIG_SERIAL_8250_NR_UARTS=16
543CONFIG_SERIAL_8250_RUNTIME_UARTS=8
509# CONFIG_SERIAL_8250_EXTENDED is not set 544# CONFIG_SERIAL_8250_EXTENDED is not set
545CONFIG_SERIAL_8250_ACORN=y
510 546
511# 547#
512# Non-8250 serial port support 548# Non-8250 serial port support
513# 549#
514CONFIG_SERIAL_8250_ACORN=y
515CONFIG_SERIAL_CORE=y 550CONFIG_SERIAL_CORE=y
516CONFIG_SERIAL_CORE_CONSOLE=y 551CONFIG_SERIAL_CORE_CONSOLE=y
517CONFIG_UNIX98_PTYS=y 552CONFIG_UNIX98_PTYS=y
@@ -521,31 +556,15 @@ CONFIG_PRINTER=m
521# CONFIG_LP_CONSOLE is not set 556# CONFIG_LP_CONSOLE is not set
522# CONFIG_PPDEV is not set 557# CONFIG_PPDEV is not set
523# CONFIG_TIPAR is not set 558# CONFIG_TIPAR is not set
524
525#
526# IPMI
527#
528# CONFIG_IPMI_HANDLER is not set 559# CONFIG_IPMI_HANDLER is not set
529
530#
531# Watchdog Cards
532#
533# CONFIG_WATCHDOG is not set 560# CONFIG_WATCHDOG is not set
561# CONFIG_HW_RANDOM is not set
534# CONFIG_NVRAM is not set 562# CONFIG_NVRAM is not set
535# CONFIG_RTC is not set
536# CONFIG_DTLK is not set
537# CONFIG_R3964 is not set 563# CONFIG_R3964 is not set
538
539#
540# Ftape, the floppy tape device driver
541#
542# CONFIG_DRM is not set
543# CONFIG_RAW_DRIVER is not set 564# CONFIG_RAW_DRIVER is not set
544 565# CONFIG_TCG_TPM is not set
545#
546# I2C support
547#
548CONFIG_I2C=y 566CONFIG_I2C=y
567CONFIG_I2C_BOARDINFO=y
549CONFIG_I2C_CHARDEV=y 568CONFIG_I2C_CHARDEV=y
550 569
551# 570#
@@ -558,76 +577,87 @@ CONFIG_I2C_ALGOBIT=y
558# 577#
559# I2C Hardware Bus support 578# I2C Hardware Bus support
560# 579#
580# CONFIG_I2C_OCORES is not set
561# CONFIG_I2C_PARPORT is not set 581# CONFIG_I2C_PARPORT is not set
562# CONFIG_I2C_PARPORT_LIGHT is not set 582# CONFIG_I2C_PARPORT_LIGHT is not set
583# CONFIG_I2C_SIMTEC is not set
584# CONFIG_I2C_TAOS_EVM is not set
563# CONFIG_I2C_STUB is not set 585# CONFIG_I2C_STUB is not set
564# CONFIG_I2C_PCA_ISA is not set 586CONFIG_I2C_ACORN=y
565 587
566# 588#
567# Hardware Sensors Chip support 589# Miscellaneous I2C Chip support
568#
569# CONFIG_I2C_SENSOR is not set
570# CONFIG_SENSORS_ADM1021 is not set
571# CONFIG_SENSORS_ADM1025 is not set
572# CONFIG_SENSORS_ADM1026 is not set
573# CONFIG_SENSORS_ADM1031 is not set
574# CONFIG_SENSORS_ASB100 is not set
575# CONFIG_SENSORS_DS1621 is not set
576# CONFIG_SENSORS_FSCHER is not set
577# CONFIG_SENSORS_FSCPOS is not set
578# CONFIG_SENSORS_GL518SM is not set
579# CONFIG_SENSORS_GL520SM is not set
580# CONFIG_SENSORS_IT87 is not set
581# CONFIG_SENSORS_LM63 is not set
582# CONFIG_SENSORS_LM75 is not set
583# CONFIG_SENSORS_LM77 is not set
584# CONFIG_SENSORS_LM78 is not set
585# CONFIG_SENSORS_LM80 is not set
586# CONFIG_SENSORS_LM83 is not set
587# CONFIG_SENSORS_LM85 is not set
588# CONFIG_SENSORS_LM87 is not set
589# CONFIG_SENSORS_LM90 is not set
590# CONFIG_SENSORS_MAX1619 is not set
591# CONFIG_SENSORS_PC87360 is not set
592# CONFIG_SENSORS_SMSC47B397 is not set
593# CONFIG_SENSORS_SMSC47M1 is not set
594# CONFIG_SENSORS_W83781D is not set
595# CONFIG_SENSORS_W83L785TS is not set
596# CONFIG_SENSORS_W83627HF is not set
597
598#
599# Other I2C Chip support
600# 590#
591# CONFIG_SENSORS_DS1337 is not set
592# CONFIG_SENSORS_DS1374 is not set
593# CONFIG_DS1682 is not set
601# CONFIG_SENSORS_EEPROM is not set 594# CONFIG_SENSORS_EEPROM is not set
602# CONFIG_SENSORS_PCF8574 is not set 595# CONFIG_SENSORS_PCF8574 is not set
596# CONFIG_SENSORS_PCA9539 is not set
603# CONFIG_SENSORS_PCF8591 is not set 597# CONFIG_SENSORS_PCF8591 is not set
604# CONFIG_SENSORS_RTC8564 is not set 598# CONFIG_SENSORS_MAX6875 is not set
599# CONFIG_SENSORS_TSL2550 is not set
605# CONFIG_I2C_DEBUG_CORE is not set 600# CONFIG_I2C_DEBUG_CORE is not set
606# CONFIG_I2C_DEBUG_ALGO is not set 601# CONFIG_I2C_DEBUG_ALGO is not set
607# CONFIG_I2C_DEBUG_BUS is not set 602# CONFIG_I2C_DEBUG_BUS is not set
608# CONFIG_I2C_DEBUG_CHIP is not set 603# CONFIG_I2C_DEBUG_CHIP is not set
609 604
610# 605#
611# Misc devices 606# SPI support
612# 607#
608# CONFIG_SPI is not set
609# CONFIG_SPI_MASTER is not set
610# CONFIG_W1 is not set
611# CONFIG_HWMON is not set
612CONFIG_MISC_DEVICES=y
613# CONFIG_EEPROM_93CX6 is not set
614
615#
616# Multifunction device drivers
617#
618# CONFIG_MFD_SM501 is not set
619# CONFIG_NEW_LEDS is not set
613 620
614# 621#
615# Multimedia devices 622# Multimedia devices
616# 623#
617# CONFIG_VIDEO_DEV is not set 624# CONFIG_VIDEO_DEV is not set
625# CONFIG_DVB_CORE is not set
626# CONFIG_DAB is not set
618 627
619# 628#
620# Digital Video Broadcasting Devices 629# Graphics support
621# 630#
622# CONFIG_DVB is not set 631# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
623 632
624# 633#
625# Graphics support 634# Display device support
626# 635#
636# CONFIG_DISPLAY_SUPPORT is not set
637# CONFIG_VGASTATE is not set
638# CONFIG_VIDEO_OUTPUT_CONTROL is not set
627CONFIG_FB=y 639CONFIG_FB=y
640# CONFIG_FIRMWARE_EDID is not set
641# CONFIG_FB_DDC is not set
642CONFIG_FB_CFB_FILLRECT=y
643CONFIG_FB_CFB_COPYAREA=y
644CONFIG_FB_CFB_IMAGEBLIT=y
645# CONFIG_FB_SYS_FILLRECT is not set
646# CONFIG_FB_SYS_COPYAREA is not set
647# CONFIG_FB_SYS_IMAGEBLIT is not set
648# CONFIG_FB_SYS_FOPS is not set
649CONFIG_FB_DEFERRED_IO=y
650# CONFIG_FB_SVGALIB is not set
651# CONFIG_FB_MACMODES is not set
652# CONFIG_FB_BACKLIGHT is not set
628# CONFIG_FB_MODE_HELPERS is not set 653# CONFIG_FB_MODE_HELPERS is not set
629# CONFIG_FB_TILEBLITTING is not set 654# CONFIG_FB_TILEBLITTING is not set
655
656#
657# Frame buffer hardware drivers
658#
630CONFIG_FB_ACORN=y 659CONFIG_FB_ACORN=y
660# CONFIG_FB_S1D13XXX is not set
631# CONFIG_FB_VIRTUAL is not set 661# CONFIG_FB_VIRTUAL is not set
632 662
633# 663#
@@ -635,24 +665,23 @@ CONFIG_FB_ACORN=y
635# 665#
636CONFIG_DUMMY_CONSOLE=y 666CONFIG_DUMMY_CONSOLE=y
637CONFIG_FRAMEBUFFER_CONSOLE=y 667CONFIG_FRAMEBUFFER_CONSOLE=y
668# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
669# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
638CONFIG_FONTS=y 670CONFIG_FONTS=y
639# CONFIG_FONT_8x8 is not set 671# CONFIG_FONT_8x8 is not set
640CONFIG_FONT_8x16=y 672CONFIG_FONT_8x16=y
641# CONFIG_FONT_6x11 is not set 673# CONFIG_FONT_6x11 is not set
674# CONFIG_FONT_7x14 is not set
642# CONFIG_FONT_PEARL_8x8 is not set 675# CONFIG_FONT_PEARL_8x8 is not set
643CONFIG_FONT_ACORN_8x8=y 676CONFIG_FONT_ACORN_8x8=y
644# CONFIG_FONT_MINI_4x6 is not set 677# CONFIG_FONT_MINI_4x6 is not set
645# CONFIG_FONT_SUN8x16 is not set 678# CONFIG_FONT_SUN8x16 is not set
646# CONFIG_FONT_SUN12x22 is not set 679# CONFIG_FONT_SUN12x22 is not set
647 680# CONFIG_FONT_10x18 is not set
648#
649# Logo configuration
650#
651CONFIG_LOGO=y 681CONFIG_LOGO=y
652CONFIG_LOGO_LINUX_MONO=y 682CONFIG_LOGO_LINUX_MONO=y
653CONFIG_LOGO_LINUX_VGA16=y 683CONFIG_LOGO_LINUX_VGA16=y
654CONFIG_LOGO_LINUX_CLUT224=y 684CONFIG_LOGO_LINUX_CLUT224=y
655# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
656 685
657# 686#
658# Sound 687# Sound
@@ -668,91 +697,115 @@ CONFIG_SOUND=m
668# Open Sound System 697# Open Sound System
669# 698#
670CONFIG_SOUND_PRIME=m 699CONFIG_SOUND_PRIME=m
671# CONFIG_SOUND_BT878 is not set
672# CONFIG_SOUND_FUSION is not set
673# CONFIG_SOUND_CS4281 is not set
674# CONFIG_SOUND_SONICVIBES is not set
675# CONFIG_SOUND_TRIDENT is not set
676# CONFIG_SOUND_MSNDCLAS is not set 700# CONFIG_SOUND_MSNDCLAS is not set
677# CONFIG_SOUND_MSNDPIN is not set 701# CONFIG_SOUND_MSNDPIN is not set
678CONFIG_SOUND_OSS=m 702CONFIG_SOUND_OSS=m
679# CONFIG_SOUND_TRACEINIT is not set 703# CONFIG_SOUND_TRACEINIT is not set
680# CONFIG_SOUND_DMAP is not set 704# CONFIG_SOUND_DMAP is not set
681# CONFIG_SOUND_AD1816 is not set
682# CONFIG_SOUND_AD1889 is not set
683# CONFIG_SOUND_SGALAXY is not set
684# CONFIG_SOUND_ADLIB is not set
685# CONFIG_SOUND_ACI_MIXER is not set
686# CONFIG_SOUND_CS4232 is not set
687# CONFIG_SOUND_SSCAPE is not set 705# CONFIG_SOUND_SSCAPE is not set
688# CONFIG_SOUND_GUS is not set
689# CONFIG_SOUND_VMIDI is not set 706# CONFIG_SOUND_VMIDI is not set
690# CONFIG_SOUND_TRIX is not set 707# CONFIG_SOUND_TRIX is not set
691# CONFIG_SOUND_MSS is not set 708# CONFIG_SOUND_MSS is not set
692# CONFIG_SOUND_MPU401 is not set 709# CONFIG_SOUND_MPU401 is not set
693# CONFIG_SOUND_NM256 is not set
694# CONFIG_SOUND_MAD16 is not set
695# CONFIG_SOUND_PAS is not set 710# CONFIG_SOUND_PAS is not set
696# CONFIG_SOUND_PSS is not set 711# CONFIG_SOUND_PSS is not set
697# CONFIG_SOUND_SB is not set 712# CONFIG_SOUND_SB is not set
698# CONFIG_SOUND_AWE32_SYNTH is not set
699# CONFIG_SOUND_WAVEFRONT is not set
700# CONFIG_SOUND_MAUI is not set
701# CONFIG_SOUND_YM3812 is not set 713# CONFIG_SOUND_YM3812 is not set
702# CONFIG_SOUND_OPL3SA1 is not set
703# CONFIG_SOUND_OPL3SA2 is not set
704# CONFIG_SOUND_UART6850 is not set 714# CONFIG_SOUND_UART6850 is not set
705# CONFIG_SOUND_AEDSP16 is not set 715# CONFIG_SOUND_AEDSP16 is not set
706CONFIG_SOUND_VIDC=m 716CONFIG_SOUND_VIDC=m
707# CONFIG_SOUND_TVMIXER is not set 717# CONFIG_HID_SUPPORT is not set
708# CONFIG_SOUND_AD1980 is not set 718# CONFIG_USB_SUPPORT is not set
719# CONFIG_MMC is not set
720CONFIG_RTC_LIB=y
721CONFIG_RTC_CLASS=y
722CONFIG_RTC_HCTOSYS=y
723CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
724# CONFIG_RTC_DEBUG is not set
709 725
710# 726#
711# USB support 727# RTC interfaces
712# 728#
713# CONFIG_USB is not set 729CONFIG_RTC_INTF_SYSFS=y
714CONFIG_USB_ARCH_HAS_HCD=y 730CONFIG_RTC_INTF_PROC=y
715# CONFIG_USB_ARCH_HAS_OHCI is not set 731CONFIG_RTC_INTF_DEV=y
732# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
733# CONFIG_RTC_DRV_TEST is not set
716 734
717# 735#
718# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information 736# I2C RTC drivers
719# 737#
738# CONFIG_RTC_DRV_DS1307 is not set
739# CONFIG_RTC_DRV_DS1672 is not set
740# CONFIG_RTC_DRV_MAX6900 is not set
741# CONFIG_RTC_DRV_RS5C372 is not set
742# CONFIG_RTC_DRV_ISL1208 is not set
743# CONFIG_RTC_DRV_X1205 is not set
744# CONFIG_RTC_DRV_PCF8563 is not set
745CONFIG_RTC_DRV_PCF8583=y
746# CONFIG_RTC_DRV_M41T80 is not set
720 747
721# 748#
722# USB Gadget Support 749# SPI RTC drivers
723# 750#
724# CONFIG_USB_GADGET is not set
725 751
726# 752#
727# MMC/SD Card support 753# Platform RTC drivers
754#
755# CONFIG_RTC_DRV_CMOS is not set
756# CONFIG_RTC_DRV_DS1553 is not set
757# CONFIG_RTC_DRV_STK17TA8 is not set
758# CONFIG_RTC_DRV_DS1742 is not set
759# CONFIG_RTC_DRV_M48T86 is not set
760# CONFIG_RTC_DRV_M48T59 is not set
761# CONFIG_RTC_DRV_V3020 is not set
762
763#
764# on-CPU RTC drivers
765#
766
767#
768# DMA Engine support
769#
770# CONFIG_DMA_ENGINE is not set
771
772#
773# DMA Clients
774#
775
776#
777# DMA Devices
728# 778#
729# CONFIG_MMC is not set
730 779
731# 780#
732# File systems 781# File systems
733# 782#
734CONFIG_EXT2_FS=y 783CONFIG_EXT2_FS=y
735# CONFIG_EXT2_FS_XATTR is not set 784# CONFIG_EXT2_FS_XATTR is not set
785# CONFIG_EXT2_FS_XIP is not set
736CONFIG_EXT3_FS=y 786CONFIG_EXT3_FS=y
737CONFIG_EXT3_FS_XATTR=y 787CONFIG_EXT3_FS_XATTR=y
738# CONFIG_EXT3_FS_POSIX_ACL is not set 788# CONFIG_EXT3_FS_POSIX_ACL is not set
739# CONFIG_EXT3_FS_SECURITY is not set 789# CONFIG_EXT3_FS_SECURITY is not set
790# CONFIG_EXT4DEV_FS is not set
740CONFIG_JBD=y 791CONFIG_JBD=y
741# CONFIG_JBD_DEBUG is not set 792# CONFIG_JBD_DEBUG is not set
742CONFIG_FS_MBCACHE=y 793CONFIG_FS_MBCACHE=y
743# CONFIG_REISERFS_FS is not set 794# CONFIG_REISERFS_FS is not set
744# CONFIG_JFS_FS is not set 795# CONFIG_JFS_FS is not set
745 796# CONFIG_FS_POSIX_ACL is not set
746#
747# XFS support
748#
749# CONFIG_XFS_FS is not set 797# CONFIG_XFS_FS is not set
798# CONFIG_GFS2_FS is not set
799# CONFIG_OCFS2_FS is not set
750# CONFIG_MINIX_FS is not set 800# CONFIG_MINIX_FS is not set
751# CONFIG_ROMFS_FS is not set 801# CONFIG_ROMFS_FS is not set
802CONFIG_INOTIFY=y
803CONFIG_INOTIFY_USER=y
752# CONFIG_QUOTA is not set 804# CONFIG_QUOTA is not set
753CONFIG_DNOTIFY=y 805CONFIG_DNOTIFY=y
754# CONFIG_AUTOFS_FS is not set 806# CONFIG_AUTOFS_FS is not set
755CONFIG_AUTOFS4_FS=m 807CONFIG_AUTOFS4_FS=m
808# CONFIG_FUSE_FS is not set
756 809
757# 810#
758# CD-ROM/DVD Filesystems 811# CD-ROM/DVD Filesystems
@@ -776,12 +829,12 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
776# Pseudo filesystems 829# Pseudo filesystems
777# 830#
778CONFIG_PROC_FS=y 831CONFIG_PROC_FS=y
832CONFIG_PROC_SYSCTL=y
779CONFIG_SYSFS=y 833CONFIG_SYSFS=y
780# CONFIG_DEVFS_FS is not set
781# CONFIG_DEVPTS_FS_XATTR is not set
782# CONFIG_TMPFS is not set 834# CONFIG_TMPFS is not set
783# CONFIG_HUGETLB_PAGE is not set 835# CONFIG_HUGETLB_PAGE is not set
784CONFIG_RAMFS=y 836CONFIG_RAMFS=y
837# CONFIG_CONFIGFS_FS is not set
785 838
786# 839#
787# Miscellaneous filesystems 840# Miscellaneous filesystems
@@ -810,7 +863,9 @@ CONFIG_NFS_FS=y
810# CONFIG_NFS_DIRECTIO is not set 863# CONFIG_NFS_DIRECTIO is not set
811# CONFIG_NFSD is not set 864# CONFIG_NFSD is not set
812CONFIG_LOCKD=y 865CONFIG_LOCKD=y
866CONFIG_NFS_COMMON=y
813CONFIG_SUNRPC=y 867CONFIG_SUNRPC=y
868# CONFIG_SUNRPC_BIND34 is not set
814# CONFIG_RPCSEC_GSS_KRB5 is not set 869# CONFIG_RPCSEC_GSS_KRB5 is not set
815# CONFIG_RPCSEC_GSS_SPKM3 is not set 870# CONFIG_RPCSEC_GSS_SPKM3 is not set
816# CONFIG_SMB_FS is not set 871# CONFIG_SMB_FS is not set
@@ -830,20 +885,22 @@ CONFIG_ACORN_PARTITION_ICS=y
830CONFIG_ACORN_PARTITION_ADFS=y 885CONFIG_ACORN_PARTITION_ADFS=y
831CONFIG_ACORN_PARTITION_POWERTEC=y 886CONFIG_ACORN_PARTITION_POWERTEC=y
832CONFIG_ACORN_PARTITION_RISCIX=y 887CONFIG_ACORN_PARTITION_RISCIX=y
833CONFIG_OSF_PARTITION=y 888# CONFIG_OSF_PARTITION is not set
834CONFIG_AMIGA_PARTITION=y 889# CONFIG_AMIGA_PARTITION is not set
835# CONFIG_ATARI_PARTITION is not set 890# CONFIG_ATARI_PARTITION is not set
836CONFIG_MAC_PARTITION=y 891# CONFIG_MAC_PARTITION is not set
837CONFIG_MSDOS_PARTITION=y 892CONFIG_MSDOS_PARTITION=y
838CONFIG_BSD_DISKLABEL=y 893CONFIG_BSD_DISKLABEL=y
839# CONFIG_MINIX_SUBPARTITION is not set 894# CONFIG_MINIX_SUBPARTITION is not set
840CONFIG_SOLARIS_X86_PARTITION=y 895# CONFIG_SOLARIS_X86_PARTITION is not set
841# CONFIG_UNIXWARE_DISKLABEL is not set 896# CONFIG_UNIXWARE_DISKLABEL is not set
842# CONFIG_LDM_PARTITION is not set 897# CONFIG_LDM_PARTITION is not set
843CONFIG_SGI_PARTITION=y 898# CONFIG_SGI_PARTITION is not set
844# CONFIG_ULTRIX_PARTITION is not set 899# CONFIG_ULTRIX_PARTITION is not set
845CONFIG_SUN_PARTITION=y 900# CONFIG_SUN_PARTITION is not set
901# CONFIG_KARMA_PARTITION is not set
846# CONFIG_EFI_PARTITION is not set 902# CONFIG_EFI_PARTITION is not set
903# CONFIG_SYSV68_PARTITION is not set
847 904
848# 905#
849# Native Language Support 906# Native Language Support
@@ -890,6 +947,11 @@ CONFIG_NLS_KOI8_R=m
890# CONFIG_NLS_UTF8 is not set 947# CONFIG_NLS_UTF8 is not set
891 948
892# 949#
950# Distributed Lock Manager
951#
952# CONFIG_DLM is not set
953
954#
893# Profiling support 955# Profiling support
894# 956#
895# CONFIG_PROFILING is not set 957# CONFIG_PROFILING is not set
@@ -897,17 +959,37 @@ CONFIG_NLS_KOI8_R=m
897# 959#
898# Kernel hacking 960# Kernel hacking
899# 961#
900CONFIG_DEBUG_KERNEL=y
901CONFIG_MAGIC_SYSRQ=y
902# CONFIG_PRINTK_TIME is not set 962# CONFIG_PRINTK_TIME is not set
963CONFIG_ENABLE_MUST_CHECK=y
964CONFIG_MAGIC_SYSRQ=y
965# CONFIG_UNUSED_SYMBOLS is not set
966# CONFIG_DEBUG_FS is not set
967# CONFIG_HEADERS_CHECK is not set
968CONFIG_DEBUG_KERNEL=y
969# CONFIG_DEBUG_SHIRQ is not set
970CONFIG_DETECT_SOFTLOCKUP=y
971CONFIG_SCHED_DEBUG=y
903# CONFIG_SCHEDSTATS is not set 972# CONFIG_SCHEDSTATS is not set
973# CONFIG_TIMER_STATS is not set
904# CONFIG_DEBUG_SLAB is not set 974# CONFIG_DEBUG_SLAB is not set
975# CONFIG_DEBUG_RT_MUTEXES is not set
976# CONFIG_RT_MUTEX_TESTER is not set
905# CONFIG_DEBUG_SPINLOCK is not set 977# CONFIG_DEBUG_SPINLOCK is not set
978# CONFIG_DEBUG_MUTEXES is not set
979# CONFIG_DEBUG_LOCK_ALLOC is not set
980# CONFIG_PROVE_LOCKING is not set
981# CONFIG_LOCK_STAT is not set
982# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
983# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
906# CONFIG_DEBUG_KOBJECT is not set 984# CONFIG_DEBUG_KOBJECT is not set
907CONFIG_DEBUG_BUGVERBOSE=y 985CONFIG_DEBUG_BUGVERBOSE=y
908# CONFIG_DEBUG_INFO is not set 986# CONFIG_DEBUG_INFO is not set
909# CONFIG_DEBUG_FS is not set 987# CONFIG_DEBUG_VM is not set
988# CONFIG_DEBUG_LIST is not set
910CONFIG_FRAME_POINTER=y 989CONFIG_FRAME_POINTER=y
990CONFIG_FORCED_INLINING=y
991# CONFIG_RCU_TORTURE_TEST is not set
992# CONFIG_FAULT_INJECTION is not set
911CONFIG_DEBUG_USER=y 993CONFIG_DEBUG_USER=y
912CONFIG_DEBUG_ERRORS=y 994CONFIG_DEBUG_ERRORS=y
913CONFIG_DEBUG_LL=y 995CONFIG_DEBUG_LL=y
@@ -918,19 +1000,18 @@ CONFIG_DEBUG_LL=y
918# 1000#
919# CONFIG_KEYS is not set 1001# CONFIG_KEYS is not set
920# CONFIG_SECURITY is not set 1002# CONFIG_SECURITY is not set
921
922#
923# Cryptographic options
924#
925# CONFIG_CRYPTO is not set 1003# CONFIG_CRYPTO is not set
926 1004
927# 1005#
928# Hardware crypto devices
929#
930
931#
932# Library routines 1006# Library routines
933# 1007#
1008CONFIG_BITREVERSE=y
934# CONFIG_CRC_CCITT is not set 1009# CONFIG_CRC_CCITT is not set
1010# CONFIG_CRC16 is not set
1011# CONFIG_CRC_ITU_T is not set
935CONFIG_CRC32=y 1012CONFIG_CRC32=y
1013# CONFIG_CRC7 is not set
936# CONFIG_LIBCRC32C is not set 1014# CONFIG_LIBCRC32C is not set
1015CONFIG_PLIST=y
1016CONFIG_HAS_IOMEM=y
1017CONFIG_HAS_DMA=y
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 9db58da04754..3576595b4941 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -15,6 +15,8 @@
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18#include <video/atmel_lcdc.h>
19
18#include <asm/arch/board.h> 20#include <asm/arch/board.h>
19#include <asm/arch/gpio.h> 21#include <asm/arch/gpio.h>
20#include <asm/arch/at91sam9261.h> 22#include <asm/arch/at91sam9261.h>
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 635695787f91..f924bd5017de 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -14,6 +14,8 @@
14 14
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16 16
17#include <video/atmel_lcdc.h>
18
17#include <asm/arch/board.h> 19#include <asm/arch/board.h>
18#include <asm/arch/gpio.h> 20#include <asm/arch/gpio.h>
19#include <asm/arch/at91sam9263.h> 21#include <asm/arch/at91sam9263.h>
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index 2edcecdea8bd..ef801563bbf5 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -9,6 +9,7 @@
9 */ 9 */
10#include <linux/clk.h> 10#include <linux/clk.h>
11#include <linux/etherdevice.h> 11#include <linux/etherdevice.h>
12#include <linux/i2c-gpio.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/linkage.h> 14#include <linux/linkage.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -123,6 +124,19 @@ static struct platform_device ngw_gpio_leds = {
123 } 124 }
124}; 125};
125 126
127static struct i2c_gpio_platform_data i2c_gpio_data = {
128 .sda_pin = GPIO_PIN_PA(6),
129 .scl_pin = GPIO_PIN_PA(7),
130};
131
132static struct platform_device i2c_gpio_device = {
133 .name = "i2c-gpio",
134 .id = 0,
135 .dev = {
136 .platform_data = &i2c_gpio_data,
137 },
138};
139
126static int __init atngw100_init(void) 140static int __init atngw100_init(void)
127{ 141{
128 unsigned i; 142 unsigned i;
@@ -147,6 +161,10 @@ static int __init atngw100_init(void)
147 } 161 }
148 platform_device_register(&ngw_gpio_leds); 162 platform_device_register(&ngw_gpio_leds);
149 163
164 at32_select_gpio(i2c_gpio_data.sda_pin, 0);
165 at32_select_gpio(i2c_gpio_data.scl_pin, 0);
166 platform_device_register(&i2c_gpio_device);
167
150 return 0; 168 return 0;
151} 169}
152postcore_initcall(atngw100_init); 170postcore_initcall(atngw100_init);
diff --git a/arch/avr32/boards/atstk1000/Kconfig b/arch/avr32/boards/atstk1000/Kconfig
index 71bc7d364fb7..718578f64069 100644
--- a/arch/avr32/boards/atstk1000/Kconfig
+++ b/arch/avr32/boards/atstk1000/Kconfig
@@ -50,4 +50,30 @@ config BOARD_ATSTK1002_SPI1
50 GPIO lines and accessed through the J1 jumper block. Say "y" 50 GPIO lines and accessed through the J1 jumper block. Say "y"
51 here to configure that SPI controller. 51 here to configure that SPI controller.
52 52
53config BOARD_ATSTK1002_J2_LED
54 bool
55 default BOARD_ATSTK1002_J2_LED8 || BOARD_ATSTK1002_J2_RGB
56
57choice
58 prompt "LEDs connected to J2:"
59 depends on LEDS_GPIO && !BOARD_ATSTK1002_SW4_CUSTOM
60 optional
61 help
62 Select this if you have jumpered the J2 jumper block to the
63 LED0..LED7 amber leds, or to the RGB leds, using a ten-pin
64 IDC cable. A default "heartbeat" trigger is provided, but
65 you can of course override this.
66
67config BOARD_ATSTK1002_J2_LED8
68 bool "LED0..LED7"
69 help
70 Select this if J2 is jumpered to LED0..LED7 amber leds.
71
72config BOARD_ATSTK1002_J2_RGB
73 bool "RGB leds"
74 help
75 Select this if J2 is jumpered to the RGB leds.
76
77endchoice
78
53endif # stk 1002 79endif # stk 1002
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index cb93eabb9c6c..c9981b731efa 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -11,6 +11,7 @@
11#include <linux/etherdevice.h> 11#include <linux/etherdevice.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/leds.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
15#include <linux/string.h> 16#include <linux/string.h>
16#include <linux/types.h> 17#include <linux/types.h>
@@ -120,6 +121,65 @@ static void __init set_hw_addr(struct platform_device *pdev)
120 clk_put(pclk); 121 clk_put(pclk);
121} 122}
122 123
124#ifdef CONFIG_BOARD_ATSTK1002_J2_LED
125
126static struct gpio_led stk_j2_led[] = {
127#ifdef CONFIG_BOARD_ATSTK1002_J2_LED8
128#define LEDSTRING "J2 jumpered to LED8"
129 { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), },
130 { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), },
131 { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), },
132 { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), },
133 { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), },
134 { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), },
135 { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), },
136 { .name = "led7:amber", .gpio = GPIO_PIN_PB(30),
137 .default_trigger = "heartbeat", },
138#else /* RGB */
139#define LEDSTRING "J2 jumpered to RGB LEDs"
140 { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), },
141 { .name = "g1:green", .gpio = GPIO_PIN_PB(10), },
142 { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), },
143
144 { .name = "r2:red", .gpio = GPIO_PIN_PB( 9),
145 .default_trigger = "heartbeat", },
146 { .name = "g2:green", .gpio = GPIO_PIN_PB(13), },
147 { .name = "b2:blue", .gpio = GPIO_PIN_PB(15),
148 .default_trigger = "heartbeat", },
149 /* PB16, PB30 unused */
150#endif
151};
152
153static struct gpio_led_platform_data stk_j2_led_data = {
154 .num_leds = ARRAY_SIZE(stk_j2_led),
155 .leds = stk_j2_led,
156};
157
158static struct platform_device stk_j2_led_dev = {
159 .name = "leds-gpio",
160 .id = 2, /* gpio block J2 */
161 .dev = {
162 .platform_data = &stk_j2_led_data,
163 },
164};
165
166static void setup_j2_leds(void)
167{
168 unsigned i;
169
170 for (i = 0; i < ARRAY_SIZE(stk_j2_led); i++)
171 at32_select_gpio(stk_j2_led[i].gpio, AT32_GPIOF_OUTPUT);
172
173 printk("STK1002: " LEDSTRING "\n");
174 platform_device_register(&stk_j2_led_dev);
175}
176
177#else
178static void setup_j2_leds(void)
179{
180}
181#endif
182
123void __init setup_board(void) 183void __init setup_board(void)
124{ 184{
125#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM 185#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
@@ -185,6 +245,8 @@ static int __init atstk1002_init(void)
185 at32_add_device_ssc(0, ATMEL_SSC_TX); 245 at32_add_device_ssc(0, ATMEL_SSC_TX);
186#endif 246#endif
187 247
248 setup_j2_leds();
249
188 return 0; 250 return 0;
189} 251}
190postcore_initcall(atstk1002_init); 252postcore_initcall(atstk1002_init);
diff --git a/arch/blackfin/kernel/init_task.c b/arch/blackfin/kernel/init_task.c
index b45188f8512e..673c860ffc23 100644
--- a/arch/blackfin/kernel/init_task.c
+++ b/arch/blackfin/kernel/init_task.c
@@ -31,6 +31,7 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/init_task.h> 32#include <linux/init_task.h>
33#include <linux/mqueue.h> 33#include <linux/mqueue.h>
34#include <linux/fs.h>
34 35
35static struct fs_struct init_fs = INIT_FS; 36static struct fs_struct init_fs = INIT_FS;
36static struct files_struct init_files = INIT_FILES; 37static struct files_struct init_files = INIT_FILES;
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 5a51dd6ab280..6a7aefe48346 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -33,6 +33,8 @@
33#include <linux/user.h> 33#include <linux/user.h>
34#include <linux/a.out.h> 34#include <linux/a.out.h>
35#include <linux/uaccess.h> 35#include <linux/uaccess.h>
36#include <linux/fs.h>
37#include <linux/err.h>
36 38
37#include <asm/blackfin.h> 39#include <asm/blackfin.h>
38#include <asm/fixed_code.h> 40#include <asm/fixed_code.h>
diff --git a/arch/blackfin/kernel/sys_bfin.c b/arch/blackfin/kernel/sys_bfin.c
index f5e1ae3d1705..abcd14817d0e 100644
--- a/arch/blackfin/kernel/sys_bfin.c
+++ b/arch/blackfin/kernel/sys_bfin.c
@@ -37,6 +37,7 @@
37#include <linux/syscalls.h> 37#include <linux/syscalls.h>
38#include <linux/mman.h> 38#include <linux/mman.h>
39#include <linux/file.h> 39#include <linux/file.h>
40#include <linux/fs.h>
40#include <linux/uaccess.h> 41#include <linux/uaccess.h>
41#include <linux/ipc.h> 42#include <linux/ipc.h>
42#include <linux/unistd.h> 43#include <linux/unistd.h>
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index 8766bd612b47..792a8416fe10 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -31,6 +31,7 @@
31#include <linux/interrupt.h> 31#include <linux/interrupt.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/kallsyms.h> 33#include <linux/kallsyms.h>
34#include <linux/fs.h>
34#include <asm/traps.h> 35#include <asm/traps.h>
35#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
36#include <asm/blackfin.h> 37#include <asm/blackfin.h>
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 4b41248b61ad..6b4d026a00a1 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -180,8 +180,6 @@ source "drivers/isdn/Kconfig"
180 180
181source "drivers/telephony/Kconfig" 181source "drivers/telephony/Kconfig"
182 182
183source "drivers/cdrom/Kconfig"
184
185# 183#
186# input before char - char/joystick depends on it. As does USB. 184# input before char - char/joystick depends on it. As does USB.
187# 185#
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index 275673c192aa..1e74f3c5cee2 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -1496,6 +1496,7 @@ sys_call_table:
1496 .long sys_signalfd 1496 .long sys_signalfd
1497 .long sys_timerfd 1497 .long sys_timerfd
1498 .long sys_eventfd 1498 .long sys_eventfd
1499 .long sys_fallocate
1499 1500
1500 1501
1501syscall_table_size = (. - sys_call_table) 1502syscall_table_size = (. - sys_call_table)
diff --git a/arch/i386/boot/edd.c b/arch/i386/boot/edd.c
index 658834d9f92a..82b5c846a194 100644
--- a/arch/i386/boot/edd.c
+++ b/arch/i386/boot/edd.c
@@ -19,40 +19,12 @@
19 19
20#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) 20#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
21 21
22struct edd_dapa {
23 u8 pkt_size;
24 u8 rsvd;
25 u16 sector_cnt;
26 u16 buf_off, buf_seg;
27 u64 lba;
28 u64 buf_lin_addr;
29};
30
31/* 22/*
32 * Read the MBR (first sector) from a specific device. 23 * Read the MBR (first sector) from a specific device.
33 */ 24 */
34static int read_mbr(u8 devno, void *buf) 25static int read_mbr(u8 devno, void *buf)
35{ 26{
36 struct edd_dapa dapa; 27 u16 ax, bx, cx, dx;
37 u16 ax, bx, cx, dx, si;
38
39 memset(&dapa, 0, sizeof dapa);
40 dapa.pkt_size = sizeof(dapa);
41 dapa.sector_cnt = 1;
42 dapa.buf_off = (size_t)buf;
43 dapa.buf_seg = ds();
44 /* dapa.lba = 0; */
45
46 ax = 0x4200; /* Extended Read */
47 si = (size_t)&dapa;
48 dx = devno;
49 asm("pushfl; stc; int $0x13; setc %%al; popfl"
50 : "+a" (ax), "+S" (si), "+d" (dx)
51 : "m" (dapa)
52 : "ebx", "ecx", "edi", "memory");
53
54 if (!(u8)ax)
55 return 0; /* OK */
56 28
57 ax = 0x0201; /* Legacy Read, one sector */ 29 ax = 0x0201; /* Legacy Read, one sector */
58 cx = 0x0001; /* Sector 0-0-1 */ 30 cx = 0x0001; /* Sector 0-0-1 */
@@ -65,11 +37,10 @@ static int read_mbr(u8 devno, void *buf)
65 return -(u8)ax; /* 0 or -1 */ 37 return -(u8)ax; /* 0 or -1 */
66} 38}
67 39
68static u32 read_mbr_sig(u8 devno, struct edd_info *ei) 40static u32 read_mbr_sig(u8 devno, struct edd_info *ei, u32 *mbrsig)
69{ 41{
70 int sector_size; 42 int sector_size;
71 char *mbrbuf_ptr, *mbrbuf_end; 43 char *mbrbuf_ptr, *mbrbuf_end;
72 u32 mbrsig;
73 u32 buf_base, mbr_base; 44 u32 buf_base, mbr_base;
74 extern char _end[]; 45 extern char _end[];
75 46
@@ -85,15 +56,15 @@ static u32 read_mbr_sig(u8 devno, struct edd_info *ei)
85 56
86 /* Make sure we actually have space on the heap... */ 57 /* Make sure we actually have space on the heap... */
87 if (!(boot_params.hdr.loadflags & CAN_USE_HEAP)) 58 if (!(boot_params.hdr.loadflags & CAN_USE_HEAP))
88 return 0; 59 return -1;
89 if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr) 60 if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr)
90 return 0; 61 return -1;
91 62
92 if (read_mbr(devno, mbrbuf_ptr)) 63 if (read_mbr(devno, mbrbuf_ptr))
93 return 0; 64 return -1;
94 65
95 mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET]; 66 *mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET];
96 return mbrsig; 67 return 0;
97} 68}
98 69
99static int get_edd_info(u8 devno, struct edd_info *ei) 70static int get_edd_info(u8 devno, struct edd_info *ei)
@@ -160,6 +131,7 @@ void query_edd(void)
160 int do_edd = 1; 131 int do_edd = 1;
161 int devno; 132 int devno;
162 struct edd_info ei, *edp; 133 struct edd_info ei, *edp;
134 u32 *mbrptr;
163 135
164 if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) { 136 if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) {
165 if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) 137 if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip"))
@@ -168,7 +140,8 @@ void query_edd(void)
168 do_edd = 0; 140 do_edd = 0;
169 } 141 }
170 142
171 edp = (struct edd_info *)boot_params.eddbuf; 143 edp = boot_params.eddbuf;
144 mbrptr = boot_params.edd_mbr_sig_buffer;
172 145
173 if (!do_edd) 146 if (!do_edd)
174 return; 147 return;
@@ -186,11 +159,8 @@ void query_edd(void)
186 boot_params.eddbuf_entries++; 159 boot_params.eddbuf_entries++;
187 } 160 }
188 161
189 if (do_mbr) { 162 if (do_mbr && !read_mbr_sig(devno, &ei, mbrptr++))
190 u32 mbr_sig; 163 boot_params.edd_mbr_sig_buf_entries = devno-0x80+1;
191 mbr_sig = read_mbr_sig(devno, &ei);
192 boot_params.edd_mbr_sig_buffer[devno-0x80] = mbr_sig;
193 }
194 } 164 }
195} 165}
196 166
diff --git a/arch/i386/boot/video.c b/arch/i386/boot/video.c
index 958130ef0042..693f20d3102e 100644
--- a/arch/i386/boot/video.c
+++ b/arch/i386/boot/video.c
@@ -61,7 +61,7 @@ static void store_video_mode(void)
61 61
62 /* Not all BIOSes are clean with respect to the top bit */ 62 /* Not all BIOSes are clean with respect to the top bit */
63 boot_params.screen_info.orig_video_mode = ax & 0x7f; 63 boot_params.screen_info.orig_video_mode = ax & 0x7f;
64 boot_params.screen_info.orig_video_page = page; 64 boot_params.screen_info.orig_video_page = page >> 8;
65} 65}
66 66
67/* 67/*
diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
index c85598acb8fd..1b66d5c70eaf 100644
--- a/arch/i386/kernel/alternative.c
+++ b/arch/i386/kernel/alternative.c
@@ -11,6 +11,8 @@
11#include <asm/mce.h> 11#include <asm/mce.h>
12#include <asm/nmi.h> 12#include <asm/nmi.h>
13 13
14#define MAX_PATCH_LEN (255-1)
15
14#ifdef CONFIG_HOTPLUG_CPU 16#ifdef CONFIG_HOTPLUG_CPU
15static int smp_alt_once; 17static int smp_alt_once;
16 18
@@ -148,7 +150,8 @@ static unsigned char** find_nop_table(void)
148 150
149#endif /* CONFIG_X86_64 */ 151#endif /* CONFIG_X86_64 */
150 152
151static void nop_out(void *insns, unsigned int len) 153/* Use this to add nops to a buffer, then text_poke the whole buffer. */
154static void add_nops(void *insns, unsigned int len)
152{ 155{
153 unsigned char **noptable = find_nop_table(); 156 unsigned char **noptable = find_nop_table();
154 157
@@ -156,7 +159,7 @@ static void nop_out(void *insns, unsigned int len)
156 unsigned int noplen = len; 159 unsigned int noplen = len;
157 if (noplen > ASM_NOP_MAX) 160 if (noplen > ASM_NOP_MAX)
158 noplen = ASM_NOP_MAX; 161 noplen = ASM_NOP_MAX;
159 text_poke(insns, noptable[noplen], noplen); 162 memcpy(insns, noptable[noplen], noplen);
160 insns += noplen; 163 insns += noplen;
161 len -= noplen; 164 len -= noplen;
162 } 165 }
@@ -174,15 +177,15 @@ extern u8 *__smp_locks[], *__smp_locks_end[];
174void apply_alternatives(struct alt_instr *start, struct alt_instr *end) 177void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
175{ 178{
176 struct alt_instr *a; 179 struct alt_instr *a;
177 u8 *instr; 180 char insnbuf[MAX_PATCH_LEN];
178 int diff;
179 181
180 DPRINTK("%s: alt table %p -> %p\n", __FUNCTION__, start, end); 182 DPRINTK("%s: alt table %p -> %p\n", __FUNCTION__, start, end);
181 for (a = start; a < end; a++) { 183 for (a = start; a < end; a++) {
184 u8 *instr = a->instr;
182 BUG_ON(a->replacementlen > a->instrlen); 185 BUG_ON(a->replacementlen > a->instrlen);
186 BUG_ON(a->instrlen > sizeof(insnbuf));
183 if (!boot_cpu_has(a->cpuid)) 187 if (!boot_cpu_has(a->cpuid))
184 continue; 188 continue;
185 instr = a->instr;
186#ifdef CONFIG_X86_64 189#ifdef CONFIG_X86_64
187 /* vsyscall code is not mapped yet. resolve it manually. */ 190 /* vsyscall code is not mapped yet. resolve it manually. */
188 if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END) { 191 if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END) {
@@ -191,9 +194,10 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
191 __FUNCTION__, a->instr, instr); 194 __FUNCTION__, a->instr, instr);
192 } 195 }
193#endif 196#endif
194 memcpy(instr, a->replacement, a->replacementlen); 197 memcpy(insnbuf, a->replacement, a->replacementlen);
195 diff = a->instrlen - a->replacementlen; 198 add_nops(insnbuf + a->replacementlen,
196 nop_out(instr + a->replacementlen, diff); 199 a->instrlen - a->replacementlen);
200 text_poke(instr, insnbuf, a->instrlen);
197 } 201 }
198} 202}
199 203
@@ -215,16 +219,18 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end)
215static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end) 219static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end)
216{ 220{
217 u8 **ptr; 221 u8 **ptr;
222 char insn[1];
218 223
219 if (noreplace_smp) 224 if (noreplace_smp)
220 return; 225 return;
221 226
227 add_nops(insn, 1);
222 for (ptr = start; ptr < end; ptr++) { 228 for (ptr = start; ptr < end; ptr++) {
223 if (*ptr < text) 229 if (*ptr < text)
224 continue; 230 continue;
225 if (*ptr > text_end) 231 if (*ptr > text_end)
226 continue; 232 continue;
227 nop_out(*ptr, 1); 233 text_poke(*ptr, insn, 1);
228 }; 234 };
229} 235}
230 236
@@ -351,6 +357,7 @@ void apply_paravirt(struct paravirt_patch_site *start,
351 struct paravirt_patch_site *end) 357 struct paravirt_patch_site *end)
352{ 358{
353 struct paravirt_patch_site *p; 359 struct paravirt_patch_site *p;
360 char insnbuf[MAX_PATCH_LEN];
354 361
355 if (noreplace_paravirt) 362 if (noreplace_paravirt)
356 return; 363 return;
@@ -358,13 +365,15 @@ void apply_paravirt(struct paravirt_patch_site *start,
358 for (p = start; p < end; p++) { 365 for (p = start; p < end; p++) {
359 unsigned int used; 366 unsigned int used;
360 367
361 used = paravirt_ops.patch(p->instrtype, p->clobbers, p->instr, 368 BUG_ON(p->len > MAX_PATCH_LEN);
362 p->len); 369 used = paravirt_ops.patch(p->instrtype, p->clobbers, insnbuf,
370 (unsigned long)p->instr, p->len);
363 371
364 BUG_ON(used > p->len); 372 BUG_ON(used > p->len);
365 373
366 /* Pad the rest with nops */ 374 /* Pad the rest with nops */
367 nop_out(p->instr + used, p->len - used); 375 add_nops(insnbuf + used, p->len - used);
376 text_poke(p->instr, insnbuf, p->len);
368 } 377 }
369} 378}
370extern struct paravirt_patch_site __start_parainstructions[], 379extern struct paravirt_patch_site __start_parainstructions[],
@@ -379,7 +388,7 @@ void __init alternative_instructions(void)
379 that might execute the to be patched code. 388 that might execute the to be patched code.
380 Other CPUs are not running. */ 389 Other CPUs are not running. */
381 stop_nmi(); 390 stop_nmi();
382#ifdef CONFIG_MCE 391#ifdef CONFIG_X86_MCE
383 stop_mce(); 392 stop_mce();
384#endif 393#endif
385 394
@@ -417,7 +426,7 @@ void __init alternative_instructions(void)
417 local_irq_restore(flags); 426 local_irq_restore(flags);
418 427
419 restart_nmi(); 428 restart_nmi();
420#ifdef CONFIG_MCE 429#ifdef CONFIG_X86_MCE
421 restart_mce(); 430 restart_mce();
422#endif 431#endif
423} 432}
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index bfc6cb7df7e7..f9fff29e01a9 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -61,8 +61,9 @@ static int enable_local_apic __initdata = 0;
61 61
62/* Local APIC timer verification ok */ 62/* Local APIC timer verification ok */
63static int local_apic_timer_verify_ok; 63static int local_apic_timer_verify_ok;
64/* Disable local APIC timer from the kernel commandline or via dmi quirk */ 64/* Disable local APIC timer from the kernel commandline or via dmi quirk
65static int local_apic_timer_disabled; 65 or using CPU MSR check */
66int local_apic_timer_disabled;
66/* Local APIC timer works in C2 */ 67/* Local APIC timer works in C2 */
67int local_apic_timer_c2_ok; 68int local_apic_timer_c2_ok;
68EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok); 69EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
@@ -370,12 +371,9 @@ void __init setup_boot_APIC_clock(void)
370 long delta, deltapm; 371 long delta, deltapm;
371 int pm_referenced = 0; 372 int pm_referenced = 0;
372 373
373 if (boot_cpu_has(X86_FEATURE_LAPIC_TIMER_BROKEN))
374 local_apic_timer_disabled = 1;
375
376 /* 374 /*
377 * The local apic timer can be disabled via the kernel 375 * The local apic timer can be disabled via the kernel
378 * commandline or from the test above. Register the lapic 376 * commandline or from the CPU detection code. Register the lapic
379 * timer as a dummy clock event source on SMP systems, so the 377 * timer as a dummy clock event source on SMP systems, so the
380 * broadcast mechanism is used. On UP systems simply ignore it. 378 * broadcast mechanism is used. On UP systems simply ignore it.
381 */ 379 */
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c
index c7ba455d5ac7..dcf6bbb1c7c0 100644
--- a/arch/i386/kernel/cpu/amd.c
+++ b/arch/i386/kernel/cpu/amd.c
@@ -3,6 +3,7 @@
3#include <linux/mm.h> 3#include <linux/mm.h>
4#include <asm/io.h> 4#include <asm/io.h>
5#include <asm/processor.h> 5#include <asm/processor.h>
6#include <asm/apic.h>
6 7
7#include "cpu.h" 8#include "cpu.h"
8 9
@@ -22,6 +23,7 @@
22extern void vide(void); 23extern void vide(void);
23__asm__(".align 4\nvide: ret"); 24__asm__(".align 4\nvide: ret");
24 25
26#ifdef CONFIG_X86_LOCAL_APIC
25#define ENABLE_C1E_MASK 0x18000000 27#define ENABLE_C1E_MASK 0x18000000
26#define CPUID_PROCESSOR_SIGNATURE 1 28#define CPUID_PROCESSOR_SIGNATURE 1
27#define CPUID_XFAM 0x0ff00000 29#define CPUID_XFAM 0x0ff00000
@@ -52,6 +54,7 @@ static __cpuinit int amd_apic_timer_broken(void)
52 } 54 }
53 return 0; 55 return 0;
54} 56}
57#endif
55 58
56int force_mwait __cpuinitdata; 59int force_mwait __cpuinitdata;
57 60
@@ -282,8 +285,10 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
282 num_cache_leaves = 3; 285 num_cache_leaves = 3;
283 } 286 }
284 287
288#ifdef CONFIG_X86_LOCAL_APIC
285 if (amd_apic_timer_broken()) 289 if (amd_apic_timer_broken())
286 set_bit(X86_FEATURE_LAPIC_TIMER_BROKEN, c->x86_capability); 290 local_apic_timer_disabled = 1;
291#endif
287 292
288 if (c->x86 == 0x10 && !force_mwait) 293 if (c->x86 == 0x10 && !force_mwait)
289 clear_bit(X86_FEATURE_MWAIT, c->x86_capability); 294 clear_bit(X86_FEATURE_MWAIT, c->x86_capability);
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index 32d04b083e38..705e13a30781 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -68,7 +68,8 @@ struct acpi_cpufreq_data {
68}; 68};
69 69
70static struct acpi_cpufreq_data *drv_data[NR_CPUS]; 70static struct acpi_cpufreq_data *drv_data[NR_CPUS];
71static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; 71/* acpi_perf_data is a pointer to percpu data. */
72static struct acpi_processor_performance *acpi_perf_data;
72 73
73static struct cpufreq_driver acpi_cpufreq_driver; 74static struct cpufreq_driver acpi_cpufreq_driver;
74 75
@@ -508,24 +509,14 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
508 * do _PDC and _PSD and find out the processor dependency for the 509 * do _PDC and _PSD and find out the processor dependency for the
509 * actual init that will happen later... 510 * actual init that will happen later...
510 */ 511 */
511static int acpi_cpufreq_early_init(void) 512static int __init acpi_cpufreq_early_init(void)
512{ 513{
513 struct acpi_processor_performance *data;
514 unsigned int i, j;
515
516 dprintk("acpi_cpufreq_early_init\n"); 514 dprintk("acpi_cpufreq_early_init\n");
517 515
518 for_each_possible_cpu(i) { 516 acpi_perf_data = alloc_percpu(struct acpi_processor_performance);
519 data = kzalloc(sizeof(struct acpi_processor_performance), 517 if (!acpi_perf_data) {
520 GFP_KERNEL); 518 dprintk("Memory allocation error for acpi_perf_data.\n");
521 if (!data) { 519 return -ENOMEM;
522 for_each_possible_cpu(j) {
523 kfree(acpi_perf_data[j]);
524 acpi_perf_data[j] = NULL;
525 }
526 return -ENOMEM;
527 }
528 acpi_perf_data[i] = data;
529 } 520 }
530 521
531 /* Do initialization in ACPI core */ 522 /* Do initialization in ACPI core */
@@ -574,14 +565,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
574 565
575 dprintk("acpi_cpufreq_cpu_init\n"); 566 dprintk("acpi_cpufreq_cpu_init\n");
576 567
577 if (!acpi_perf_data[cpu])
578 return -ENODEV;
579
580 data = kzalloc(sizeof(struct acpi_cpufreq_data), GFP_KERNEL); 568 data = kzalloc(sizeof(struct acpi_cpufreq_data), GFP_KERNEL);
581 if (!data) 569 if (!data)
582 return -ENOMEM; 570 return -ENOMEM;
583 571
584 data->acpi_data = acpi_perf_data[cpu]; 572 data->acpi_data = percpu_ptr(acpi_perf_data, cpu);
585 drv_data[cpu] = data; 573 drv_data[cpu] = data;
586 574
587 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) 575 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC))
@@ -778,24 +766,25 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
778 766
779static int __init acpi_cpufreq_init(void) 767static int __init acpi_cpufreq_init(void)
780{ 768{
769 int ret;
770
781 dprintk("acpi_cpufreq_init\n"); 771 dprintk("acpi_cpufreq_init\n");
782 772
783 acpi_cpufreq_early_init(); 773 ret = acpi_cpufreq_early_init();
774 if (ret)
775 return ret;
784 776
785 return cpufreq_register_driver(&acpi_cpufreq_driver); 777 return cpufreq_register_driver(&acpi_cpufreq_driver);
786} 778}
787 779
788static void __exit acpi_cpufreq_exit(void) 780static void __exit acpi_cpufreq_exit(void)
789{ 781{
790 unsigned int i;
791 dprintk("acpi_cpufreq_exit\n"); 782 dprintk("acpi_cpufreq_exit\n");
792 783
793 cpufreq_unregister_driver(&acpi_cpufreq_driver); 784 cpufreq_unregister_driver(&acpi_cpufreq_driver);
794 785
795 for_each_possible_cpu(i) { 786 free_percpu(acpi_perf_data);
796 kfree(acpi_perf_data[i]); 787
797 acpi_perf_data[i] = NULL;
798 }
799 return; 788 return;
800} 789}
801 790
diff --git a/arch/i386/kernel/doublefault.c b/arch/i386/kernel/doublefault.c
index 265c5597efb0..40978af630e7 100644
--- a/arch/i386/kernel/doublefault.c
+++ b/arch/i386/kernel/doublefault.c
@@ -13,7 +13,7 @@
13static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE]; 13static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE];
14#define STACK_START (unsigned long)(doublefault_stack+DOUBLEFAULT_STACKSIZE) 14#define STACK_START (unsigned long)(doublefault_stack+DOUBLEFAULT_STACKSIZE)
15 15
16#define ptr_ok(x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + 0x1000000) 16#define ptr_ok(x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + MAXMEM)
17 17
18static void doublefault_fn(void) 18static void doublefault_fn(void)
19{ 19{
@@ -23,23 +23,23 @@ static void doublefault_fn(void)
23 store_gdt(&gdt_desc); 23 store_gdt(&gdt_desc);
24 gdt = gdt_desc.address; 24 gdt = gdt_desc.address;
25 25
26 printk("double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size); 26 printk(KERN_EMERG "PANIC: double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size);
27 27
28 if (ptr_ok(gdt)) { 28 if (ptr_ok(gdt)) {
29 gdt += GDT_ENTRY_TSS << 3; 29 gdt += GDT_ENTRY_TSS << 3;
30 tss = *(u16 *)(gdt+2); 30 tss = *(u16 *)(gdt+2);
31 tss += *(u8 *)(gdt+4) << 16; 31 tss += *(u8 *)(gdt+4) << 16;
32 tss += *(u8 *)(gdt+7) << 24; 32 tss += *(u8 *)(gdt+7) << 24;
33 printk("double fault, tss at %08lx\n", tss); 33 printk(KERN_EMERG "double fault, tss at %08lx\n", tss);
34 34
35 if (ptr_ok(tss)) { 35 if (ptr_ok(tss)) {
36 struct i386_hw_tss *t = (struct i386_hw_tss *)tss; 36 struct i386_hw_tss *t = (struct i386_hw_tss *)tss;
37 37
38 printk("eip = %08lx, esp = %08lx\n", t->eip, t->esp); 38 printk(KERN_EMERG "eip = %08lx, esp = %08lx\n", t->eip, t->esp);
39 39
40 printk("eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n", 40 printk(KERN_EMERG "eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n",
41 t->eax, t->ebx, t->ecx, t->edx); 41 t->eax, t->ebx, t->ecx, t->edx);
42 printk("esi = %08lx, edi = %08lx\n", 42 printk(KERN_EMERG "esi = %08lx, edi = %08lx\n",
43 t->esi, t->edi); 43 t->esi, t->edi);
44 } 44 }
45 } 45 }
@@ -63,6 +63,7 @@ struct tss_struct doublefault_tss __cacheline_aligned = {
63 .cs = __KERNEL_CS, 63 .cs = __KERNEL_CS,
64 .ss = __KERNEL_DS, 64 .ss = __KERNEL_DS,
65 .ds = __USER_DS, 65 .ds = __USER_DS,
66 .fs = __KERNEL_PERCPU,
66 67
67 .__cr3 = __pa(swapper_pg_dir) 68 .__cr3 = __pa(swapper_pg_dir)
68 } 69 }
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index 7c52b222207e..8f0382161c91 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -162,9 +162,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
162 * which will be freed later 162 * which will be freed later
163 */ 163 */
164 164
165#ifdef CONFIG_HOTPLUG_CPU 165#ifndef CONFIG_HOTPLUG_CPU
166.section .text,"ax",@progbits
167#else
168.section .init.text,"ax",@progbits 166.section .init.text,"ax",@progbits
169#endif 167#endif
170 168
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 893df8280756..4b8a8da4b2e0 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -1256,12 +1256,15 @@ static struct irq_chip ioapic_chip;
1256static void ioapic_register_intr(int irq, int vector, unsigned long trigger) 1256static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
1257{ 1257{
1258 if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) || 1258 if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
1259 trigger == IOAPIC_LEVEL) 1259 trigger == IOAPIC_LEVEL) {
1260 irq_desc[irq].status |= IRQ_LEVEL;
1260 set_irq_chip_and_handler_name(irq, &ioapic_chip, 1261 set_irq_chip_and_handler_name(irq, &ioapic_chip,
1261 handle_fasteoi_irq, "fasteoi"); 1262 handle_fasteoi_irq, "fasteoi");
1262 else 1263 } else {
1264 irq_desc[irq].status &= ~IRQ_LEVEL;
1263 set_irq_chip_and_handler_name(irq, &ioapic_chip, 1265 set_irq_chip_and_handler_name(irq, &ioapic_chip,
1264 handle_edge_irq, "edge"); 1266 handle_edge_irq, "edge");
1267 }
1265 set_intr_gate(vector, interrupt[irq]); 1268 set_intr_gate(vector, interrupt[irq]);
1266} 1269}
1267 1270
diff --git a/arch/i386/kernel/paravirt.c b/arch/i386/kernel/paravirt.c
index ea962c0667d5..739cfb207dd7 100644
--- a/arch/i386/kernel/paravirt.c
+++ b/arch/i386/kernel/paravirt.c
@@ -69,7 +69,8 @@ DEF_NATIVE(read_tsc, "rdtsc");
69 69
70DEF_NATIVE(ud2a, "ud2a"); 70DEF_NATIVE(ud2a, "ud2a");
71 71
72static unsigned native_patch(u8 type, u16 clobbers, void *insns, unsigned len) 72static unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
73 unsigned long addr, unsigned len)
73{ 74{
74 const unsigned char *start, *end; 75 const unsigned char *start, *end;
75 unsigned ret; 76 unsigned ret;
@@ -90,7 +91,7 @@ static unsigned native_patch(u8 type, u16 clobbers, void *insns, unsigned len)
90#undef SITE 91#undef SITE
91 92
92 patch_site: 93 patch_site:
93 ret = paravirt_patch_insns(insns, len, start, end); 94 ret = paravirt_patch_insns(ibuf, len, start, end);
94 break; 95 break;
95 96
96 case PARAVIRT_PATCH(make_pgd): 97 case PARAVIRT_PATCH(make_pgd):
@@ -107,7 +108,7 @@ static unsigned native_patch(u8 type, u16 clobbers, void *insns, unsigned len)
107 break; 108 break;
108 109
109 default: 110 default:
110 ret = paravirt_patch_default(type, clobbers, insns, len); 111 ret = paravirt_patch_default(type, clobbers, ibuf, addr, len);
111 break; 112 break;
112 } 113 }
113 114
@@ -129,68 +130,67 @@ struct branch {
129 u32 delta; 130 u32 delta;
130} __attribute__((packed)); 131} __attribute__((packed));
131 132
132unsigned paravirt_patch_call(void *target, u16 tgt_clobbers, 133unsigned paravirt_patch_call(void *insnbuf,
133 void *site, u16 site_clobbers, 134 const void *target, u16 tgt_clobbers,
135 unsigned long addr, u16 site_clobbers,
134 unsigned len) 136 unsigned len)
135{ 137{
136 unsigned char *call = site; 138 struct branch *b = insnbuf;
137 unsigned long delta = (unsigned long)target - (unsigned long)(call+5); 139 unsigned long delta = (unsigned long)target - (addr+5);
138 struct branch b;
139 140
140 if (tgt_clobbers & ~site_clobbers) 141 if (tgt_clobbers & ~site_clobbers)
141 return len; /* target would clobber too much for this site */ 142 return len; /* target would clobber too much for this site */
142 if (len < 5) 143 if (len < 5)
143 return len; /* call too long for patch site */ 144 return len; /* call too long for patch site */
144 145
145 b.opcode = 0xe8; /* call */ 146 b->opcode = 0xe8; /* call */
146 b.delta = delta; 147 b->delta = delta;
147 BUILD_BUG_ON(sizeof(b) != 5); 148 BUILD_BUG_ON(sizeof(*b) != 5);
148 text_poke(call, (unsigned char *)&b, 5);
149 149
150 return 5; 150 return 5;
151} 151}
152 152
153unsigned paravirt_patch_jmp(void *target, void *site, unsigned len) 153unsigned paravirt_patch_jmp(const void *target, void *insnbuf,
154 unsigned long addr, unsigned len)
154{ 155{
155 unsigned char *jmp = site; 156 struct branch *b = insnbuf;
156 unsigned long delta = (unsigned long)target - (unsigned long)(jmp+5); 157 unsigned long delta = (unsigned long)target - (addr+5);
157 struct branch b;
158 158
159 if (len < 5) 159 if (len < 5)
160 return len; /* call too long for patch site */ 160 return len; /* call too long for patch site */
161 161
162 b.opcode = 0xe9; /* jmp */ 162 b->opcode = 0xe9; /* jmp */
163 b.delta = delta; 163 b->delta = delta;
164 text_poke(jmp, (unsigned char *)&b, 5);
165 164
166 return 5; 165 return 5;
167} 166}
168 167
169unsigned paravirt_patch_default(u8 type, u16 clobbers, void *site, unsigned len) 168unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
169 unsigned long addr, unsigned len)
170{ 170{
171 void *opfunc = *((void **)&paravirt_ops + type); 171 void *opfunc = *((void **)&paravirt_ops + type);
172 unsigned ret; 172 unsigned ret;
173 173
174 if (opfunc == NULL) 174 if (opfunc == NULL)
175 /* If there's no function, patch it with a ud2a (BUG) */ 175 /* If there's no function, patch it with a ud2a (BUG) */
176 ret = paravirt_patch_insns(site, len, start_ud2a, end_ud2a); 176 ret = paravirt_patch_insns(insnbuf, len, start_ud2a, end_ud2a);
177 else if (opfunc == paravirt_nop) 177 else if (opfunc == paravirt_nop)
178 /* If the operation is a nop, then nop the callsite */ 178 /* If the operation is a nop, then nop the callsite */
179 ret = paravirt_patch_nop(); 179 ret = paravirt_patch_nop();
180 else if (type == PARAVIRT_PATCH(iret) || 180 else if (type == PARAVIRT_PATCH(iret) ||
181 type == PARAVIRT_PATCH(irq_enable_sysexit)) 181 type == PARAVIRT_PATCH(irq_enable_sysexit))
182 /* If operation requires a jmp, then jmp */ 182 /* If operation requires a jmp, then jmp */
183 ret = paravirt_patch_jmp(opfunc, site, len); 183 ret = paravirt_patch_jmp(opfunc, insnbuf, addr, len);
184 else 184 else
185 /* Otherwise call the function; assume target could 185 /* Otherwise call the function; assume target could
186 clobber any caller-save reg */ 186 clobber any caller-save reg */
187 ret = paravirt_patch_call(opfunc, CLBR_ANY, 187 ret = paravirt_patch_call(insnbuf, opfunc, CLBR_ANY,
188 site, clobbers, len); 188 addr, clobbers, len);
189 189
190 return ret; 190 return ret;
191} 191}
192 192
193unsigned paravirt_patch_insns(void *site, unsigned len, 193unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
194 const char *start, const char *end) 194 const char *start, const char *end)
195{ 195{
196 unsigned insn_len = end - start; 196 unsigned insn_len = end - start;
@@ -198,7 +198,7 @@ unsigned paravirt_patch_insns(void *site, unsigned len,
198 if (insn_len > len || start == NULL) 198 if (insn_len > len || start == NULL)
199 insn_len = len; 199 insn_len = len;
200 else 200 else
201 memcpy(site, start, insn_len); 201 memcpy(insnbuf, start, insn_len);
202 202
203 return insn_len; 203 return insn_len;
204} 204}
diff --git a/arch/i386/kernel/vmi.c b/arch/i386/kernel/vmi.c
index 72042bb7ec94..18673e0f193b 100644
--- a/arch/i386/kernel/vmi.c
+++ b/arch/i386/kernel/vmi.c
@@ -87,12 +87,14 @@ struct vmi_timer_ops vmi_timer_ops;
87#define IRQ_PATCH_INT_MASK 0 87#define IRQ_PATCH_INT_MASK 0
88#define IRQ_PATCH_DISABLE 5 88#define IRQ_PATCH_DISABLE 5
89 89
90static inline void patch_offset(unsigned char *eip, unsigned char *dest) 90static inline void patch_offset(void *insnbuf,
91 unsigned long eip, unsigned long dest)
91{ 92{
92 *(unsigned long *)(eip+1) = dest-eip-5; 93 *(unsigned long *)(insnbuf+1) = dest-eip-5;
93} 94}
94 95
95static unsigned patch_internal(int call, unsigned len, void *insns) 96static unsigned patch_internal(int call, unsigned len, void *insnbuf,
97 unsigned long eip)
96{ 98{
97 u64 reloc; 99 u64 reloc;
98 struct vmi_relocation_info *const rel = (struct vmi_relocation_info *)&reloc; 100 struct vmi_relocation_info *const rel = (struct vmi_relocation_info *)&reloc;
@@ -100,14 +102,14 @@ static unsigned patch_internal(int call, unsigned len, void *insns)
100 switch(rel->type) { 102 switch(rel->type) {
101 case VMI_RELOCATION_CALL_REL: 103 case VMI_RELOCATION_CALL_REL:
102 BUG_ON(len < 5); 104 BUG_ON(len < 5);
103 *(char *)insns = MNEM_CALL; 105 *(char *)insnbuf = MNEM_CALL;
104 patch_offset(insns, rel->eip); 106 patch_offset(insnbuf, eip, (unsigned long)rel->eip);
105 return 5; 107 return 5;
106 108
107 case VMI_RELOCATION_JUMP_REL: 109 case VMI_RELOCATION_JUMP_REL:
108 BUG_ON(len < 5); 110 BUG_ON(len < 5);
109 *(char *)insns = MNEM_JMP; 111 *(char *)insnbuf = MNEM_JMP;
110 patch_offset(insns, rel->eip); 112 patch_offset(insnbuf, eip, (unsigned long)rel->eip);
111 return 5; 113 return 5;
112 114
113 case VMI_RELOCATION_NOP: 115 case VMI_RELOCATION_NOP:
@@ -128,21 +130,26 @@ static unsigned patch_internal(int call, unsigned len, void *insns)
128 * Apply patch if appropriate, return length of new instruction 130 * Apply patch if appropriate, return length of new instruction
129 * sequence. The callee does nop padding for us. 131 * sequence. The callee does nop padding for us.
130 */ 132 */
131static unsigned vmi_patch(u8 type, u16 clobbers, void *insns, unsigned len) 133static unsigned vmi_patch(u8 type, u16 clobbers, void *insns,
134 unsigned long eip, unsigned len)
132{ 135{
133 switch (type) { 136 switch (type) {
134 case PARAVIRT_PATCH(irq_disable): 137 case PARAVIRT_PATCH(irq_disable):
135 return patch_internal(VMI_CALL_DisableInterrupts, len, insns); 138 return patch_internal(VMI_CALL_DisableInterrupts, len,
139 insns, eip);
136 case PARAVIRT_PATCH(irq_enable): 140 case PARAVIRT_PATCH(irq_enable):
137 return patch_internal(VMI_CALL_EnableInterrupts, len, insns); 141 return patch_internal(VMI_CALL_EnableInterrupts, len,
142 insns, eip);
138 case PARAVIRT_PATCH(restore_fl): 143 case PARAVIRT_PATCH(restore_fl):
139 return patch_internal(VMI_CALL_SetInterruptMask, len, insns); 144 return patch_internal(VMI_CALL_SetInterruptMask, len,
145 insns, eip);
140 case PARAVIRT_PATCH(save_fl): 146 case PARAVIRT_PATCH(save_fl):
141 return patch_internal(VMI_CALL_GetInterruptMask, len, insns); 147 return patch_internal(VMI_CALL_GetInterruptMask, len,
148 insns, eip);
142 case PARAVIRT_PATCH(iret): 149 case PARAVIRT_PATCH(iret):
143 return patch_internal(VMI_CALL_IRET, len, insns); 150 return patch_internal(VMI_CALL_IRET, len, insns, eip);
144 case PARAVIRT_PATCH(irq_enable_sysexit): 151 case PARAVIRT_PATCH(irq_enable_sysexit):
145 return patch_internal(VMI_CALL_SYSEXIT, len, insns); 152 return patch_internal(VMI_CALL_SYSEXIT, len, insns, eip);
146 default: 153 default:
147 break; 154 break;
148 } 155 }
diff --git a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c
index 8927222b3ab2..4241a74d16c8 100644
--- a/arch/i386/mm/pageattr.c
+++ b/arch/i386/mm/pageattr.c
@@ -82,7 +82,7 @@ static void flush_kernel_map(void *arg)
82 struct page *p; 82 struct page *p;
83 83
84 /* High level code is not ready for clflush yet */ 84 /* High level code is not ready for clflush yet */
85 if (cpu_has_clflush) { 85 if (0 && cpu_has_clflush) {
86 list_for_each_entry (p, lh, lru) 86 list_for_each_entry (p, lh, lru)
87 cache_flush_page(p); 87 cache_flush_page(p);
88 } else if (boot_cpu_data.x86_model >= 4) 88 } else if (boot_cpu_data.x86_model >= 4)
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
index 85503deeda46..ebc6f3c66340 100644
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -455,3 +455,26 @@ void pcibios_disable_device (struct pci_dev *dev)
455 if (!dev->msi_enabled && pcibios_disable_irq) 455 if (!dev->msi_enabled && pcibios_disable_irq)
456 pcibios_disable_irq(dev); 456 pcibios_disable_irq(dev);
457} 457}
458
459struct pci_bus *pci_scan_bus_with_sysdata(int busno)
460{
461 struct pci_bus *bus = NULL;
462 struct pci_sysdata *sd;
463
464 /*
465 * Allocate per-root-bus (not per bus) arch-specific data.
466 * TODO: leak; this memory is never freed.
467 * It's arguable whether it's worth the trouble to care.
468 */
469 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
470 if (!sd) {
471 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno);
472 return NULL;
473 }
474 sd->node = -1;
475 bus = pci_scan_bus(busno, &pci_root_ops, sd);
476 if (!bus)
477 kfree(sd);
478
479 return bus;
480}
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c
index e7306dbf6c42..c82cbf4c7226 100644
--- a/arch/i386/pci/fixup.c
+++ b/arch/i386/pci/fixup.c
@@ -25,9 +25,9 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
25 pci_read_config_byte(d, reg++, &subb); 25 pci_read_config_byte(d, reg++, &subb);
26 DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); 26 DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb);
27 if (busno) 27 if (busno)
28 pci_scan_bus(busno, &pci_root_ops, NULL); /* Bus A */ 28 pci_scan_bus_with_sysdata(busno); /* Bus A */
29 if (suba < subb) 29 if (suba < subb)
30 pci_scan_bus(suba+1, &pci_root_ops, NULL); /* Bus B */ 30 pci_scan_bus_with_sysdata(suba+1); /* Bus B */
31 } 31 }
32 pcibios_last_bus = -1; 32 pcibios_last_bus = -1;
33} 33}
@@ -42,7 +42,7 @@ static void __devinit pci_fixup_i450gx(struct pci_dev *d)
42 u8 busno; 42 u8 busno;
43 pci_read_config_byte(d, 0x4a, &busno); 43 pci_read_config_byte(d, 0x4a, &busno);
44 printk(KERN_INFO "PCI: i440KX/GX host bridge %s: secondary bus %02x\n", pci_name(d), busno); 44 printk(KERN_INFO "PCI: i440KX/GX host bridge %s: secondary bus %02x\n", pci_name(d), busno);
45 pci_scan_bus(busno, &pci_root_ops, NULL); 45 pci_scan_bus_with_sysdata(busno);
46 pcibios_last_bus = -1; 46 pcibios_last_bus = -1;
47} 47}
48DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx); 48DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx);
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index f2cb942f8281..665db063a40a 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -138,8 +138,9 @@ static void __init pirq_peer_trick(void)
138 for(i = 1; i < 256; i++) { 138 for(i = 1; i < 256; i++) {
139 if (!busmap[i] || pci_find_bus(0, i)) 139 if (!busmap[i] || pci_find_bus(0, i))
140 continue; 140 continue;
141 if (pci_scan_bus(i, &pci_root_ops, NULL)) 141 if (pci_scan_bus_with_sysdata(i))
142 printk(KERN_INFO "PCI: Discovered primary peer bus %02x [IRQ]\n", i); 142 printk(KERN_INFO "PCI: Discovered primary peer "
143 "bus %02x [IRQ]\n", i);
143 } 144 }
144 pcibios_last_bus = -1; 145 pcibios_last_bus = -1;
145} 146}
diff --git a/arch/i386/pci/legacy.c b/arch/i386/pci/legacy.c
index 149a9588c256..5565d7016b75 100644
--- a/arch/i386/pci/legacy.c
+++ b/arch/i386/pci/legacy.c
@@ -26,7 +26,7 @@ static void __devinit pcibios_fixup_peer_bridges(void)
26 l != 0x0000 && l != 0xffff) { 26 l != 0x0000 && l != 0xffff) {
27 DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l); 27 DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l);
28 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n); 28 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n);
29 pci_scan_bus(n, &pci_root_ops, NULL); 29 pci_scan_bus_with_sysdata(n);
30 break; 30 break;
31 } 31 }
32 } 32 }
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
index bb1afd9e589d..1bf5816d34c8 100644
--- a/arch/i386/pci/mmconfig.c
+++ b/arch/i386/pci/mmconfig.c
@@ -82,16 +82,15 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
82 82
83 switch (len) { 83 switch (len) {
84 case 1: 84 case 1:
85 *value = readb(mmcfg_virt_addr + reg); 85 *value = mmio_config_readb(mmcfg_virt_addr + reg);
86 break; 86 break;
87 case 2: 87 case 2:
88 *value = readw(mmcfg_virt_addr + reg); 88 *value = mmio_config_readw(mmcfg_virt_addr + reg);
89 break; 89 break;
90 case 4: 90 case 4:
91 *value = readl(mmcfg_virt_addr + reg); 91 *value = mmio_config_readl(mmcfg_virt_addr + reg);
92 break; 92 break;
93 } 93 }
94
95 spin_unlock_irqrestore(&pci_config_lock, flags); 94 spin_unlock_irqrestore(&pci_config_lock, flags);
96 95
97 return 0; 96 return 0;
@@ -116,16 +115,15 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
116 115
117 switch (len) { 116 switch (len) {
118 case 1: 117 case 1:
119 writeb(value, mmcfg_virt_addr + reg); 118 mmio_config_writeb(mmcfg_virt_addr + reg, value);
120 break; 119 break;
121 case 2: 120 case 2:
122 writew(value, mmcfg_virt_addr + reg); 121 mmio_config_writew(mmcfg_virt_addr + reg, value);
123 break; 122 break;
124 case 4: 123 case 4:
125 writel(value, mmcfg_virt_addr + reg); 124 mmio_config_writel(mmcfg_virt_addr + reg, value);
126 break; 125 break;
127 } 126 }
128
129 spin_unlock_irqrestore(&pci_config_lock, flags); 127 spin_unlock_irqrestore(&pci_config_lock, flags);
130 128
131 return 0; 129 return 0;
diff --git a/arch/i386/pci/numa.c b/arch/i386/pci/numa.c
index adbe17a38f6f..f5f165f69e0c 100644
--- a/arch/i386/pci/numa.c
+++ b/arch/i386/pci/numa.c
@@ -96,10 +96,14 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
96 pci_read_config_byte(d, reg++, &suba); 96 pci_read_config_byte(d, reg++, &suba);
97 pci_read_config_byte(d, reg++, &subb); 97 pci_read_config_byte(d, reg++, &subb);
98 DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); 98 DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb);
99 if (busno) 99 if (busno) {
100 pci_scan_bus(QUADLOCAL2BUS(quad,busno), &pci_root_ops, NULL); /* Bus A */ 100 /* Bus A */
101 if (suba < subb) 101 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno));
102 pci_scan_bus(QUADLOCAL2BUS(quad,suba+1), &pci_root_ops, NULL); /* Bus B */ 102 }
103 if (suba < subb) {
104 /* Bus B */
105 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, suba+1));
106 }
103 } 107 }
104 pcibios_last_bus = -1; 108 pcibios_last_bus = -1;
105} 109}
@@ -123,8 +127,7 @@ static int __init pci_numa_init(void)
123 continue; 127 continue;
124 printk("Scanning PCI bus %d for quad %d\n", 128 printk("Scanning PCI bus %d for quad %d\n",
125 QUADLOCAL2BUS(quad,0), quad); 129 QUADLOCAL2BUS(quad,0), quad);
126 pci_scan_bus(QUADLOCAL2BUS(quad,0), 130 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, 0));
127 &pci_root_ops, NULL);
128 } 131 }
129 return 0; 132 return 0;
130} 133}
diff --git a/arch/i386/pci/pci.h b/arch/i386/pci/pci.h
index e58bae2076ad..8c66f275756f 100644
--- a/arch/i386/pci/pci.h
+++ b/arch/i386/pci/pci.h
@@ -104,3 +104,46 @@ extern DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
104extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus, 104extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
105 unsigned int devfn); 105 unsigned int devfn);
106extern int __init pci_mmcfg_arch_init(void); 106extern int __init pci_mmcfg_arch_init(void);
107
108/*
109 * AMD Fam10h CPUs are buggy, and cannot access MMIO config space
110 * on their northbrige except through the * %eax register. As such, you MUST
111 * NOT use normal IOMEM accesses, you need to only use the magic mmio-config
112 * accessor functions.
113 * In fact just use pci_config_*, nothing else please.
114 */
115static inline unsigned char mmio_config_readb(void __iomem *pos)
116{
117 u8 val;
118 asm volatile("movb (%1),%%al" : "=a" (val) : "r" (pos));
119 return val;
120}
121
122static inline unsigned short mmio_config_readw(void __iomem *pos)
123{
124 u16 val;
125 asm volatile("movw (%1),%%ax" : "=a" (val) : "r" (pos));
126 return val;
127}
128
129static inline unsigned int mmio_config_readl(void __iomem *pos)
130{
131 u32 val;
132 asm volatile("movl (%1),%%eax" : "=a" (val) : "r" (pos));
133 return val;
134}
135
136static inline void mmio_config_writeb(void __iomem *pos, u8 val)
137{
138 asm volatile("movb %%al,(%1)" :: "a" (val), "r" (pos) : "memory");
139}
140
141static inline void mmio_config_writew(void __iomem *pos, u16 val)
142{
143 asm volatile("movw %%ax,(%1)" :: "a" (val), "r" (pos) : "memory");
144}
145
146static inline void mmio_config_writel(void __iomem *pos, u32 val)
147{
148 asm volatile("movl %%eax,(%1)" :: "a" (val), "r" (pos) : "memory");
149}
diff --git a/arch/i386/pci/visws.c b/arch/i386/pci/visws.c
index f1b486d4190b..8ecb1c722594 100644
--- a/arch/i386/pci/visws.c
+++ b/arch/i386/pci/visws.c
@@ -101,8 +101,8 @@ static int __init pcibios_init(void)
101 "bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0); 101 "bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0);
102 102
103 raw_pci_ops = &pci_direct_conf1; 103 raw_pci_ops = &pci_direct_conf1;
104 pci_scan_bus(pci_bus0, &pci_root_ops, NULL); 104 pci_scan_bus_with_sysdata(pci_bus0);
105 pci_scan_bus(pci_bus1, &pci_root_ops, NULL); 105 pci_scan_bus_with_sysdata(pci_bus1);
106 pci_fixup_irqs(visws_swizzle, visws_map_irq); 106 pci_fixup_irqs(visws_swizzle, visws_map_irq);
107 pcibios_resource_survey(); 107 pcibios_resource_survey();
108 return 0; 108 return 0;
diff --git a/arch/i386/xen/enlighten.c b/arch/i386/xen/enlighten.c
index 9a8c1181c001..f0c37511d8da 100644
--- a/arch/i386/xen/enlighten.c
+++ b/arch/i386/xen/enlighten.c
@@ -842,7 +842,8 @@ void __init xen_setup_vcpu_info_placement(void)
842 } 842 }
843} 843}
844 844
845static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len) 845static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
846 unsigned long addr, unsigned len)
846{ 847{
847 char *start, *end, *reloc; 848 char *start, *end, *reloc;
848 unsigned ret; 849 unsigned ret;
@@ -869,7 +870,7 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len)
869 if (start == NULL || (end-start) > len) 870 if (start == NULL || (end-start) > len)
870 goto default_patch; 871 goto default_patch;
871 872
872 ret = paravirt_patch_insns(insns, len, start, end); 873 ret = paravirt_patch_insns(insnbuf, len, start, end);
873 874
874 /* Note: because reloc is assigned from something that 875 /* Note: because reloc is assigned from something that
875 appears to be an array, gcc assumes it's non-null, 876 appears to be an array, gcc assumes it's non-null,
@@ -877,8 +878,8 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len)
877 end. */ 878 end. */
878 if (reloc > start && reloc < end) { 879 if (reloc > start && reloc < end) {
879 int reloc_off = reloc - start; 880 int reloc_off = reloc - start;
880 long *relocp = (long *)(insns + reloc_off); 881 long *relocp = (long *)(insnbuf + reloc_off);
881 long delta = start - (char *)insns; 882 long delta = start - (char *)addr;
882 883
883 *relocp += delta; 884 *relocp += delta;
884 } 885 }
@@ -886,7 +887,8 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len)
886 887
887 default_patch: 888 default_patch:
888 default: 889 default:
889 ret = paravirt_patch_default(type, clobbers, insns, len); 890 ret = paravirt_patch_default(type, clobbers, insnbuf,
891 addr, len);
890 break; 892 break;
891 } 893 }
892 894
diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index b732644788db..13761bf160c4 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -134,20 +134,6 @@ static char *ft_next(struct ft_cxt *cxt, char *p, struct ft_atom *ret)
134#define HDR_SIZE _ALIGN(sizeof(struct boot_param_header), 8) 134#define HDR_SIZE _ALIGN(sizeof(struct boot_param_header), 8)
135#define EXPAND_INCR 1024 /* alloc this much extra when expanding */ 135#define EXPAND_INCR 1024 /* alloc this much extra when expanding */
136 136
137/* See if the regions are in the standard order and non-overlapping */
138static int ft_ordered(struct ft_cxt *cxt)
139{
140 char *p = (char *)cxt->bph + HDR_SIZE;
141 enum ft_rgn_id r;
142
143 for (r = FT_RSVMAP; r <= FT_STRINGS; ++r) {
144 if (p > cxt->rgn[r].start)
145 return 0;
146 p = cxt->rgn[r].start + cxt->rgn[r].size;
147 }
148 return p <= (char *)cxt->bph + cxt->max_size;
149}
150
151/* Copy the tree to a newly-allocated region and put things in order */ 137/* Copy the tree to a newly-allocated region and put things in order */
152static int ft_reorder(struct ft_cxt *cxt, int nextra) 138static int ft_reorder(struct ft_cxt *cxt, int nextra)
153{ 139{
@@ -573,10 +559,6 @@ int ft_open(struct ft_cxt *cxt, void *blob, unsigned int max_size,
573 cxt->rgn[FT_STRUCT].size = struct_size(cxt); 559 cxt->rgn[FT_STRUCT].size = struct_size(cxt);
574 cxt->rgn[FT_STRINGS].start = blob + be32_to_cpu(bph->off_dt_strings); 560 cxt->rgn[FT_STRINGS].start = blob + be32_to_cpu(bph->off_dt_strings);
575 cxt->rgn[FT_STRINGS].size = be32_to_cpu(bph->dt_strings_size); 561 cxt->rgn[FT_STRINGS].size = be32_to_cpu(bph->dt_strings_size);
576 /* Leave as '0' to force first ft_make_space call to do a ft_reorder
577 * and move dt to an area allocated by realloc.
578 cxt->isordered = ft_ordered(cxt);
579 */
580 562
581 cxt->p = cxt->rgn[FT_STRUCT].start; 563 cxt->p = cxt->rgn[FT_STRUCT].start;
582 cxt->str_anchor = cxt->rgn[FT_STRINGS].start; 564 cxt->str_anchor = cxt->rgn[FT_STRINGS].start;
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig
index d0b43df44426..ca7a197998ee 100644
--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -1,9 +1,23 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-rc6 3# Linux kernel version: 2.6.23-rc2
4# Tue Jun 26 14:15:19 2007 4# Tue Aug 7 19:17:26 2007
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7
8#
9# Processor support
10#
11# CONFIG_POWER4_ONLY is not set
12CONFIG_POWER3=y
13CONFIG_POWER4=y
14CONFIG_PPC_FPU=y
15CONFIG_ALTIVEC=y
16CONFIG_PPC_STD_MMU=y
17# CONFIG_PPC_MM_SLICES is not set
18CONFIG_VIRT_CPU_ACCOUNTING=y
19CONFIG_SMP=y
20CONFIG_NR_CPUS=2
7CONFIG_64BIT=y 21CONFIG_64BIT=y
8CONFIG_PPC_MERGE=y 22CONFIG_PPC_MERGE=y
9CONFIG_MMU=y 23CONFIG_MMU=y
@@ -15,6 +29,7 @@ CONFIG_ARCH_HAS_ILOG2_U64=y
15CONFIG_GENERIC_HWEIGHT=y 29CONFIG_GENERIC_HWEIGHT=y
16CONFIG_GENERIC_CALIBRATE_DELAY=y 30CONFIG_GENERIC_CALIBRATE_DELAY=y
17CONFIG_GENERIC_FIND_NEXT_BIT=y 31CONFIG_GENERIC_FIND_NEXT_BIT=y
32CONFIG_ARCH_NO_VIRT_TO_BUS=y
18CONFIG_PPC=y 33CONFIG_PPC=y
19CONFIG_EARLY_PRINTK=y 34CONFIG_EARLY_PRINTK=y
20CONFIG_COMPAT=y 35CONFIG_COMPAT=y
@@ -22,50 +37,32 @@ CONFIG_SYSVIPC_COMPAT=y
22CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 37CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
23CONFIG_ARCH_MAY_HAVE_PC_FDC=y 38CONFIG_ARCH_MAY_HAVE_PC_FDC=y
24CONFIG_PPC_OF=y 39CONFIG_PPC_OF=y
40CONFIG_OF=y
25# CONFIG_PPC_UDBG_16550 is not set 41# CONFIG_PPC_UDBG_16550 is not set
26# CONFIG_GENERIC_TBSYNC is not set 42# CONFIG_GENERIC_TBSYNC is not set
27CONFIG_AUDIT_ARCH=y 43CONFIG_AUDIT_ARCH=y
28CONFIG_GENERIC_BUG=y 44CONFIG_GENERIC_BUG=y
29# CONFIG_DEFAULT_UIMAGE is not set 45# CONFIG_DEFAULT_UIMAGE is not set
30
31#
32# Processor support
33#
34# CONFIG_POWER4_ONLY is not set
35CONFIG_POWER3=y
36CONFIG_POWER4=y
37CONFIG_PPC_FPU=y
38# CONFIG_PPC_DCR_NATIVE is not set 46# CONFIG_PPC_DCR_NATIVE is not set
39# CONFIG_PPC_DCR_MMIO is not set 47# CONFIG_PPC_DCR_MMIO is not set
40# CONFIG_PPC_OF_PLATFORM_PCI is not set 48# CONFIG_PPC_OF_PLATFORM_PCI is not set
41CONFIG_ALTIVEC=y
42CONFIG_PPC_STD_MMU=y
43# CONFIG_PPC_MM_SLICES is not set
44CONFIG_VIRT_CPU_ACCOUNTING=y
45CONFIG_SMP=y
46CONFIG_NR_CPUS=2
47CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 49CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
48 50
49# 51#
50# Code maturity level options 52# General setup
51# 53#
52CONFIG_EXPERIMENTAL=y 54CONFIG_EXPERIMENTAL=y
53CONFIG_LOCK_KERNEL=y 55CONFIG_LOCK_KERNEL=y
54CONFIG_INIT_ENV_ARG_LIMIT=32 56CONFIG_INIT_ENV_ARG_LIMIT=32
55
56#
57# General setup
58#
59CONFIG_LOCALVERSION="" 57CONFIG_LOCALVERSION=""
60CONFIG_LOCALVERSION_AUTO=y 58CONFIG_LOCALVERSION_AUTO=y
61CONFIG_SWAP=y 59CONFIG_SWAP=y
62CONFIG_SYSVIPC=y 60CONFIG_SYSVIPC=y
63# CONFIG_IPC_NS is not set
64CONFIG_SYSVIPC_SYSCTL=y 61CONFIG_SYSVIPC_SYSCTL=y
65# CONFIG_POSIX_MQUEUE is not set 62# CONFIG_POSIX_MQUEUE is not set
66# CONFIG_BSD_PROCESS_ACCT is not set 63# CONFIG_BSD_PROCESS_ACCT is not set
67# CONFIG_TASKSTATS is not set 64# CONFIG_TASKSTATS is not set
68# CONFIG_UTS_NS is not set 65# CONFIG_USER_NS is not set
69# CONFIG_AUDIT is not set 66# CONFIG_AUDIT is not set
70# CONFIG_IKCONFIG is not set 67# CONFIG_IKCONFIG is not set
71CONFIG_LOG_BUF_SHIFT=17 68CONFIG_LOG_BUF_SHIFT=17
@@ -100,10 +97,6 @@ CONFIG_SLAB=y
100CONFIG_RT_MUTEXES=y 97CONFIG_RT_MUTEXES=y
101# CONFIG_TINY_SHMEM is not set 98# CONFIG_TINY_SHMEM is not set
102CONFIG_BASE_SMALL=0 99CONFIG_BASE_SMALL=0
103
104#
105# Loadable module support
106#
107CONFIG_MODULES=y 100CONFIG_MODULES=y
108CONFIG_MODULE_UNLOAD=y 101CONFIG_MODULE_UNLOAD=y
109# CONFIG_MODULE_FORCE_UNLOAD is not set 102# CONFIG_MODULE_FORCE_UNLOAD is not set
@@ -111,12 +104,9 @@ CONFIG_MODULE_UNLOAD=y
111# CONFIG_MODULE_SRCVERSION_ALL is not set 104# CONFIG_MODULE_SRCVERSION_ALL is not set
112CONFIG_KMOD=y 105CONFIG_KMOD=y
113CONFIG_STOP_MACHINE=y 106CONFIG_STOP_MACHINE=y
114
115#
116# Block layer
117#
118CONFIG_BLOCK=y 107CONFIG_BLOCK=y
119# CONFIG_BLK_DEV_IO_TRACE is not set 108# CONFIG_BLK_DEV_IO_TRACE is not set
109CONFIG_BLK_DEV_BSG=y
120 110
121# 111#
122# IO Schedulers 112# IO Schedulers
@@ -136,7 +126,9 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
136# 126#
137CONFIG_PPC_MULTIPLATFORM=y 127CONFIG_PPC_MULTIPLATFORM=y
138# CONFIG_EMBEDDED6xx is not set 128# CONFIG_EMBEDDED6xx is not set
139# CONFIG_APUS is not set 129# CONFIG_PPC_82xx is not set
130# CONFIG_PPC_83xx is not set
131# CONFIG_PPC_86xx is not set
140# CONFIG_PPC_PSERIES is not set 132# CONFIG_PPC_PSERIES is not set
141# CONFIG_PPC_ISERIES is not set 133# CONFIG_PPC_ISERIES is not set
142# CONFIG_PPC_MPC52xx is not set 134# CONFIG_PPC_MPC52xx is not set
@@ -223,6 +215,7 @@ CONFIG_MEMORY_HOTPLUG_SPARSE=y
223CONFIG_SPLIT_PTLOCK_CPUS=4 215CONFIG_SPLIT_PTLOCK_CPUS=4
224CONFIG_RESOURCES_64BIT=y 216CONFIG_RESOURCES_64BIT=y
225CONFIG_ZONE_DMA_FLAG=1 217CONFIG_ZONE_DMA_FLAG=1
218CONFIG_BOUNCE=y
226CONFIG_ARCH_MEMORY_PROBE=y 219CONFIG_ARCH_MEMORY_PROBE=y
227# CONFIG_PPC_HAS_HASH_64K is not set 220# CONFIG_PPC_HAS_HASH_64K is not set
228# CONFIG_PPC_64K_PAGES is not set 221# CONFIG_PPC_64K_PAGES is not set
@@ -241,6 +234,7 @@ CONFIG_ZONE_DMA=y
241CONFIG_GENERIC_ISA_DMA=y 234CONFIG_GENERIC_ISA_DMA=y
242# CONFIG_PCI is not set 235# CONFIG_PCI is not set
243# CONFIG_PCI_DOMAINS is not set 236# CONFIG_PCI_DOMAINS is not set
237# CONFIG_PCI_SYSCALL is not set
244# CONFIG_ARCH_SUPPORTS_MSI is not set 238# CONFIG_ARCH_SUPPORTS_MSI is not set
245 239
246# 240#
@@ -365,6 +359,7 @@ CONFIG_WIRELESS_EXT=y
365# CONFIG_MAC80211 is not set 359# CONFIG_MAC80211 is not set
366# CONFIG_IEEE80211 is not set 360# CONFIG_IEEE80211 is not set
367# CONFIG_RFKILL is not set 361# CONFIG_RFKILL is not set
362# CONFIG_NET_9P is not set
368 363
369# 364#
370# Device Drivers 365# Device Drivers
@@ -379,26 +374,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
379# CONFIG_DEBUG_DRIVER is not set 374# CONFIG_DEBUG_DRIVER is not set
380# CONFIG_DEBUG_DEVRES is not set 375# CONFIG_DEBUG_DEVRES is not set
381# CONFIG_SYS_HYPERVISOR is not set 376# CONFIG_SYS_HYPERVISOR is not set
382
383#
384# Connector - unified userspace <-> kernelspace linker
385#
386# CONFIG_CONNECTOR is not set 377# CONFIG_CONNECTOR is not set
387# CONFIG_MTD is not set 378# CONFIG_MTD is not set
388 379CONFIG_OF_DEVICE=y
389#
390# Parallel port support
391#
392# CONFIG_PARPORT is not set 380# CONFIG_PARPORT is not set
393 381CONFIG_BLK_DEV=y
394#
395# Plug and Play support
396#
397# CONFIG_PNPACPI is not set
398
399#
400# Block devices
401#
402# CONFIG_BLK_DEV_FD is not set 382# CONFIG_BLK_DEV_FD is not set
403# CONFIG_BLK_DEV_COW_COMMON is not set 383# CONFIG_BLK_DEV_COW_COMMON is not set
404CONFIG_BLK_DEV_LOOP=y 384CONFIG_BLK_DEV_LOOP=y
@@ -411,11 +391,8 @@ CONFIG_BLK_DEV_RAM_SIZE=65535
411CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 391CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
412# CONFIG_CDROM_PKTCDVD is not set 392# CONFIG_CDROM_PKTCDVD is not set
413# CONFIG_ATA_OVER_ETH is not set 393# CONFIG_ATA_OVER_ETH is not set
414 394CONFIG_MISC_DEVICES=y
415# 395# CONFIG_EEPROM_93CX6 is not set
416# Misc devices
417#
418# CONFIG_BLINK is not set
419# CONFIG_IDE is not set 396# CONFIG_IDE is not set
420 397
421# 398#
@@ -423,6 +400,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
423# 400#
424# CONFIG_RAID_ATTRS is not set 401# CONFIG_RAID_ATTRS is not set
425CONFIG_SCSI=y 402CONFIG_SCSI=y
403CONFIG_SCSI_DMA=y
426# CONFIG_SCSI_TGT is not set 404# CONFIG_SCSI_TGT is not set
427# CONFIG_SCSI_NETLINK is not set 405# CONFIG_SCSI_NETLINK is not set
428CONFIG_SCSI_PROC_FS=y 406CONFIG_SCSI_PROC_FS=y
@@ -455,37 +433,22 @@ CONFIG_SCSI_WAIT_SCAN=m
455# CONFIG_SCSI_ISCSI_ATTRS is not set 433# CONFIG_SCSI_ISCSI_ATTRS is not set
456# CONFIG_SCSI_SAS_ATTRS is not set 434# CONFIG_SCSI_SAS_ATTRS is not set
457# CONFIG_SCSI_SAS_LIBSAS is not set 435# CONFIG_SCSI_SAS_LIBSAS is not set
458 436# CONFIG_SCSI_LOWLEVEL is not set
459#
460# SCSI low-level drivers
461#
462# CONFIG_ISCSI_TCP is not set
463# CONFIG_SCSI_DEBUG is not set
464# CONFIG_ATA is not set 437# CONFIG_ATA is not set
465
466#
467# Multi-device support (RAID and LVM)
468#
469# CONFIG_MD is not set 438# CONFIG_MD is not set
470# CONFIG_MACINTOSH_DRIVERS is not set 439# CONFIG_MACINTOSH_DRIVERS is not set
471
472#
473# Network device support
474#
475CONFIG_NETDEVICES=y 440CONFIG_NETDEVICES=y
441# CONFIG_NETDEVICES_MULTIQUEUE is not set
476# CONFIG_DUMMY is not set 442# CONFIG_DUMMY is not set
477# CONFIG_BONDING is not set 443# CONFIG_BONDING is not set
444# CONFIG_MACVLAN is not set
478# CONFIG_EQUALIZER is not set 445# CONFIG_EQUALIZER is not set
479# CONFIG_TUN is not set 446# CONFIG_TUN is not set
480
481#
482# Ethernet (10 or 100Mbit)
483#
484# CONFIG_NET_ETHERNET is not set 447# CONFIG_NET_ETHERNET is not set
485CONFIG_MII=m 448CONFIG_MII=m
486CONFIG_NETDEV_1000=y 449CONFIG_NETDEV_1000=y
487CONFIG_NETDEV_10000=y
488CONFIG_GELIC_NET=y 450CONFIG_GELIC_NET=y
451# CONFIG_NETDEV_10000 is not set
489 452
490# 453#
491# Wireless LAN 454# Wireless LAN
@@ -518,15 +481,7 @@ CONFIG_USB_NET_MCS7830=m
518# CONFIG_NETCONSOLE is not set 481# CONFIG_NETCONSOLE is not set
519# CONFIG_NETPOLL is not set 482# CONFIG_NETPOLL is not set
520# CONFIG_NET_POLL_CONTROLLER is not set 483# CONFIG_NET_POLL_CONTROLLER is not set
521
522#
523# ISDN subsystem
524#
525# CONFIG_ISDN is not set 484# CONFIG_ISDN is not set
526
527#
528# Telephony Support
529#
530# CONFIG_PHONE is not set 485# CONFIG_PHONE is not set
531 486
532# 487#
@@ -604,10 +559,6 @@ CONFIG_VT_HW_CONSOLE_BINDING=y
604CONFIG_UNIX98_PTYS=y 559CONFIG_UNIX98_PTYS=y
605CONFIG_LEGACY_PTYS=y 560CONFIG_LEGACY_PTYS=y
606CONFIG_LEGACY_PTY_COUNT=16 561CONFIG_LEGACY_PTY_COUNT=16
607
608#
609# IPMI
610#
611# CONFIG_IPMI_HANDLER is not set 562# CONFIG_IPMI_HANDLER is not set
612# CONFIG_WATCHDOG is not set 563# CONFIG_WATCHDOG is not set
613# CONFIG_HW_RANDOM is not set 564# CONFIG_HW_RANDOM is not set
@@ -616,10 +567,6 @@ CONFIG_GEN_RTC=y
616# CONFIG_R3964 is not set 567# CONFIG_R3964 is not set
617# CONFIG_RAW_DRIVER is not set 568# CONFIG_RAW_DRIVER is not set
618# CONFIG_HANGCHECK_TIMER is not set 569# CONFIG_HANGCHECK_TIMER is not set
619
620#
621# TPM devices
622#
623# CONFIG_TCG_TPM is not set 570# CONFIG_TCG_TPM is not set
624# CONFIG_I2C is not set 571# CONFIG_I2C is not set
625 572
@@ -628,11 +575,8 @@ CONFIG_GEN_RTC=y
628# 575#
629# CONFIG_SPI is not set 576# CONFIG_SPI is not set
630# CONFIG_SPI_MASTER is not set 577# CONFIG_SPI_MASTER is not set
631
632#
633# Dallas's 1-wire bus
634#
635# CONFIG_W1 is not set 578# CONFIG_W1 is not set
579# CONFIG_POWER_SUPPLY is not set
636# CONFIG_HWMON is not set 580# CONFIG_HWMON is not set
637 581
638# 582#
@@ -657,6 +601,7 @@ CONFIG_GEN_RTC=y
657# 601#
658# CONFIG_DISPLAY_SUPPORT is not set 602# CONFIG_DISPLAY_SUPPORT is not set
659# CONFIG_VGASTATE is not set 603# CONFIG_VGASTATE is not set
604CONFIG_VIDEO_OUTPUT_CONTROL=m
660CONFIG_FB=y 605CONFIG_FB=y
661# CONFIG_FIRMWARE_EDID is not set 606# CONFIG_FIRMWARE_EDID is not set
662# CONFIG_FB_DDC is not set 607# CONFIG_FB_DDC is not set
@@ -691,11 +636,13 @@ CONFIG_FB_PS3_DEFAULT_SIZE_M=18
691# CONFIG_VGA_CONSOLE is not set 636# CONFIG_VGA_CONSOLE is not set
692CONFIG_DUMMY_CONSOLE=y 637CONFIG_DUMMY_CONSOLE=y
693CONFIG_FRAMEBUFFER_CONSOLE=y 638CONFIG_FRAMEBUFFER_CONSOLE=y
639CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
694CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y 640CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
695# CONFIG_FONTS is not set 641# CONFIG_FONTS is not set
696CONFIG_FONT_8x8=y 642CONFIG_FONT_8x8=y
697CONFIG_FONT_8x16=y 643CONFIG_FONT_8x16=y
698CONFIG_LOGO=y 644CONFIG_LOGO=y
645CONFIG_FB_LOGO_EXTRA=y
699# CONFIG_LOGO_LINUX_MONO is not set 646# CONFIG_LOGO_LINUX_MONO is not set
700# CONFIG_LOGO_LINUX_VGA16 is not set 647# CONFIG_LOGO_LINUX_VGA16 is not set
701CONFIG_LOGO_LINUX_CLUT224=y 648CONFIG_LOGO_LINUX_CLUT224=y
@@ -709,6 +656,8 @@ CONFIG_SOUND=y
709# Advanced Linux Sound Architecture 656# Advanced Linux Sound Architecture
710# 657#
711CONFIG_SND=y 658CONFIG_SND=y
659CONFIG_SND_TIMER=y
660CONFIG_SND_PCM=y
712# CONFIG_SND_SEQUENCER is not set 661# CONFIG_SND_SEQUENCER is not set
713# CONFIG_SND_MIXER_OSS is not set 662# CONFIG_SND_MIXER_OSS is not set
714# CONFIG_SND_PCM_OSS is not set 663# CONFIG_SND_PCM_OSS is not set
@@ -735,6 +684,12 @@ CONFIG_SND_VERBOSE_PROCFS=y
735# 684#
736 685
737# 686#
687# ALSA PowerPC devices
688#
689CONFIG_SND_PS3=y
690CONFIG_SND_PS3_DEFAULT_START_DELAY=2000
691
692#
738# USB devices 693# USB devices
739# 694#
740# CONFIG_SND_USB_AUDIO is not set 695# CONFIG_SND_USB_AUDIO is not set
@@ -747,13 +702,14 @@ CONFIG_SND_VERBOSE_PROCFS=y
747# CONFIG_SND_SOC is not set 702# CONFIG_SND_SOC is not set
748 703
749# 704#
750# Open Sound System 705# SoC Audio support for SuperH
751# 706#
752# CONFIG_SOUND_PRIME is not set
753 707
754# 708#
755# HID Devices 709# Open Sound System
756# 710#
711# CONFIG_SOUND_PRIME is not set
712CONFIG_HID_SUPPORT=y
757CONFIG_HID=y 713CONFIG_HID=y
758# CONFIG_HID_DEBUG is not set 714# CONFIG_HID_DEBUG is not set
759 715
@@ -770,10 +726,7 @@ CONFIG_USB_HID=m
770# 726#
771# CONFIG_USB_KBD is not set 727# CONFIG_USB_KBD is not set
772# CONFIG_USB_MOUSE is not set 728# CONFIG_USB_MOUSE is not set
773 729CONFIG_USB_SUPPORT=y
774#
775# USB support
776#
777CONFIG_USB_ARCH_HAS_HCD=y 730CONFIG_USB_ARCH_HAS_HCD=y
778CONFIG_USB_ARCH_HAS_OHCI=y 731CONFIG_USB_ARCH_HAS_OHCI=y
779CONFIG_USB_ARCH_HAS_EHCI=y 732CONFIG_USB_ARCH_HAS_EHCI=y
@@ -803,6 +756,7 @@ CONFIG_USB_OHCI_HCD=y
803CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y 756CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
804CONFIG_USB_OHCI_LITTLE_ENDIAN=y 757CONFIG_USB_OHCI_LITTLE_ENDIAN=y
805# CONFIG_USB_SL811_HCD is not set 758# CONFIG_USB_SL811_HCD is not set
759# CONFIG_USB_R8A66597_HCD is not set
806 760
807# 761#
808# USB Device Class drivers 762# USB Device Class drivers
@@ -879,31 +833,8 @@ CONFIG_USB_MON=y
879# 833#
880# CONFIG_USB_GADGET is not set 834# CONFIG_USB_GADGET is not set
881# CONFIG_MMC is not set 835# CONFIG_MMC is not set
882
883#
884# LED devices
885#
886# CONFIG_NEW_LEDS is not set 836# CONFIG_NEW_LEDS is not set
887 837# CONFIG_EDAC is not set
888#
889# LED drivers
890#
891
892#
893# LED Triggers
894#
895
896#
897# InfiniBand support
898#
899
900#
901# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
902#
903
904#
905# Real Time Clock
906#
907# CONFIG_RTC_CLASS is not set 838# CONFIG_RTC_CLASS is not set
908 839
909# 840#
@@ -920,6 +851,11 @@ CONFIG_USB_MON=y
920# 851#
921 852
922# 853#
854# Userspace I/O
855#
856# CONFIG_UIO is not set
857
858#
923# File systems 859# File systems
924# 860#
925CONFIG_EXT2_FS=m 861CONFIG_EXT2_FS=m
@@ -948,8 +884,8 @@ CONFIG_QUOTA=y
948CONFIG_QFMT_V2=y 884CONFIG_QFMT_V2=y
949CONFIG_QUOTACTL=y 885CONFIG_QUOTACTL=y
950CONFIG_DNOTIFY=y 886CONFIG_DNOTIFY=y
951# CONFIG_AUTOFS_FS is not set 887CONFIG_AUTOFS_FS=m
952CONFIG_AUTOFS4_FS=y 888CONFIG_AUTOFS4_FS=m
953# CONFIG_FUSE_FS is not set 889# CONFIG_FUSE_FS is not set
954 890
955# 891#
@@ -1030,7 +966,6 @@ CONFIG_CIFS=m
1030# CONFIG_NCP_FS is not set 966# CONFIG_NCP_FS is not set
1031# CONFIG_CODA_FS is not set 967# CONFIG_CODA_FS is not set
1032# CONFIG_AFS_FS is not set 968# CONFIG_AFS_FS is not set
1033# CONFIG_9P_FS is not set
1034 969
1035# 970#
1036# Partition Types 971# Partition Types
@@ -1096,6 +1031,7 @@ CONFIG_BITREVERSE=y
1096# CONFIG_CRC16 is not set 1031# CONFIG_CRC16 is not set
1097# CONFIG_CRC_ITU_T is not set 1032# CONFIG_CRC_ITU_T is not set
1098CONFIG_CRC32=y 1033CONFIG_CRC32=y
1034# CONFIG_CRC7 is not set
1099# CONFIG_LIBCRC32C is not set 1035# CONFIG_LIBCRC32C is not set
1100CONFIG_PLIST=y 1036CONFIG_PLIST=y
1101CONFIG_HAS_IOMEM=y 1037CONFIG_HAS_IOMEM=y
@@ -1120,6 +1056,7 @@ CONFIG_MAGIC_SYSRQ=y
1120CONFIG_DEBUG_KERNEL=y 1056CONFIG_DEBUG_KERNEL=y
1121# CONFIG_DEBUG_SHIRQ is not set 1057# CONFIG_DEBUG_SHIRQ is not set
1122CONFIG_DETECT_SOFTLOCKUP=y 1058CONFIG_DETECT_SOFTLOCKUP=y
1059CONFIG_SCHED_DEBUG=y
1123# CONFIG_SCHEDSTATS is not set 1060# CONFIG_SCHEDSTATS is not set
1124# CONFIG_TIMER_STATS is not set 1061# CONFIG_TIMER_STATS is not set
1125# CONFIG_DEBUG_SLAB is not set 1062# CONFIG_DEBUG_SLAB is not set
@@ -1150,10 +1087,6 @@ CONFIG_IRQSTACKS=y
1150# 1087#
1151# CONFIG_KEYS is not set 1088# CONFIG_KEYS is not set
1152# CONFIG_SECURITY is not set 1089# CONFIG_SECURITY is not set
1153
1154#
1155# Cryptographic options
1156#
1157CONFIG_CRYPTO=y 1090CONFIG_CRYPTO=y
1158CONFIG_CRYPTO_ALGAPI=y 1091CONFIG_CRYPTO_ALGAPI=y
1159CONFIG_CRYPTO_BLKCIPHER=y 1092CONFIG_CRYPTO_BLKCIPHER=y
@@ -1191,7 +1124,4 @@ CONFIG_CRYPTO_DES=y
1191# CONFIG_CRYPTO_CRC32C is not set 1124# CONFIG_CRYPTO_CRC32C is not set
1192# CONFIG_CRYPTO_CAMELLIA is not set 1125# CONFIG_CRYPTO_CAMELLIA is not set
1193# CONFIG_CRYPTO_TEST is not set 1126# CONFIG_CRYPTO_TEST is not set
1194 1127CONFIG_CRYPTO_HW=y
1195#
1196# Hardware crypto devices
1197#
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index f39a72f30aad..b0cb2e662c25 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -81,6 +81,7 @@ obj-y += iomap.o
81endif 81endif
82 82
83ifeq ($(CONFIG_PPC_ISERIES),y) 83ifeq ($(CONFIG_PPC_ISERIES),y)
84CFLAGS_lparmap.s += -g0
84extra-y += lparmap.s 85extra-y += lparmap.s
85$(obj)/head_64.o: $(obj)/lparmap.s 86$(obj)/head_64.o: $(obj)/lparmap.s
86AFLAGS_head_64.o += -I$(obj) 87AFLAGS_head_64.o += -I$(obj)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 9ef28da2c7fe..952eba6701f4 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -389,8 +389,11 @@ BEGIN_FTR_SECTION
389 ld r9,PACA_SLBSHADOWPTR(r13) 389 ld r9,PACA_SLBSHADOWPTR(r13)
390 li r12,0 390 li r12,0
391 std r12,SLBSHADOW_STACKESID(r9) /* Clear ESID */ 391 std r12,SLBSHADOW_STACKESID(r9) /* Clear ESID */
392 eieio
392 std r7,SLBSHADOW_STACKVSID(r9) /* Save VSID */ 393 std r7,SLBSHADOW_STACKVSID(r9) /* Save VSID */
394 eieio
393 std r0,SLBSHADOW_STACKESID(r9) /* Save ESID */ 395 std r0,SLBSHADOW_STACKESID(r9) /* Save ESID */
396 eieio
394 397
395 slbie r6 398 slbie r6
396 slbie r6 /* Workaround POWER5 < DD2.1 issue */ 399 slbie r6 /* Workaround POWER5 < DD2.1 issue */
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 1448af92c6a9..171800002ede 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -1672,8 +1672,9 @@ _GLOBAL(__start_initialization_multiplatform)
1672 * Are we booted from a PROM Of-type client-interface ? 1672 * Are we booted from a PROM Of-type client-interface ?
1673 */ 1673 */
1674 cmpldi cr0,r5,0 1674 cmpldi cr0,r5,0
1675 bne .__boot_from_prom /* yes -> prom */ 1675 beq 1f
1676 1676 b .__boot_from_prom /* yes -> prom */
16771:
1677 /* Save parameters */ 1678 /* Save parameters */
1678 mr r31,r3 1679 mr r31,r3
1679 mr r30,r4 1680 mr r30,r4
@@ -1701,7 +1702,7 @@ _GLOBAL(__start_initialization_multiplatform)
1701 bl .__mmu_off 1702 bl .__mmu_off
1702 b .__after_prom_start 1703 b .__after_prom_start
1703 1704
1704_STATIC(__boot_from_prom) 1705_INIT_STATIC(__boot_from_prom)
1705 /* Save parameters */ 1706 /* Save parameters */
1706 mr r31,r3 1707 mr r31,r3
1707 mr r30,r4 1708 mr r30,r4
@@ -1768,9 +1769,10 @@ _STATIC(__after_prom_start)
1768 /* the source addr */ 1769 /* the source addr */
1769 1770
1770 cmpdi r4,0 /* In some cases the loader may */ 1771 cmpdi r4,0 /* In some cases the loader may */
1771 beq .start_here_multiplatform /* have already put us at zero */ 1772 bne 1f
1773 b .start_here_multiplatform /* have already put us at zero */
1772 /* so we can skip the copy. */ 1774 /* so we can skip the copy. */
1773 LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */ 17751: LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */
1774 sub r5,r5,r27 1776 sub r5,r5,r27
1775 1777
1776 li r6,0x100 /* Start offset, the first 0x100 */ 1778 li r6,0x100 /* Start offset, the first 0x100 */
@@ -1957,7 +1959,7 @@ _GLOBAL(enable_64b_mode)
1957/* 1959/*
1958 * This is where the main kernel code starts. 1960 * This is where the main kernel code starts.
1959 */ 1961 */
1960_STATIC(start_here_multiplatform) 1962_INIT_STATIC(start_here_multiplatform)
1961 /* get a new offset, now that the kernel has moved. */ 1963 /* get a new offset, now that the kernel has moved. */
1962 bl .reloc_offset 1964 bl .reloc_offset
1963 mr r26,r3 1965 mr r26,r3
@@ -2019,7 +2021,7 @@ _STATIC(start_here_multiplatform)
2019 b . /* prevent speculative execution */ 2021 b . /* prevent speculative execution */
2020 2022
2021 /* This is where all platforms converge execution */ 2023 /* This is where all platforms converge execution */
2022_STATIC(start_here_common) 2024_INIT_STATIC(start_here_common)
2023 /* relocation is on at this point */ 2025 /* relocation is on at this point */
2024 2026
2025 /* The following code sets up the SP and TOC now that we are */ 2027 /* The following code sets up the SP and TOC now that we are */
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index e708ab7ca9e8..8533de50347d 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -301,9 +301,19 @@ _GLOBAL(_tlbie)
301 mfspr r4,SPRN_MMUCR 301 mfspr r4,SPRN_MMUCR
302 mfspr r5,SPRN_PID /* Get PID */ 302 mfspr r5,SPRN_PID /* Get PID */
303 rlwimi r4,r5,0,24,31 /* Set TID */ 303 rlwimi r4,r5,0,24,31 /* Set TID */
304 mtspr SPRN_MMUCR,r4
305 304
305 /* We have to run the search with interrupts disabled, even critical
306 * and debug interrupts (in fact the only critical exceptions we have
307 * are debug and machine check). Otherwise an interrupt which causes
308 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
309 mfmsr r5
310 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
311 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
312 andc r6,r5,r6
313 mtmsr r6
314 mtspr SPRN_MMUCR,r4
306 tlbsx. r3, 0, r3 315 tlbsx. r3, 0, r3
316 mtmsr r5
307 bne 10f 317 bne 10f
308 sync 318 sync
309 /* There are only 64 TLB entries, so r3 < 64, 319 /* There are only 64 TLB entries, so r3 < 64,
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index cd35c969bb28..04a3109ae3c6 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -581,8 +581,11 @@ pcibios_assign_resources(void)
581 if ((r->flags & IORESOURCE_UNSET) && r->end && 581 if ((r->flags & IORESOURCE_UNSET) && r->end &&
582 (!ppc_md.pcibios_enable_device_hook || 582 (!ppc_md.pcibios_enable_device_hook ||
583 !ppc_md.pcibios_enable_device_hook(dev, 1))) { 583 !ppc_md.pcibios_enable_device_hook(dev, 1))) {
584 int rc;
585
584 r->flags &= ~IORESOURCE_UNSET; 586 r->flags &= ~IORESOURCE_UNSET;
585 pci_assign_resource(dev, idx); 587 rc = pci_assign_resource(dev, idx);
588 BUG_ON(rc);
586 } 589 }
587 } 590 }
588 591
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index a97e23ac1976..291ffbc360c9 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -313,6 +313,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
313 313
314 dev->current_state = 4; /* unknown power state */ 314 dev->current_state = 4; /* unknown power state */
315 dev->error_state = pci_channel_io_normal; 315 dev->error_state = pci_channel_io_normal;
316 dev->dma_mask = 0xffffffff;
316 317
317 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { 318 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
318 /* a PCI-PCI bridge */ 319 /* a PCI-PCI bridge */
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 087c92f2a3eb..1ea43160f543 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -212,11 +212,6 @@ int smp_call_function_map(void (*func) (void *info), void *info, int nonatomic,
212 atomic_set(&data.finished, 0); 212 atomic_set(&data.finished, 0);
213 213
214 spin_lock(&call_lock); 214 spin_lock(&call_lock);
215 /* Must grab online cpu count with preempt disabled, otherwise
216 * it can change. */
217 num_cpus = num_online_cpus() - 1;
218 if (!num_cpus)
219 goto done;
220 215
221 /* remove 'self' from the map */ 216 /* remove 'self' from the map */
222 if (cpu_isset(smp_processor_id(), map)) 217 if (cpu_isset(smp_processor_id(), map))
@@ -224,7 +219,9 @@ int smp_call_function_map(void (*func) (void *info), void *info, int nonatomic,
224 219
225 /* sanity check the map, remove any non-online processors. */ 220 /* sanity check the map, remove any non-online processors. */
226 cpus_and(map, map, cpu_online_map); 221 cpus_and(map, map, cpu_online_map);
227 if (cpus_empty(map)) 222
223 num_cpus = cpus_weight(map);
224 if (!num_cpus)
228 goto done; 225 goto done;
229 226
230 call_data = &data; 227 call_data = &data;
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index 4762ff7c14df..35eabfb50723 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -472,10 +472,12 @@ _GLOBAL(htab_call_hpte_insert1)
472 /* Now try secondary slot */ 472 /* Now try secondary slot */
473 473
474 /* real page number in r5, PTE RPN value + index */ 474 /* real page number in r5, PTE RPN value + index */
475 rldicl r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT 475 andis. r0,r31,_PAGE_4K_PFN@h
476 srdi r5,r31,PTE_RPN_SHIFT
477 bne- 3f
476 sldi r5,r5,PAGE_SHIFT-HW_PAGE_SHIFT 478 sldi r5,r5,PAGE_SHIFT-HW_PAGE_SHIFT
477 add r5,r5,r25 479 add r5,r5,r25
478 sldi r5,r5,HW_PAGE_SHIFT 4803: sldi r5,r5,HW_PAGE_SHIFT
479 481
480 /* Calculate secondary group hash */ 482 /* Calculate secondary group hash */
481 andc r0,r27,r28 483 andc r0,r27,r28
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index bc7b0cedae5e..a47151e806ca 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -759,7 +759,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
759 mmu_psize_defs[mmu_vmalloc_psize].sllp) { 759 mmu_psize_defs[mmu_vmalloc_psize].sllp) {
760 get_paca()->vmalloc_sllp = 760 get_paca()->vmalloc_sllp =
761 mmu_psize_defs[mmu_vmalloc_psize].sllp; 761 mmu_psize_defs[mmu_vmalloc_psize].sllp;
762 slb_flush_and_rebolt(); 762 slb_vmalloc_update();
763 } 763 }
764#endif /* CONFIG_PPC_64K_PAGES */ 764#endif /* CONFIG_PPC_64K_PAGES */
765 765
@@ -795,7 +795,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
795 795
796#ifdef CONFIG_PPC_MM_SLICES 796#ifdef CONFIG_PPC_MM_SLICES
797 /* We only prefault standard pages for now */ 797 /* We only prefault standard pages for now */
798 if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize)); 798 if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize))
799 return; 799 return;
800#endif 800#endif
801 801
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index de45aa82d97b..c12adc3ddffd 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -307,9 +307,9 @@ static void __init parse_drconf_memory(struct device_node *memory)
307 const unsigned int *lm, *dm, *aa; 307 const unsigned int *lm, *dm, *aa;
308 unsigned int ls, ld, la; 308 unsigned int ls, ld, la;
309 unsigned int n, aam, aalen; 309 unsigned int n, aam, aalen;
310 unsigned long lmb_size, size; 310 unsigned long lmb_size, size, start;
311 int nid, default_nid = 0; 311 int nid, default_nid = 0;
312 unsigned int start, ai, flags; 312 unsigned int ai, flags;
313 313
314 lm = of_get_property(memory, "ibm,lmb-size", &ls); 314 lm = of_get_property(memory, "ibm,lmb-size", &ls);
315 dm = of_get_property(memory, "ibm,dynamic-memory", &ld); 315 dm = of_get_property(memory, "ibm,dynamic-memory", &ld);
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index 304375a73574..a73d2d700973 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -53,7 +53,8 @@ static inline unsigned long mk_vsid_data(unsigned long ea, unsigned long flags)
53 return (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | flags; 53 return (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | flags;
54} 54}
55 55
56static inline void slb_shadow_update(unsigned long esid, unsigned long vsid, 56static inline void slb_shadow_update(unsigned long ea,
57 unsigned long flags,
57 unsigned long entry) 58 unsigned long entry)
58{ 59{
59 /* 60 /*
@@ -61,28 +62,16 @@ static inline void slb_shadow_update(unsigned long esid, unsigned long vsid,
61 * updating it. 62 * updating it.
62 */ 63 */
63 get_slb_shadow()->save_area[entry].esid = 0; 64 get_slb_shadow()->save_area[entry].esid = 0;
64 barrier(); 65 smp_wmb();
65 get_slb_shadow()->save_area[entry].vsid = vsid; 66 get_slb_shadow()->save_area[entry].vsid = mk_vsid_data(ea, flags);
66 barrier(); 67 smp_wmb();
67 get_slb_shadow()->save_area[entry].esid = esid; 68 get_slb_shadow()->save_area[entry].esid = mk_esid_data(ea, entry);
68 69 smp_wmb();
69} 70}
70 71
71static inline void create_shadowed_slbe(unsigned long ea, unsigned long flags, 72static inline void slb_shadow_clear(unsigned long entry)
72 unsigned long entry)
73{ 73{
74 /* 74 get_slb_shadow()->save_area[entry].esid = 0;
75 * Updating the shadow buffer before writing the SLB ensures
76 * we don't get a stale entry here if we get preempted by PHYP
77 * between these two statements.
78 */
79 slb_shadow_update(mk_esid_data(ea, entry), mk_vsid_data(ea, flags),
80 entry);
81
82 asm volatile("slbmte %0,%1" :
83 : "r" (mk_vsid_data(ea, flags)),
84 "r" (mk_esid_data(ea, entry))
85 : "memory" );
86} 75}
87 76
88void slb_flush_and_rebolt(void) 77void slb_flush_and_rebolt(void)
@@ -100,12 +89,13 @@ void slb_flush_and_rebolt(void)
100 vflags = SLB_VSID_KERNEL | vmalloc_llp; 89 vflags = SLB_VSID_KERNEL | vmalloc_llp;
101 90
102 ksp_esid_data = mk_esid_data(get_paca()->kstack, 2); 91 ksp_esid_data = mk_esid_data(get_paca()->kstack, 2);
103 if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET) 92 if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET) {
104 ksp_esid_data &= ~SLB_ESID_V; 93 ksp_esid_data &= ~SLB_ESID_V;
105 94 slb_shadow_clear(2);
106 /* Only third entry (stack) may change here so only resave that */ 95 } else {
107 slb_shadow_update(ksp_esid_data, 96 /* Update stack entry; others don't change */
108 mk_vsid_data(ksp_esid_data, lflags), 2); 97 slb_shadow_update(get_paca()->kstack, lflags, 2);
98 }
109 99
110 /* We need to do this all in asm, so we're sure we don't touch 100 /* We need to do this all in asm, so we're sure we don't touch
111 * the stack between the slbia and rebolting it. */ 101 * the stack between the slbia and rebolting it. */
@@ -123,6 +113,15 @@ void slb_flush_and_rebolt(void)
123 : "memory"); 113 : "memory");
124} 114}
125 115
116void slb_vmalloc_update(void)
117{
118 unsigned long vflags;
119
120 vflags = SLB_VSID_KERNEL | mmu_psize_defs[mmu_vmalloc_psize].sllp;
121 slb_shadow_update(VMALLOC_START, vflags, 1);
122 slb_flush_and_rebolt();
123}
124
126/* Flush all user entries from the segment table of the current processor. */ 125/* Flush all user entries from the segment table of the current processor. */
127void switch_slb(struct task_struct *tsk, struct mm_struct *mm) 126void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
128{ 127{
@@ -227,16 +226,12 @@ void slb_initialize(void)
227 vflags = SLB_VSID_KERNEL | vmalloc_llp; 226 vflags = SLB_VSID_KERNEL | vmalloc_llp;
228 227
229 /* Invalidate the entire SLB (even slot 0) & all the ERATS */ 228 /* Invalidate the entire SLB (even slot 0) & all the ERATS */
230 asm volatile("isync":::"memory"); 229 slb_shadow_update(PAGE_OFFSET, lflags, 0);
231 asm volatile("slbmte %0,%0"::"r" (0) : "memory"); 230 asm volatile("isync; slbia; sync; slbmte %0,%1; isync" ::
232 asm volatile("isync; slbia; isync":::"memory"); 231 "r" (get_slb_shadow()->save_area[0].vsid),
233 create_shadowed_slbe(PAGE_OFFSET, lflags, 0); 232 "r" (get_slb_shadow()->save_area[0].esid) : "memory");
234 233
235 create_shadowed_slbe(VMALLOC_START, vflags, 1); 234 slb_shadow_update(VMALLOC_START, vflags, 1);
236 235
237 /* We don't bolt the stack for the time being - we're in boot, 236 slb_flush_and_rebolt();
238 * so the stack is in the bolted segment. By the time it goes
239 * elsewhere, we'll call _switch() which will bolt in the new
240 * one. */
241 asm volatile("isync":::"memory");
242} 237}
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index f833dba2a028..d5fd3909d13a 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -405,6 +405,8 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
405 405
406 if (len > mm->task_size) 406 if (len > mm->task_size)
407 return -ENOMEM; 407 return -ENOMEM;
408 if (len & ((1ul << pshift) - 1))
409 return -EINVAL;
408 if (fixed && (addr & ((1ul << pshift) - 1))) 410 if (fixed && (addr & ((1ul << pshift) - 1)))
409 return -EINVAL; 411 return -EINVAL;
410 if (fixed && addr > (mm->task_size - len)) 412 if (fixed && addr > (mm->task_size - len))
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index b39cb52c6fb9..2c8e641a739b 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -106,7 +106,6 @@ static struct of_device_id mpc832x_ids[] = {
106 { .type = "soc", }, 106 { .type = "soc", },
107 { .compatible = "soc", }, 107 { .compatible = "soc", },
108 { .type = "qe", }, 108 { .type = "qe", },
109 { .type = "mdio", },
110 {}, 109 {},
111}; 110};
112 111
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index b2b28a44738c..090906170a41 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -70,7 +70,6 @@ static struct of_device_id mpc832x_ids[] = {
70 { .type = "soc", }, 70 { .type = "soc", },
71 { .compatible = "soc", }, 71 { .compatible = "soc", },
72 { .type = "qe", }, 72 { .type = "qe", },
73 { .type = "mdio", },
74 {}, 73 {},
75}; 74};
76 75
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 0e615fd65c1f..84b58934aafd 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -113,7 +113,6 @@ static struct of_device_id mpc836x_ids[] = {
113 { .type = "soc", }, 113 { .type = "soc", },
114 { .compatible = "soc", }, 114 { .compatible = "soc", },
115 { .type = "qe", }, 115 { .type = "qe", },
116 { .type = "mdio", },
117 {}, 116 {},
118}; 117};
119 118
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index e8003bf00c9a..be25ecd911ba 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -142,7 +142,6 @@ static struct of_device_id mpc85xx_ids[] = {
142 { .type = "soc", }, 142 { .type = "soc", },
143 { .compatible = "soc", }, 143 { .compatible = "soc", },
144 { .type = "qe", }, 144 { .type = "qe", },
145 { .type = "mdio", },
146 {}, 145 {},
147}; 146};
148 147
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 90124228b8f4..095a30304c56 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -36,7 +36,6 @@
36#include <asm/spu_priv1.h> 36#include <asm/spu_priv1.h>
37#include <asm/xmon.h> 37#include <asm/xmon.h>
38#include <asm/prom.h> 38#include <asm/prom.h>
39#include "spu_priv1_mmio.h"
40 39
41const struct spu_management_ops *spu_management_ops; 40const struct spu_management_ops *spu_management_ops;
42EXPORT_SYMBOL_GPL(spu_management_ops); 41EXPORT_SYMBOL_GPL(spu_management_ops);
@@ -636,138 +635,6 @@ static ssize_t spu_stat_show(struct sys_device *sysdev, char *buf)
636 635
637static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL); 636static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL);
638 637
639/* Hardcoded affinity idxs for QS20 */
640#define SPES_PER_BE 8
641static int QS20_reg_idxs[SPES_PER_BE] = { 0, 2, 4, 6, 7, 5, 3, 1 };
642static int QS20_reg_memory[SPES_PER_BE] = { 1, 1, 0, 0, 0, 0, 0, 0 };
643
644static struct spu *spu_lookup_reg(int node, u32 reg)
645{
646 struct spu *spu;
647
648 list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
649 if (*(u32 *)get_property(spu_devnode(spu), "reg", NULL) == reg)
650 return spu;
651 }
652 return NULL;
653}
654
655static void init_aff_QS20_harcoded(void)
656{
657 int node, i;
658 struct spu *last_spu, *spu;
659 u32 reg;
660
661 for (node = 0; node < MAX_NUMNODES; node++) {
662 last_spu = NULL;
663 for (i = 0; i < SPES_PER_BE; i++) {
664 reg = QS20_reg_idxs[i];
665 spu = spu_lookup_reg(node, reg);
666 if (!spu)
667 continue;
668 spu->has_mem_affinity = QS20_reg_memory[reg];
669 if (last_spu)
670 list_add_tail(&spu->aff_list,
671 &last_spu->aff_list);
672 last_spu = spu;
673 }
674 }
675}
676
677static int of_has_vicinity(void)
678{
679 struct spu* spu;
680
681 spu = list_entry(cbe_spu_info[0].spus.next, struct spu, cbe_list);
682 return of_find_property(spu_devnode(spu), "vicinity", NULL) != NULL;
683}
684
685static struct spu *aff_devnode_spu(int cbe, struct device_node *dn)
686{
687 struct spu *spu;
688
689 list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list)
690 if (spu_devnode(spu) == dn)
691 return spu;
692 return NULL;
693}
694
695static struct spu *
696aff_node_next_to(int cbe, struct device_node *target, struct device_node *avoid)
697{
698 struct spu *spu;
699 const phandle *vic_handles;
700 int lenp, i;
701
702 list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list) {
703 if (spu_devnode(spu) == avoid)
704 continue;
705 vic_handles = get_property(spu_devnode(spu), "vicinity", &lenp);
706 for (i=0; i < (lenp / sizeof(phandle)); i++) {
707 if (vic_handles[i] == target->linux_phandle)
708 return spu;
709 }
710 }
711 return NULL;
712}
713
714static void init_aff_fw_vicinity_node(int cbe)
715{
716 struct spu *spu, *last_spu;
717 struct device_node *vic_dn, *last_spu_dn;
718 phandle avoid_ph;
719 const phandle *vic_handles;
720 const char *name;
721 int lenp, i, added, mem_aff;
722
723 last_spu = list_entry(cbe_spu_info[cbe].spus.next, struct spu, cbe_list);
724 avoid_ph = 0;
725 for (added = 1; added < cbe_spu_info[cbe].n_spus; added++) {
726 last_spu_dn = spu_devnode(last_spu);
727 vic_handles = get_property(last_spu_dn, "vicinity", &lenp);
728
729 for (i = 0; i < (lenp / sizeof(phandle)); i++) {
730 if (vic_handles[i] == avoid_ph)
731 continue;
732
733 vic_dn = of_find_node_by_phandle(vic_handles[i]);
734 if (!vic_dn)
735 continue;
736
737 name = get_property(vic_dn, "name", NULL);
738 if (strcmp(name, "spe") == 0) {
739 spu = aff_devnode_spu(cbe, vic_dn);
740 avoid_ph = last_spu_dn->linux_phandle;
741 }
742 else {
743 mem_aff = strcmp(name, "mic-tm") == 0;
744 spu = aff_node_next_to(cbe, vic_dn, last_spu_dn);
745 if (!spu)
746 continue;
747 if (mem_aff) {
748 last_spu->has_mem_affinity = 1;
749 spu->has_mem_affinity = 1;
750 }
751 avoid_ph = vic_dn->linux_phandle;
752 }
753 list_add_tail(&spu->aff_list, &last_spu->aff_list);
754 last_spu = spu;
755 break;
756 }
757 }
758}
759
760static void init_aff_fw_vicinity(void)
761{
762 int cbe;
763
764 /* sets has_mem_affinity for each spu, as long as the
765 * spu->aff_list list, linking each spu to its neighbors
766 */
767 for (cbe = 0; cbe < MAX_NUMNODES; cbe++)
768 init_aff_fw_vicinity_node(cbe);
769}
770
771static int __init init_spu_base(void) 638static int __init init_spu_base(void)
772{ 639{
773 int i, ret = 0; 640 int i, ret = 0;
@@ -811,13 +678,7 @@ static int __init init_spu_base(void)
811 mutex_unlock(&spu_full_list_mutex); 678 mutex_unlock(&spu_full_list_mutex);
812 spu_add_sysdev_attr(&attr_stat); 679 spu_add_sysdev_attr(&attr_stat);
813 680
814 if (of_has_vicinity()) { 681 spu_init_affinity();
815 init_aff_fw_vicinity();
816 } else {
817 long root = of_get_flat_dt_root();
818 if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
819 init_aff_QS20_harcoded();
820 }
821 682
822 return 0; 683 return 0;
823 684
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index 75ed50fcc3db..5eb88346181a 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -361,8 +361,171 @@ static int of_destroy_spu(struct spu *spu)
361 return 0; 361 return 0;
362} 362}
363 363
364/* Hardcoded affinity idxs for qs20 */
365#define QS20_SPES_PER_BE 8
366static int qs20_reg_idxs[QS20_SPES_PER_BE] = { 0, 2, 4, 6, 7, 5, 3, 1 };
367static int qs20_reg_memory[QS20_SPES_PER_BE] = { 1, 1, 0, 0, 0, 0, 0, 0 };
368
369static struct spu *spu_lookup_reg(int node, u32 reg)
370{
371 struct spu *spu;
372 u32 *spu_reg;
373
374 list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
375 spu_reg = (u32*)of_get_property(spu_devnode(spu), "reg", NULL);
376 if (*spu_reg == reg)
377 return spu;
378 }
379 return NULL;
380}
381
382static void init_affinity_qs20_harcoded(void)
383{
384 int node, i;
385 struct spu *last_spu, *spu;
386 u32 reg;
387
388 for (node = 0; node < MAX_NUMNODES; node++) {
389 last_spu = NULL;
390 for (i = 0; i < QS20_SPES_PER_BE; i++) {
391 reg = qs20_reg_idxs[i];
392 spu = spu_lookup_reg(node, reg);
393 if (!spu)
394 continue;
395 spu->has_mem_affinity = qs20_reg_memory[reg];
396 if (last_spu)
397 list_add_tail(&spu->aff_list,
398 &last_spu->aff_list);
399 last_spu = spu;
400 }
401 }
402}
403
404static int of_has_vicinity(void)
405{
406 struct spu* spu;
407
408 spu = list_first_entry(&cbe_spu_info[0].spus, struct spu, cbe_list);
409 return of_find_property(spu_devnode(spu), "vicinity", NULL) != NULL;
410}
411
412static struct spu *devnode_spu(int cbe, struct device_node *dn)
413{
414 struct spu *spu;
415
416 list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list)
417 if (spu_devnode(spu) == dn)
418 return spu;
419 return NULL;
420}
421
422static struct spu *
423neighbour_spu(int cbe, struct device_node *target, struct device_node *avoid)
424{
425 struct spu *spu;
426 struct device_node *spu_dn;
427 const phandle *vic_handles;
428 int lenp, i;
429
430 list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list) {
431 spu_dn = spu_devnode(spu);
432 if (spu_dn == avoid)
433 continue;
434 vic_handles = of_get_property(spu_dn, "vicinity", &lenp);
435 for (i=0; i < (lenp / sizeof(phandle)); i++) {
436 if (vic_handles[i] == target->linux_phandle)
437 return spu;
438 }
439 }
440 return NULL;
441}
442
443static void init_affinity_node(int cbe)
444{
445 struct spu *spu, *last_spu;
446 struct device_node *vic_dn, *last_spu_dn;
447 phandle avoid_ph;
448 const phandle *vic_handles;
449 const char *name;
450 int lenp, i, added;
451
452 last_spu = list_first_entry(&cbe_spu_info[cbe].spus, struct spu,
453 cbe_list);
454 avoid_ph = 0;
455 for (added = 1; added < cbe_spu_info[cbe].n_spus; added++) {
456 last_spu_dn = spu_devnode(last_spu);
457 vic_handles = of_get_property(last_spu_dn, "vicinity", &lenp);
458
459 /*
460 * Walk through each phandle in vicinity property of the spu
461 * (tipically two vicinity phandles per spe node)
462 */
463 for (i = 0; i < (lenp / sizeof(phandle)); i++) {
464 if (vic_handles[i] == avoid_ph)
465 continue;
466
467 vic_dn = of_find_node_by_phandle(vic_handles[i]);
468 if (!vic_dn)
469 continue;
470
471 /* a neighbour might be spe, mic-tm, or bif0 */
472 name = of_get_property(vic_dn, "name", NULL);
473 if (!name)
474 continue;
475
476 if (strcmp(name, "spe") == 0) {
477 spu = devnode_spu(cbe, vic_dn);
478 avoid_ph = last_spu_dn->linux_phandle;
479 } else {
480 /*
481 * "mic-tm" and "bif0" nodes do not have
482 * vicinity property. So we need to find the
483 * spe which has vic_dn as neighbour, but
484 * skipping the one we came from (last_spu_dn)
485 */
486 spu = neighbour_spu(cbe, vic_dn, last_spu_dn);
487 if (!spu)
488 continue;
489 if (!strcmp(name, "mic-tm")) {
490 last_spu->has_mem_affinity = 1;
491 spu->has_mem_affinity = 1;
492 }
493 avoid_ph = vic_dn->linux_phandle;
494 }
495
496 list_add_tail(&spu->aff_list, &last_spu->aff_list);
497 last_spu = spu;
498 break;
499 }
500 }
501}
502
503static void init_affinity_fw(void)
504{
505 int cbe;
506
507 for (cbe = 0; cbe < MAX_NUMNODES; cbe++)
508 init_affinity_node(cbe);
509}
510
511static int __init init_affinity(void)
512{
513 if (of_has_vicinity()) {
514 init_affinity_fw();
515 } else {
516 long root = of_get_flat_dt_root();
517 if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
518 init_affinity_qs20_harcoded();
519 else
520 printk("No affinity configuration found");
521 }
522
523 return 0;
524}
525
364const struct spu_management_ops spu_management_of_ops = { 526const struct spu_management_ops spu_management_of_ops = {
365 .enumerate_spus = of_enumerate_spus, 527 .enumerate_spus = of_enumerate_spus,
366 .create_spu = of_create_spu, 528 .create_spu = of_create_spu,
367 .destroy_spu = of_destroy_spu, 529 .destroy_spu = of_destroy_spu,
530 .init_affinity = init_affinity,
368}; 531};
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index dd2c6688c8aa..027ac32cc636 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -45,6 +45,7 @@ asmlinkage long sys_spu_create(const char __user *name,
45 if (owner && try_module_get(owner)) { 45 if (owner && try_module_get(owner)) {
46 if (flags & SPU_CREATE_AFFINITY_SPU) { 46 if (flags & SPU_CREATE_AFFINITY_SPU) {
47 neighbor = fget_light(neighbor_fd, &fput_needed); 47 neighbor = fget_light(neighbor_fd, &fput_needed);
48 ret = -EBADF;
48 if (neighbor) { 49 if (neighbor) {
49 ret = spufs_calls.create_thread(name, flags, 50 ret = spufs_calls.create_thread(name, flags,
50 mode, neighbor); 51 mode, neighbor);
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 758a80ac080a..c784edd40ea7 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -351,7 +351,8 @@ static void aff_set_ref_point_location(struct spu_gang *gang)
351 lowest_offset = ctx->aff_offset; 351 lowest_offset = ctx->aff_offset;
352 } 352 }
353 353
354 gang->aff_ref_spu = aff_ref_location(ctx, mem_aff, gs, lowest_offset); 354 gang->aff_ref_spu = aff_ref_location(gang->aff_ref_ctx, mem_aff, gs,
355 lowest_offset);
355} 356}
356 357
357static struct spu *ctx_location(struct spu *ref, int offset, int node) 358static struct spu *ctx_location(struct spu *ref, int offset, int node)
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index f29705f8047d..ba931be2175c 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -826,13 +826,15 @@ core99_ata100_enable(struct device_node *node, long value)
826 826
827 if (value) { 827 if (value) {
828 if (pci_device_from_OF_node(node, &pbus, &pid) == 0) 828 if (pci_device_from_OF_node(node, &pbus, &pid) == 0)
829 pdev = pci_find_slot(pbus, pid); 829 pdev = pci_get_bus_and_slot(pbus, pid);
830 if (pdev == NULL) 830 if (pdev == NULL)
831 return 0; 831 return 0;
832 rc = pci_enable_device(pdev); 832 rc = pci_enable_device(pdev);
833 if (rc == 0)
834 pci_set_master(pdev);
835 pci_dev_put(pdev);
833 if (rc) 836 if (rc)
834 return rc; 837 return rc;
835 pci_set_master(pdev);
836 } 838 }
837 return 0; 839 return 0;
838} 840}
diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig
index d4fc74f7bb15..67144d1d1405 100644
--- a/arch/powerpc/platforms/ps3/Kconfig
+++ b/arch/powerpc/platforms/ps3/Kconfig
@@ -1,5 +1,5 @@
1config PPC_PS3 1config PPC_PS3
2 bool "Sony PS3 (incomplete)" 2 bool "Sony PS3"
3 depends on PPC_MULTIPLATFORM && PPC64 3 depends on PPC_MULTIPLATFORM && PPC64
4 select PPC_CELL 4 select PPC_CELL
5 select USB_ARCH_HAS_OHCI 5 select USB_ARCH_HAS_OHCI
@@ -10,10 +10,10 @@ config PPC_PS3
10 select MEMORY_HOTPLUG 10 select MEMORY_HOTPLUG
11 help 11 help
12 This option enables support for the Sony PS3 game console 12 This option enables support for the Sony PS3 game console
13 and other platforms using the PS3 hypervisor. 13 and other platforms using the PS3 hypervisor. Enabling this
14 Support for this platform is not yet complete, so 14 option will allow building otheros.bld, a kernel image suitable
15 enabling this will not result in a bootable kernel on a 15 for programming into flash memory, and vmlinux, a kernel image
16 PS3 system. 16 suitable for loading via kexec.
17 17
18menu "PS3 Platform Options" 18menu "PS3 Platform Options"
19 depends on PPC_PS3 19 depends on PPC_PS3
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index 825ebb2cbc2a..ce15cada88d4 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -273,55 +273,58 @@ static int ps3stor_wait_for_completion(u64 dev_id, u64 tag,
273 273
274static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo) 274static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
275{ 275{
276 int error = -ENODEV;
276 int result; 277 int result;
277 const u64 notification_dev_id = (u64)-1LL; 278 const u64 notification_dev_id = (u64)-1LL;
278 const unsigned int timeout = HZ; 279 const unsigned int timeout = HZ;
279 u64 lpar; 280 u64 lpar;
280 u64 tag; 281 u64 tag;
282 void *buf;
283 enum ps3_notify_type {
284 notify_device_ready = 0,
285 notify_region_probe = 1,
286 notify_region_update = 2,
287 };
281 struct { 288 struct {
282 u64 operation_code; /* must be zero */ 289 u64 operation_code; /* must be zero */
283 u64 event_mask; /* 1 = device ready */ 290 u64 event_mask; /* OR of 1UL << enum ps3_notify_type */
284 } *notify_cmd; 291 } *notify_cmd;
285 struct { 292 struct {
286 u64 event_type; /* notify_device_ready */ 293 u64 event_type; /* enum ps3_notify_type */
287 u64 bus_id; 294 u64 bus_id;
288 u64 dev_id; 295 u64 dev_id;
289 u64 dev_type; 296 u64 dev_type;
290 u64 dev_port; 297 u64 dev_port;
291 } *notify_event; 298 } *notify_event;
292 enum {
293 notify_device_ready = 1
294 };
295 299
296 pr_debug(" -> %s:%u: bus_id %u, dev_id %u, dev_type %u\n", __func__, 300 pr_debug(" -> %s:%u: bus_id %u, dev_id %u, dev_type %u\n", __func__,
297 __LINE__, repo->bus_id, repo->dev_id, repo->dev_type); 301 __LINE__, repo->bus_id, repo->dev_id, repo->dev_type);
298 302
299 notify_cmd = kzalloc(512, GFP_KERNEL); 303 buf = kzalloc(512, GFP_KERNEL);
300 notify_event = (void *)notify_cmd; 304 if (!buf)
301 if (!notify_cmd)
302 return -ENOMEM; 305 return -ENOMEM;
303 306
304 lpar = ps3_mm_phys_to_lpar(__pa(notify_cmd)); 307 lpar = ps3_mm_phys_to_lpar(__pa(buf));
308 notify_cmd = buf;
309 notify_event = buf;
305 310
306 result = lv1_open_device(repo->bus_id, notification_dev_id, 0); 311 result = lv1_open_device(repo->bus_id, notification_dev_id, 0);
307 if (result) { 312 if (result) {
308 printk(KERN_ERR "%s:%u: lv1_open_device %s\n", __func__, 313 printk(KERN_ERR "%s:%u: lv1_open_device %s\n", __func__,
309 __LINE__, ps3_result(result)); 314 __LINE__, ps3_result(result));
310 result = -ENODEV;
311 goto fail_free; 315 goto fail_free;
312 } 316 }
313 317
314 /* Setup and write the request for device notification. */ 318 /* Setup and write the request for device notification. */
315 319
316 notify_cmd->operation_code = 0; /* must be zero */ 320 notify_cmd->operation_code = 0; /* must be zero */
317 notify_cmd->event_mask = 0x01; /* device ready */ 321 notify_cmd->event_mask = 1UL << notify_region_probe;
318 322
319 result = lv1_storage_write(notification_dev_id, 0, 0, 1, 0, lpar, 323 result = lv1_storage_write(notification_dev_id, 0, 0, 1, 0, lpar,
320 &tag); 324 &tag);
321 if (result) { 325 if (result) {
322 printk(KERN_ERR "%s:%u: write failed %s\n", __func__, __LINE__, 326 printk(KERN_ERR "%s:%u: write failed %s\n", __func__, __LINE__,
323 ps3_result(result)); 327 ps3_result(result));
324 result = -ENODEV;
325 goto fail_close; 328 goto fail_close;
326 } 329 }
327 330
@@ -332,13 +335,11 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
332 if (result) { 335 if (result) {
333 printk(KERN_ERR "%s:%u: write not completed %s\n", __func__, 336 printk(KERN_ERR "%s:%u: write not completed %s\n", __func__,
334 __LINE__, ps3_result(result)); 337 __LINE__, ps3_result(result));
335 result = -ENODEV;
336 goto fail_close; 338 goto fail_close;
337 } 339 }
338 340
339 /* Loop here processing the requested notification events. */ 341 /* Loop here processing the requested notification events. */
340 342
341 result = -ENODEV;
342 while (1) { 343 while (1) {
343 memset(notify_event, 0, sizeof(*notify_event)); 344 memset(notify_event, 0, sizeof(*notify_event));
344 345
@@ -358,7 +359,7 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
358 break; 359 break;
359 } 360 }
360 361
361 if (notify_event->event_type != notify_device_ready || 362 if (notify_event->event_type != notify_region_probe ||
362 notify_event->bus_id != repo->bus_id) { 363 notify_event->bus_id != repo->bus_id) {
363 pr_debug("%s:%u: bad notify_event: event %lu, " 364 pr_debug("%s:%u: bad notify_event: event %lu, "
364 "dev_id %lu, dev_type %lu\n", 365 "dev_id %lu, dev_type %lu\n",
@@ -371,7 +372,7 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
371 notify_event->dev_type == repo->dev_type) { 372 notify_event->dev_type == repo->dev_type) {
372 pr_debug("%s:%u: device ready: dev_id %u\n", __func__, 373 pr_debug("%s:%u: device ready: dev_id %u\n", __func__,
373 __LINE__, repo->dev_id); 374 __LINE__, repo->dev_id);
374 result = 0; 375 error = 0;
375 break; 376 break;
376 } 377 }
377 378
@@ -386,9 +387,9 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
386fail_close: 387fail_close:
387 lv1_close_device(repo->bus_id, notification_dev_id); 388 lv1_close_device(repo->bus_id, notification_dev_id);
388fail_free: 389fail_free:
389 kfree(notify_cmd); 390 kfree(buf);
390 pr_debug(" <- %s:%u\n", __func__, __LINE__); 391 pr_debug(" <- %s:%u\n", __func__, __LINE__);
391 return result; 392 return error;
392} 393}
393 394
394static int ps3_setup_storage_dev(const struct ps3_repository_device *repo, 395static int ps3_setup_storage_dev(const struct ps3_repository_device *repo,
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index aa05288de64e..2952b22f1c84 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -109,7 +109,7 @@ static void ps3_panic(char *str)
109 109
110#if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \ 110#if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \
111 defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE) 111 defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE)
112static void prealloc(struct ps3_prealloc *p) 112static void __init prealloc(struct ps3_prealloc *p)
113{ 113{
114 if (!p->size) 114 if (!p->size)
115 return; 115 return;
diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
index 502d80ed982b..ac2a4b8a4c14 100644
--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -414,10 +414,16 @@ static int __init ps3_enumerate_spus(int (*fn)(void *data))
414 return num_resource_id; 414 return num_resource_id;
415} 415}
416 416
417static int ps3_init_affinity(void)
418{
419 return 0;
420}
421
417const struct spu_management_ops spu_management_ps3_ops = { 422const struct spu_management_ops spu_management_ps3_ops = {
418 .enumerate_spus = ps3_enumerate_spus, 423 .enumerate_spus = ps3_enumerate_spus,
419 .create_spu = ps3_create_spu, 424 .create_spu = ps3_create_spu,
420 .destroy_spu = ps3_destroy_spu, 425 .destroy_spu = ps3_destroy_spu,
426 .init_affinity = ps3_init_affinity,
421}; 427};
422 428
423/* spu_priv1_ops */ 429/* spu_priv1_ops */
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index 0da55368655c..a22e1f4d94c8 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -237,9 +237,19 @@ _GLOBAL(_tlbie)
237 mfspr r4,SPRN_MMUCR 237 mfspr r4,SPRN_MMUCR
238 mfspr r5,SPRN_PID /* Get PID */ 238 mfspr r5,SPRN_PID /* Get PID */
239 rlwimi r4,r5,0,24,31 /* Set TID */ 239 rlwimi r4,r5,0,24,31 /* Set TID */
240 mtspr SPRN_MMUCR,r4
241 240
241 /* We have to run the search with interrupts disabled, even critical
242 * and debug interrupts (in fact the only critical exceptions we have
243 * are debug and machine check). Otherwise an interrupt which causes
244 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
245 mfmsr r5
246 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
247 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
248 andc r6,r5,r6
249 mtmsr r6
250 mtspr SPRN_MMUCR,r4
242 tlbsx. r3, 0, r3 251 tlbsx. r3, 0, r3
252 mtmsr r5
243 bne 10f 253 bne 10f
244 sync 254 sync
245 /* There are only 64 TLB entries, so r3 < 64, 255 /* There are only 64 TLB entries, so r3 < 64,
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 098c62c29f9c..b71132166f60 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -109,10 +109,6 @@ config HOTPLUG_CPU
109 can be controlled through /sys/devices/system/cpu/cpu#. 109 can be controlled through /sys/devices/system/cpu/cpu#.
110 Say N if you want to disable CPU hotplug. 110 Say N if you want to disable CPU hotplug.
111 111
112config DEFAULT_MIGRATION_COST
113 int
114 default "1000000"
115
116config MATHEMU 112config MATHEMU
117 bool "IEEE FPU emulation" 113 bool "IEEE FPU emulation"
118 depends on MARCH_G5 114 depends on MARCH_G5
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 8e1ea1c40128..ad4ca75c0f04 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -17,6 +17,8 @@
17#include <linux/parser.h> 17#include <linux/parser.h>
18#include <linux/sysfs.h> 18#include <linux/sysfs.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/seq_file.h>
21#include <linux/mount.h>
20#include <asm/ebcdic.h> 22#include <asm/ebcdic.h>
21#include "hypfs.h" 23#include "hypfs.h"
22 24
@@ -256,6 +258,15 @@ static int hypfs_parse_options(char *options, struct super_block *sb)
256 return 0; 258 return 0;
257} 259}
258 260
261static int hypfs_show_options(struct seq_file *s, struct vfsmount *mnt)
262{
263 struct hypfs_sb_info *hypfs_info = mnt->mnt_sb->s_fs_info;
264
265 seq_printf(s, ",uid=%u", hypfs_info->uid);
266 seq_printf(s, ",gid=%u", hypfs_info->gid);
267 return 0;
268}
269
259static int hypfs_fill_super(struct super_block *sb, void *data, int silent) 270static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
260{ 271{
261 struct inode *root_inode; 272 struct inode *root_inode;
@@ -459,6 +470,7 @@ static struct file_system_type hypfs_type = {
459static struct super_operations hypfs_s_ops = { 470static struct super_operations hypfs_s_ops = {
460 .statfs = simple_statfs, 471 .statfs = simple_statfs,
461 .drop_inode = hypfs_drop_inode, 472 .drop_inode = hypfs_drop_inode,
473 .show_options = hypfs_show_options,
462}; 474};
463 475
464static decl_subsys(s390, NULL, NULL); 476static decl_subsys(s390, NULL, NULL);
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index e165d85c03b5..6f7029d33241 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -140,12 +140,19 @@ static struct platform_device sm501_device = {
140static struct platform_device *rts7751r2d_devices[] __initdata = { 140static struct platform_device *rts7751r2d_devices[] __initdata = {
141 &uart_device, 141 &uart_device,
142 &heartbeat_device, 142 &heartbeat_device,
143 &cf_ide_device,
144 &sm501_device, 143 &sm501_device,
145}; 144};
146 145
147static int __init rts7751r2d_devices_setup(void) 146static int __init rts7751r2d_devices_setup(void)
148{ 147{
148 int ret;
149
150 if (ctrl_inw(PA_BVERREG) == 0x10) { /* only working on R2D-PLUS */
151 ret = platform_device_register(&cf_ide_device);
152 if (ret)
153 return ret;
154 }
155
149 return platform_add_devices(rts7751r2d_devices, 156 return platform_add_devices(rts7751r2d_devices,
150 ARRAY_SIZE(rts7751r2d_devices)); 157 ARRAY_SIZE(rts7751r2d_devices));
151} 158}
diff --git a/arch/sh/configs/hs7751rvoip_defconfig b/arch/sh/configs/hs7751rvoip_defconfig
index e1a886d621db..5d9da5a02759 100644
--- a/arch/sh/configs/hs7751rvoip_defconfig
+++ b/arch/sh/configs/hs7751rvoip_defconfig
@@ -145,7 +145,7 @@ CONFIG_CPU_SH4=y
145# CONFIG_CPU_SUBTYPE_SH7091 is not set 145# CONFIG_CPU_SUBTYPE_SH7091 is not set
146# CONFIG_CPU_SUBTYPE_SH7750R is not set 146# CONFIG_CPU_SUBTYPE_SH7750R is not set
147# CONFIG_CPU_SUBTYPE_SH7750S is not set 147# CONFIG_CPU_SUBTYPE_SH7750S is not set
148CONFIG_CPU_SUBTYPE_SH7751=y 148# CONFIG_CPU_SUBTYPE_SH7751 is not set
149CONFIG_CPU_SUBTYPE_SH7751R=y 149CONFIG_CPU_SUBTYPE_SH7751R=y
150# CONFIG_CPU_SUBTYPE_SH7760 is not set 150# CONFIG_CPU_SUBTYPE_SH7760 is not set
151# CONFIG_CPU_SUBTYPE_SH4_202 is not set 151# CONFIG_CPU_SUBTYPE_SH4_202 is not set
diff --git a/arch/sh/configs/landisk_defconfig b/arch/sh/configs/landisk_defconfig
index 07310fa03250..f52db125432f 100644
--- a/arch/sh/configs/landisk_defconfig
+++ b/arch/sh/configs/landisk_defconfig
@@ -156,7 +156,7 @@ CONFIG_CPU_SH4=y
156# CONFIG_CPU_SUBTYPE_SH7091 is not set 156# CONFIG_CPU_SUBTYPE_SH7091 is not set
157# CONFIG_CPU_SUBTYPE_SH7750R is not set 157# CONFIG_CPU_SUBTYPE_SH7750R is not set
158# CONFIG_CPU_SUBTYPE_SH7750S is not set 158# CONFIG_CPU_SUBTYPE_SH7750S is not set
159CONFIG_CPU_SUBTYPE_SH7751=y 159# CONFIG_CPU_SUBTYPE_SH7751 is not set
160CONFIG_CPU_SUBTYPE_SH7751R=y 160CONFIG_CPU_SUBTYPE_SH7751R=y
161# CONFIG_CPU_SUBTYPE_SH7760 is not set 161# CONFIG_CPU_SUBTYPE_SH7760 is not set
162# CONFIG_CPU_SUBTYPE_SH4_202 is not set 162# CONFIG_CPU_SUBTYPE_SH4_202 is not set
diff --git a/arch/sh/configs/lboxre2_defconfig b/arch/sh/configs/lboxre2_defconfig
index fa09d68d057a..9fa66d92a4e7 100644
--- a/arch/sh/configs/lboxre2_defconfig
+++ b/arch/sh/configs/lboxre2_defconfig
@@ -159,7 +159,7 @@ CONFIG_CPU_SH4=y
159# CONFIG_CPU_SUBTYPE_SH7091 is not set 159# CONFIG_CPU_SUBTYPE_SH7091 is not set
160# CONFIG_CPU_SUBTYPE_SH7750R is not set 160# CONFIG_CPU_SUBTYPE_SH7750R is not set
161# CONFIG_CPU_SUBTYPE_SH7750S is not set 161# CONFIG_CPU_SUBTYPE_SH7750S is not set
162CONFIG_CPU_SUBTYPE_SH7751=y 162# CONFIG_CPU_SUBTYPE_SH7751 is not set
163CONFIG_CPU_SUBTYPE_SH7751R=y 163CONFIG_CPU_SUBTYPE_SH7751R=y
164# CONFIG_CPU_SUBTYPE_SH7760 is not set 164# CONFIG_CPU_SUBTYPE_SH7760 is not set
165# CONFIG_CPU_SUBTYPE_SH4_202 is not set 165# CONFIG_CPU_SUBTYPE_SH4_202 is not set
diff --git a/arch/sh/configs/rts7751r2d_defconfig b/arch/sh/configs/rts7751r2d_defconfig
index f1e979b1e495..b64f73b704d6 100644
--- a/arch/sh/configs/rts7751r2d_defconfig
+++ b/arch/sh/configs/rts7751r2d_defconfig
@@ -243,8 +243,8 @@ CONFIG_SH_PCLK_FREQ=60000000
243# 243#
244# DMA support 244# DMA support
245# 245#
246CONFIG_SH_DMA=y 246# CONFIG_SH_DMA is not set
247CONFIG_NR_ONCHIP_DMA_CHANNELS=8 247# CONFIG_NR_ONCHIP_DMA_CHANNELS is not set
248# CONFIG_NR_DMA_CHANNELS_BOOL is not set 248# CONFIG_NR_DMA_CHANNELS_BOOL is not set
249 249
250# 250#
@@ -280,7 +280,7 @@ CONFIG_ZERO_PAGE_OFFSET=0x00010000
280CONFIG_BOOT_LINK_OFFSET=0x00800000 280CONFIG_BOOT_LINK_OFFSET=0x00800000
281# CONFIG_UBC_WAKEUP is not set 281# CONFIG_UBC_WAKEUP is not set
282CONFIG_CMDLINE_BOOL=y 282CONFIG_CMDLINE_BOOL=y
283CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 root=/dev/sda1 earlyprintk=bios" 283CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 root=/dev/sda1 earlyprintk=serial"
284 284
285# 285#
286# Bus options 286# Bus options
@@ -1323,7 +1323,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1323# CONFIG_DEBUG_KERNEL is not set 1323# CONFIG_DEBUG_KERNEL is not set
1324CONFIG_LOG_BUF_SHIFT=14 1324CONFIG_LOG_BUF_SHIFT=14
1325# CONFIG_DEBUG_BUGVERBOSE is not set 1325# CONFIG_DEBUG_BUGVERBOSE is not set
1326CONFIG_SH_STANDARD_BIOS=y 1326# CONFIG_SH_STANDARD_BIOS is not set
1327CONFIG_EARLY_SCIF_CONSOLE=y 1327CONFIG_EARLY_SCIF_CONSOLE=y
1328CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000 1328CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000
1329CONFIG_EARLY_PRINTK=y 1329CONFIG_EARLY_PRINTK=y
diff --git a/arch/sh/configs/snapgear_defconfig b/arch/sh/configs/snapgear_defconfig
index 98503f16f3f5..e4e5d2178131 100644
--- a/arch/sh/configs/snapgear_defconfig
+++ b/arch/sh/configs/snapgear_defconfig
@@ -1,15 +1,24 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18 3# Linux kernel version: 2.6.23-rc1
4# Tue Oct 3 12:55:47 2006 4# Thu Jul 26 11:49:11 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y
8CONFIG_GENERIC_FIND_NEXT_BIT=y 9CONFIG_GENERIC_FIND_NEXT_BIT=y
9CONFIG_GENERIC_HWEIGHT=y 10CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_HARDIRQS=y 11CONFIG_GENERIC_HARDIRQS=y
11CONFIG_GENERIC_IRQ_PROBE=y 12CONFIG_GENERIC_IRQ_PROBE=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_TIME=y
15CONFIG_GENERIC_CLOCKEVENTS=y
16CONFIG_SYS_SUPPORTS_PCI=y
17CONFIG_STACKTRACE_SUPPORT=y
18CONFIG_LOCKDEP_SUPPORT=y
19# CONFIG_ARCH_HAS_ILOG2_U32 is not set
20# CONFIG_ARCH_HAS_ILOG2_U64 is not set
21CONFIG_ARCH_NO_VIRT_TO_BUS=y
13CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
14 23
15# 24#
@@ -24,15 +33,18 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
24# 33#
25CONFIG_LOCALVERSION="" 34CONFIG_LOCALVERSION=""
26CONFIG_LOCALVERSION_AUTO=y 35CONFIG_LOCALVERSION_AUTO=y
27CONFIG_SWAP=y 36# CONFIG_SWAP is not set
28# CONFIG_SYSVIPC is not set 37# CONFIG_SYSVIPC is not set
29# CONFIG_POSIX_MQUEUE is not set 38# CONFIG_POSIX_MQUEUE is not set
30# CONFIG_BSD_PROCESS_ACCT is not set 39# CONFIG_BSD_PROCESS_ACCT is not set
31# CONFIG_TASKSTATS is not set 40# CONFIG_TASKSTATS is not set
32# CONFIG_UTS_NS is not set 41# CONFIG_USER_NS is not set
33# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
34# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
44CONFIG_LOG_BUF_SHIFT=14
45# CONFIG_SYSFS_DEPRECATED is not set
35# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
47CONFIG_BLK_DEV_INITRD=y
36CONFIG_INITRAMFS_SOURCE="" 48CONFIG_INITRAMFS_SOURCE=""
37CONFIG_CC_OPTIMIZE_FOR_SIZE=y 49CONFIG_CC_OPTIMIZE_FOR_SIZE=y
38CONFIG_SYSCTL=y 50CONFIG_SYSCTL=y
@@ -47,27 +59,25 @@ CONFIG_BUG=y
47CONFIG_ELF_CORE=y 59CONFIG_ELF_CORE=y
48CONFIG_BASE_FULL=y 60CONFIG_BASE_FULL=y
49CONFIG_FUTEX=y 61CONFIG_FUTEX=y
62CONFIG_ANON_INODES=y
50CONFIG_EPOLL=y 63CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y
65CONFIG_TIMERFD=y
66CONFIG_EVENTFD=y
51CONFIG_SHMEM=y 67CONFIG_SHMEM=y
52CONFIG_SLAB=y
53CONFIG_VM_EVENT_COUNTERS=y 68CONFIG_VM_EVENT_COUNTERS=y
69CONFIG_SLAB=y
70# CONFIG_SLUB is not set
71# CONFIG_SLOB is not set
54CONFIG_RT_MUTEXES=y 72CONFIG_RT_MUTEXES=y
55# CONFIG_TINY_SHMEM is not set 73# CONFIG_TINY_SHMEM is not set
56CONFIG_BASE_SMALL=0 74CONFIG_BASE_SMALL=0
57# CONFIG_SLOB is not set
58
59#
60# Loadable module support
61#
62# CONFIG_MODULES is not set 75# CONFIG_MODULES is not set
63
64#
65# Block layer
66#
67CONFIG_BLOCK=y 76CONFIG_BLOCK=y
68# CONFIG_LBD is not set 77# CONFIG_LBD is not set
69# CONFIG_BLK_DEV_IO_TRACE is not set 78# CONFIG_BLK_DEV_IO_TRACE is not set
70# CONFIG_LSF is not set 79# CONFIG_LSF is not set
80# CONFIG_BLK_DEV_BSG is not set
71 81
72# 82#
73# IO Schedulers 83# IO Schedulers
@@ -85,122 +95,103 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
85# 95#
86# System type 96# System type
87# 97#
88# CONFIG_SH_SOLUTION_ENGINE is not set
89# CONFIG_SH_7751_SOLUTION_ENGINE is not set
90# CONFIG_SH_7300_SOLUTION_ENGINE is not set
91# CONFIG_SH_7343_SOLUTION_ENGINE is not set
92# CONFIG_SH_73180_SOLUTION_ENGINE is not set
93# CONFIG_SH_7751_SYSTEMH is not set
94# CONFIG_SH_HP6XX is not set
95# CONFIG_SH_EC3104 is not set
96# CONFIG_SH_SATURN is not set
97# CONFIG_SH_DREAMCAST is not set
98# CONFIG_SH_BIGSUR is not set
99# CONFIG_SH_MPC1211 is not set
100# CONFIG_SH_SH03 is not set
101CONFIG_SH_SECUREEDGE5410=y
102# CONFIG_SH_HS7751RVOIP is not set
103# CONFIG_SH_7710VOIPGW is not set
104# CONFIG_SH_RTS7751R2D is not set
105# CONFIG_SH_R7780RP is not set
106# CONFIG_SH_EDOSK7705 is not set
107# CONFIG_SH_SH4202_MICRODEV is not set
108# CONFIG_SH_LANDISK is not set
109# CONFIG_SH_TITAN is not set
110# CONFIG_SH_SHMIN is not set
111# CONFIG_SH_UNKNOWN is not set
112
113#
114# Processor selection
115#
116CONFIG_CPU_SH4=y 98CONFIG_CPU_SH4=y
117 99# CONFIG_CPU_SUBTYPE_SH7619 is not set
118# 100# CONFIG_CPU_SUBTYPE_SH7206 is not set
119# SH-2 Processor Support
120#
121# CONFIG_CPU_SUBTYPE_SH7604 is not set
122
123#
124# SH-3 Processor Support
125#
126# CONFIG_CPU_SUBTYPE_SH7300 is not set
127# CONFIG_CPU_SUBTYPE_SH7705 is not set 101# CONFIG_CPU_SUBTYPE_SH7705 is not set
128# CONFIG_CPU_SUBTYPE_SH7706 is not set 102# CONFIG_CPU_SUBTYPE_SH7706 is not set
129# CONFIG_CPU_SUBTYPE_SH7707 is not set 103# CONFIG_CPU_SUBTYPE_SH7707 is not set
130# CONFIG_CPU_SUBTYPE_SH7708 is not set 104# CONFIG_CPU_SUBTYPE_SH7708 is not set
131# CONFIG_CPU_SUBTYPE_SH7709 is not set 105# CONFIG_CPU_SUBTYPE_SH7709 is not set
132# CONFIG_CPU_SUBTYPE_SH7710 is not set 106# CONFIG_CPU_SUBTYPE_SH7710 is not set
133 107# CONFIG_CPU_SUBTYPE_SH7712 is not set
134#
135# SH-4 Processor Support
136#
137# CONFIG_CPU_SUBTYPE_SH7750 is not set 108# CONFIG_CPU_SUBTYPE_SH7750 is not set
138# CONFIG_CPU_SUBTYPE_SH7091 is not set 109# CONFIG_CPU_SUBTYPE_SH7091 is not set
139# CONFIG_CPU_SUBTYPE_SH7750R is not set 110# CONFIG_CPU_SUBTYPE_SH7750R is not set
140# CONFIG_CPU_SUBTYPE_SH7750S is not set 111# CONFIG_CPU_SUBTYPE_SH7750S is not set
141CONFIG_CPU_SUBTYPE_SH7751=y 112# CONFIG_CPU_SUBTYPE_SH7751 is not set
142CONFIG_CPU_SUBTYPE_SH7751R=y 113CONFIG_CPU_SUBTYPE_SH7751R=y
143# CONFIG_CPU_SUBTYPE_SH7760 is not set 114# CONFIG_CPU_SUBTYPE_SH7760 is not set
144# CONFIG_CPU_SUBTYPE_SH4_202 is not set 115# CONFIG_CPU_SUBTYPE_SH4_202 is not set
145
146#
147# ST40 Processor Support
148#
149# CONFIG_CPU_SUBTYPE_ST40STB1 is not set 116# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
150# CONFIG_CPU_SUBTYPE_ST40GX1 is not set 117# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
151
152#
153# SH-4A Processor Support
154#
155# CONFIG_CPU_SUBTYPE_SH7770 is not set 118# CONFIG_CPU_SUBTYPE_SH7770 is not set
156# CONFIG_CPU_SUBTYPE_SH7780 is not set 119# CONFIG_CPU_SUBTYPE_SH7780 is not set
157 120# CONFIG_CPU_SUBTYPE_SH7785 is not set
158# 121# CONFIG_CPU_SUBTYPE_SHX3 is not set
159# SH4AL-DSP Processor Support
160#
161# CONFIG_CPU_SUBTYPE_SH73180 is not set
162# CONFIG_CPU_SUBTYPE_SH7343 is not set 122# CONFIG_CPU_SUBTYPE_SH7343 is not set
123# CONFIG_CPU_SUBTYPE_SH7722 is not set
163 124
164# 125#
165# Memory management options 126# Memory management options
166# 127#
128CONFIG_QUICKLIST=y
167CONFIG_MMU=y 129CONFIG_MMU=y
168CONFIG_PAGE_OFFSET=0x80000000 130CONFIG_PAGE_OFFSET=0x80000000
169CONFIG_MEMORY_START=0x08000000 131CONFIG_MEMORY_START=0x08000000
170CONFIG_MEMORY_SIZE=0x01000000 132CONFIG_MEMORY_SIZE=0x01000000
171CONFIG_VSYSCALL=y 133CONFIG_VSYSCALL=y
134CONFIG_ARCH_FLATMEM_ENABLE=y
135CONFIG_ARCH_SPARSEMEM_ENABLE=y
136CONFIG_ARCH_SPARSEMEM_DEFAULT=y
137CONFIG_MAX_ACTIVE_REGIONS=1
138CONFIG_ARCH_POPULATES_NODE_MAP=y
139CONFIG_ARCH_SELECT_MEMORY_MODEL=y
140CONFIG_PAGE_SIZE_4KB=y
141# CONFIG_PAGE_SIZE_8KB is not set
142# CONFIG_PAGE_SIZE_64KB is not set
172CONFIG_SELECT_MEMORY_MODEL=y 143CONFIG_SELECT_MEMORY_MODEL=y
173CONFIG_FLATMEM_MANUAL=y 144CONFIG_FLATMEM_MANUAL=y
174# CONFIG_DISCONTIGMEM_MANUAL is not set 145# CONFIG_DISCONTIGMEM_MANUAL is not set
175# CONFIG_SPARSEMEM_MANUAL is not set 146# CONFIG_SPARSEMEM_MANUAL is not set
176CONFIG_FLATMEM=y 147CONFIG_FLATMEM=y
177CONFIG_FLAT_NODE_MEM_MAP=y 148CONFIG_FLAT_NODE_MEM_MAP=y
178# CONFIG_SPARSEMEM_STATIC is not set 149CONFIG_SPARSEMEM_STATIC=y
179CONFIG_SPLIT_PTLOCK_CPUS=4 150CONFIG_SPLIT_PTLOCK_CPUS=4
180# CONFIG_RESOURCES_64BIT is not set 151# CONFIG_RESOURCES_64BIT is not set
152CONFIG_ZONE_DMA_FLAG=0
153CONFIG_NR_QUICK=2
181 154
182# 155#
183# Cache configuration 156# Cache configuration
184# 157#
185# CONFIG_SH_DIRECT_MAPPED is not set 158# CONFIG_SH_DIRECT_MAPPED is not set
186# CONFIG_SH_WRITETHROUGH is not set 159# CONFIG_SH_WRITETHROUGH is not set
187# CONFIG_SH_OCRAM is not set
188 160
189# 161#
190# Processor features 162# Processor features
191# 163#
192CONFIG_CPU_LITTLE_ENDIAN=y 164CONFIG_CPU_LITTLE_ENDIAN=y
165# CONFIG_CPU_BIG_ENDIAN is not set
193CONFIG_SH_FPU=y 166CONFIG_SH_FPU=y
194# CONFIG_SH_DSP is not set 167# CONFIG_SH_DSP is not set
195# CONFIG_SH_STORE_QUEUES is not set 168# CONFIG_SH_STORE_QUEUES is not set
196CONFIG_CPU_HAS_INTEVT=y 169CONFIG_CPU_HAS_INTEVT=y
170CONFIG_CPU_HAS_INTC_IRQ=y
171CONFIG_CPU_HAS_IPR_IRQ=y
197CONFIG_CPU_HAS_SR_RB=y 172CONFIG_CPU_HAS_SR_RB=y
173CONFIG_CPU_HAS_PTEA=y
174
175#
176# Board support
177#
178# CONFIG_SH_7751_SYSTEMH is not set
179CONFIG_SH_SECUREEDGE5410=y
180# CONFIG_SH_HS7751RVOIP is not set
181# CONFIG_SH_RTS7751R2D is not set
182# CONFIG_SH_LANDISK is not set
183# CONFIG_SH_TITAN is not set
184# CONFIG_SH_LBOX_RE2 is not set
198 185
199# 186#
200# Timer support 187# Timer and clock configuration
201# 188#
202CONFIG_SH_TMU=y 189CONFIG_SH_TMU=y
190CONFIG_SH_TIMER_IRQ=16
203CONFIG_SH_PCLK_FREQ=60000000 191CONFIG_SH_PCLK_FREQ=60000000
192# CONFIG_TICK_ONESHOT is not set
193# CONFIG_NO_HZ is not set
194# CONFIG_HIGH_RES_TIMERS is not set
204 195
205# 196#
206# CPU Frequency scaling 197# CPU Frequency scaling
@@ -210,24 +201,31 @@ CONFIG_SH_PCLK_FREQ=60000000
210# 201#
211# DMA support 202# DMA support
212# 203#
204CONFIG_SH_DMA_API=y
213CONFIG_SH_DMA=y 205CONFIG_SH_DMA=y
214CONFIG_NR_ONCHIP_DMA_CHANNELS=4 206CONFIG_NR_ONCHIP_DMA_CHANNELS=8
215# CONFIG_NR_DMA_CHANNELS_BOOL is not set 207# CONFIG_NR_DMA_CHANNELS_BOOL is not set
216 208
217# 209#
218# Companion Chips 210# Companion Chips
219# 211#
220# CONFIG_HD6446X_SERIES is not set 212
213#
214# Additional SuperH Device Drivers
215#
216# CONFIG_HEARTBEAT is not set
217# CONFIG_PUSH_SWITCH is not set
221 218
222# 219#
223# Kernel features 220# Kernel features
224# 221#
225# CONFIG_HZ_100 is not set 222# CONFIG_HZ_100 is not set
226CONFIG_HZ_250=y 223CONFIG_HZ_250=y
224# CONFIG_HZ_300 is not set
227# CONFIG_HZ_1000 is not set 225# CONFIG_HZ_1000 is not set
228CONFIG_HZ=250 226CONFIG_HZ=250
229# CONFIG_KEXEC is not set 227# CONFIG_KEXEC is not set
230# CONFIG_SMP is not set 228# CONFIG_CRASH_DUMP is not set
231CONFIG_PREEMPT_NONE=y 229CONFIG_PREEMPT_NONE=y
232# CONFIG_PREEMPT_VOLUNTARY is not set 230# CONFIG_PREEMPT_VOLUNTARY is not set
233# CONFIG_PREEMPT is not set 231# CONFIG_PREEMPT is not set
@@ -243,33 +241,24 @@ CONFIG_BOOT_LINK_OFFSET=0x00800000
243# 241#
244# Bus options 242# Bus options
245# 243#
244CONFIG_SH_CONCAT_FS=y
246CONFIG_PCI=y 245CONFIG_PCI=y
247# CONFIG_SH_PCIDMA_NONCOHERENT is not set 246CONFIG_SH_PCIDMA_NONCOHERENT=y
248CONFIG_PCI_AUTO=y 247CONFIG_PCI_AUTO=y
249CONFIG_PCI_AUTO_UPDATE_RESOURCES=y 248CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
250# CONFIG_PCI_MULTITHREAD_PROBE is not set 249# CONFIG_ARCH_SUPPORTS_MSI is not set
251 250
252# 251#
253# PCCARD (PCMCIA/CardBus) support 252# PCCARD (PCMCIA/CardBus) support
254# 253#
255 254
256# 255#
257# PCI Hotplug Support
258#
259
260#
261# Executable file formats 256# Executable file formats
262# 257#
263CONFIG_BINFMT_ELF=y 258CONFIG_BINFMT_ELF=y
264# CONFIG_BINFMT_FLAT is not set
265# CONFIG_BINFMT_MISC is not set 259# CONFIG_BINFMT_MISC is not set
266 260
267# 261#
268# Power management options (EXPERIMENTAL)
269#
270# CONFIG_PM is not set
271
272#
273# Networking 262# Networking
274# 263#
275CONFIG_NET=y 264CONFIG_NET=y
@@ -277,21 +266,14 @@ CONFIG_NET=y
277# 266#
278# Networking options 267# Networking options
279# 268#
280# CONFIG_NETDEBUG is not set
281# CONFIG_PACKET is not set 269# CONFIG_PACKET is not set
282# CONFIG_UNIX is not set 270# CONFIG_UNIX is not set
283CONFIG_XFRM=y
284# CONFIG_XFRM_USER is not set
285# CONFIG_XFRM_SUB_POLICY is not set
286# CONFIG_NET_KEY is not set 271# CONFIG_NET_KEY is not set
287CONFIG_INET=y 272CONFIG_INET=y
288# CONFIG_IP_MULTICAST is not set 273# CONFIG_IP_MULTICAST is not set
289# CONFIG_IP_ADVANCED_ROUTER is not set 274# CONFIG_IP_ADVANCED_ROUTER is not set
290CONFIG_IP_FIB_HASH=y 275CONFIG_IP_FIB_HASH=y
291CONFIG_IP_PNP=y 276# CONFIG_IP_PNP is not set
292CONFIG_IP_PNP_DHCP=y
293# CONFIG_IP_PNP_BOOTP is not set
294# CONFIG_IP_PNP_RARP is not set
295# CONFIG_NET_IPIP is not set 277# CONFIG_NET_IPIP is not set
296# CONFIG_NET_IPGRE is not set 278# CONFIG_NET_IPGRE is not set
297# CONFIG_ARPD is not set 279# CONFIG_ARPD is not set
@@ -301,32 +283,21 @@ CONFIG_IP_PNP_DHCP=y
301# CONFIG_INET_IPCOMP is not set 283# CONFIG_INET_IPCOMP is not set
302# CONFIG_INET_XFRM_TUNNEL is not set 284# CONFIG_INET_XFRM_TUNNEL is not set
303# CONFIG_INET_TUNNEL is not set 285# CONFIG_INET_TUNNEL is not set
304CONFIG_INET_XFRM_MODE_TRANSPORT=y 286# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
305CONFIG_INET_XFRM_MODE_TUNNEL=y 287# CONFIG_INET_XFRM_MODE_TUNNEL is not set
306CONFIG_INET_DIAG=y 288# CONFIG_INET_XFRM_MODE_BEET is not set
307CONFIG_INET_TCP_DIAG=y 289# CONFIG_INET_DIAG is not set
308# CONFIG_TCP_CONG_ADVANCED is not set 290# CONFIG_TCP_CONG_ADVANCED is not set
309CONFIG_TCP_CONG_CUBIC=y 291CONFIG_TCP_CONG_CUBIC=y
310CONFIG_DEFAULT_TCP_CONG="cubic" 292CONFIG_DEFAULT_TCP_CONG="cubic"
293# CONFIG_TCP_MD5SIG is not set
311# CONFIG_IPV6 is not set 294# CONFIG_IPV6 is not set
312# CONFIG_INET6_XFRM_TUNNEL is not set 295# CONFIG_INET6_XFRM_TUNNEL is not set
313# CONFIG_INET6_TUNNEL is not set 296# CONFIG_INET6_TUNNEL is not set
314# CONFIG_NETWORK_SECMARK is not set 297# CONFIG_NETWORK_SECMARK is not set
315# CONFIG_NETFILTER is not set 298# CONFIG_NETFILTER is not set
316
317#
318# DCCP Configuration (EXPERIMENTAL)
319#
320# CONFIG_IP_DCCP is not set 299# CONFIG_IP_DCCP is not set
321
322#
323# SCTP Configuration (EXPERIMENTAL)
324#
325# CONFIG_IP_SCTP is not set 300# CONFIG_IP_SCTP is not set
326
327#
328# TIPC Configuration (EXPERIMENTAL)
329#
330# CONFIG_TIPC is not set 301# CONFIG_TIPC is not set
331# CONFIG_ATM is not set 302# CONFIG_ATM is not set
332# CONFIG_BRIDGE is not set 303# CONFIG_BRIDGE is not set
@@ -352,7 +323,17 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
352# CONFIG_HAMRADIO is not set 323# CONFIG_HAMRADIO is not set
353# CONFIG_IRDA is not set 324# CONFIG_IRDA is not set
354# CONFIG_BT is not set 325# CONFIG_BT is not set
326# CONFIG_AF_RXRPC is not set
327
328#
329# Wireless
330#
331# CONFIG_CFG80211 is not set
332# CONFIG_WIRELESS_EXT is not set
333# CONFIG_MAC80211 is not set
355# CONFIG_IEEE80211 is not set 334# CONFIG_IEEE80211 is not set
335# CONFIG_RFKILL is not set
336# CONFIG_NET_9P is not set
356 337
357# 338#
358# Device Drivers 339# Device Drivers
@@ -364,30 +345,88 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
364CONFIG_STANDALONE=y 345CONFIG_STANDALONE=y
365CONFIG_PREVENT_FIRMWARE_BUILD=y 346CONFIG_PREVENT_FIRMWARE_BUILD=y
366# CONFIG_SYS_HYPERVISOR is not set 347# CONFIG_SYS_HYPERVISOR is not set
367
368#
369# Connector - unified userspace <-> kernelspace linker
370#
371# CONFIG_CONNECTOR is not set 348# CONFIG_CONNECTOR is not set
372 349CONFIG_MTD=y
373# 350# CONFIG_MTD_DEBUG is not set
374# Memory Technology Devices (MTD) 351# CONFIG_MTD_CONCAT is not set
375# 352CONFIG_MTD_PARTITIONS=y
376# CONFIG_MTD is not set 353# CONFIG_MTD_REDBOOT_PARTS is not set
377 354# CONFIG_MTD_CMDLINE_PARTS is not set
378# 355
379# Parallel port support 356#
380# 357# User Modules And Translation Layers
358#
359CONFIG_MTD_CHAR=y
360CONFIG_MTD_BLKDEVS=y
361# CONFIG_MTD_BLOCK is not set
362CONFIG_MTD_BLOCK_RO=y
363# CONFIG_FTL is not set
364# CONFIG_NFTL is not set
365# CONFIG_INFTL is not set
366# CONFIG_RFD_FTL is not set
367# CONFIG_SSFDC is not set
368
369#
370# RAM/ROM/Flash chip drivers
371#
372CONFIG_MTD_CFI=y
373# CONFIG_MTD_JEDECPROBE is not set
374CONFIG_MTD_GEN_PROBE=y
375CONFIG_MTD_CFI_ADV_OPTIONS=y
376CONFIG_MTD_CFI_NOSWAP=y
377# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
378# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
379CONFIG_MTD_CFI_GEOMETRY=y
380CONFIG_MTD_MAP_BANK_WIDTH_1=y
381# CONFIG_MTD_MAP_BANK_WIDTH_2 is not set
382# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
383# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
384# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
385# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
386CONFIG_MTD_CFI_I1=y
387# CONFIG_MTD_CFI_I2 is not set
388# CONFIG_MTD_CFI_I4 is not set
389# CONFIG_MTD_CFI_I8 is not set
390# CONFIG_MTD_OTP is not set
391CONFIG_MTD_CFI_INTELEXT=y
392# CONFIG_MTD_CFI_AMDSTD is not set
393# CONFIG_MTD_CFI_STAA is not set
394CONFIG_MTD_CFI_UTIL=y
395CONFIG_MTD_RAM=y
396# CONFIG_MTD_ROM is not set
397# CONFIG_MTD_ABSENT is not set
398
399#
400# Mapping drivers for chip access
401#
402# CONFIG_MTD_COMPLEX_MAPPINGS is not set
403# CONFIG_MTD_PHYSMAP is not set
404CONFIG_MTD_PLATRAM=y
405
406#
407# Self-contained MTD device drivers
408#
409# CONFIG_MTD_PMC551 is not set
410# CONFIG_MTD_SLRAM is not set
411# CONFIG_MTD_PHRAM is not set
412# CONFIG_MTD_MTDRAM is not set
413# CONFIG_MTD_BLOCK2MTD is not set
414
415#
416# Disk-On-Chip Device Drivers
417#
418# CONFIG_MTD_DOC2000 is not set
419# CONFIG_MTD_DOC2001 is not set
420# CONFIG_MTD_DOC2001PLUS is not set
421# CONFIG_MTD_NAND is not set
422# CONFIG_MTD_ONENAND is not set
423
424#
425# UBI - Unsorted block images
426#
427# CONFIG_MTD_UBI is not set
381# CONFIG_PARPORT is not set 428# CONFIG_PARPORT is not set
382 429CONFIG_BLK_DEV=y
383#
384# Plug and Play support
385#
386
387#
388# Block devices
389#
390# CONFIG_BLK_CPQ_DA is not set
391# CONFIG_BLK_CPQ_CISS_DA is not set 430# CONFIG_BLK_CPQ_CISS_DA is not set
392# CONFIG_BLK_DEV_DAC960 is not set 431# CONFIG_BLK_DEV_DAC960 is not set
393# CONFIG_BLK_DEV_UMEM is not set 432# CONFIG_BLK_DEV_UMEM is not set
@@ -399,13 +438,9 @@ CONFIG_BLK_DEV_RAM=y
399CONFIG_BLK_DEV_RAM_COUNT=16 438CONFIG_BLK_DEV_RAM_COUNT=16
400CONFIG_BLK_DEV_RAM_SIZE=4096 439CONFIG_BLK_DEV_RAM_SIZE=4096
401CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 440CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
402CONFIG_BLK_DEV_INITRD=y
403# CONFIG_CDROM_PKTCDVD is not set 441# CONFIG_CDROM_PKTCDVD is not set
404# CONFIG_ATA_OVER_ETH is not set 442# CONFIG_ATA_OVER_ETH is not set
405 443# CONFIG_MISC_DEVICES is not set
406#
407# ATA/ATAPI/MFM/RLL support
408#
409# CONFIG_IDE is not set 444# CONFIG_IDE is not set
410 445
411# 446#
@@ -413,16 +448,9 @@ CONFIG_BLK_DEV_INITRD=y
413# 448#
414# CONFIG_RAID_ATTRS is not set 449# CONFIG_RAID_ATTRS is not set
415# CONFIG_SCSI is not set 450# CONFIG_SCSI is not set
451# CONFIG_SCSI_DMA is not set
416# CONFIG_SCSI_NETLINK is not set 452# CONFIG_SCSI_NETLINK is not set
417
418#
419# Serial ATA (prod) and Parallel ATA (experimental) drivers
420#
421# CONFIG_ATA is not set 453# CONFIG_ATA is not set
422
423#
424# Multi-device support (RAID and LVM)
425#
426# CONFIG_MD is not set 454# CONFIG_MD is not set
427 455
428# 456#
@@ -433,35 +461,18 @@ CONFIG_BLK_DEV_INITRD=y
433# 461#
434# IEEE 1394 (FireWire) support 462# IEEE 1394 (FireWire) support
435# 463#
464# CONFIG_FIREWIRE is not set
436# CONFIG_IEEE1394 is not set 465# CONFIG_IEEE1394 is not set
437
438#
439# I2O device support
440#
441# CONFIG_I2O is not set 466# CONFIG_I2O is not set
442
443#
444# Network device support
445#
446CONFIG_NETDEVICES=y 467CONFIG_NETDEVICES=y
468# CONFIG_NETDEVICES_MULTIQUEUE is not set
447# CONFIG_DUMMY is not set 469# CONFIG_DUMMY is not set
448# CONFIG_BONDING is not set 470# CONFIG_BONDING is not set
471# CONFIG_MACVLAN is not set
449# CONFIG_EQUALIZER is not set 472# CONFIG_EQUALIZER is not set
450# CONFIG_TUN is not set 473# CONFIG_TUN is not set
451
452#
453# ARCnet devices
454#
455# CONFIG_ARCNET is not set 474# CONFIG_ARCNET is not set
456
457#
458# PHY device support
459#
460# CONFIG_PHYLIB is not set 475# CONFIG_PHYLIB is not set
461
462#
463# Ethernet (10 or 100Mbit)
464#
465CONFIG_NET_ETHERNET=y 476CONFIG_NET_ETHERNET=y
466CONFIG_MII=y 477CONFIG_MII=y
467# CONFIG_STNIC is not set 478# CONFIG_STNIC is not set
@@ -470,10 +481,6 @@ CONFIG_MII=y
470# CONFIG_CASSINI is not set 481# CONFIG_CASSINI is not set
471# CONFIG_NET_VENDOR_3COM is not set 482# CONFIG_NET_VENDOR_3COM is not set
472# CONFIG_SMC91X is not set 483# CONFIG_SMC91X is not set
473
474#
475# Tulip family network device support
476#
477# CONFIG_NET_TULIP is not set 484# CONFIG_NET_TULIP is not set
478# CONFIG_HP100 is not set 485# CONFIG_HP100 is not set
479CONFIG_NET_PCI=y 486CONFIG_NET_PCI=y
@@ -488,9 +495,9 @@ CONFIG_NET_PCI=y
488# CONFIG_FEALNX is not set 495# CONFIG_FEALNX is not set
489# CONFIG_NATSEMI is not set 496# CONFIG_NATSEMI is not set
490# CONFIG_NE2K_PCI is not set 497# CONFIG_NE2K_PCI is not set
491# CONFIG_8139CP is not set 498CONFIG_8139CP=y
492CONFIG_8139TOO=y 499CONFIG_8139TOO=y
493# CONFIG_8139TOO_PIO is not set 500CONFIG_8139TOO_PIO=y
494# CONFIG_8139TOO_TUNE_TWISTER is not set 501# CONFIG_8139TOO_TUNE_TWISTER is not set
495# CONFIG_8139TOO_8129 is not set 502# CONFIG_8139TOO_8129 is not set
496# CONFIG_8139_OLD_RX_RESET is not set 503# CONFIG_8139_OLD_RX_RESET is not set
@@ -499,47 +506,16 @@ CONFIG_8139TOO=y
499# CONFIG_SUNDANCE is not set 506# CONFIG_SUNDANCE is not set
500# CONFIG_TLAN is not set 507# CONFIG_TLAN is not set
501# CONFIG_VIA_RHINE is not set 508# CONFIG_VIA_RHINE is not set
502 509# CONFIG_SC92031 is not set
503# 510# CONFIG_NETDEV_1000 is not set
504# Ethernet (1000 Mbit) 511# CONFIG_NETDEV_10000 is not set
505#
506# CONFIG_ACENIC is not set
507# CONFIG_DL2K is not set
508# CONFIG_E1000 is not set
509# CONFIG_NS83820 is not set
510# CONFIG_HAMACHI is not set
511# CONFIG_YELLOWFIN is not set
512# CONFIG_R8169 is not set
513# CONFIG_SIS190 is not set
514# CONFIG_SKGE is not set
515# CONFIG_SKY2 is not set
516# CONFIG_SK98LIN is not set
517# CONFIG_VIA_VELOCITY is not set
518# CONFIG_TIGON3 is not set
519# CONFIG_BNX2 is not set
520# CONFIG_QLA3XXX is not set
521
522#
523# Ethernet (10000 Mbit)
524#
525# CONFIG_CHELSIO_T1 is not set
526# CONFIG_IXGB is not set
527# CONFIG_S2IO is not set
528# CONFIG_MYRI10GE is not set
529
530#
531# Token Ring devices
532#
533# CONFIG_TR is not set 512# CONFIG_TR is not set
534 513
535# 514#
536# Wireless LAN (non-hamradio) 515# Wireless LAN
537#
538# CONFIG_NET_RADIO is not set
539
540#
541# Wan interfaces
542# 516#
517# CONFIG_WLAN_PRE80211 is not set
518# CONFIG_WLAN_80211 is not set
543# CONFIG_WAN is not set 519# CONFIG_WAN is not set
544# CONFIG_FDDI is not set 520# CONFIG_FDDI is not set
545# CONFIG_HIPPI is not set 521# CONFIG_HIPPI is not set
@@ -549,15 +525,7 @@ CONFIG_8139TOO=y
549# CONFIG_NETCONSOLE is not set 525# CONFIG_NETCONSOLE is not set
550# CONFIG_NETPOLL is not set 526# CONFIG_NETPOLL is not set
551# CONFIG_NET_POLL_CONTROLLER is not set 527# CONFIG_NET_POLL_CONTROLLER is not set
552
553#
554# ISDN subsystem
555#
556# CONFIG_ISDN is not set 528# CONFIG_ISDN is not set
557
558#
559# Telephony Support
560#
561# CONFIG_PHONE is not set 529# CONFIG_PHONE is not set
562 530
563# 531#
@@ -565,14 +533,12 @@ CONFIG_8139TOO=y
565# 533#
566CONFIG_INPUT=y 534CONFIG_INPUT=y
567# CONFIG_INPUT_FF_MEMLESS is not set 535# CONFIG_INPUT_FF_MEMLESS is not set
536# CONFIG_INPUT_POLLDEV is not set
568 537
569# 538#
570# Userland interfaces 539# Userland interfaces
571# 540#
572CONFIG_INPUT_MOUSEDEV=y 541# CONFIG_INPUT_MOUSEDEV is not set
573CONFIG_INPUT_MOUSEDEV_PSAUX=y
574CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
575CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
576# CONFIG_INPUT_JOYDEV is not set 542# CONFIG_INPUT_JOYDEV is not set
577# CONFIG_INPUT_TSDEV is not set 543# CONFIG_INPUT_TSDEV is not set
578# CONFIG_INPUT_EVDEV is not set 544# CONFIG_INPUT_EVDEV is not set
@@ -584,27 +550,20 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
584# CONFIG_INPUT_KEYBOARD is not set 550# CONFIG_INPUT_KEYBOARD is not set
585# CONFIG_INPUT_MOUSE is not set 551# CONFIG_INPUT_MOUSE is not set
586# CONFIG_INPUT_JOYSTICK is not set 552# CONFIG_INPUT_JOYSTICK is not set
553# CONFIG_INPUT_TABLET is not set
587# CONFIG_INPUT_TOUCHSCREEN is not set 554# CONFIG_INPUT_TOUCHSCREEN is not set
588# CONFIG_INPUT_MISC is not set 555# CONFIG_INPUT_MISC is not set
589 556
590# 557#
591# Hardware I/O ports 558# Hardware I/O ports
592# 559#
593CONFIG_SERIO=y 560# CONFIG_SERIO is not set
594CONFIG_SERIO_I8042=y
595CONFIG_SERIO_SERPORT=y
596# CONFIG_SERIO_PCIPS2 is not set
597# CONFIG_SERIO_LIBPS2 is not set
598# CONFIG_SERIO_RAW is not set
599# CONFIG_GAMEPORT is not set 561# CONFIG_GAMEPORT is not set
600 562
601# 563#
602# Character devices 564# Character devices
603# 565#
604CONFIG_VT=y 566# CONFIG_VT is not set
605CONFIG_VT_CONSOLE=y
606CONFIG_HW_CONSOLE=y
607# CONFIG_VT_HW_CONSOLE_BINDING is not set
608# CONFIG_SERIAL_NONSTANDARD is not set 567# CONFIG_SERIAL_NONSTANDARD is not set
609 568
610# 569#
@@ -615,42 +574,24 @@ CONFIG_HW_CONSOLE=y
615# 574#
616# Non-8250 serial port support 575# Non-8250 serial port support
617# 576#
618# CONFIG_SERIAL_SH_SCI is not set 577CONFIG_SERIAL_SH_SCI=y
578CONFIG_SERIAL_SH_SCI_NR_UARTS=2
579CONFIG_SERIAL_SH_SCI_CONSOLE=y
580CONFIG_SERIAL_CORE=y
581CONFIG_SERIAL_CORE_CONSOLE=y
619# CONFIG_SERIAL_JSM is not set 582# CONFIG_SERIAL_JSM is not set
620CONFIG_UNIX98_PTYS=y 583CONFIG_UNIX98_PTYS=y
621CONFIG_LEGACY_PTYS=y 584CONFIG_LEGACY_PTYS=y
622CONFIG_LEGACY_PTY_COUNT=256 585CONFIG_LEGACY_PTY_COUNT=256
623
624#
625# IPMI
626#
627# CONFIG_IPMI_HANDLER is not set 586# CONFIG_IPMI_HANDLER is not set
628
629#
630# Watchdog Cards
631#
632# CONFIG_WATCHDOG is not set 587# CONFIG_WATCHDOG is not set
633CONFIG_HW_RANDOM=y 588# CONFIG_HW_RANDOM is not set
634# CONFIG_GEN_RTC is not set
635# CONFIG_DTLK is not set
636# CONFIG_R3964 is not set 589# CONFIG_R3964 is not set
637# CONFIG_APPLICOM is not set 590# CONFIG_APPLICOM is not set
638
639#
640# Ftape, the floppy tape device driver
641#
642# CONFIG_DRM is not set 591# CONFIG_DRM is not set
643# CONFIG_RAW_DRIVER is not set 592# CONFIG_RAW_DRIVER is not set
644
645#
646# TPM devices
647#
648# CONFIG_TCG_TPM is not set 593# CONFIG_TCG_TPM is not set
649# CONFIG_TELCLOCK is not set 594CONFIG_DEVPORT=y
650
651#
652# I2C support
653#
654# CONFIG_I2C is not set 595# CONFIG_I2C is not set
655 596
656# 597#
@@ -658,98 +599,46 @@ CONFIG_HW_RANDOM=y
658# 599#
659# CONFIG_SPI is not set 600# CONFIG_SPI is not set
660# CONFIG_SPI_MASTER is not set 601# CONFIG_SPI_MASTER is not set
602# CONFIG_W1 is not set
603# CONFIG_POWER_SUPPLY is not set
604# CONFIG_HWMON is not set
661 605
662# 606#
663# Dallas's 1-wire bus 607# Multifunction device drivers
664#
665
666#
667# Hardware Monitoring support
668#
669CONFIG_HWMON=y
670# CONFIG_HWMON_VID is not set
671# CONFIG_SENSORS_ABITUGURU is not set
672# CONFIG_SENSORS_F71805F is not set
673# CONFIG_SENSORS_VT1211 is not set
674# CONFIG_HWMON_DEBUG_CHIP is not set
675
676#
677# Misc devices
678# 608#
609# CONFIG_MFD_SM501 is not set
679 610
680# 611#
681# Multimedia devices 612# Multimedia devices
682# 613#
683# CONFIG_VIDEO_DEV is not set 614# CONFIG_VIDEO_DEV is not set
684CONFIG_VIDEO_V4L2=y 615# CONFIG_DVB_CORE is not set
685 616# CONFIG_DAB is not set
686#
687# Digital Video Broadcasting Devices
688#
689# CONFIG_DVB is not set
690 617
691# 618#
692# Graphics support 619# Graphics support
693# 620#
694CONFIG_FIRMWARE_EDID=y 621# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
695# CONFIG_FB is not set
696 622
697# 623#
698# Console display driver support 624# Display device support
699# 625#
700CONFIG_DUMMY_CONSOLE=y 626# CONFIG_DISPLAY_SUPPORT is not set
701# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 627# CONFIG_VGASTATE is not set
628# CONFIG_VIDEO_OUTPUT_CONTROL is not set
629# CONFIG_FB is not set
702 630
703# 631#
704# Sound 632# Sound
705# 633#
706# CONFIG_SOUND is not set 634# CONFIG_SOUND is not set
707 635# CONFIG_HID_SUPPORT is not set
708# 636# CONFIG_USB_SUPPORT is not set
709# USB support
710#
711CONFIG_USB_ARCH_HAS_HCD=y
712CONFIG_USB_ARCH_HAS_OHCI=y
713CONFIG_USB_ARCH_HAS_EHCI=y
714# CONFIG_USB is not set
715
716#
717# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
718#
719
720#
721# USB Gadget Support
722#
723# CONFIG_USB_GADGET is not set
724
725#
726# MMC/SD Card support
727#
728# CONFIG_MMC is not set 637# CONFIG_MMC is not set
729
730#
731# LED devices
732#
733# CONFIG_NEW_LEDS is not set 638# CONFIG_NEW_LEDS is not set
734
735#
736# LED drivers
737#
738
739#
740# LED Triggers
741#
742
743#
744# InfiniBand support
745#
746# CONFIG_INFINIBAND is not set 639# CONFIG_INFINIBAND is not set
747 640
748# 641#
749# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
750#
751
752#
753# Real Time Clock 642# Real Time Clock
754# 643#
755# CONFIG_RTC_CLASS is not set 644# CONFIG_RTC_CLASS is not set
@@ -768,23 +657,29 @@ CONFIG_USB_ARCH_HAS_EHCI=y
768# 657#
769 658
770# 659#
660# Userspace I/O
661#
662# CONFIG_UIO is not set
663
664#
771# File systems 665# File systems
772# 666#
773CONFIG_EXT2_FS=y 667CONFIG_EXT2_FS=y
774# CONFIG_EXT2_FS_XATTR is not set 668# CONFIG_EXT2_FS_XATTR is not set
775# CONFIG_EXT2_FS_XIP is not set 669# CONFIG_EXT2_FS_XIP is not set
776# CONFIG_EXT3_FS is not set 670# CONFIG_EXT3_FS is not set
671# CONFIG_EXT4DEV_FS is not set
777# CONFIG_REISERFS_FS is not set 672# CONFIG_REISERFS_FS is not set
778# CONFIG_JFS_FS is not set 673# CONFIG_JFS_FS is not set
779# CONFIG_FS_POSIX_ACL is not set 674# CONFIG_FS_POSIX_ACL is not set
780# CONFIG_XFS_FS is not set 675# CONFIG_XFS_FS is not set
676# CONFIG_GFS2_FS is not set
781# CONFIG_OCFS2_FS is not set 677# CONFIG_OCFS2_FS is not set
782# CONFIG_MINIX_FS is not set 678# CONFIG_MINIX_FS is not set
783CONFIG_ROMFS_FS=y 679CONFIG_ROMFS_FS=y
784CONFIG_INOTIFY=y 680# CONFIG_INOTIFY is not set
785CONFIG_INOTIFY_USER=y
786# CONFIG_QUOTA is not set 681# CONFIG_QUOTA is not set
787CONFIG_DNOTIFY=y 682# CONFIG_DNOTIFY is not set
788# CONFIG_AUTOFS_FS is not set 683# CONFIG_AUTOFS_FS is not set
789# CONFIG_AUTOFS4_FS is not set 684# CONFIG_AUTOFS4_FS is not set
790# CONFIG_FUSE_FS is not set 685# CONFIG_FUSE_FS is not set
@@ -826,6 +721,7 @@ CONFIG_RAMFS=y
826# CONFIG_BEFS_FS is not set 721# CONFIG_BEFS_FS is not set
827# CONFIG_BFS_FS is not set 722# CONFIG_BFS_FS is not set
828# CONFIG_EFS_FS is not set 723# CONFIG_EFS_FS is not set
724# CONFIG_JFFS2_FS is not set
829CONFIG_CRAMFS=y 725CONFIG_CRAMFS=y
830# CONFIG_VXFS_FS is not set 726# CONFIG_VXFS_FS is not set
831# CONFIG_HPFS_FS is not set 727# CONFIG_HPFS_FS is not set
@@ -836,25 +732,13 @@ CONFIG_CRAMFS=y
836# 732#
837# Network File Systems 733# Network File Systems
838# 734#
839CONFIG_NFS_FS=y 735# CONFIG_NFS_FS is not set
840CONFIG_NFS_V3=y
841# CONFIG_NFS_V3_ACL is not set
842# CONFIG_NFS_V4 is not set
843# CONFIG_NFS_DIRECTIO is not set
844# CONFIG_NFSD is not set 736# CONFIG_NFSD is not set
845CONFIG_ROOT_NFS=y
846CONFIG_LOCKD=y
847CONFIG_LOCKD_V4=y
848CONFIG_NFS_COMMON=y
849CONFIG_SUNRPC=y
850# CONFIG_RPCSEC_GSS_KRB5 is not set
851# CONFIG_RPCSEC_GSS_SPKM3 is not set
852# CONFIG_SMB_FS is not set 737# CONFIG_SMB_FS is not set
853# CONFIG_CIFS is not set 738# CONFIG_CIFS is not set
854# CONFIG_NCP_FS is not set 739# CONFIG_NCP_FS is not set
855# CONFIG_CODA_FS is not set 740# CONFIG_CODA_FS is not set
856# CONFIG_AFS_FS is not set 741# CONFIG_AFS_FS is not set
857# CONFIG_9P_FS is not set
858 742
859# 743#
860# Partition Types 744# Partition Types
@@ -868,6 +752,11 @@ CONFIG_MSDOS_PARTITION=y
868# CONFIG_NLS is not set 752# CONFIG_NLS is not set
869 753
870# 754#
755# Distributed Lock Manager
756#
757# CONFIG_DLM is not set
758
759#
871# Profiling support 760# Profiling support
872# 761#
873# CONFIG_PROFILING is not set 762# CONFIG_PROFILING is not set
@@ -875,36 +764,38 @@ CONFIG_MSDOS_PARTITION=y
875# 764#
876# Kernel hacking 765# Kernel hacking
877# 766#
767CONFIG_TRACE_IRQFLAGS_SUPPORT=y
878# CONFIG_PRINTK_TIME is not set 768# CONFIG_PRINTK_TIME is not set
879CONFIG_ENABLE_MUST_CHECK=y 769CONFIG_ENABLE_MUST_CHECK=y
880# CONFIG_MAGIC_SYSRQ is not set 770# CONFIG_MAGIC_SYSRQ is not set
881# CONFIG_UNUSED_SYMBOLS is not set 771# CONFIG_UNUSED_SYMBOLS is not set
772# CONFIG_DEBUG_FS is not set
773# CONFIG_HEADERS_CHECK is not set
882# CONFIG_DEBUG_KERNEL is not set 774# CONFIG_DEBUG_KERNEL is not set
883CONFIG_LOG_BUF_SHIFT=14
884# CONFIG_DEBUG_BUGVERBOSE is not set 775# CONFIG_DEBUG_BUGVERBOSE is not set
885# CONFIG_DEBUG_FS is not set
886# CONFIG_UNWIND_INFO is not set
887# CONFIG_SH_STANDARD_BIOS is not set 776# CONFIG_SH_STANDARD_BIOS is not set
888# CONFIG_EARLY_SCIF_CONSOLE is not set 777# CONFIG_EARLY_SCIF_CONSOLE is not set
889# CONFIG_KGDB is not set 778# CONFIG_SH_KGDB is not set
890 779
891# 780#
892# Security options 781# Security options
893# 782#
894# CONFIG_KEYS is not set 783# CONFIG_KEYS is not set
895# CONFIG_SECURITY is not set 784# CONFIG_SECURITY is not set
896
897#
898# Cryptographic options
899#
900# CONFIG_CRYPTO is not set 785# CONFIG_CRYPTO is not set
901 786
902# 787#
903# Library routines 788# Library routines
904# 789#
790CONFIG_BITREVERSE=y
905# CONFIG_CRC_CCITT is not set 791# CONFIG_CRC_CCITT is not set
906# CONFIG_CRC16 is not set 792# CONFIG_CRC16 is not set
793# CONFIG_CRC_ITU_T is not set
907CONFIG_CRC32=y 794CONFIG_CRC32=y
795# CONFIG_CRC7 is not set
908# CONFIG_LIBCRC32C is not set 796# CONFIG_LIBCRC32C is not set
909CONFIG_ZLIB_INFLATE=y 797CONFIG_ZLIB_INFLATE=y
910CONFIG_PLIST=y 798CONFIG_PLIST=y
799CONFIG_HAS_IOMEM=y
800CONFIG_HAS_IOPORT=y
801CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/systemh_defconfig b/arch/sh/configs/systemh_defconfig
index c16350dac01b..af921b5a9d46 100644
--- a/arch/sh/configs/systemh_defconfig
+++ b/arch/sh/configs/systemh_defconfig
@@ -141,7 +141,7 @@ CONFIG_CPU_SH4=y
141# CONFIG_CPU_SUBTYPE_SH7091 is not set 141# CONFIG_CPU_SUBTYPE_SH7091 is not set
142# CONFIG_CPU_SUBTYPE_SH7750R is not set 142# CONFIG_CPU_SUBTYPE_SH7750R is not set
143# CONFIG_CPU_SUBTYPE_SH7750S is not set 143# CONFIG_CPU_SUBTYPE_SH7750S is not set
144CONFIG_CPU_SUBTYPE_SH7751=y 144# CONFIG_CPU_SUBTYPE_SH7751 is not set
145CONFIG_CPU_SUBTYPE_SH7751R=y 145CONFIG_CPU_SUBTYPE_SH7751R=y
146# CONFIG_CPU_SUBTYPE_SH7760 is not set 146# CONFIG_CPU_SUBTYPE_SH7760 is not set
147# CONFIG_CPU_SUBTYPE_SH4_202 is not set 147# CONFIG_CPU_SUBTYPE_SH4_202 is not set
diff --git a/arch/sh/configs/titan_defconfig b/arch/sh/configs/titan_defconfig
index 41049cf14b79..0686ed6fe17a 100644
--- a/arch/sh/configs/titan_defconfig
+++ b/arch/sh/configs/titan_defconfig
@@ -147,7 +147,7 @@ CONFIG_CPU_SH4=y
147# CONFIG_CPU_SUBTYPE_SH7091 is not set 147# CONFIG_CPU_SUBTYPE_SH7091 is not set
148# CONFIG_CPU_SUBTYPE_SH7750R is not set 148# CONFIG_CPU_SUBTYPE_SH7750R is not set
149# CONFIG_CPU_SUBTYPE_SH7750S is not set 149# CONFIG_CPU_SUBTYPE_SH7750S is not set
150CONFIG_CPU_SUBTYPE_SH7751=y 150# CONFIG_CPU_SUBTYPE_SH7751 is not set
151CONFIG_CPU_SUBTYPE_SH7751R=y 151CONFIG_CPU_SUBTYPE_SH7751R=y
152# CONFIG_CPU_SUBTYPE_SH7760 is not set 152# CONFIG_CPU_SUBTYPE_SH7760 is not set
153# CONFIG_CPU_SUBTYPE_SH4_202 is not set 153# CONFIG_CPU_SUBTYPE_SH4_202 is not set
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S
index d8e122971c3e..0d12a124055c 100644
--- a/arch/sh/kernel/cpu/sh3/entry.S
+++ b/arch/sh/kernel/cpu/sh3/entry.S
@@ -149,8 +149,7 @@ call_dpf:
149 lds r10, pr 149 lds r10, pr
150 rts 150 rts
151 nop 151 nop
1520: sti 1520: mov.l 3f, r0
153 mov.l 3f, r0
154 mov r9, r6 153 mov r9, r6
155 mov r8, r5 154 mov r8, r5
156 jmp @r0 155 jmp @r0
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index 502d43e4785c..67015044d74a 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -854,9 +854,14 @@ void __init trap_init(void)
854 set_exception_table_evt(0x800, do_reserved_inst); 854 set_exception_table_evt(0x800, do_reserved_inst);
855 set_exception_table_evt(0x820, do_illegal_slot_inst); 855 set_exception_table_evt(0x820, do_illegal_slot_inst);
856#elif defined(CONFIG_SH_FPU) 856#elif defined(CONFIG_SH_FPU)
857#ifdef CONFIG_CPU_SUBTYPE_SHX3
858 set_exception_table_evt(0xd80, do_fpu_state_restore);
859 set_exception_table_evt(0xda0, do_fpu_state_restore);
860#else
857 set_exception_table_evt(0x800, do_fpu_state_restore); 861 set_exception_table_evt(0x800, do_fpu_state_restore);
858 set_exception_table_evt(0x820, do_fpu_state_restore); 862 set_exception_table_evt(0x820, do_fpu_state_restore);
859#endif 863#endif
864#endif
860 865
861#ifdef CONFIG_CPU_SH2 866#ifdef CONFIG_CPU_SH2
862 set_exception_table_vec(TRAP_ADDRESS_ERROR, address_error_handler); 867 set_exception_table_vec(TRAP_ADDRESS_ERROR, address_error_handler);
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile
index d677d7f3afc1..4061e89d84d0 100644
--- a/arch/sh/mm/Makefile
+++ b/arch/sh/mm/Makefile
@@ -8,7 +8,9 @@ obj-$(CONFIG_CPU_SH2) += cache-sh2.o
8obj-$(CONFIG_CPU_SH3) += cache-sh3.o 8obj-$(CONFIG_CPU_SH3) += cache-sh3.o
9obj-$(CONFIG_CPU_SH4) += cache-sh4.o 9obj-$(CONFIG_CPU_SH4) += cache-sh4.o
10 10
11mmu-y := fault-nommu.o tlb-nommu.o pg-nommu.o 11mmu-y := tlb-nommu.o pg-nommu.o
12mmu-$(CONFIG_CPU_SH3) += fault-nommu.o
13mmu-$(CONFIG_CPU_SH4) += fault-nommu.o
12mmu-$(CONFIG_MMU) := fault.o clear_page.o copy_page.o tlb-flush.o \ 14mmu-$(CONFIG_MMU) := fault.o clear_page.o copy_page.o tlb-flush.o \
13 ioremap.o 15 ioremap.o
14 16
diff --git a/arch/sh/mm/fault-nommu.c b/arch/sh/mm/fault-nommu.c
index 923cb456819b..c6f5b51ec2c7 100644
--- a/arch/sh/mm/fault-nommu.c
+++ b/arch/sh/mm/fault-nommu.c
@@ -1,47 +1,33 @@
1/* 1/*
2 * arch/sh/mm/fault-nommu.c 2 * arch/sh/mm/fault-nommu.c
3 * 3 *
4 * Copyright (C) 2002 Paul Mundt 4 * Copyright (C) 2002 - 2007 Paul Mundt
5 * 5 *
6 * Based on linux/arch/sh/mm/fault.c: 6 * Based on linux/arch/sh/mm/fault.c:
7 * Copyright (C) 1999 Niibe Yutaka 7 * Copyright (C) 1999 Niibe Yutaka
8 * 8 *
9 * Released under the terms of the GNU GPL v2.0. 9 * Released under the terms of the GNU GPL v2.0.
10 */ 10 */
11
12#include <linux/signal.h>
13#include <linux/sched.h>
14#include <linux/kernel.h> 11#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/string.h>
17#include <linux/types.h>
18#include <linux/ptrace.h>
19#include <linux/mman.h>
20#include <linux/mm.h> 12#include <linux/mm.h>
21#include <linux/smp.h> 13#include <linux/hardirq.h>
22#include <linux/interrupt.h> 14#include <linux/kprobes.h>
23
24#include <asm/system.h> 15#include <asm/system.h>
25#include <asm/io.h> 16#include <asm/ptrace.h>
26#include <asm/uaccess.h>
27#include <asm/pgalloc.h>
28#include <asm/mmu_context.h>
29#include <asm/cacheflush.h>
30
31#if defined(CONFIG_SH_KGDB)
32#include <asm/kgdb.h> 17#include <asm/kgdb.h>
33#endif
34
35extern void die(const char *,struct pt_regs *,long);
36 18
37/* 19/*
38 * This routine handles page faults. It determines the address, 20 * This routine handles page faults. It determines the address,
39 * and the problem, and then passes it off to one of the appropriate 21 * and the problem, and then passes it off to one of the appropriate
40 * routines. 22 * routines.
41 */ 23 */
42asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess, 24asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
43 unsigned long address) 25 unsigned long writeaccess,
26 unsigned long address)
44{ 27{
28 trace_hardirqs_on();
29 local_irq_enable();
30
45#if defined(CONFIG_SH_KGDB) 31#if defined(CONFIG_SH_KGDB)
46 if (kgdb_nofault && kgdb_bus_err_hook) 32 if (kgdb_nofault && kgdb_bus_err_hook)
47 kgdb_bus_err_hook(); 33 kgdb_bus_err_hook();
@@ -65,17 +51,14 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
65 do_exit(SIGKILL); 51 do_exit(SIGKILL);
66} 52}
67 53
68asmlinkage int __do_page_fault(struct pt_regs *regs, unsigned long writeaccess, 54asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
69 unsigned long address) 55 unsigned long writeaccess,
56 unsigned long address)
70{ 57{
71#if defined(CONFIG_SH_KGDB) 58#if defined(CONFIG_SH_KGDB)
72 if (kgdb_nofault && kgdb_bus_err_hook) 59 if (kgdb_nofault && kgdb_bus_err_hook)
73 kgdb_bus_err_hook(); 60 kgdb_bus_err_hook();
74#endif 61#endif
75 62
76 if (address >= TASK_SIZE) 63 return (address >= TASK_SIZE);
77 return 1;
78
79 return 0;
80} 64}
81
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index 964c6767dc73..04a39aa7f1f9 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -184,8 +184,7 @@ no_context:
184 printk(KERN_ALERT "pc = %08lx\n", regs->pc); 184 printk(KERN_ALERT "pc = %08lx\n", regs->pc);
185 page = (unsigned long)get_TTB(); 185 page = (unsigned long)get_TTB();
186 if (page) { 186 if (page) {
187 page = ((__typeof__(page) *) __va(page))[address >> 187 page = ((__typeof__(page) *)page)[address >> PGDIR_SHIFT];
188 PGDIR_SHIFT];
189 printk(KERN_ALERT "*pde = %08lx\n", page); 188 printk(KERN_ALERT "*pde = %08lx\n", page);
190 if (page & _PAGE_PRESENT) { 189 if (page & _PAGE_PRESENT) {
191 page &= PAGE_MASK; 190 page &= PAGE_MASK;
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index ac352eb6dff3..e2d02fd13f35 100644
--- a/arch/sparc/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
@@ -238,6 +238,7 @@ void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *d
238 sd = &dev->ofdev.dev.archdata; 238 sd = &dev->ofdev.dev.archdata;
239 sd->prom_node = dp; 239 sd->prom_node = dp;
240 sd->op = &dev->ofdev; 240 sd->op = &dev->ofdev;
241 sd->iommu = dev->bus->ofdev.dev.parent->archdata.iommu;
241 242
242 dev->ofdev.node = dp; 243 dev->ofdev.node = dp;
243 dev->ofdev.dev.parent = &dev->bus->ofdev.dev; 244 dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index eac38388f5fd..88d2cefd01be 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -1,7 +1,6 @@
1/* $Id: entry.S,v 1.170 2001/11/13 00:57:05 davem Exp $ 1/* arch/sparc/kernel/entry.S: Sparc trap low-level entry points.
2 * arch/sparc/kernel/entry.S: Sparc trap low-level entry points.
3 * 2 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
6 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) 5 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
7 * Copyright (C) 1996-1999 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 6 * Copyright (C) 1996-1999 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -129,7 +128,7 @@ trap_low:
129 RESTORE_ALL 128 RESTORE_ALL
130#endif 129#endif
131 130
132#ifdef CONFIG_BLK_DEV_FD 131#if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
133 .text 132 .text
134 .align 4 133 .align 4
135 .globl floppy_hardint 134 .globl floppy_hardint
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c
index 75b2240ad0f9..b76dc03fc318 100644
--- a/arch/sparc/kernel/irq.c
+++ b/arch/sparc/kernel/irq.c
@@ -351,34 +351,14 @@ void handler_irq(int irq, struct pt_regs * regs)
351 set_irq_regs(old_regs); 351 set_irq_regs(old_regs);
352} 352}
353 353
354#ifdef CONFIG_BLK_DEV_FD 354#if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
355extern void floppy_interrupt(int irq, void *dev_id);
356
357void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
358{
359 struct pt_regs *old_regs;
360 int cpu = smp_processor_id();
361
362 old_regs = set_irq_regs(regs);
363 disable_pil_irq(irq);
364 irq_enter();
365 kstat_cpu(cpu).irqs[irq]++;
366 floppy_interrupt(irq, dev_id);
367 irq_exit();
368 enable_pil_irq(irq);
369 set_irq_regs(old_regs);
370 // XXX Eek, it's totally changed with preempt_count() and such
371 // if (softirq_pending(cpu))
372 // do_softirq();
373}
374#endif
375 355
376/* Fast IRQs on the Sparc can only have one routine attached to them, 356/* Fast IRQs on the Sparc can only have one routine attached to them,
377 * thus no sharing possible. 357 * thus no sharing possible.
378 */ 358 */
379int request_fast_irq(unsigned int irq, 359static int request_fast_irq(unsigned int irq,
380 irq_handler_t handler, 360 void (*handler)(void),
381 unsigned long irqflags, const char *devname) 361 unsigned long irqflags, const char *devname)
382{ 362{
383 struct irqaction *action; 363 struct irqaction *action;
384 unsigned long flags; 364 unsigned long flags;
@@ -457,7 +437,6 @@ int request_fast_irq(unsigned int irq,
457 */ 437 */
458 flush_cache_all(); 438 flush_cache_all();
459 439
460 action->handler = handler;
461 action->flags = irqflags; 440 action->flags = irqflags;
462 cpus_clear(action->mask); 441 cpus_clear(action->mask);
463 action->name = devname; 442 action->name = devname;
@@ -475,6 +454,61 @@ out:
475 return ret; 454 return ret;
476} 455}
477 456
457/* These variables are used to access state from the assembler
458 * interrupt handler, floppy_hardint, so we cannot put these in
459 * the floppy driver image because that would not work in the
460 * modular case.
461 */
462volatile unsigned char *fdc_status;
463EXPORT_SYMBOL(fdc_status);
464
465char *pdma_vaddr;
466EXPORT_SYMBOL(pdma_vaddr);
467
468unsigned long pdma_size;
469EXPORT_SYMBOL(pdma_size);
470
471volatile int doing_pdma;
472EXPORT_SYMBOL(doing_pdma);
473
474char *pdma_base;
475EXPORT_SYMBOL(pdma_base);
476
477unsigned long pdma_areasize;
478EXPORT_SYMBOL(pdma_areasize);
479
480extern void floppy_hardint(void);
481
482static irqreturn_t (*floppy_irq_handler)(int irq, void *dev_id);
483
484void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
485{
486 struct pt_regs *old_regs;
487 int cpu = smp_processor_id();
488
489 old_regs = set_irq_regs(regs);
490 disable_pil_irq(irq);
491 irq_enter();
492 kstat_cpu(cpu).irqs[irq]++;
493 floppy_irq_handler(irq, dev_id);
494 irq_exit();
495 enable_pil_irq(irq);
496 set_irq_regs(old_regs);
497 // XXX Eek, it's totally changed with preempt_count() and such
498 // if (softirq_pending(cpu))
499 // do_softirq();
500}
501
502int sparc_floppy_request_irq(int irq, unsigned long flags,
503 irqreturn_t (*irq_handler)(int irq, void *))
504{
505 floppy_irq_handler = irq_handler;
506 return request_fast_irq(irq, floppy_hardint, flags, "floppy");
507}
508EXPORT_SYMBOL(sparc_floppy_request_irq);
509
510#endif
511
478int request_irq(unsigned int irq, 512int request_irq(unsigned int irq,
479 irq_handler_t handler, 513 irq_handler_t handler,
480 unsigned long irqflags, const char * devname, void *dev_id) 514 unsigned long irqflags, const char * devname, void *dev_id)
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index 39fbd3c8ab0b..cd4fb79aa3a8 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -102,6 +102,21 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
102} 102}
103EXPORT_SYMBOL(of_set_property); 103EXPORT_SYMBOL(of_set_property);
104 104
105int of_find_in_proplist(const char *list, const char *match, int len)
106{
107 while (len > 0) {
108 int l;
109
110 if (!strcmp(list, match))
111 return 1;
112 l = strlen(list) + 1;
113 list += l;
114 len -= l;
115 }
116 return 0;
117}
118EXPORT_SYMBOL(of_find_in_proplist);
119
105static unsigned int prom_early_allocated; 120static unsigned int prom_early_allocated;
106 121
107static void * __init prom_early_alloc(unsigned long size) 122static void * __init prom_early_alloc(unsigned long size)
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index 7b4abde43028..ef647acc479e 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -143,7 +143,6 @@ EXPORT_SYMBOL(mstk48t02_regs);
143EXPORT_SYMBOL(set_auxio); 143EXPORT_SYMBOL(set_auxio);
144EXPORT_SYMBOL(get_auxio); 144EXPORT_SYMBOL(get_auxio);
145#endif 145#endif
146EXPORT_SYMBOL(request_fast_irq);
147EXPORT_SYMBOL(io_remap_pfn_range); 146EXPORT_SYMBOL(io_remap_pfn_range);
148 /* P3: iounit_xxx may be needed, sun4d users */ 147 /* P3: iounit_xxx may be needed, sun4d users */
149/* EXPORT_SYMBOL(iounit_map_dma_init); */ 148/* EXPORT_SYMBOL(iounit_map_dma_init); */
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c
index a1bef07755a9..c13e6cd279ac 100644
--- a/arch/sparc/mm/init.c
+++ b/arch/sparc/mm/init.c
@@ -206,8 +206,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
206#ifdef CONFIG_BLK_DEV_INITRD 206#ifdef CONFIG_BLK_DEV_INITRD
207 /* Now have to check initial ramdisk, so that bootmap does not overwrite it */ 207 /* Now have to check initial ramdisk, so that bootmap does not overwrite it */
208 if (sparc_ramdisk_image) { 208 if (sparc_ramdisk_image) {
209 if (sparc_ramdisk_image >= (unsigned long)&_end - 2 * PAGE_SIZE) 209 sparc_ramdisk_image -= KERNBASE;
210 sparc_ramdisk_image -= KERNBASE;
211 initrd_start = sparc_ramdisk_image + phys_base; 210 initrd_start = sparc_ramdisk_image + phys_base;
212 initrd_end = initrd_start + sparc_ramdisk_size; 211 initrd_end = initrd_start + sparc_ramdisk_size;
213 if (initrd_end > end_of_phys_memory) { 212 if (initrd_end > end_of_phys_memory) {
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index 4ccda77d08d6..7c89893b1fe8 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -66,7 +66,7 @@ iounit_init(int sbi_node, int io_node, struct sbus_bus *sbus)
66 } 66 }
67 if(!xpt) panic("Cannot map External Page Table."); 67 if(!xpt) panic("Cannot map External Page Table.");
68 68
69 sbus->iommu = (struct iommu_struct *)iounit; 69 sbus->ofdev.dev.archdata.iommu = iounit;
70 iounit->page_table = xpt; 70 iounit->page_table = xpt;
71 spin_lock_init(&iounit->lock); 71 spin_lock_init(&iounit->lock);
72 72
@@ -127,7 +127,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
127static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus) 127static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus)
128{ 128{
129 unsigned long ret, flags; 129 unsigned long ret, flags;
130 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 130 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
131 131
132 spin_lock_irqsave(&iounit->lock, flags); 132 spin_lock_irqsave(&iounit->lock, flags);
133 ret = iounit_get_area(iounit, (unsigned long)vaddr, len); 133 ret = iounit_get_area(iounit, (unsigned long)vaddr, len);
@@ -138,7 +138,7 @@ static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus
138static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus) 138static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus)
139{ 139{
140 unsigned long flags; 140 unsigned long flags;
141 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 141 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
142 142
143 /* FIXME: Cache some resolved pages - often several sg entries are to the same page */ 143 /* FIXME: Cache some resolved pages - often several sg entries are to the same page */
144 spin_lock_irqsave(&iounit->lock, flags); 144 spin_lock_irqsave(&iounit->lock, flags);
@@ -153,7 +153,7 @@ static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus
153static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus) 153static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus)
154{ 154{
155 unsigned long flags; 155 unsigned long flags;
156 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 156 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
157 157
158 spin_lock_irqsave(&iounit->lock, flags); 158 spin_lock_irqsave(&iounit->lock, flags);
159 len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT; 159 len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT;
@@ -168,7 +168,7 @@ static void iounit_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_
168{ 168{
169 unsigned long flags; 169 unsigned long flags;
170 unsigned long vaddr, len; 170 unsigned long vaddr, len;
171 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 171 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
172 172
173 spin_lock_irqsave(&iounit->lock, flags); 173 spin_lock_irqsave(&iounit->lock, flags);
174 while (sz != 0) { 174 while (sz != 0) {
@@ -211,7 +211,7 @@ static int iounit_map_dma_area(dma_addr_t *pba, unsigned long va, __u32 addr, in
211 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); 211 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT);
212 212
213 for_each_sbus(sbus) { 213 for_each_sbus(sbus) {
214 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 214 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
215 215
216 iopte = (iopte_t *)(iounit->page_table + i); 216 iopte = (iopte_t *)(iounit->page_table + i);
217 *iopte = MKIOPTE(__pa(page)); 217 *iopte = MKIOPTE(__pa(page));
@@ -235,7 +235,7 @@ static void iounit_unmap_dma_area(unsigned long addr, int len)
235static struct page *iounit_translate_dvma(unsigned long addr) 235static struct page *iounit_translate_dvma(unsigned long addr)
236{ 236{
237 struct sbus_bus *sbus = sbus_root; /* They are all the same */ 237 struct sbus_bus *sbus = sbus_root; /* They are all the same */
238 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 238 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
239 int i; 239 int i;
240 iopte_t *iopte; 240 iopte_t *iopte;
241 241
@@ -279,7 +279,7 @@ __u32 iounit_map_dma_init(struct sbus_bus *sbus, int size)
279 unsigned long rotor, scan, limit; 279 unsigned long rotor, scan, limit;
280 unsigned long flags; 280 unsigned long flags;
281 __u32 ret; 281 __u32 ret;
282 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 282 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
283 283
284 npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT; 284 npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT;
285 i = 0x0213; 285 i = 0x0213;
@@ -315,7 +315,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
315__u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus) 315__u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus)
316{ 316{
317 int scan = (vaddr - IOUNIT_DMA_BASE) >> PAGE_SHIFT; 317 int scan = (vaddr - IOUNIT_DMA_BASE) >> PAGE_SHIFT;
318 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 318 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
319 319
320 iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK)); 320 iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK));
321 return vaddr + (((unsigned long)addr) & ~PAGE_MASK); 321 return vaddr + (((unsigned long)addr) & ~PAGE_MASK);
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index be042efd1ba4..52e907af9d29 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -132,7 +132,7 @@ iommu_init(int iommund, struct sbus_bus *sbus)
132 impl, vers, iommu->page_table, 132 impl, vers, iommu->page_table,
133 (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES); 133 (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);
134 134
135 sbus->iommu = iommu; 135 sbus->ofdev.dev.archdata.iommu = iommu;
136} 136}
137 137
138/* This begs to be btfixup-ed by srmmu. */ 138/* This begs to be btfixup-ed by srmmu. */
@@ -166,7 +166,7 @@ static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte)
166 166
167static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus) 167static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus)
168{ 168{
169 struct iommu_struct *iommu = sbus->iommu; 169 struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu;
170 int ioptex; 170 int ioptex;
171 iopte_t *iopte, *iopte0; 171 iopte_t *iopte, *iopte0;
172 unsigned int busa, busa0; 172 unsigned int busa, busa0;
@@ -291,7 +291,7 @@ static void iommu_get_scsi_sgl_pflush(struct scatterlist *sg, int sz, struct sbu
291 291
292static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus) 292static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus)
293{ 293{
294 struct iommu_struct *iommu = sbus->iommu; 294 struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu;
295 int ioptex; 295 int ioptex;
296 int i; 296 int i;
297 297
@@ -334,7 +334,7 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
334 unsigned long addr, int len) 334 unsigned long addr, int len)
335{ 335{
336 unsigned long page, end; 336 unsigned long page, end;
337 struct iommu_struct *iommu = sbus_root->iommu; 337 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
338 iopte_t *iopte = iommu->page_table; 338 iopte_t *iopte = iommu->page_table;
339 iopte_t *first; 339 iopte_t *first;
340 int ioptex; 340 int ioptex;
@@ -399,7 +399,7 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
399 399
400static void iommu_unmap_dma_area(unsigned long busa, int len) 400static void iommu_unmap_dma_area(unsigned long busa, int len)
401{ 401{
402 struct iommu_struct *iommu = sbus_root->iommu; 402 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
403 iopte_t *iopte = iommu->page_table; 403 iopte_t *iopte = iommu->page_table;
404 unsigned long end; 404 unsigned long end;
405 int ioptex = (busa - iommu->start) >> PAGE_SHIFT; 405 int ioptex = (busa - iommu->start) >> PAGE_SHIFT;
@@ -420,7 +420,7 @@ static void iommu_unmap_dma_area(unsigned long busa, int len)
420 420
421static struct page *iommu_translate_dvma(unsigned long busa) 421static struct page *iommu_translate_dvma(unsigned long busa)
422{ 422{
423 struct iommu_struct *iommu = sbus_root->iommu; 423 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
424 iopte_t *iopte = iommu->page_table; 424 iopte_t *iopte = iommu->page_table;
425 425
426 iopte += ((busa - iommu->start) >> PAGE_SHIFT); 426 iopte += ((busa - iommu->start) >> PAGE_SHIFT);
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index 79d60d86f6f8..005a3e72d4f2 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -268,7 +268,6 @@ static inline void sun4c_init_clean_mmu(unsigned long kernel_end)
268 unsigned char savectx, ctx; 268 unsigned char savectx, ctx;
269 269
270 savectx = sun4c_get_context(); 270 savectx = sun4c_get_context();
271 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end);
272 for (ctx = 0; ctx < num_contexts; ctx++) { 271 for (ctx = 0; ctx < num_contexts; ctx++) {
273 sun4c_set_context(ctx); 272 sun4c_set_context(ctx);
274 for (vaddr = 0; vaddr < 0x20000000; vaddr += SUN4C_REAL_PGDIR_SIZE) 273 for (vaddr = 0; vaddr < 0x20000000; vaddr += SUN4C_REAL_PGDIR_SIZE)
@@ -2064,7 +2063,6 @@ void __init sun4c_paging_init(void)
2064 unsigned long end_pfn, pages_avail; 2063 unsigned long end_pfn, pages_avail;
2065 2064
2066 kernel_end = (unsigned long) &end; 2065 kernel_end = (unsigned long) &end;
2067 kernel_end += (SUN4C_REAL_PGDIR_SIZE * 4);
2068 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end); 2066 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end);
2069 2067
2070 pages_avail = 0; 2068 pages_avail = 0;
diff --git a/arch/sparc64/kernel/cpu.c b/arch/sparc64/kernel/cpu.c
index 7eb81d3954d9..e43db73f2b91 100644
--- a/arch/sparc64/kernel/cpu.c
+++ b/arch/sparc64/kernel/cpu.c
@@ -1,7 +1,7 @@
1/* cpu.c: Dinky routines to look for the kind of Sparc cpu 1/* cpu.c: Dinky routines to look for the kind of Sparc cpu
2 * we are on. 2 * we are on.
3 * 3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net)
5 */ 5 */
6 6
7#include <linux/kernel.h> 7#include <linux/kernel.h>
@@ -13,6 +13,7 @@
13#include <asm/fpumacro.h> 13#include <asm/fpumacro.h>
14#include <asm/cpudata.h> 14#include <asm/cpudata.h>
15#include <asm/spitfire.h> 15#include <asm/spitfire.h>
16#include <asm/oplib.h>
16 17
17DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; 18DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
18 19
@@ -61,21 +62,40 @@ struct cpu_iu_info linux_sparc_chips[] = {
61 62
62#define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips) 63#define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips)
63 64
64char *sparc_cpu_type = "cpu-oops"; 65char *sparc_cpu_type;
65char *sparc_fpu_type = "fpu-oops"; 66char *sparc_fpu_type;
66 67
67unsigned int fsr_storage; 68unsigned int fsr_storage;
68 69
70static void __init sun4v_cpu_probe(void)
71{
72 switch (sun4v_chip_type) {
73 case SUN4V_CHIP_NIAGARA1:
74 sparc_cpu_type = "UltraSparc T1 (Niagara)";
75 sparc_fpu_type = "UltraSparc T1 integrated FPU";
76 break;
77
78 case SUN4V_CHIP_NIAGARA2:
79 sparc_cpu_type = "UltraSparc T2 (Niagara2)";
80 sparc_fpu_type = "UltraSparc T2 integrated FPU";
81 break;
82
83 default:
84 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
85 prom_cpu_compatible);
86 sparc_cpu_type = "Unknown SUN4V CPU";
87 sparc_fpu_type = "Unknown SUN4V FPU";
88 break;
89 }
90}
91
69void __init cpu_probe(void) 92void __init cpu_probe(void)
70{ 93{
71 unsigned long ver, fpu_vers, manuf, impl, fprs; 94 unsigned long ver, fpu_vers, manuf, impl, fprs;
72 int i; 95 int i;
73 96
74 if (tlb_type == hypervisor) { 97 if (tlb_type == hypervisor)
75 sparc_cpu_type = "UltraSparc T1 (Niagara)"; 98 return sun4v_cpu_probe();
76 sparc_fpu_type = "UltraSparc T1 integrated FPU";
77 return;
78 }
79 99
80 fprs = fprs_read(); 100 fprs = fprs_read();
81 fprs_write(FPRS_FEF); 101 fprs_write(FPRS_FEF);
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S
index 9dbd833d79d6..63144ad476f6 100644
--- a/arch/sparc64/kernel/head.S
+++ b/arch/sparc64/kernel/head.S
@@ -97,7 +97,8 @@ sparc64_boot:
97 .globl prom_map_name, prom_unmap_name, prom_mmu_ihandle_cache 97 .globl prom_map_name, prom_unmap_name, prom_mmu_ihandle_cache
98 .globl prom_boot_mapped_pc, prom_boot_mapping_mode 98 .globl prom_boot_mapped_pc, prom_boot_mapping_mode
99 .globl prom_boot_mapping_phys_high, prom_boot_mapping_phys_low 99 .globl prom_boot_mapping_phys_high, prom_boot_mapping_phys_low
100 .globl is_sun4v 100 .globl prom_compatible_name, prom_cpu_path, prom_cpu_compatible
101 .globl is_sun4v, sun4v_chip_type
101prom_peer_name: 102prom_peer_name:
102 .asciz "peer" 103 .asciz "peer"
103prom_compatible_name: 104prom_compatible_name:
@@ -106,6 +107,8 @@ prom_finddev_name:
106 .asciz "finddevice" 107 .asciz "finddevice"
107prom_chosen_path: 108prom_chosen_path:
108 .asciz "/chosen" 109 .asciz "/chosen"
110prom_cpu_path:
111 .asciz "/cpu"
109prom_getprop_name: 112prom_getprop_name:
110 .asciz "getprop" 113 .asciz "getprop"
111prom_mmu_name: 114prom_mmu_name:
@@ -120,9 +123,13 @@ prom_unmap_name:
120 .asciz "unmap" 123 .asciz "unmap"
121prom_sun4v_name: 124prom_sun4v_name:
122 .asciz "sun4v" 125 .asciz "sun4v"
126prom_niagara_prefix:
127 .asciz "SUNW,UltraSPARC-T"
123 .align 4 128 .align 4
124prom_root_compatible: 129prom_root_compatible:
125 .skip 64 130 .skip 64
131prom_cpu_compatible:
132 .skip 64
126prom_root_node: 133prom_root_node:
127 .word 0 134 .word 0
128prom_mmu_ihandle_cache: 135prom_mmu_ihandle_cache:
@@ -138,6 +145,8 @@ prom_boot_mapping_phys_low:
138 .xword 0 145 .xword 0
139is_sun4v: 146is_sun4v:
140 .word 0 147 .word 0
148sun4v_chip_type:
149 .word SUN4V_CHIP_INVALID
1411: 1501:
142 rd %pc, %l0 151 rd %pc, %l0
143 152
@@ -296,13 +305,13 @@ is_sun4v:
296 sethi %hi(prom_sun4v_name), %g7 305 sethi %hi(prom_sun4v_name), %g7
297 or %g7, %lo(prom_sun4v_name), %g7 306 or %g7, %lo(prom_sun4v_name), %g7
298 mov 5, %g3 307 mov 5, %g3
2991: ldub [%g7], %g2 30890: ldub [%g7], %g2
300 ldub [%g1], %g4 309 ldub [%g1], %g4
301 cmp %g2, %g4 310 cmp %g2, %g4
302 bne,pn %icc, 2f 311 bne,pn %icc, 80f
303 add %g7, 1, %g7 312 add %g7, 1, %g7
304 subcc %g3, 1, %g3 313 subcc %g3, 1, %g3
305 bne,pt %xcc, 1b 314 bne,pt %xcc, 90b
306 add %g1, 1, %g1 315 add %g1, 1, %g1
307 316
308 sethi %hi(is_sun4v), %g1 317 sethi %hi(is_sun4v), %g1
@@ -310,7 +319,80 @@ is_sun4v:
310 mov 1, %g7 319 mov 1, %g7
311 stw %g7, [%g1] 320 stw %g7, [%g1]
312 321
3132: 322 /* cpu_node = prom_finddevice("/cpu") */
323 mov (1b - prom_finddev_name), %l1
324 mov (1b - prom_cpu_path), %l2
325 sub %l0, %l1, %l1
326 sub %l0, %l2, %l2
327 sub %sp, (192 + 128), %sp
328
329 stx %l1, [%sp + 2047 + 128 + 0x00] ! service, "finddevice"
330 mov 1, %l3
331 stx %l3, [%sp + 2047 + 128 + 0x08] ! num_args, 1
332 stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 1
333 stx %l2, [%sp + 2047 + 128 + 0x18] ! arg1, "/cpu"
334 stx %g0, [%sp + 2047 + 128 + 0x20] ! ret1
335 call %l7
336 add %sp, (2047 + 128), %o0 ! argument array
337
338 ldx [%sp + 2047 + 128 + 0x20], %l4 ! cpu device node
339
340 mov (1b - prom_getprop_name), %l1
341 mov (1b - prom_compatible_name), %l2
342 mov (1b - prom_cpu_compatible), %l5
343 sub %l0, %l1, %l1
344 sub %l0, %l2, %l2
345 sub %l0, %l5, %l5
346
347 /* prom_getproperty(cpu_node, "compatible",
348 * &prom_cpu_compatible, 64)
349 */
350 stx %l1, [%sp + 2047 + 128 + 0x00] ! service, "getprop"
351 mov 4, %l3
352 stx %l3, [%sp + 2047 + 128 + 0x08] ! num_args, 4
353 mov 1, %l3
354 stx %l3, [%sp + 2047 + 128 + 0x10] ! num_rets, 1
355 stx %l4, [%sp + 2047 + 128 + 0x18] ! arg1, cpu_node
356 stx %l2, [%sp + 2047 + 128 + 0x20] ! arg2, "compatible"
357 stx %l5, [%sp + 2047 + 128 + 0x28] ! arg3, &prom_cpu_compatible
358 mov 64, %l3
359 stx %l3, [%sp + 2047 + 128 + 0x30] ! arg4, size
360 stx %g0, [%sp + 2047 + 128 + 0x38] ! ret1
361 call %l7
362 add %sp, (2047 + 128), %o0 ! argument array
363
364 add %sp, (192 + 128), %sp
365
366 sethi %hi(prom_cpu_compatible), %g1
367 or %g1, %lo(prom_cpu_compatible), %g1
368 sethi %hi(prom_niagara_prefix), %g7
369 or %g7, %lo(prom_niagara_prefix), %g7
370 mov 17, %g3
37190: ldub [%g7], %g2
372 ldub [%g1], %g4
373 cmp %g2, %g4
374 bne,pn %icc, 4f
375 add %g7, 1, %g7
376 subcc %g3, 1, %g3
377 bne,pt %xcc, 90b
378 add %g1, 1, %g1
379
380 sethi %hi(prom_cpu_compatible), %g1
381 or %g1, %lo(prom_cpu_compatible), %g1
382 ldub [%g1 + 17], %g2
383 cmp %g2, '1'
384 be,pt %xcc, 5f
385 mov SUN4V_CHIP_NIAGARA1, %g4
386 cmp %g2, '2'
387 be,pt %xcc, 5f
388 mov SUN4V_CHIP_NIAGARA2, %g4
3894:
390 mov SUN4V_CHIP_UNKNOWN, %g4
3915: sethi %hi(sun4v_chip_type), %g2
392 or %g2, %lo(sun4v_chip_type), %g2
393 stw %g4, [%g2]
394
39580:
314 BRANCH_IF_SUN4V(g1, jump_to_sun4u_init) 396 BRANCH_IF_SUN4V(g1, jump_to_sun4u_init)
315 BRANCH_IF_CHEETAH_BASE(g1,g7,cheetah_boot) 397 BRANCH_IF_CHEETAH_BASE(g1,g7,cheetah_boot)
316 BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,cheetah_plus_boot) 398 BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,cheetah_plus_boot)
@@ -414,6 +496,33 @@ niagara_tlb_fixup:
414 stw %g2, [%g1 + %lo(tlb_type)] 496 stw %g2, [%g1 + %lo(tlb_type)]
415 497
416 /* Patch copy/clear ops. */ 498 /* Patch copy/clear ops. */
499 sethi %hi(sun4v_chip_type), %g1
500 lduw [%g1 + %lo(sun4v_chip_type)], %g1
501 cmp %g1, SUN4V_CHIP_NIAGARA1
502 be,pt %xcc, niagara_patch
503 cmp %g1, SUN4V_CHIP_NIAGARA2
504 be,pt %xcc, niagara2_patch
505 nop
506
507 call generic_patch_copyops
508 nop
509 call generic_patch_bzero
510 nop
511 call generic_patch_pageops
512 nop
513
514 ba,a,pt %xcc, 80f
515niagara2_patch:
516 call niagara2_patch_copyops
517 nop
518 call niagara_patch_bzero
519 nop
520 call niagara2_patch_pageops
521 nop
522
523 ba,a,pt %xcc, 80f
524
525niagara_patch:
417 call niagara_patch_copyops 526 call niagara_patch_copyops
418 nop 527 nop
419 call niagara_patch_bzero 528 call niagara_patch_bzero
@@ -421,6 +530,7 @@ niagara_tlb_fixup:
421 call niagara_patch_pageops 530 call niagara_patch_pageops
422 nop 531 nop
423 532
53380:
424 /* Patch TLB/cache ops. */ 534 /* Patch TLB/cache ops. */
425 call hypervisor_patch_cachetlbops 535 call hypervisor_patch_cachetlbops
426 nop 536 nop
@@ -605,12 +715,13 @@ setup_trap_table:
605 715
606 membar #Sync 716 membar #Sync
607 717
718 BRANCH_IF_SUN4V(o2, 1f)
719
608 /* Kill PROM timer */ 720 /* Kill PROM timer */
609 sethi %hi(0x80000000), %o2 721 sethi %hi(0x80000000), %o2
610 sllx %o2, 32, %o2 722 sllx %o2, 32, %o2
611 wr %o2, 0, %tick_cmpr 723 wr %o2, 0, %tick_cmpr
612 724
613 BRANCH_IF_SUN4V(o2, 1f)
614 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f) 725 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f)
615 726
616 ba,pt %xcc, 2f 727 ba,pt %xcc, 2f
diff --git a/arch/sparc64/kernel/hvtramp.S b/arch/sparc64/kernel/hvtramp.S
index a55c252e18cc..b692e044a463 100644
--- a/arch/sparc64/kernel/hvtramp.S
+++ b/arch/sparc64/kernel/hvtramp.S
@@ -115,11 +115,8 @@ hv_cpu_startup:
115 call hard_smp_processor_id 115 call hard_smp_processor_id
116 nop 116 nop
117 117
118 mov %o0, %o1 118 call sun4v_register_mondo_queues
119 mov 0, %o0 119 nop
120 mov 0, %o2
121 call sun4v_init_mondo_queues
122 mov 1, %o3
123 120
124 call init_cur_cpu_trap 121 call init_cur_cpu_trap
125 mov %g6, %o0 122 mov %g6, %o0
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index db31bf6b42db..384abf410cf0 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -929,7 +929,7 @@ static void __cpuinit register_one_mondo(unsigned long paddr, unsigned long type
929 } 929 }
930} 930}
931 931
932static void __cpuinit sun4v_register_mondo_queues(int this_cpu) 932void __cpuinit sun4v_register_mondo_queues(int this_cpu)
933{ 933{
934 struct trap_per_cpu *tb = &trap_block[this_cpu]; 934 struct trap_per_cpu *tb = &trap_block[this_cpu];
935 935
@@ -943,20 +943,10 @@ static void __cpuinit sun4v_register_mondo_queues(int this_cpu)
943 tb->nonresum_qmask); 943 tb->nonresum_qmask);
944} 944}
945 945
946static void __cpuinit alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask, int use_bootmem) 946static void __init alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask)
947{ 947{
948 unsigned long size = PAGE_ALIGN(qmask + 1); 948 unsigned long size = PAGE_ALIGN(qmask + 1);
949 unsigned long order = get_order(size); 949 void *p = __alloc_bootmem_low(size, size, 0);
950 void *p = NULL;
951
952 if (use_bootmem) {
953 p = __alloc_bootmem_low(size, size, 0);
954 } else {
955 struct page *page = alloc_pages(GFP_ATOMIC | __GFP_ZERO, order);
956 if (page)
957 p = page_address(page);
958 }
959
960 if (!p) { 950 if (!p) {
961 prom_printf("SUN4V: Error, cannot allocate mondo queue.\n"); 951 prom_printf("SUN4V: Error, cannot allocate mondo queue.\n");
962 prom_halt(); 952 prom_halt();
@@ -965,19 +955,10 @@ static void __cpuinit alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask
965 *pa_ptr = __pa(p); 955 *pa_ptr = __pa(p);
966} 956}
967 957
968static void __cpuinit alloc_one_kbuf(unsigned long *pa_ptr, unsigned long qmask, int use_bootmem) 958static void __init alloc_one_kbuf(unsigned long *pa_ptr, unsigned long qmask)
969{ 959{
970 unsigned long size = PAGE_ALIGN(qmask + 1); 960 unsigned long size = PAGE_ALIGN(qmask + 1);
971 unsigned long order = get_order(size); 961 void *p = __alloc_bootmem_low(size, size, 0);
972 void *p = NULL;
973
974 if (use_bootmem) {
975 p = __alloc_bootmem_low(size, size, 0);
976 } else {
977 struct page *page = alloc_pages(GFP_ATOMIC | __GFP_ZERO, order);
978 if (page)
979 p = page_address(page);
980 }
981 962
982 if (!p) { 963 if (!p) {
983 prom_printf("SUN4V: Error, cannot allocate kbuf page.\n"); 964 prom_printf("SUN4V: Error, cannot allocate kbuf page.\n");
@@ -987,18 +968,14 @@ static void __cpuinit alloc_one_kbuf(unsigned long *pa_ptr, unsigned long qmask,
987 *pa_ptr = __pa(p); 968 *pa_ptr = __pa(p);
988} 969}
989 970
990static void __cpuinit init_cpu_send_mondo_info(struct trap_per_cpu *tb, int use_bootmem) 971static void __init init_cpu_send_mondo_info(struct trap_per_cpu *tb)
991{ 972{
992#ifdef CONFIG_SMP 973#ifdef CONFIG_SMP
993 void *page; 974 void *page;
994 975
995 BUILD_BUG_ON((NR_CPUS * sizeof(u16)) > (PAGE_SIZE - 64)); 976 BUILD_BUG_ON((NR_CPUS * sizeof(u16)) > (PAGE_SIZE - 64));
996 977
997 if (use_bootmem) 978 page = alloc_bootmem_low_pages(PAGE_SIZE);
998 page = alloc_bootmem_low_pages(PAGE_SIZE);
999 else
1000 page = (void *) get_zeroed_page(GFP_ATOMIC);
1001
1002 if (!page) { 979 if (!page) {
1003 prom_printf("SUN4V: Error, cannot allocate cpu mondo page.\n"); 980 prom_printf("SUN4V: Error, cannot allocate cpu mondo page.\n");
1004 prom_halt(); 981 prom_halt();
@@ -1009,30 +986,27 @@ static void __cpuinit init_cpu_send_mondo_info(struct trap_per_cpu *tb, int use_
1009#endif 986#endif
1010} 987}
1011 988
1012/* Allocate and register the mondo and error queues for this cpu. */ 989/* Allocate mondo and error queues for all possible cpus. */
1013void __cpuinit sun4v_init_mondo_queues(int use_bootmem, int cpu, int alloc, int load) 990static void __init sun4v_init_mondo_queues(void)
1014{ 991{
1015 struct trap_per_cpu *tb = &trap_block[cpu]; 992 int cpu;
1016 993
1017 if (alloc) { 994 for_each_possible_cpu(cpu) {
1018 alloc_one_mondo(&tb->cpu_mondo_pa, tb->cpu_mondo_qmask, use_bootmem); 995 struct trap_per_cpu *tb = &trap_block[cpu];
1019 alloc_one_mondo(&tb->dev_mondo_pa, tb->dev_mondo_qmask, use_bootmem);
1020 alloc_one_mondo(&tb->resum_mondo_pa, tb->resum_qmask, use_bootmem);
1021 alloc_one_kbuf(&tb->resum_kernel_buf_pa, tb->resum_qmask, use_bootmem);
1022 alloc_one_mondo(&tb->nonresum_mondo_pa, tb->nonresum_qmask, use_bootmem);
1023 alloc_one_kbuf(&tb->nonresum_kernel_buf_pa, tb->nonresum_qmask, use_bootmem);
1024 996
1025 init_cpu_send_mondo_info(tb, use_bootmem); 997 alloc_one_mondo(&tb->cpu_mondo_pa, tb->cpu_mondo_qmask);
1026 } 998 alloc_one_mondo(&tb->dev_mondo_pa, tb->dev_mondo_qmask);
999 alloc_one_mondo(&tb->resum_mondo_pa, tb->resum_qmask);
1000 alloc_one_kbuf(&tb->resum_kernel_buf_pa, tb->resum_qmask);
1001 alloc_one_mondo(&tb->nonresum_mondo_pa, tb->nonresum_qmask);
1002 alloc_one_kbuf(&tb->nonresum_kernel_buf_pa,
1003 tb->nonresum_qmask);
1027 1004
1028 if (load) { 1005 init_cpu_send_mondo_info(tb);
1029 if (cpu != hard_smp_processor_id()) {
1030 prom_printf("SUN4V: init mondo on cpu %d not %d\n",
1031 cpu, hard_smp_processor_id());
1032 prom_halt();
1033 }
1034 sun4v_register_mondo_queues(cpu);
1035 } 1006 }
1007
1008 /* Load up the boot cpu's entries. */
1009 sun4v_register_mondo_queues(hard_smp_processor_id());
1036} 1010}
1037 1011
1038static struct irqaction timer_irq_action = { 1012static struct irqaction timer_irq_action = {
@@ -1047,7 +1021,7 @@ void __init init_IRQ(void)
1047 memset(&ivector_table[0], 0, sizeof(ivector_table)); 1021 memset(&ivector_table[0], 0, sizeof(ivector_table));
1048 1022
1049 if (tlb_type == hypervisor) 1023 if (tlb_type == hypervisor)
1050 sun4v_init_mondo_queues(1, hard_smp_processor_id(), 1, 1); 1024 sun4v_init_mondo_queues();
1051 1025
1052 /* We need to clear any IRQ's pending in the soft interrupt 1026 /* We need to clear any IRQ's pending in the soft interrupt
1053 * registers, a spurious one could be left around from the 1027 * registers, a spurious one could be left around from the
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc64/kernel/mdesc.c
index cce4d0ddf5d5..9f22e4ff6015 100644
--- a/arch/sparc64/kernel/mdesc.c
+++ b/arch/sparc64/kernel/mdesc.c
@@ -9,6 +9,7 @@
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/miscdevice.h>
12 13
13#include <asm/hypervisor.h> 14#include <asm/hypervisor.h>
14#include <asm/mdesc.h> 15#include <asm/mdesc.h>
@@ -568,20 +569,6 @@ static void __init report_platform_properties(void)
568 mdesc_release(hp); 569 mdesc_release(hp);
569} 570}
570 571
571static int inline find_in_proplist(const char *list, const char *match, int len)
572{
573 while (len > 0) {
574 int l;
575
576 if (!strcmp(list, match))
577 return 1;
578 l = strlen(list) + 1;
579 list += l;
580 len -= l;
581 }
582 return 0;
583}
584
585static void __devinit fill_in_one_cache(cpuinfo_sparc *c, 572static void __devinit fill_in_one_cache(cpuinfo_sparc *c,
586 struct mdesc_handle *hp, 573 struct mdesc_handle *hp,
587 u64 mp) 574 u64 mp)
@@ -596,10 +583,10 @@ static void __devinit fill_in_one_cache(cpuinfo_sparc *c,
596 583
597 switch (*level) { 584 switch (*level) {
598 case 1: 585 case 1:
599 if (find_in_proplist(type, "instn", type_len)) { 586 if (of_find_in_proplist(type, "instn", type_len)) {
600 c->icache_size = *size; 587 c->icache_size = *size;
601 c->icache_line_size = *line_size; 588 c->icache_line_size = *line_size;
602 } else if (find_in_proplist(type, "data", type_len)) { 589 } else if (of_find_in_proplist(type, "data", type_len)) {
603 c->dcache_size = *size; 590 c->dcache_size = *size;
604 c->dcache_line_size = *line_size; 591 c->dcache_line_size = *line_size;
605 } 592 }
@@ -677,7 +664,7 @@ static void __devinit set_core_ids(struct mdesc_handle *hp)
677 continue; 664 continue;
678 665
679 type = mdesc_get_property(hp, mp, "type", &len); 666 type = mdesc_get_property(hp, mp, "type", &len);
680 if (!find_in_proplist(type, "instn", len)) 667 if (!of_find_in_proplist(type, "instn", len))
681 continue; 668 continue;
682 669
683 mark_core_ids(hp, mp, idx); 670 mark_core_ids(hp, mp, idx);
@@ -718,8 +705,8 @@ static void __devinit __set_proc_ids(struct mdesc_handle *hp,
718 int len; 705 int len;
719 706
720 type = mdesc_get_property(hp, mp, "type", &len); 707 type = mdesc_get_property(hp, mp, "type", &len);
721 if (!find_in_proplist(type, "int", len) && 708 if (!of_find_in_proplist(type, "int", len) &&
722 !find_in_proplist(type, "integer", len)) 709 !of_find_in_proplist(type, "integer", len))
723 continue; 710 continue;
724 711
725 mark_proc_ids(hp, mp, idx); 712 mark_proc_ids(hp, mp, idx);
@@ -850,6 +837,43 @@ void __devinit mdesc_fill_in_cpu_data(cpumask_t mask)
850 mdesc_release(hp); 837 mdesc_release(hp);
851} 838}
852 839
840static ssize_t mdesc_read(struct file *file, char __user *buf,
841 size_t len, loff_t *offp)
842{
843 struct mdesc_handle *hp = mdesc_grab();
844 int err;
845
846 if (!hp)
847 return -ENODEV;
848
849 err = hp->handle_size;
850 if (len < hp->handle_size)
851 err = -EMSGSIZE;
852 else if (copy_to_user(buf, &hp->mdesc, hp->handle_size))
853 err = -EFAULT;
854 mdesc_release(hp);
855
856 return err;
857}
858
859static const struct file_operations mdesc_fops = {
860 .read = mdesc_read,
861 .owner = THIS_MODULE,
862};
863
864static struct miscdevice mdesc_misc = {
865 .minor = MISC_DYNAMIC_MINOR,
866 .name = "mdesc",
867 .fops = &mdesc_fops,
868};
869
870static int __init mdesc_misc_init(void)
871{
872 return misc_register(&mdesc_misc);
873}
874
875__initcall(mdesc_misc_init);
876
853void __init sun4v_mdesc_init(void) 877void __init sun4v_mdesc_init(void)
854{ 878{
855 struct mdesc_handle *hp; 879 struct mdesc_handle *hp;
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index f4e0a9ad9be3..d1a78c976cef 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -107,6 +107,21 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
107} 107}
108EXPORT_SYMBOL(of_set_property); 108EXPORT_SYMBOL(of_set_property);
109 109
110int of_find_in_proplist(const char *list, const char *match, int len)
111{
112 while (len > 0) {
113 int l;
114
115 if (!strcmp(list, match))
116 return 1;
117 l = strlen(list) + 1;
118 list += l;
119 len -= l;
120 }
121 return 0;
122}
123EXPORT_SYMBOL(of_find_in_proplist);
124
110static unsigned int prom_early_allocated; 125static unsigned int prom_early_allocated;
111 126
112static void * __init prom_early_alloc(unsigned long size) 127static void * __init prom_early_alloc(unsigned long size)
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index b448d33321c6..b84c49e3697c 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -334,8 +334,6 @@ static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg)
334} 334}
335#endif 335#endif
336 336
337extern void sun4v_init_mondo_queues(int use_bootmem, int cpu, int alloc, int load);
338
339extern unsigned long sparc64_cpu_startup; 337extern unsigned long sparc64_cpu_startup;
340 338
341/* The OBP cpu startup callback truncates the 3rd arg cookie to 339/* The OBP cpu startup callback truncates the 3rd arg cookie to
@@ -359,9 +357,6 @@ static int __devinit smp_boot_one_cpu(unsigned int cpu)
359 cpu_new_thread = task_thread_info(p); 357 cpu_new_thread = task_thread_info(p);
360 358
361 if (tlb_type == hypervisor) { 359 if (tlb_type == hypervisor) {
362 /* Alloc the mondo queues, cpu will load them. */
363 sun4v_init_mondo_queues(0, cpu, 1, 0);
364
365#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) 360#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
366 if (ldom_domaining_enabled) 361 if (ldom_domaining_enabled)
367 ldom_startcpu_cpuid(cpu, 362 ldom_startcpu_cpuid(cpu,
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index d270c2f0be0f..23fad7ebdd0d 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -168,6 +168,7 @@ EXPORT_SYMBOL(change_bit);
168EXPORT_SYMBOL(__flushw_user); 168EXPORT_SYMBOL(__flushw_user);
169 169
170EXPORT_SYMBOL(tlb_type); 170EXPORT_SYMBOL(tlb_type);
171EXPORT_SYMBOL(sun4v_chip_type);
171EXPORT_SYMBOL(get_fb_unmapped_area); 172EXPORT_SYMBOL(get_fb_unmapped_area);
172EXPORT_SYMBOL(flush_icache_range); 173EXPORT_SYMBOL(flush_icache_range);
173 174
diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S
index a4dc01a3d238..9533a25ce5d2 100644
--- a/arch/sparc64/kernel/trampoline.S
+++ b/arch/sparc64/kernel/trampoline.S
@@ -95,14 +95,13 @@ spitfire_startup:
95 membar #Sync 95 membar #Sync
96 96
97startup_continue: 97startup_continue:
98 mov %o0, %l0
99 BRANCH_IF_SUN4V(g1, niagara_lock_tlb)
100
98 sethi %hi(0x80000000), %g2 101 sethi %hi(0x80000000), %g2
99 sllx %g2, 32, %g2 102 sllx %g2, 32, %g2
100 wr %g2, 0, %tick_cmpr 103 wr %g2, 0, %tick_cmpr
101 104
102 mov %o0, %l0
103
104 BRANCH_IF_SUN4V(g1, niagara_lock_tlb)
105
106 /* Call OBP by hand to lock KERNBASE into i/d tlbs. 105 /* Call OBP by hand to lock KERNBASE into i/d tlbs.
107 * We lock 2 consequetive entries if we are 'bigkernel'. 106 * We lock 2 consequetive entries if we are 'bigkernel'.
108 */ 107 */
@@ -366,11 +365,8 @@ after_lock_tlb:
366 call hard_smp_processor_id 365 call hard_smp_processor_id
367 nop 366 nop
368 367
369 mov %o0, %o1 368 call sun4v_register_mondo_queues
370 mov 0, %o0 369 nop
371 mov 0, %o2
372 call sun4v_init_mondo_queues
373 mov 1, %o3
374 370
3751: call init_cur_cpu_trap 3711: call init_cur_cpu_trap
376 ldx [%l0], %o0 372 ldx [%l0], %o0
diff --git a/arch/sparc64/kernel/vio.c b/arch/sparc64/kernel/vio.c
index 3685daf5157f..1550ac5673da 100644
--- a/arch/sparc64/kernel/vio.c
+++ b/arch/sparc64/kernel/vio.c
@@ -16,21 +16,6 @@
16#include <asm/mdesc.h> 16#include <asm/mdesc.h>
17#include <asm/vio.h> 17#include <asm/vio.h>
18 18
19static inline int find_in_proplist(const char *list, const char *match,
20 int len)
21{
22 while (len > 0) {
23 int l;
24
25 if (!strcmp(list, match))
26 return 1;
27 l = strlen(list) + 1;
28 list += l;
29 len -= l;
30 }
31 return 0;
32}
33
34static const struct vio_device_id *vio_match_device( 19static const struct vio_device_id *vio_match_device(
35 const struct vio_device_id *matches, 20 const struct vio_device_id *matches,
36 const struct vio_dev *dev) 21 const struct vio_dev *dev)
@@ -49,7 +34,7 @@ static const struct vio_device_id *vio_match_device(
49 34
50 if (matches->compat[0]) { 35 if (matches->compat[0]) {
51 match &= len && 36 match &= len &&
52 find_in_proplist(compat, matches->compat, len); 37 of_find_in_proplist(compat, matches->compat, len);
53 } 38 }
54 if (match) 39 if (match)
55 return matches; 40 return matches;
@@ -406,7 +391,7 @@ static int __init vio_init(void)
406 "property\n"); 391 "property\n");
407 goto out_release; 392 goto out_release;
408 } 393 }
409 if (!find_in_proplist(compat, channel_devices_compat, len)) { 394 if (!of_find_in_proplist(compat, channel_devices_compat, len)) {
410 printk(KERN_ERR "VIO: Channel devices node lacks (%s) " 395 printk(KERN_ERR "VIO: Channel devices node lacks (%s) "
411 "compat entry.\n", channel_devices_compat); 396 "compat entry.\n", channel_devices_compat);
412 goto out_release; 397 goto out_release;
diff --git a/arch/sparc64/lib/GENbzero.S b/arch/sparc64/lib/GENbzero.S
new file mode 100644
index 000000000000..f9c71d64eba1
--- /dev/null
+++ b/arch/sparc64/lib/GENbzero.S
@@ -0,0 +1,160 @@
1/* GENbzero.S: Generic sparc64 memset/clear_user.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5#include <asm/asi.h>
6
7#define EX_ST(x,y) \
898: x,y; \
9 .section .fixup; \
10 .align 4; \
1199: retl; \
12 mov %o1, %o0; \
13 .section __ex_table; \
14 .align 4; \
15 .word 98b, 99b; \
16 .text; \
17 .align 4;
18
19 .align 32
20 .text
21
22 .globl GENmemset
23 .type GENmemset, #function
24GENmemset: /* %o0=buf, %o1=pat, %o2=len */
25 and %o1, 0xff, %o3
26 mov %o2, %o1
27 sllx %o3, 8, %g1
28 or %g1, %o3, %o2
29 sllx %o2, 16, %g1
30 or %g1, %o2, %o2
31 sllx %o2, 32, %g1
32 ba,pt %xcc, 1f
33 or %g1, %o2, %o2
34
35 .globl GENbzero
36 .type GENbzero, #function
37GENbzero:
38 clr %o2
391: brz,pn %o1, GENbzero_return
40 mov %o0, %o3
41
42 /* %o5: saved %asi, restored at GENbzero_done
43 * %o4: store %asi to use
44 */
45 rd %asi, %o5
46 mov ASI_P, %o4
47 wr %o4, 0x0, %asi
48
49GENbzero_from_clear_user:
50 cmp %o1, 15
51 bl,pn %icc, GENbzero_tiny
52 andcc %o0, 0x7, %g1
53 be,pt %xcc, 2f
54 mov 8, %g2
55 sub %g2, %g1, %g1
56 sub %o1, %g1, %o1
571: EX_ST(stba %o2, [%o0 + 0x00] %asi)
58 subcc %g1, 1, %g1
59 bne,pt %xcc, 1b
60 add %o0, 1, %o0
612: cmp %o1, 128
62 bl,pn %icc, GENbzero_medium
63 andcc %o0, (64 - 1), %g1
64 be,pt %xcc, GENbzero_pre_loop
65 mov 64, %g2
66 sub %g2, %g1, %g1
67 sub %o1, %g1, %o1
681: EX_ST(stxa %o2, [%o0 + 0x00] %asi)
69 subcc %g1, 8, %g1
70 bne,pt %xcc, 1b
71 add %o0, 8, %o0
72
73GENbzero_pre_loop:
74 andn %o1, (64 - 1), %g1
75 sub %o1, %g1, %o1
76GENbzero_loop:
77 EX_ST(stxa %o2, [%o0 + 0x00] %asi)
78 EX_ST(stxa %o2, [%o0 + 0x08] %asi)
79 EX_ST(stxa %o2, [%o0 + 0x10] %asi)
80 EX_ST(stxa %o2, [%o0 + 0x18] %asi)
81 EX_ST(stxa %o2, [%o0 + 0x20] %asi)
82 EX_ST(stxa %o2, [%o0 + 0x28] %asi)
83 EX_ST(stxa %o2, [%o0 + 0x30] %asi)
84 EX_ST(stxa %o2, [%o0 + 0x38] %asi)
85 subcc %g1, 64, %g1
86 bne,pt %xcc, GENbzero_loop
87 add %o0, 64, %o0
88
89 membar #Sync
90 wr %o4, 0x0, %asi
91 brz,pn %o1, GENbzero_done
92GENbzero_medium:
93 andncc %o1, 0x7, %g1
94 be,pn %xcc, 2f
95 sub %o1, %g1, %o1
961: EX_ST(stxa %o2, [%o0 + 0x00] %asi)
97 subcc %g1, 8, %g1
98 bne,pt %xcc, 1b
99 add %o0, 8, %o0
1002: brz,pt %o1, GENbzero_done
101 nop
102
103GENbzero_tiny:
1041: EX_ST(stba %o2, [%o0 + 0x00] %asi)
105 subcc %o1, 1, %o1
106 bne,pt %icc, 1b
107 add %o0, 1, %o0
108
109 /* fallthrough */
110
111GENbzero_done:
112 wr %o5, 0x0, %asi
113
114GENbzero_return:
115 retl
116 mov %o3, %o0
117 .size GENbzero, .-GENbzero
118 .size GENmemset, .-GENmemset
119
120 .globl GENclear_user
121 .type GENclear_user, #function
122GENclear_user: /* %o0=buf, %o1=len */
123 rd %asi, %o5
124 brz,pn %o1, GENbzero_done
125 clr %o3
126 cmp %o5, ASI_AIUS
127 bne,pn %icc, GENbzero
128 clr %o2
129 ba,pt %xcc, GENbzero_from_clear_user
130 mov ASI_AIUS, %o4
131 .size GENclear_user, .-GENclear_user
132
133#define BRANCH_ALWAYS 0x10680000
134#define NOP 0x01000000
135#define GEN_DO_PATCH(OLD, NEW) \
136 sethi %hi(NEW), %g1; \
137 or %g1, %lo(NEW), %g1; \
138 sethi %hi(OLD), %g2; \
139 or %g2, %lo(OLD), %g2; \
140 sub %g1, %g2, %g1; \
141 sethi %hi(BRANCH_ALWAYS), %g3; \
142 sll %g1, 11, %g1; \
143 srl %g1, 11 + 2, %g1; \
144 or %g3, %lo(BRANCH_ALWAYS), %g3; \
145 or %g3, %g1, %g3; \
146 stw %g3, [%g2]; \
147 sethi %hi(NOP), %g3; \
148 or %g3, %lo(NOP), %g3; \
149 stw %g3, [%g2 + 0x4]; \
150 flush %g2;
151
152 .globl generic_patch_bzero
153 .type generic_patch_bzero,#function
154generic_patch_bzero:
155 GEN_DO_PATCH(memset, GENmemset)
156 GEN_DO_PATCH(__bzero, GENbzero)
157 GEN_DO_PATCH(__clear_user, GENclear_user)
158 retl
159 nop
160 .size generic_patch_bzero,.-generic_patch_bzero
diff --git a/arch/sparc64/lib/GENcopy_from_user.S b/arch/sparc64/lib/GENcopy_from_user.S
new file mode 100644
index 000000000000..2b9df99e87f9
--- /dev/null
+++ b/arch/sparc64/lib/GENcopy_from_user.S
@@ -0,0 +1,34 @@
1/* GENcopy_from_user.S: Generic sparc64 copy from userspace.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#define EX_LD(x) \
798: x; \
8 .section .fixup; \
9 .align 4; \
1099: retl; \
11 mov 1, %o0; \
12 .section __ex_table,"a";\
13 .align 4; \
14 .word 98b, 99b; \
15 .text; \
16 .align 4;
17
18#ifndef ASI_AIUS
19#define ASI_AIUS 0x11
20#endif
21
22#define FUNC_NAME GENcopy_from_user
23#define LOAD(type,addr,dest) type##a [addr] ASI_AIUS, dest
24#define EX_RETVAL(x) 0
25
26#ifdef __KERNEL__
27#define PREAMBLE \
28 rd %asi, %g1; \
29 cmp %g1, ASI_AIUS; \
30 bne,pn %icc, memcpy_user_stub; \
31 nop
32#endif
33
34#include "GENmemcpy.S"
diff --git a/arch/sparc64/lib/GENcopy_to_user.S b/arch/sparc64/lib/GENcopy_to_user.S
new file mode 100644
index 000000000000..bb3f7084daf9
--- /dev/null
+++ b/arch/sparc64/lib/GENcopy_to_user.S
@@ -0,0 +1,38 @@
1/* GENcopy_to_user.S: Generic sparc64 copy to userspace.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#define EX_ST(x) \
798: x; \
8 .section .fixup; \
9 .align 4; \
1099: retl; \
11 mov 1, %o0; \
12 .section __ex_table,"a";\
13 .align 4; \
14 .word 98b, 99b; \
15 .text; \
16 .align 4;
17
18#ifndef ASI_AIUS
19#define ASI_AIUS 0x11
20#endif
21
22#define FUNC_NAME GENcopy_to_user
23#define STORE(type,src,addr) type##a src, [addr] ASI_AIUS
24#define EX_RETVAL(x) 0
25
26#ifdef __KERNEL__
27 /* Writing to %asi is _expensive_ so we hardcode it.
28 * Reading %asi to check for KERNEL_DS is comparatively
29 * cheap.
30 */
31#define PREAMBLE \
32 rd %asi, %g1; \
33 cmp %g1, ASI_AIUS; \
34 bne,pn %icc, memcpy_user_stub; \
35 nop
36#endif
37
38#include "GENmemcpy.S"
diff --git a/arch/sparc64/lib/GENmemcpy.S b/arch/sparc64/lib/GENmemcpy.S
new file mode 100644
index 000000000000..89358ee94851
--- /dev/null
+++ b/arch/sparc64/lib/GENmemcpy.S
@@ -0,0 +1,121 @@
1/* GENmemcpy.S: Generic sparc64 memcpy.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#ifdef __KERNEL__
7#define GLOBAL_SPARE %g7
8#else
9#define GLOBAL_SPARE %g5
10#endif
11
12#ifndef EX_LD
13#define EX_LD(x) x
14#endif
15
16#ifndef EX_ST
17#define EX_ST(x) x
18#endif
19
20#ifndef EX_RETVAL
21#define EX_RETVAL(x) x
22#endif
23
24#ifndef LOAD
25#define LOAD(type,addr,dest) type [addr], dest
26#endif
27
28#ifndef STORE
29#define STORE(type,src,addr) type src, [addr]
30#endif
31
32#ifndef FUNC_NAME
33#define FUNC_NAME GENmemcpy
34#endif
35
36#ifndef PREAMBLE
37#define PREAMBLE
38#endif
39
40#ifndef XCC
41#define XCC xcc
42#endif
43
44 .register %g2,#scratch
45 .register %g3,#scratch
46
47 .text
48 .align 64
49
50 .globl FUNC_NAME
51 .type FUNC_NAME,#function
52FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
53 srlx %o2, 31, %g2
54 cmp %g2, 0
55 tne %XCC, 5
56 PREAMBLE
57 mov %o0, GLOBAL_SPARE
58
59 cmp %o2, 0
60 be,pn %XCC, 85f
61 or %o0, %o1, %o3
62 cmp %o2, 16
63 blu,a,pn %XCC, 80f
64 or %o3, %o2, %o3
65
66 xor %o0, %o1, %o4
67 andcc %o4, 0x7, %g0
68 bne,a,pn %XCC, 90f
69 sub %o0, %o1, %o3
70
71 and %o0, 0x7, %o4
72 sub %o4, 0x8, %o4
73 sub %g0, %o4, %o4
74 sub %o2, %o4, %o2
751: subcc %o4, 1, %o4
76 EX_LD(LOAD(ldub, %o1, %g1))
77 EX_ST(STORE(stb, %g1, %o0))
78 add %o1, 1, %o1
79 bne,pt %XCC, 1b
80 add %o0, 1, %o0
81
82 andn %o2, 0x7, %g1
83 sub %o2, %g1, %o2
841: subcc %g1, 0x8, %g1
85 EX_LD(LOAD(ldx, %o1, %g2))
86 EX_ST(STORE(stx, %g2, %o0))
87 add %o1, 0x8, %o1
88 bne,pt %XCC, 1b
89 add %o0, 0x8, %o0
90
91 brz,pt %o2, 85f
92 sub %o0, %o1, %o3
93 ba,a,pt %XCC, 90f
94
95 .align 64
9680: /* 0 < len <= 16 */
97 andcc %o3, 0x3, %g0
98 bne,pn %XCC, 90f
99 sub %o0, %o1, %o3
100
1011:
102 subcc %o2, 4, %o2
103 EX_LD(LOAD(lduw, %o1, %g1))
104 EX_ST(STORE(stw, %g1, %o1 + %o3))
105 bgu,pt %XCC, 1b
106 add %o1, 4, %o1
107
10885: retl
109 mov EX_RETVAL(GLOBAL_SPARE), %o0
110
111 .align 32
11290:
113 subcc %o2, 1, %o2
114 EX_LD(LOAD(ldub, %o1, %g1))
115 EX_ST(STORE(stb, %g1, %o1 + %o3))
116 bgu,pt %XCC, 90b
117 add %o1, 1, %o1
118 retl
119 mov EX_RETVAL(GLOBAL_SPARE), %o0
120
121 .size FUNC_NAME, .-FUNC_NAME
diff --git a/arch/sparc64/lib/GENpage.S b/arch/sparc64/lib/GENpage.S
new file mode 100644
index 000000000000..2ef9d05f21bc
--- /dev/null
+++ b/arch/sparc64/lib/GENpage.S
@@ -0,0 +1,77 @@
1/* GENpage.S: Generic clear and copy page.
2 *
3 * Copyright (C) 2007 (davem@davemloft.net)
4 */
5#include <asm/page.h>
6
7 .text
8 .align 32
9
10GENcopy_user_page:
11 set PAGE_SIZE, %g7
121: ldx [%o1 + 0x00], %o2
13 ldx [%o1 + 0x08], %o3
14 ldx [%o1 + 0x10], %o4
15 ldx [%o1 + 0x18], %o5
16 stx %o2, [%o0 + 0x00]
17 stx %o3, [%o0 + 0x08]
18 stx %o4, [%o0 + 0x10]
19 stx %o5, [%o0 + 0x18]
20 ldx [%o1 + 0x20], %o2
21 ldx [%o1 + 0x28], %o3
22 ldx [%o1 + 0x30], %o4
23 ldx [%o1 + 0x38], %o5
24 stx %o2, [%o0 + 0x20]
25 stx %o3, [%o0 + 0x28]
26 stx %o4, [%o0 + 0x30]
27 stx %o5, [%o0 + 0x38]
28 subcc %g7, 64, %g7
29 add %o1, 64, %o1
30 bne,pt %xcc, 1b
31 add %o0, 64, %o0
32 retl
33 nop
34
35GENclear_page:
36GENclear_user_page:
37 set PAGE_SIZE, %g7
381: stx %g0, [%o0 + 0x00]
39 stx %g0, [%o0 + 0x08]
40 stx %g0, [%o0 + 0x10]
41 stx %g0, [%o0 + 0x18]
42 stx %g0, [%o0 + 0x20]
43 stx %g0, [%o0 + 0x28]
44 stx %g0, [%o0 + 0x30]
45 stx %g0, [%o0 + 0x38]
46 subcc %g7, 64, %g7
47 bne,pt %xcc, 1b
48 add %o0, 64, %o0
49
50#define BRANCH_ALWAYS 0x10680000
51#define NOP 0x01000000
52#define GEN_DO_PATCH(OLD, NEW) \
53 sethi %hi(NEW), %g1; \
54 or %g1, %lo(NEW), %g1; \
55 sethi %hi(OLD), %g2; \
56 or %g2, %lo(OLD), %g2; \
57 sub %g1, %g2, %g1; \
58 sethi %hi(BRANCH_ALWAYS), %g3; \
59 sll %g1, 11, %g1; \
60 srl %g1, 11 + 2, %g1; \
61 or %g3, %lo(BRANCH_ALWAYS), %g3; \
62 or %g3, %g1, %g3; \
63 stw %g3, [%g2]; \
64 sethi %hi(NOP), %g3; \
65 or %g3, %lo(NOP), %g3; \
66 stw %g3, [%g2 + 0x4]; \
67 flush %g2;
68
69 .globl generic_patch_pageops
70 .type generic_patch_pageops,#function
71generic_patch_pageops:
72 GEN_DO_PATCH(copy_user_page, GENcopy_user_page)
73 GEN_DO_PATCH(_clear_page, GENclear_page)
74 GEN_DO_PATCH(clear_user_page, GENclear_user_page)
75 retl
76 nop
77 .size generic_patch_pageops,.-generic_patch_pageops
diff --git a/arch/sparc64/lib/GENpatch.S b/arch/sparc64/lib/GENpatch.S
new file mode 100644
index 000000000000..fab9e89f16bd
--- /dev/null
+++ b/arch/sparc64/lib/GENpatch.S
@@ -0,0 +1,33 @@
1/* GENpatch.S: Patch Ultra-I routines with generic variant.
2 *
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
4 */
5
6#define BRANCH_ALWAYS 0x10680000
7#define NOP 0x01000000
8#define GEN_DO_PATCH(OLD, NEW) \
9 sethi %hi(NEW), %g1; \
10 or %g1, %lo(NEW), %g1; \
11 sethi %hi(OLD), %g2; \
12 or %g2, %lo(OLD), %g2; \
13 sub %g1, %g2, %g1; \
14 sethi %hi(BRANCH_ALWAYS), %g3; \
15 sll %g1, 11, %g1; \
16 srl %g1, 11 + 2, %g1; \
17 or %g3, %lo(BRANCH_ALWAYS), %g3; \
18 or %g3, %g1, %g3; \
19 stw %g3, [%g2]; \
20 sethi %hi(NOP), %g3; \
21 or %g3, %lo(NOP), %g3; \
22 stw %g3, [%g2 + 0x4]; \
23 flush %g2;
24
25 .globl generic_patch_copyops
26 .type generic_patch_copyops,#function
27generic_patch_copyops:
28 GEN_DO_PATCH(memcpy, GENmemcpy)
29 GEN_DO_PATCH(___copy_from_user, GENcopy_from_user)
30 GEN_DO_PATCH(___copy_to_user, GENcopy_to_user)
31 retl
32 nop
33 .size generic_patch_copyops,.-generic_patch_copyops
diff --git a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile
index c4a6d6e7d03c..f095e13910bc 100644
--- a/arch/sparc64/lib/Makefile
+++ b/arch/sparc64/lib/Makefile
@@ -1,4 +1,4 @@
1# $Id: Makefile,v 1.25 2000/12/14 22:57:25 davem Exp $ 1#
2# Makefile for Sparc64 library files.. 2# Makefile for Sparc64 library files..
3# 3#
4 4
@@ -13,6 +13,10 @@ lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \
13 U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \ 13 U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \
14 NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \ 14 NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \
15 NGpage.o NGbzero.o \ 15 NGpage.o NGbzero.o \
16 NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o NG2patch.o \
17 NG2page.o \
18 GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o GENpatch.o \
19 GENpage.o GENbzero.o \
16 copy_in_user.o user_fixup.o memmove.o \ 20 copy_in_user.o user_fixup.o memmove.o \
17 mcount.o ipcsum.o rwsem.o xor.o 21 mcount.o ipcsum.o rwsem.o xor.o
18 22
diff --git a/arch/sparc64/lib/NG2copy_from_user.S b/arch/sparc64/lib/NG2copy_from_user.S
new file mode 100644
index 000000000000..c77ef5f22102
--- /dev/null
+++ b/arch/sparc64/lib/NG2copy_from_user.S
@@ -0,0 +1,40 @@
1/* NG2copy_from_user.S: Niagara-2 optimized copy from userspace.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#define EX_LD(x) \
798: x; \
8 .section .fixup; \
9 .align 4; \
1099: wr %g0, ASI_AIUS, %asi;\
11 retl; \
12 mov 1, %o0; \
13 .section __ex_table,"a";\
14 .align 4; \
15 .word 98b, 99b; \
16 .text; \
17 .align 4;
18
19#ifndef ASI_AIUS
20#define ASI_AIUS 0x11
21#endif
22
23#ifndef ASI_BLK_AIUS_4V
24#define ASI_BLK_AIUS_4V 0x17
25#endif
26
27#define FUNC_NAME NG2copy_from_user
28#define LOAD(type,addr,dest) type##a [addr] %asi, dest
29#define LOAD_BLK(addr,dest) ldda [addr] ASI_BLK_AIUS_4V, dest
30#define EX_RETVAL(x) 0
31
32#ifdef __KERNEL__
33#define PREAMBLE \
34 rd %asi, %g1; \
35 cmp %g1, ASI_AIUS; \
36 bne,pn %icc, memcpy_user_stub; \
37 nop
38#endif
39
40#include "NG2memcpy.S"
diff --git a/arch/sparc64/lib/NG2copy_to_user.S b/arch/sparc64/lib/NG2copy_to_user.S
new file mode 100644
index 000000000000..4bd4093acbbd
--- /dev/null
+++ b/arch/sparc64/lib/NG2copy_to_user.S
@@ -0,0 +1,49 @@
1/* NG2copy_to_user.S: Niagara-2 optimized copy to userspace.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#define EX_ST(x) \
798: x; \
8 .section .fixup; \
9 .align 4; \
1099: wr %g0, ASI_AIUS, %asi;\
11 retl; \
12 mov 1, %o0; \
13 .section __ex_table,"a";\
14 .align 4; \
15 .word 98b, 99b; \
16 .text; \
17 .align 4;
18
19#ifndef ASI_AIUS
20#define ASI_AIUS 0x11
21#endif
22
23#ifndef ASI_BLK_AIUS_4V
24#define ASI_BLK_AIUS_4V 0x17
25#endif
26
27#ifndef ASI_BLK_INIT_QUAD_LDD_AIUS
28#define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23
29#endif
30
31#define FUNC_NAME NG2copy_to_user
32#define STORE(type,src,addr) type##a src, [addr] ASI_AIUS
33#define STORE_ASI ASI_BLK_INIT_QUAD_LDD_AIUS
34#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_AIUS_4V
35#define EX_RETVAL(x) 0
36
37#ifdef __KERNEL__
38 /* Writing to %asi is _expensive_ so we hardcode it.
39 * Reading %asi to check for KERNEL_DS is comparatively
40 * cheap.
41 */
42#define PREAMBLE \
43 rd %asi, %g1; \
44 cmp %g1, ASI_AIUS; \
45 bne,pn %icc, memcpy_user_stub; \
46 nop
47#endif
48
49#include "NG2memcpy.S"
diff --git a/arch/sparc64/lib/NG2memcpy.S b/arch/sparc64/lib/NG2memcpy.S
new file mode 100644
index 000000000000..0aed75653b50
--- /dev/null
+++ b/arch/sparc64/lib/NG2memcpy.S
@@ -0,0 +1,520 @@
1/* NG2memcpy.S: Niagara-2 optimized memcpy.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#ifdef __KERNEL__
7#include <asm/visasm.h>
8#include <asm/asi.h>
9#define GLOBAL_SPARE %g7
10#else
11#define ASI_PNF 0x82
12#define ASI_BLK_P 0xf0
13#define ASI_BLK_INIT_QUAD_LDD_P 0xe2
14#define FPRS_FEF 0x04
15#ifdef MEMCPY_DEBUG
16#define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs; \
17 clr %g1; clr %g2; clr %g3; subcc %g0, %g0, %g0;
18#define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs
19#else
20#define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs
21#define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs
22#endif
23#define GLOBAL_SPARE %g5
24#endif
25
26#ifndef STORE_ASI
27#ifndef SIMULATE_NIAGARA_ON_NON_NIAGARA
28#define STORE_ASI ASI_BLK_INIT_QUAD_LDD_P
29#else
30#define STORE_ASI 0x80 /* ASI_P */
31#endif
32#endif
33
34#ifndef EX_LD
35#define EX_LD(x) x
36#endif
37
38#ifndef EX_ST
39#define EX_ST(x) x
40#endif
41
42#ifndef EX_RETVAL
43#define EX_RETVAL(x) x
44#endif
45
46#ifndef LOAD
47#define LOAD(type,addr,dest) type [addr], dest
48#endif
49
50#ifndef LOAD_BLK
51#define LOAD_BLK(addr,dest) ldda [addr] ASI_BLK_P, dest
52#endif
53
54#ifndef STORE
55#ifndef MEMCPY_DEBUG
56#define STORE(type,src,addr) type src, [addr]
57#else
58#define STORE(type,src,addr) type##a src, [addr] 0x80
59#endif
60#endif
61
62#ifndef STORE_BLK
63#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_P
64#endif
65
66#ifndef STORE_INIT
67#define STORE_INIT(src,addr) stxa src, [addr] STORE_ASI
68#endif
69
70#ifndef FUNC_NAME
71#define FUNC_NAME NG2memcpy
72#endif
73
74#ifndef PREAMBLE
75#define PREAMBLE
76#endif
77
78#ifndef XCC
79#define XCC xcc
80#endif
81
82#define FREG_FROB(x0, x1, x2, x3, x4, x5, x6, x7, x8) \
83 faligndata %x0, %x1, %f0; \
84 faligndata %x1, %x2, %f2; \
85 faligndata %x2, %x3, %f4; \
86 faligndata %x3, %x4, %f6; \
87 faligndata %x4, %x5, %f8; \
88 faligndata %x5, %x6, %f10; \
89 faligndata %x6, %x7, %f12; \
90 faligndata %x7, %x8, %f14;
91
92#define FREG_MOVE_1(x0) \
93 fmovd %x0, %f0;
94#define FREG_MOVE_2(x0, x1) \
95 fmovd %x0, %f0; \
96 fmovd %x1, %f2;
97#define FREG_MOVE_3(x0, x1, x2) \
98 fmovd %x0, %f0; \
99 fmovd %x1, %f2; \
100 fmovd %x2, %f4;
101#define FREG_MOVE_4(x0, x1, x2, x3) \
102 fmovd %x0, %f0; \
103 fmovd %x1, %f2; \
104 fmovd %x2, %f4; \
105 fmovd %x3, %f6;
106#define FREG_MOVE_5(x0, x1, x2, x3, x4) \
107 fmovd %x0, %f0; \
108 fmovd %x1, %f2; \
109 fmovd %x2, %f4; \
110 fmovd %x3, %f6; \
111 fmovd %x4, %f8;
112#define FREG_MOVE_6(x0, x1, x2, x3, x4, x5) \
113 fmovd %x0, %f0; \
114 fmovd %x1, %f2; \
115 fmovd %x2, %f4; \
116 fmovd %x3, %f6; \
117 fmovd %x4, %f8; \
118 fmovd %x5, %f10;
119#define FREG_MOVE_7(x0, x1, x2, x3, x4, x5, x6) \
120 fmovd %x0, %f0; \
121 fmovd %x1, %f2; \
122 fmovd %x2, %f4; \
123 fmovd %x3, %f6; \
124 fmovd %x4, %f8; \
125 fmovd %x5, %f10; \
126 fmovd %x6, %f12;
127#define FREG_MOVE_8(x0, x1, x2, x3, x4, x5, x6, x7) \
128 fmovd %x0, %f0; \
129 fmovd %x1, %f2; \
130 fmovd %x2, %f4; \
131 fmovd %x3, %f6; \
132 fmovd %x4, %f8; \
133 fmovd %x5, %f10; \
134 fmovd %x6, %f12; \
135 fmovd %x7, %f14;
136#define FREG_LOAD_1(base, x0) \
137 EX_LD(LOAD(ldd, base + 0x00, %x0))
138#define FREG_LOAD_2(base, x0, x1) \
139 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
140 EX_LD(LOAD(ldd, base + 0x08, %x1));
141#define FREG_LOAD_3(base, x0, x1, x2) \
142 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
143 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
144 EX_LD(LOAD(ldd, base + 0x10, %x2));
145#define FREG_LOAD_4(base, x0, x1, x2, x3) \
146 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
147 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
148 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
149 EX_LD(LOAD(ldd, base + 0x18, %x3));
150#define FREG_LOAD_5(base, x0, x1, x2, x3, x4) \
151 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
152 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
153 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
154 EX_LD(LOAD(ldd, base + 0x18, %x3)); \
155 EX_LD(LOAD(ldd, base + 0x20, %x4));
156#define FREG_LOAD_6(base, x0, x1, x2, x3, x4, x5) \
157 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
158 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
159 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
160 EX_LD(LOAD(ldd, base + 0x18, %x3)); \
161 EX_LD(LOAD(ldd, base + 0x20, %x4)); \
162 EX_LD(LOAD(ldd, base + 0x28, %x5));
163#define FREG_LOAD_7(base, x0, x1, x2, x3, x4, x5, x6) \
164 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
165 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
166 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
167 EX_LD(LOAD(ldd, base + 0x18, %x3)); \
168 EX_LD(LOAD(ldd, base + 0x20, %x4)); \
169 EX_LD(LOAD(ldd, base + 0x28, %x5)); \
170 EX_LD(LOAD(ldd, base + 0x30, %x6));
171
172 .register %g2,#scratch
173 .register %g3,#scratch
174
175 .text
176 .align 64
177
178 .globl FUNC_NAME
179 .type FUNC_NAME,#function
180FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
181 srlx %o2, 31, %g2
182 cmp %g2, 0
183 tne %xcc, 5
184 PREAMBLE
185 mov %o0, GLOBAL_SPARE
186 cmp %o2, 0
187 be,pn %XCC, 85f
188 or %o0, %o1, %o3
189 cmp %o2, 16
190 blu,a,pn %XCC, 80f
191 or %o3, %o2, %o3
192
193 /* 2 blocks (128 bytes) is the minimum we can do the block
194 * copy with. We need to ensure that we'll iterate at least
195 * once in the block copy loop. At worst we'll need to align
196 * the destination to a 64-byte boundary which can chew up
197 * to (64 - 1) bytes from the length before we perform the
198 * block copy loop.
199 *
200 * However, the cut-off point, performance wise, is around
201 * 4 64-byte blocks.
202 */
203 cmp %o2, (4 * 64)
204 blu,pt %XCC, 75f
205 andcc %o3, 0x7, %g0
206
207 /* %o0: dst
208 * %o1: src
209 * %o2: len (known to be >= 128)
210 *
211 * The block copy loops can use %o4, %g2, %g3 as
212 * temporaries while copying the data. %o5 must
213 * be preserved between VISEntryHalf and VISExitHalf
214 */
215
216 LOAD(prefetch, %o1 + 0x000, #one_read)
217 LOAD(prefetch, %o1 + 0x040, #one_read)
218 LOAD(prefetch, %o1 + 0x080, #one_read)
219
220 /* Align destination on 64-byte boundary. */
221 andcc %o0, (64 - 1), %o4
222 be,pt %XCC, 2f
223 sub %o4, 64, %o4
224 sub %g0, %o4, %o4 ! bytes to align dst
225 sub %o2, %o4, %o2
2261: subcc %o4, 1, %o4
227 EX_LD(LOAD(ldub, %o1, %g1))
228 EX_ST(STORE(stb, %g1, %o0))
229 add %o1, 1, %o1
230 bne,pt %XCC, 1b
231 add %o0, 1, %o0
232
2332:
234 /* Clobbers o5/g1/g2/g3/g7/icc/xcc. We must preserve
235 * o5 from here until we hit VISExitHalf.
236 */
237 VISEntryHalf
238
239 alignaddr %o1, %g0, %g0
240
241 add %o1, (64 - 1), %o4
242 andn %o4, (64 - 1), %o4
243 andn %o2, (64 - 1), %g1
244 sub %o2, %g1, %o2
245
246 and %o1, (64 - 1), %g2
247 add %o1, %g1, %o1
248 sub %o0, %o4, %g3
249 brz,pt %g2, 190f
250 cmp %g2, 32
251 blu,a 5f
252 cmp %g2, 16
253 cmp %g2, 48
254 blu,a 4f
255 cmp %g2, 40
256 cmp %g2, 56
257 blu 170f
258 nop
259 ba,a,pt %xcc, 180f
260
2614: /* 32 <= low bits < 48 */
262 blu 150f
263 nop
264 ba,a,pt %xcc, 160f
2655: /* 0 < low bits < 32 */
266 blu,a 6f
267 cmp %g2, 8
268 cmp %g2, 24
269 blu 130f
270 nop
271 ba,a,pt %xcc, 140f
2726: /* 0 < low bits < 16 */
273 bgeu 120f
274 nop
275 /* fall through for 0 < low bits < 8 */
276110: sub %o4, 64, %g2
277 EX_LD(LOAD_BLK(%g2, %f0))
2781: EX_ST(STORE_INIT(%g0, %o4 + %g3))
279 EX_LD(LOAD_BLK(%o4, %f16))
280 FREG_FROB(f0, f2, f4, f6, f8, f10, f12, f14, f16)
281 EX_ST(STORE_BLK(%f0, %o4 + %g3))
282 FREG_MOVE_8(f16, f18, f20, f22, f24, f26, f28, f30)
283 subcc %g1, 64, %g1
284 add %o4, 64, %o4
285 bne,pt %xcc, 1b
286 LOAD(prefetch, %o4 + 64, #one_read)
287 ba,pt %xcc, 195f
288 nop
289
290120: sub %o4, 56, %g2
291 FREG_LOAD_7(%g2, f0, f2, f4, f6, f8, f10, f12)
2921: EX_ST(STORE_INIT(%g0, %o4 + %g3))
293 EX_LD(LOAD_BLK(%o4, %f16))
294 FREG_FROB(f0, f2, f4, f6, f8, f10, f12, f16, f18)
295 EX_ST(STORE_BLK(%f0, %o4 + %g3))
296 FREG_MOVE_7(f18, f20, f22, f24, f26, f28, f30)
297 subcc %g1, 64, %g1
298 add %o4, 64, %o4
299 bne,pt %xcc, 1b
300 LOAD(prefetch, %o4 + 64, #one_read)
301 ba,pt %xcc, 195f
302 nop
303
304130: sub %o4, 48, %g2
305 FREG_LOAD_6(%g2, f0, f2, f4, f6, f8, f10)
3061: EX_ST(STORE_INIT(%g0, %o4 + %g3))
307 EX_LD(LOAD_BLK(%o4, %f16))
308 FREG_FROB(f0, f2, f4, f6, f8, f10, f16, f18, f20)
309 EX_ST(STORE_BLK(%f0, %o4 + %g3))
310 FREG_MOVE_6(f20, f22, f24, f26, f28, f30)
311 subcc %g1, 64, %g1
312 add %o4, 64, %o4
313 bne,pt %xcc, 1b
314 LOAD(prefetch, %o4 + 64, #one_read)
315 ba,pt %xcc, 195f
316 nop
317
318140: sub %o4, 40, %g2
319 FREG_LOAD_5(%g2, f0, f2, f4, f6, f8)
3201: EX_ST(STORE_INIT(%g0, %o4 + %g3))
321 EX_LD(LOAD_BLK(%o4, %f16))
322 FREG_FROB(f0, f2, f4, f6, f8, f16, f18, f20, f22)
323 EX_ST(STORE_BLK(%f0, %o4 + %g3))
324 FREG_MOVE_5(f22, f24, f26, f28, f30)
325 subcc %g1, 64, %g1
326 add %o4, 64, %o4
327 bne,pt %xcc, 1b
328 LOAD(prefetch, %o4 + 64, #one_read)
329 ba,pt %xcc, 195f
330 nop
331
332150: sub %o4, 32, %g2
333 FREG_LOAD_4(%g2, f0, f2, f4, f6)
3341: EX_ST(STORE_INIT(%g0, %o4 + %g3))
335 EX_LD(LOAD_BLK(%o4, %f16))
336 FREG_FROB(f0, f2, f4, f6, f16, f18, f20, f22, f24)
337 EX_ST(STORE_BLK(%f0, %o4 + %g3))
338 FREG_MOVE_4(f24, f26, f28, f30)
339 subcc %g1, 64, %g1
340 add %o4, 64, %o4
341 bne,pt %xcc, 1b
342 LOAD(prefetch, %o4 + 64, #one_read)
343 ba,pt %xcc, 195f
344 nop
345
346160: sub %o4, 24, %g2
347 FREG_LOAD_3(%g2, f0, f2, f4)
3481: EX_ST(STORE_INIT(%g0, %o4 + %g3))
349 EX_LD(LOAD_BLK(%o4, %f16))
350 FREG_FROB(f0, f2, f4, f16, f18, f20, f22, f24, f26)
351 EX_ST(STORE_BLK(%f0, %o4 + %g3))
352 FREG_MOVE_3(f26, f28, f30)
353 subcc %g1, 64, %g1
354 add %o4, 64, %o4
355 bne,pt %xcc, 1b
356 LOAD(prefetch, %o4 + 64, #one_read)
357 ba,pt %xcc, 195f
358 nop
359
360170: sub %o4, 16, %g2
361 FREG_LOAD_2(%g2, f0, f2)
3621: EX_ST(STORE_INIT(%g0, %o4 + %g3))
363 EX_LD(LOAD_BLK(%o4, %f16))
364 FREG_FROB(f0, f2, f16, f18, f20, f22, f24, f26, f28)
365 EX_ST(STORE_BLK(%f0, %o4 + %g3))
366 FREG_MOVE_2(f28, f30)
367 subcc %g1, 64, %g1
368 add %o4, 64, %o4
369 bne,pt %xcc, 1b
370 LOAD(prefetch, %o4 + 64, #one_read)
371 ba,pt %xcc, 195f
372 nop
373
374180: sub %o4, 8, %g2
375 FREG_LOAD_1(%g2, f0)
3761: EX_ST(STORE_INIT(%g0, %o4 + %g3))
377 EX_LD(LOAD_BLK(%o4, %f16))
378 FREG_FROB(f0, f16, f18, f20, f22, f24, f26, f28, f30)
379 EX_ST(STORE_BLK(%f0, %o4 + %g3))
380 FREG_MOVE_1(f30)
381 subcc %g1, 64, %g1
382 add %o4, 64, %o4
383 bne,pt %xcc, 1b
384 LOAD(prefetch, %o4 + 64, #one_read)
385 ba,pt %xcc, 195f
386 nop
387
388190:
3891: EX_ST(STORE_INIT(%g0, %o4 + %g3))
390 subcc %g1, 64, %g1
391 EX_LD(LOAD_BLK(%o4, %f0))
392 EX_ST(STORE_BLK(%f0, %o4 + %g3))
393 add %o4, 64, %o4
394 bne,pt %xcc, 1b
395 LOAD(prefetch, %o4 + 64, #one_read)
396
397195:
398 add %o4, %g3, %o0
399 membar #Sync
400
401 VISExitHalf
402
403 /* %o2 contains any final bytes still needed to be copied
404 * over. If anything is left, we copy it one byte at a time.
405 */
406 brz,pt %o2, 85f
407 sub %o0, %o1, %o3
408 ba,a,pt %XCC, 90f
409
410 .align 64
41175: /* 16 < len <= 64 */
412 bne,pn %XCC, 75f
413 sub %o0, %o1, %o3
414
41572:
416 andn %o2, 0xf, %o4
417 and %o2, 0xf, %o2
4181: subcc %o4, 0x10, %o4
419 EX_LD(LOAD(ldx, %o1, %o5))
420 add %o1, 0x08, %o1
421 EX_LD(LOAD(ldx, %o1, %g1))
422 sub %o1, 0x08, %o1
423 EX_ST(STORE(stx, %o5, %o1 + %o3))
424 add %o1, 0x8, %o1
425 EX_ST(STORE(stx, %g1, %o1 + %o3))
426 bgu,pt %XCC, 1b
427 add %o1, 0x8, %o1
42873: andcc %o2, 0x8, %g0
429 be,pt %XCC, 1f
430 nop
431 sub %o2, 0x8, %o2
432 EX_LD(LOAD(ldx, %o1, %o5))
433 EX_ST(STORE(stx, %o5, %o1 + %o3))
434 add %o1, 0x8, %o1
4351: andcc %o2, 0x4, %g0
436 be,pt %XCC, 1f
437 nop
438 sub %o2, 0x4, %o2
439 EX_LD(LOAD(lduw, %o1, %o5))
440 EX_ST(STORE(stw, %o5, %o1 + %o3))
441 add %o1, 0x4, %o1
4421: cmp %o2, 0
443 be,pt %XCC, 85f
444 nop
445 ba,pt %xcc, 90f
446 nop
447
44875:
449 andcc %o0, 0x7, %g1
450 sub %g1, 0x8, %g1
451 be,pn %icc, 2f
452 sub %g0, %g1, %g1
453 sub %o2, %g1, %o2
454
4551: subcc %g1, 1, %g1
456 EX_LD(LOAD(ldub, %o1, %o5))
457 EX_ST(STORE(stb, %o5, %o1 + %o3))
458 bgu,pt %icc, 1b
459 add %o1, 1, %o1
460
4612: add %o1, %o3, %o0
462 andcc %o1, 0x7, %g1
463 bne,pt %icc, 8f
464 sll %g1, 3, %g1
465
466 cmp %o2, 16
467 bgeu,pt %icc, 72b
468 nop
469 ba,a,pt %xcc, 73b
470
4718: mov 64, %o3
472 andn %o1, 0x7, %o1
473 EX_LD(LOAD(ldx, %o1, %g2))
474 sub %o3, %g1, %o3
475 andn %o2, 0x7, %o4
476 sllx %g2, %g1, %g2
4771: add %o1, 0x8, %o1
478 EX_LD(LOAD(ldx, %o1, %g3))
479 subcc %o4, 0x8, %o4
480 srlx %g3, %o3, %o5
481 or %o5, %g2, %o5
482 EX_ST(STORE(stx, %o5, %o0))
483 add %o0, 0x8, %o0
484 bgu,pt %icc, 1b
485 sllx %g3, %g1, %g2
486
487 srl %g1, 3, %g1
488 andcc %o2, 0x7, %o2
489 be,pn %icc, 85f
490 add %o1, %g1, %o1
491 ba,pt %xcc, 90f
492 sub %o0, %o1, %o3
493
494 .align 64
49580: /* 0 < len <= 16 */
496 andcc %o3, 0x3, %g0
497 bne,pn %XCC, 90f
498 sub %o0, %o1, %o3
499
5001:
501 subcc %o2, 4, %o2
502 EX_LD(LOAD(lduw, %o1, %g1))
503 EX_ST(STORE(stw, %g1, %o1 + %o3))
504 bgu,pt %XCC, 1b
505 add %o1, 4, %o1
506
50785: retl
508 mov EX_RETVAL(GLOBAL_SPARE), %o0
509
510 .align 32
51190:
512 subcc %o2, 1, %o2
513 EX_LD(LOAD(ldub, %o1, %g1))
514 EX_ST(STORE(stb, %g1, %o1 + %o3))
515 bgu,pt %XCC, 90b
516 add %o1, 1, %o1
517 retl
518 mov EX_RETVAL(GLOBAL_SPARE), %o0
519
520 .size FUNC_NAME, .-FUNC_NAME
diff --git a/arch/sparc64/lib/NG2page.S b/arch/sparc64/lib/NG2page.S
new file mode 100644
index 000000000000..73b6b7c72cbf
--- /dev/null
+++ b/arch/sparc64/lib/NG2page.S
@@ -0,0 +1,61 @@
1/* NG2page.S: Niagara-2 optimized clear and copy page.
2 *
3 * Copyright (C) 2007 (davem@davemloft.net)
4 */
5
6#include <asm/asi.h>
7#include <asm/page.h>
8#include <asm/visasm.h>
9
10 .text
11 .align 32
12
13 /* This is heavily simplified from the sun4u variants
14 * because Niagara-2 does not have any D-cache aliasing issues.
15 */
16NG2copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
17 prefetch [%o1 + 0x00], #one_read
18 prefetch [%o1 + 0x40], #one_read
19 VISEntryHalf
20 set PAGE_SIZE, %g7
21 sub %o0, %o1, %g3
221: stxa %g0, [%o1 + %g3] ASI_BLK_INIT_QUAD_LDD_P
23 subcc %g7, 64, %g7
24 ldda [%o1] ASI_BLK_P, %f0
25 stda %f0, [%o1 + %g3] ASI_BLK_P
26 add %o1, 64, %o1
27 bne,pt %xcc, 1b
28 prefetch [%o1 + 0x40], #one_read
29 membar #Sync
30 VISExitHalf
31 retl
32 nop
33
34#define BRANCH_ALWAYS 0x10680000
35#define NOP 0x01000000
36#define NG_DO_PATCH(OLD, NEW) \
37 sethi %hi(NEW), %g1; \
38 or %g1, %lo(NEW), %g1; \
39 sethi %hi(OLD), %g2; \
40 or %g2, %lo(OLD), %g2; \
41 sub %g1, %g2, %g1; \
42 sethi %hi(BRANCH_ALWAYS), %g3; \
43 sll %g1, 11, %g1; \
44 srl %g1, 11 + 2, %g1; \
45 or %g3, %lo(BRANCH_ALWAYS), %g3; \
46 or %g3, %g1, %g3; \
47 stw %g3, [%g2]; \
48 sethi %hi(NOP), %g3; \
49 or %g3, %lo(NOP), %g3; \
50 stw %g3, [%g2 + 0x4]; \
51 flush %g2;
52
53 .globl niagara2_patch_pageops
54 .type niagara2_patch_pageops,#function
55niagara2_patch_pageops:
56 NG_DO_PATCH(copy_user_page, NG2copy_user_page)
57 NG_DO_PATCH(_clear_page, NGclear_page)
58 NG_DO_PATCH(clear_user_page, NGclear_user_page)
59 retl
60 nop
61 .size niagara2_patch_pageops,.-niagara2_patch_pageops
diff --git a/arch/sparc64/lib/NG2patch.S b/arch/sparc64/lib/NG2patch.S
new file mode 100644
index 000000000000..28c36f06a6d1
--- /dev/null
+++ b/arch/sparc64/lib/NG2patch.S
@@ -0,0 +1,33 @@
1/* NG2patch.S: Patch Ultra-I routines with Niagara-2 variant.
2 *
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
4 */
5
6#define BRANCH_ALWAYS 0x10680000
7#define NOP 0x01000000
8#define NG_DO_PATCH(OLD, NEW) \
9 sethi %hi(NEW), %g1; \
10 or %g1, %lo(NEW), %g1; \
11 sethi %hi(OLD), %g2; \
12 or %g2, %lo(OLD), %g2; \
13 sub %g1, %g2, %g1; \
14 sethi %hi(BRANCH_ALWAYS), %g3; \
15 sll %g1, 11, %g1; \
16 srl %g1, 11 + 2, %g1; \
17 or %g3, %lo(BRANCH_ALWAYS), %g3; \
18 or %g3, %g1, %g3; \
19 stw %g3, [%g2]; \
20 sethi %hi(NOP), %g3; \
21 or %g3, %lo(NOP), %g3; \
22 stw %g3, [%g2 + 0x4]; \
23 flush %g2;
24
25 .globl niagara2_patch_copyops
26 .type niagara2_patch_copyops,#function
27niagara2_patch_copyops:
28 NG_DO_PATCH(memcpy, NG2memcpy)
29 NG_DO_PATCH(___copy_from_user, NG2copy_from_user)
30 NG_DO_PATCH(___copy_to_user, NG2copy_to_user)
31 retl
32 nop
33 .size niagara2_patch_copyops,.-niagara2_patch_copyops
diff --git a/arch/sparc64/lib/NGpage.S b/arch/sparc64/lib/NGpage.S
index 8ce3a0c9c537..428920de05ba 100644
--- a/arch/sparc64/lib/NGpage.S
+++ b/arch/sparc64/lib/NGpage.S
@@ -45,6 +45,7 @@ NGcopy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
45 retl 45 retl
46 nop 46 nop
47 47
48 .globl NGclear_page, NGclear_user_page
48NGclear_page: /* %o0=dest */ 49NGclear_page: /* %o0=dest */
49NGclear_user_page: /* %o0=dest, %o1=vaddr */ 50NGclear_user_page: /* %o0=dest, %o1=vaddr */
50 mov 8, %g1 51 mov 8, %g1
diff --git a/arch/x86_64/boot/compressed/head.S b/arch/x86_64/boot/compressed/head.S
index 1312bfaff306..9fd8030cc54f 100644
--- a/arch/x86_64/boot/compressed/head.S
+++ b/arch/x86_64/boot/compressed/head.S
@@ -195,6 +195,11 @@ ENTRY(startup_64)
195 movl %eax, %ds 195 movl %eax, %ds
196 movl %eax, %es 196 movl %eax, %es
197 movl %eax, %ss 197 movl %eax, %ss
198 movl %eax, %fs
199 movl %eax, %gs
200 lldt %ax
201 movl $0x20, %eax
202 ltr %ax
198 203
199 /* Compute the decompressed kernel start address. It is where 204 /* Compute the decompressed kernel start address. It is where
200 * we were loaded at aligned to a 2M boundary. %rbp contains the 205 * we were loaded at aligned to a 2M boundary. %rbp contains the
@@ -295,6 +300,8 @@ gdt:
295 .quad 0x0000000000000000 /* NULL descriptor */ 300 .quad 0x0000000000000000 /* NULL descriptor */
296 .quad 0x00af9a000000ffff /* __KERNEL_CS */ 301 .quad 0x00af9a000000ffff /* __KERNEL_CS */
297 .quad 0x00cf92000000ffff /* __KERNEL_DS */ 302 .quad 0x00cf92000000ffff /* __KERNEL_DS */
303 .quad 0x0080890000000000 /* TS descriptor */
304 .quad 0x0000000000000000 /* TS continued */
298gdt_end: 305gdt_end:
299 .bss 306 .bss
300/* Stack for uncompression */ 307/* Stack for uncompression */
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 900ff38d68de..925758dbca0c 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -791,10 +791,8 @@ static void setup_APIC_timer(unsigned int clocks)
791 791
792 /* wait for irq slice */ 792 /* wait for irq slice */
793 if (hpet_address && hpet_use_timer) { 793 if (hpet_address && hpet_use_timer) {
794 int trigger = hpet_readl(HPET_T0_CMP); 794 u32 trigger = hpet_readl(HPET_T0_CMP);
795 while (hpet_readl(HPET_COUNTER) >= trigger) 795 while (hpet_readl(HPET_T0_CMP) == trigger)
796 /* do nothing */ ;
797 while (hpet_readl(HPET_COUNTER) < trigger)
798 /* do nothing */ ; 796 /* do nothing */ ;
799 } else { 797 } else {
800 int c1, c2; 798 int c1, c2;
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 050141c0602b..f57f8b901912 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -800,12 +800,15 @@ static struct irq_chip ioapic_chip;
800 800
801static void ioapic_register_intr(int irq, unsigned long trigger) 801static void ioapic_register_intr(int irq, unsigned long trigger)
802{ 802{
803 if (trigger) 803 if (trigger) {
804 irq_desc[irq].status |= IRQ_LEVEL;
804 set_irq_chip_and_handler_name(irq, &ioapic_chip, 805 set_irq_chip_and_handler_name(irq, &ioapic_chip,
805 handle_fasteoi_irq, "fasteoi"); 806 handle_fasteoi_irq, "fasteoi");
806 else 807 } else {
808 irq_desc[irq].status &= ~IRQ_LEVEL;
807 set_irq_chip_and_handler_name(irq, &ioapic_chip, 809 set_irq_chip_and_handler_name(irq, &ioapic_chip,
808 handle_edge_irq, "edge"); 810 handle_edge_irq, "edge");
811 }
809} 812}
810 813
811static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, 814static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
diff --git a/arch/x86_64/kernel/pci-calgary.c b/arch/x86_64/kernel/pci-calgary.c
index ba16c968ca3f..71da01e73f03 100644
--- a/arch/x86_64/kernel/pci-calgary.c
+++ b/arch/x86_64/kernel/pci-calgary.c
@@ -367,16 +367,15 @@ static inline struct iommu_table *find_iommu_table(struct device *dev)
367 367
368 pdev = to_pci_dev(dev); 368 pdev = to_pci_dev(dev);
369 369
370 /* is the device behind a bridge? */ 370 pbus = pdev->bus;
371 if (unlikely(pdev->bus->parent)) 371
372 pbus = pdev->bus->parent; 372 /* is the device behind a bridge? Look for the root bus */
373 else 373 while (pbus->parent)
374 pbus = pdev->bus; 374 pbus = pbus->parent;
375 375
376 tbl = pci_iommu(pbus); 376 tbl = pci_iommu(pbus);
377 377
378 BUG_ON(pdev->bus->parent && 378 BUG_ON(tbl && (tbl->it_busno != pbus->number));
379 (tbl->it_busno != pdev->bus->parent->number));
380 379
381 return tbl; 380 return tbl;
382} 381}
diff --git a/arch/x86_64/lib/memcpy.S b/arch/x86_64/lib/memcpy.S
index 0ea0ddc875a7..c22981fa2f3a 100644
--- a/arch/x86_64/lib/memcpy.S
+++ b/arch/x86_64/lib/memcpy.S
@@ -124,6 +124,8 @@ ENDPROC(__memcpy)
124 .quad memcpy 124 .quad memcpy
125 .quad 1b 125 .quad 1b
126 .byte X86_FEATURE_REP_GOOD 126 .byte X86_FEATURE_REP_GOOD
127 .byte .Lfinal - memcpy 127 /* Replace only beginning, memcpy is used to apply alternatives, so it
128 * is silly to overwrite itself with nops - reboot is only outcome... */
129 .byte 2b - 1b
128 .byte 2b - 1b 130 .byte 2b - 1b
129 .previous 131 .previous
diff --git a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c
index 7e161c698af4..10b9809ce821 100644
--- a/arch/x86_64/mm/pageattr.c
+++ b/arch/x86_64/mm/pageattr.c
@@ -75,7 +75,8 @@ static void flush_kernel_map(void *arg)
75 75
76 /* When clflush is available always use it because it is 76 /* When clflush is available always use it because it is
77 much cheaper than WBINVD. */ 77 much cheaper than WBINVD. */
78 if (!cpu_has_clflush) 78 /* clflush is still broken. Disable for now. */
79 if (1 || !cpu_has_clflush)
79 asm volatile("wbinvd" ::: "memory"); 80 asm volatile("wbinvd" ::: "memory");
80 else list_for_each_entry(pg, l, lru) { 81 else list_for_each_entry(pg, l, lru) {
81 void *adr = page_address(pg); 82 void *adr = page_address(pg);
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index 65d82736987e..4095e4d66a1d 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -66,13 +66,13 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
66 66
67 switch (len) { 67 switch (len) {
68 case 1: 68 case 1:
69 *value = readb(addr + reg); 69 *value = mmio_config_readb(addr + reg);
70 break; 70 break;
71 case 2: 71 case 2:
72 *value = readw(addr + reg); 72 *value = mmio_config_readw(addr + reg);
73 break; 73 break;
74 case 4: 74 case 4:
75 *value = readl(addr + reg); 75 *value = mmio_config_readl(addr + reg);
76 break; 76 break;
77 } 77 }
78 78
@@ -94,13 +94,13 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
94 94
95 switch (len) { 95 switch (len) {
96 case 1: 96 case 1:
97 writeb(value, addr + reg); 97 mmio_config_writeb(addr + reg, value);
98 break; 98 break;
99 case 2: 99 case 2:
100 writew(value, addr + reg); 100 mmio_config_writew(addr + reg, value);
101 break; 101 break;
102 case 4: 102 case 4:
103 writel(value, addr + reg); 103 mmio_config_writel(addr + reg, value);
104 break; 104 break;
105 } 105 }
106 106
diff --git a/arch/x86_64/vdso/.gitignore b/arch/x86_64/vdso/.gitignore
new file mode 100644
index 000000000000..f8b69d84238e
--- /dev/null
+++ b/arch/x86_64/vdso/.gitignore
@@ -0,0 +1 @@
vdso.lds
diff --git a/block/bsg.c b/block/bsg.c
index d60eee549405..ed2646827234 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * bsg.c - block layer implementation of the sg v3 interface 2 * bsg.c - block layer implementation of the sg v4 interface
3 * 3 *
4 * Copyright (C) 2004 Jens Axboe <axboe@suse.de> SUSE Labs 4 * Copyright (C) 2004 Jens Axboe <axboe@suse.de> SUSE Labs
5 * Copyright (C) 2004 Peter M. Jones <pjones@redhat.com> 5 * Copyright (C) 2004 Peter M. Jones <pjones@redhat.com>
@@ -421,7 +421,6 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
421 hdr->info = 0; 421 hdr->info = 0;
422 if (hdr->device_status || hdr->transport_status || hdr->driver_status) 422 if (hdr->device_status || hdr->transport_status || hdr->driver_status)
423 hdr->info |= SG_INFO_CHECK; 423 hdr->info |= SG_INFO_CHECK;
424 hdr->din_resid = rq->data_len;
425 hdr->response_len = 0; 424 hdr->response_len = 0;
426 425
427 if (rq->sense_len && hdr->response) { 426 if (rq->sense_len && hdr->response) {
@@ -437,9 +436,14 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
437 } 436 }
438 437
439 if (rq->next_rq) { 438 if (rq->next_rq) {
439 hdr->dout_resid = rq->data_len;
440 hdr->din_resid = rq->next_rq->data_len;
440 blk_rq_unmap_user(bidi_bio); 441 blk_rq_unmap_user(bidi_bio);
441 blk_put_request(rq->next_rq); 442 blk_put_request(rq->next_rq);
442 } 443 } else if (rq_data_dir(rq) == READ)
444 hdr->din_resid = rq->data_len;
445 else
446 hdr->dout_resid = rq->data_len;
443 447
444 blk_rq_unmap_user(bio); 448 blk_rq_unmap_user(bio);
445 blk_put_request(rq); 449 blk_put_request(rq);
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 8c2caff87cc3..a15845c164f2 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3047,6 +3047,10 @@ static inline void blk_partition_remap(struct bio *bio)
3047 3047
3048 bio->bi_sector += p->start_sect; 3048 bio->bi_sector += p->start_sect;
3049 bio->bi_bdev = bdev->bd_contains; 3049 bio->bi_bdev = bdev->bd_contains;
3050
3051 blk_add_trace_remap(bdev_get_queue(bio->bi_bdev), bio,
3052 bdev->bd_dev, bio->bi_sector,
3053 bio->bi_sector - p->start_sect);
3050 } 3054 }
3051} 3055}
3052 3056
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
index 1c166b47b4cc..3dbb1cc6eab5 100644
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -35,7 +35,7 @@ static int setkey_unaligned(struct crypto_ablkcipher *tfm, const u8 *key, unsign
35 alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); 35 alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1);
36 memcpy(alignbuffer, key, keylen); 36 memcpy(alignbuffer, key, keylen);
37 ret = cipher->setkey(tfm, alignbuffer, keylen); 37 ret = cipher->setkey(tfm, alignbuffer, keylen);
38 memset(alignbuffer, 0, absize); 38 memset(alignbuffer, 0, keylen);
39 kfree(buffer); 39 kfree(buffer);
40 return ret; 40 return ret;
41} 41}
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
index 40a3dcff15bb..7755834b8846 100644
--- a/crypto/blkcipher.c
+++ b/crypto/blkcipher.c
@@ -352,7 +352,7 @@ static int setkey_unaligned(struct crypto_tfm *tfm, const u8 *key, unsigned int
352 alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); 352 alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1);
353 memcpy(alignbuffer, key, keylen); 353 memcpy(alignbuffer, key, keylen);
354 ret = cipher->setkey(tfm, alignbuffer, keylen); 354 ret = cipher->setkey(tfm, alignbuffer, keylen);
355 memset(alignbuffer, 0, absize); 355 memset(alignbuffer, 0, keylen);
356 kfree(buffer); 356 kfree(buffer);
357 return ret; 357 return ret;
358} 358}
diff --git a/crypto/cipher.c b/crypto/cipher.c
index 0b2650c2014b..fc6b46f2a9b0 100644
--- a/crypto/cipher.c
+++ b/crypto/cipher.c
@@ -36,7 +36,7 @@ static int setkey_unaligned(struct crypto_tfm *tfm, const u8 *key, unsigned int
36 alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); 36 alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1);
37 memcpy(alignbuffer, key, keylen); 37 memcpy(alignbuffer, key, keylen);
38 ret = cia->cia_setkey(tfm, alignbuffer, keylen); 38 ret = cia->cia_setkey(tfm, alignbuffer, keylen);
39 memset(alignbuffer, 0, absize); 39 memset(alignbuffer, 0, keylen);
40 kfree(buffer); 40 kfree(buffer);
41 return ret; 41 return ret;
42 42
diff --git a/crypto/hash.c b/crypto/hash.c
index 4d75ca7b57b2..4fd470bd729b 100644
--- a/crypto/hash.c
+++ b/crypto/hash.c
@@ -40,7 +40,7 @@ static int hash_setkey_unaligned(struct crypto_hash *crt, const u8 *key,
40 alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); 40 alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1);
41 memcpy(alignbuffer, key, keylen); 41 memcpy(alignbuffer, key, keylen);
42 ret = alg->setkey(crt, alignbuffer, keylen); 42 ret = alg->setkey(crt, alignbuffer, keylen);
43 memset(alignbuffer, 0, absize); 43 memset(alignbuffer, 0, keylen);
44 kfree(buffer); 44 kfree(buffer);
45 return ret; 45 return ret;
46} 46}
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index 9c4bd220c44f..86fd142f4bf3 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -1192,6 +1192,7 @@ static int asus_hotk_get_info(void)
1192 break; 1192 break;
1193 default: 1193 default:
1194 kfree(model); 1194 kfree(model);
1195 model = NULL;
1195 break; 1196 break;
1196 } 1197 }
1197 } 1198 }
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 81651032791b..d7b499fe0cd9 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -113,7 +113,7 @@ struct acpi_battery_info {
113 acpi_string oem_info; 113 acpi_string oem_info;
114}; 114};
115 115
116enum acpi_battery_files{ 116enum acpi_battery_files {
117 ACPI_BATTERY_INFO = 0, 117 ACPI_BATTERY_INFO = 0,
118 ACPI_BATTERY_STATE, 118 ACPI_BATTERY_STATE,
119 ACPI_BATTERY_ALARM, 119 ACPI_BATTERY_ALARM,
@@ -129,13 +129,14 @@ struct acpi_battery_flags {
129}; 129};
130 130
131struct acpi_battery { 131struct acpi_battery {
132 struct mutex mutex;
133 struct acpi_device *device; 132 struct acpi_device *device;
134 struct acpi_battery_flags flags; 133 struct acpi_battery_flags flags;
135 struct acpi_buffer bif_data; 134 struct acpi_buffer bif_data;
136 struct acpi_buffer bst_data; 135 struct acpi_buffer bst_data;
136 struct mutex lock;
137 unsigned long alarm; 137 unsigned long alarm;
138 unsigned long update_time[ACPI_BATTERY_NUMFILES]; 138 unsigned long update_time[ACPI_BATTERY_NUMFILES];
139
139}; 140};
140 141
141inline int acpi_battery_present(struct acpi_battery *battery) 142inline int acpi_battery_present(struct acpi_battery *battery)
@@ -235,10 +236,10 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
235 return 0; 236 return 0;
236 237
237 /* Evaluate _BIF */ 238 /* Evaluate _BIF */
238 239 mutex_lock(&battery->lock);
239 status = 240 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BIF",
240 acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL, 241 NULL, &buffer);
241 &buffer); 242 mutex_unlock(&battery->lock);
242 if (ACPI_FAILURE(status)) { 243 if (ACPI_FAILURE(status)) {
243 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); 244 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
244 return -ENODEV; 245 return -ENODEV;
@@ -285,10 +286,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
285 return 0; 286 return 0;
286 287
287 /* Evaluate _BST */ 288 /* Evaluate _BST */
288 289 mutex_lock(&battery->lock);
289 status = 290 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BST",
290 acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL, 291 NULL, &buffer);
291 &buffer); 292 mutex_unlock(&battery->lock);
292 if (ACPI_FAILURE(status)) { 293 if (ACPI_FAILURE(status)) {
293 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); 294 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
294 return -ENODEV; 295 return -ENODEV;
@@ -336,9 +337,10 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery,
336 337
337 arg0.integer.value = alarm; 338 arg0.integer.value = alarm;
338 339
339 status = 340 mutex_lock(&battery->lock);
340 acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", 341 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BTP",
341 &arg_list, NULL); 342 &arg_list, NULL);
343 mutex_unlock(&battery->lock);
342 if (ACPI_FAILURE(status)) 344 if (ACPI_FAILURE(status))
343 return -ENODEV; 345 return -ENODEV;
344 346
@@ -658,8 +660,6 @@ acpi_battery_write_alarm(struct file *file,
658 if (!battery || (count > sizeof(alarm_string) - 1)) 660 if (!battery || (count > sizeof(alarm_string) - 1))
659 return -EINVAL; 661 return -EINVAL;
660 662
661 mutex_lock(&battery->mutex);
662
663 result = acpi_battery_update(battery, 1, &update_result); 663 result = acpi_battery_update(battery, 1, &update_result);
664 if (result) { 664 if (result) {
665 result = -ENODEV; 665 result = -ENODEV;
@@ -688,9 +688,7 @@ acpi_battery_write_alarm(struct file *file,
688 acpi_battery_check_result(battery, result); 688 acpi_battery_check_result(battery, result);
689 689
690 if (!result) 690 if (!result)
691 result = count; 691 return count;
692
693 mutex_unlock(&battery->mutex);
694 692
695 return result; 693 return result;
696} 694}
@@ -714,8 +712,6 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
714 int update_result = ACPI_BATTERY_NONE_UPDATE; 712 int update_result = ACPI_BATTERY_NONE_UPDATE;
715 int update = 0; 713 int update = 0;
716 714
717 mutex_lock(&battery->mutex);
718
719 update = (get_seconds() - battery->update_time[fid] >= update_time); 715 update = (get_seconds() - battery->update_time[fid] >= update_time);
720 update = (update | battery->flags.update[fid]); 716 update = (update | battery->flags.update[fid]);
721 717
@@ -733,7 +729,6 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
733 result = acpi_read_funcs[fid].print(seq, result); 729 result = acpi_read_funcs[fid].print(seq, result);
734 acpi_battery_check_result(battery, result); 730 acpi_battery_check_result(battery, result);
735 battery->flags.update[fid] = result; 731 battery->flags.update[fid] = result;
736 mutex_unlock(&battery->mutex);
737 return result; 732 return result;
738} 733}
739 734
@@ -897,10 +892,7 @@ static int acpi_battery_add(struct acpi_device *device)
897 if (!battery) 892 if (!battery)
898 return -ENOMEM; 893 return -ENOMEM;
899 894
900 mutex_init(&battery->mutex); 895 mutex_init(&battery->lock);
901
902 mutex_lock(&battery->mutex);
903
904 battery->device = device; 896 battery->device = device;
905 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); 897 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
906 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); 898 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
@@ -936,7 +928,6 @@ static int acpi_battery_add(struct acpi_device *device)
936 kfree(battery); 928 kfree(battery);
937 } 929 }
938 930
939 mutex_unlock(&battery->mutex);
940 931
941 return result; 932 return result;
942} 933}
@@ -951,8 +942,6 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
951 942
952 battery = acpi_driver_data(device); 943 battery = acpi_driver_data(device);
953 944
954 mutex_lock(&battery->mutex);
955
956 status = acpi_remove_notify_handler(device->handle, 945 status = acpi_remove_notify_handler(device->handle,
957 ACPI_ALL_NOTIFY, 946 ACPI_ALL_NOTIFY,
958 acpi_battery_notify); 947 acpi_battery_notify);
@@ -963,9 +952,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
963 952
964 kfree(battery->bst_data.pointer); 953 kfree(battery->bst_data.pointer);
965 954
966 mutex_unlock(&battery->mutex); 955 mutex_destroy(&battery->lock);
967
968 mutex_destroy(&battery->mutex);
969 956
970 kfree(battery); 957 kfree(battery);
971 958
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c
index 56a5b3fffeb3..6daf6088ac88 100644
--- a/drivers/acpi/bay.c
+++ b/drivers/acpi/bay.c
@@ -337,7 +337,7 @@ static void bay_notify(acpi_handle handle, u32 event, void *data)
337 char *envp[] = { event_string, NULL }; 337 char *envp[] = { event_string, NULL };
338 338
339 bay_dprintk(handle, "Bay event"); 339 bay_dprintk(handle, "Bay event");
340 sprintf(event_string, "BAY_EVENT=%d\n", event); 340 sprintf(event_string, "BAY_EVENT=%d", event);
341 kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); 341 kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
342} 342}
343 343
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 6192c8be66df..1dabdf4c07b3 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -336,13 +336,13 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event)
336static void dock_event(struct dock_station *ds, u32 event, int num) 336static void dock_event(struct dock_station *ds, u32 event, int num)
337{ 337{
338 struct device *dev = &dock_device->dev; 338 struct device *dev = &dock_device->dev;
339 char event_string[7]; 339 char event_string[13];
340 char *envp[] = { event_string, NULL }; 340 char *envp[] = { event_string, NULL };
341 341
342 if (num == UNDOCK_EVENT) 342 if (num == UNDOCK_EVENT)
343 sprintf(event_string, "UNDOCK"); 343 sprintf(event_string, "EVENT=undock");
344 else 344 else
345 sprintf(event_string, "DOCK"); 345 sprintf(event_string, "EVENT=dock");
346 346
347 /* 347 /*
348 * Indicate that the status of the dock station has 348 * Indicate that the status of the dock station has
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 469f3f57f881..56bee9e065cf 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -471,7 +471,6 @@ static void acpi_ec_gpe_query(void *ec_cxt)
471 } 471 }
472 } 472 }
473 mutex_unlock(&ec->lock); 473 mutex_unlock(&ec->lock);
474 printk(KERN_ERR PREFIX "Handler for query 0x%x is not found!\n", value);
475} 474}
476 475
477static u32 acpi_ec_gpe_handler(void *data) 476static u32 acpi_ec_gpe_handler(void *data)
@@ -665,30 +664,44 @@ acpi_ec_register_query_methods(acpi_handle handle, u32 level,
665 return AE_OK; 664 return AE_OK;
666} 665}
667 666
668static int ec_parse_device(struct acpi_ec *ec, acpi_handle handle) 667static acpi_status
668ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
669{ 669{
670 if (ACPI_FAILURE(acpi_walk_resources(handle, METHOD_NAME__CRS, 670 acpi_status status;
671 ec_parse_io_ports, ec))) 671
672 return -EINVAL; 672 struct acpi_ec *ec = context;
673 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
674 ec_parse_io_ports, ec);
675 if (ACPI_FAILURE(status))
676 return status;
673 677
674 /* Get GPE bit assignment (EC events). */ 678 /* Get GPE bit assignment (EC events). */
675 /* TODO: Add support for _GPE returning a package */ 679 /* TODO: Add support for _GPE returning a package */
676 if (ACPI_FAILURE(acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe))) 680 status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe);
677 return -EINVAL; 681 if (ACPI_FAILURE(status))
678 682 return status;
679 /* Use the global lock for all EC transactions? */
680 acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock);
681 683
682 /* Find and register all query methods */ 684 /* Find and register all query methods */
683 acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1, 685 acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1,
684 acpi_ec_register_query_methods, ec, NULL); 686 acpi_ec_register_query_methods, ec, NULL);
685 687
688 /* Use the global lock for all EC transactions? */
689 acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock);
690
686 ec->handle = handle; 691 ec->handle = handle;
687 692
688 printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx", 693 printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
689 ec->gpe, ec->command_addr, ec->data_addr); 694 ec->gpe, ec->command_addr, ec->data_addr);
690 695
691 return 0; 696 return AE_CTRL_TERMINATE;
697}
698
699static void ec_remove_handlers(struct acpi_ec *ec)
700{
701 acpi_remove_address_space_handler(ec->handle,
702 ACPI_ADR_SPACE_EC,
703 &acpi_ec_space_handler);
704 acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
692} 705}
693 706
694static int acpi_ec_add(struct acpi_device *device) 707static int acpi_ec_add(struct acpi_device *device)
@@ -705,7 +718,8 @@ static int acpi_ec_add(struct acpi_device *device)
705 if (!ec) 718 if (!ec)
706 return -ENOMEM; 719 return -ENOMEM;
707 720
708 if (ec_parse_device(ec, device->handle)) { 721 if (ec_parse_device(device->handle, 0, ec, NULL) !=
722 AE_CTRL_TERMINATE) {
709 kfree(ec); 723 kfree(ec);
710 return -EINVAL; 724 return -EINVAL;
711 } 725 }
@@ -713,16 +727,13 @@ static int acpi_ec_add(struct acpi_device *device)
713 /* Check if we found the boot EC */ 727 /* Check if we found the boot EC */
714 if (boot_ec) { 728 if (boot_ec) {
715 if (boot_ec->gpe == ec->gpe) { 729 if (boot_ec->gpe == ec->gpe) {
716 /* We might have incorrect info for GL at boot time */ 730 ec_remove_handlers(boot_ec);
717 mutex_lock(&boot_ec->lock); 731 mutex_destroy(&boot_ec->lock);
718 boot_ec->global_lock = ec->global_lock; 732 kfree(boot_ec);
719 /* Copy handlers from new ec into boot ec */ 733 first_ec = boot_ec = NULL;
720 list_splice(&ec->list, &boot_ec->list);
721 mutex_unlock(&boot_ec->lock);
722 kfree(ec);
723 ec = boot_ec;
724 } 734 }
725 } else 735 }
736 if (!first_ec)
726 first_ec = ec; 737 first_ec = ec;
727 ec->handle = device->handle; 738 ec->handle = device->handle;
728 acpi_driver_data(device) = ec; 739 acpi_driver_data(device) = ec;
@@ -734,14 +745,14 @@ static int acpi_ec_add(struct acpi_device *device)
734static int acpi_ec_remove(struct acpi_device *device, int type) 745static int acpi_ec_remove(struct acpi_device *device, int type)
735{ 746{
736 struct acpi_ec *ec; 747 struct acpi_ec *ec;
737 struct acpi_ec_query_handler *handler; 748 struct acpi_ec_query_handler *handler, *tmp;
738 749
739 if (!device) 750 if (!device)
740 return -EINVAL; 751 return -EINVAL;
741 752
742 ec = acpi_driver_data(device); 753 ec = acpi_driver_data(device);
743 mutex_lock(&ec->lock); 754 mutex_lock(&ec->lock);
744 list_for_each_entry(handler, &ec->list, node) { 755 list_for_each_entry_safe(handler, tmp, &ec->list, node) {
745 list_del(&handler->node); 756 list_del(&handler->node);
746 kfree(handler); 757 kfree(handler);
747 } 758 }
@@ -751,9 +762,6 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
751 if (ec == first_ec) 762 if (ec == first_ec)
752 first_ec = NULL; 763 first_ec = NULL;
753 764
754 /* Don't touch boot EC */
755 if (boot_ec != ec)
756 kfree(ec);
757 return 0; 765 return 0;
758} 766}
759 767
@@ -817,9 +825,7 @@ static int acpi_ec_start(struct acpi_device *device)
817 if (!ec) 825 if (!ec)
818 return -EINVAL; 826 return -EINVAL;
819 827
820 /* Boot EC is already working */ 828 ret = ec_install_handlers(ec);
821 if (ec != boot_ec)
822 ret = ec_install_handlers(ec);
823 829
824 /* EC is fully operational, allow queries */ 830 /* EC is fully operational, allow queries */
825 atomic_set(&ec->query_pending, 0); 831 atomic_set(&ec->query_pending, 0);
@@ -829,7 +835,6 @@ static int acpi_ec_start(struct acpi_device *device)
829 835
830static int acpi_ec_stop(struct acpi_device *device, int type) 836static int acpi_ec_stop(struct acpi_device *device, int type)
831{ 837{
832 acpi_status status;
833 struct acpi_ec *ec; 838 struct acpi_ec *ec;
834 839
835 if (!device) 840 if (!device)
@@ -838,21 +843,7 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
838 ec = acpi_driver_data(device); 843 ec = acpi_driver_data(device);
839 if (!ec) 844 if (!ec)
840 return -EINVAL; 845 return -EINVAL;
841 846 ec_remove_handlers(ec);
842 /* Don't touch boot EC */
843 if (ec == boot_ec)
844 return 0;
845
846 status = acpi_remove_address_space_handler(ec->handle,
847 ACPI_ADR_SPACE_EC,
848 &acpi_ec_space_handler);
849 if (ACPI_FAILURE(status))
850 return -ENODEV;
851
852 status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
853 if (ACPI_FAILURE(status))
854 return -ENODEV;
855
856 return 0; 847 return 0;
857} 848}
858 849
@@ -868,18 +859,21 @@ int __init acpi_ec_ecdt_probe(void)
868 /* 859 /*
869 * Generate a boot ec context 860 * Generate a boot ec context
870 */ 861 */
871
872 status = acpi_get_table(ACPI_SIG_ECDT, 1, 862 status = acpi_get_table(ACPI_SIG_ECDT, 1,
873 (struct acpi_table_header **)&ecdt_ptr); 863 (struct acpi_table_header **)&ecdt_ptr);
874 if (ACPI_FAILURE(status)) 864 if (ACPI_SUCCESS(status)) {
875 goto error; 865 printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n\n");
876 866 boot_ec->command_addr = ecdt_ptr->control.address;
877 printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n"); 867 boot_ec->data_addr = ecdt_ptr->data.address;
878 868 boot_ec->gpe = ecdt_ptr->gpe;
879 boot_ec->command_addr = ecdt_ptr->control.address; 869 boot_ec->handle = ACPI_ROOT_OBJECT;
880 boot_ec->data_addr = ecdt_ptr->data.address; 870 } else {
881 boot_ec->gpe = ecdt_ptr->gpe; 871 printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
882 boot_ec->handle = ACPI_ROOT_OBJECT; 872 status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
873 boot_ec, NULL);
874 if (ACPI_FAILURE(status))
875 goto error;
876 }
883 877
884 ret = ec_install_handlers(boot_ec); 878 ret = ec_install_handlers(boot_ec);
885 if (!ret) { 879 if (!ret) {
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c
index dfa5853b17f0..95637a4ff782 100644
--- a/drivers/acpi/event.c
+++ b/drivers/acpi/event.c
@@ -108,7 +108,7 @@ static const struct file_operations acpi_system_event_ops = {
108}; 108};
109 109
110#ifdef CONFIG_NET 110#ifdef CONFIG_NET
111unsigned int acpi_event_seqnum; 111static unsigned int acpi_event_seqnum;
112struct acpi_genl_event { 112struct acpi_genl_event {
113 acpi_device_class device_class; 113 acpi_device_class device_class;
114 char bus_id[15]; 114 char bus_id[15];
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index a898991f77cb..a8634a0655fc 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -969,11 +969,17 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
969 } 969 }
970 970
971 if (pr->flags.bm_check) { 971 if (pr->flags.bm_check) {
972 /* bus mastering control is necessary */
973 if (!pr->flags.bm_control) { 972 if (!pr->flags.bm_control) {
974 /* In this case we enter C3 without bus mastering */ 973 if (pr->flags.has_cst != 1) {
975 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 974 /* bus mastering control is necessary */
976 "C3 support without bus mastering control\n")); 975 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
976 "C3 support requires BM control\n"));
977 return;
978 } else {
979 /* Here we enter C3 without bus mastering */
980 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
981 "C3 support without BM control\n"));
982 }
977 } 983 }
978 } else { 984 } else {
979 /* 985 /*
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index c4efc0c17f8f..463b0247cbc5 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -539,7 +539,7 @@ end:
539} 539}
540 540
541int acpi_processor_preregister_performance( 541int acpi_processor_preregister_performance(
542 struct acpi_processor_performance **performance) 542 struct acpi_processor_performance *performance)
543{ 543{
544 int count, count_target; 544 int count, count_target;
545 int retval = 0; 545 int retval = 0;
@@ -567,12 +567,12 @@ int acpi_processor_preregister_performance(
567 continue; 567 continue;
568 } 568 }
569 569
570 if (!performance || !performance[i]) { 570 if (!performance || !percpu_ptr(performance, i)) {
571 retval = -EINVAL; 571 retval = -EINVAL;
572 continue; 572 continue;
573 } 573 }
574 574
575 pr->performance = performance[i]; 575 pr->performance = percpu_ptr(performance, i);
576 cpu_set(i, pr->performance->shared_cpu_map); 576 cpu_set(i, pr->performance->shared_cpu_map);
577 if (acpi_processor_get_psd(pr)) { 577 if (acpi_processor_get_psd(pr)) {
578 retval = -EINVAL; 578 retval = -EINVAL;
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
index f63813a358c5..4c3fd4cdaf73 100644
--- a/drivers/acpi/resources/rsxface.c
+++ b/drivers/acpi/resources/rsxface.c
@@ -474,8 +474,6 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
474 return (AE_CTRL_TERMINATE); 474 return (AE_CTRL_TERMINATE);
475} 475}
476 476
477ACPI_EXPORT_SYMBOL(acpi_rs_match_vendor_resource)
478
479/******************************************************************************* 477/*******************************************************************************
480 * 478 *
481 * FUNCTION: acpi_walk_resources 479 * FUNCTION: acpi_walk_resources
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 7d8e78ea13a5..82c3a550016d 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -1415,7 +1415,7 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type)
1415 char dir_name[32]; 1415 char dir_name[32];
1416 int do_battery_init = 0, do_ac_init = 0; 1416 int do_battery_init = 0, do_ac_init = 0;
1417 int old_remaining_capacity = 0; 1417 int old_remaining_capacity = 0;
1418 int update_ac = 1, update_battery = 1; 1418 int update_battery = 1;
1419 int up_tm = update_time; 1419 int up_tm = update_time;
1420 1420
1421 if (sbs_zombie(sbs)) { 1421 if (sbs_zombie(sbs)) {
@@ -1435,10 +1435,6 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type)
1435 1435
1436 sbs->run_cnt++; 1436 sbs->run_cnt++;
1437 1437
1438 if (!update_ac && !update_battery) {
1439 goto end;
1440 }
1441
1442 old_ac_present = sbs->ac.ac_present; 1438 old_ac_present = sbs->ac.ac_present;
1443 1439
1444 result = acpi_ac_get_present(sbs); 1440 result = acpi_ac_get_present(sbs);
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index 5b302c4e293f..a9e3331fee5d 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -52,6 +52,8 @@ ACPI_MODULE_NAME("tbxface")
52/* Local prototypes */ 52/* Local prototypes */
53static acpi_status acpi_tb_load_namespace(void); 53static acpi_status acpi_tb_load_namespace(void);
54 54
55static int no_auto_ssdt;
56
55/******************************************************************************* 57/*******************************************************************************
56 * 58 *
57 * FUNCTION: acpi_allocate_root_table 59 * FUNCTION: acpi_allocate_root_table
@@ -536,6 +538,10 @@ static acpi_status acpi_tb_load_namespace(void)
536 538
537 ACPI_INFO((AE_INFO, "Table DSDT replaced by host OS")); 539 ACPI_INFO((AE_INFO, "Table DSDT replaced by host OS"));
538 acpi_tb_print_table_header(0, table); 540 acpi_tb_print_table_header(0, table);
541
542 if (no_auto_ssdt == 0) {
543 printk(KERN_WARNING "ACPI: DSDT override uses original SSDTs unless \"acpi_no_auto_ssdt\"");
544 }
539 } 545 }
540 546
541 status = 547 status =
@@ -577,6 +583,11 @@ static acpi_status acpi_tb_load_namespace(void)
577 continue; 583 continue;
578 } 584 }
579 585
586 if (no_auto_ssdt) {
587 printk(KERN_WARNING "ACPI: SSDT ignored due to \"acpi_no_auto_ssdt\"\n");
588 continue;
589 }
590
580 /* Ignore errors while loading tables, get as many as possible */ 591 /* Ignore errors while loading tables, get as many as possible */
581 592
582 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); 593 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
@@ -622,3 +633,15 @@ acpi_status acpi_load_tables(void)
622} 633}
623 634
624ACPI_EXPORT_SYMBOL(acpi_load_tables) 635ACPI_EXPORT_SYMBOL(acpi_load_tables)
636
637
638static int __init acpi_no_auto_ssdt_setup(char *s) {
639
640 printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n");
641
642 no_auto_ssdt = 1;
643
644 return 1;
645}
646
647__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 5a62de1b7f2a..1e06159fd9c4 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -33,6 +33,7 @@
33 33
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/dmi.h>
36#include <linux/init.h> 37#include <linux/init.h>
37#include <linux/types.h> 38#include <linux/types.h>
38#include <linux/proc_fs.h> 39#include <linux/proc_fs.h>
@@ -74,10 +75,26 @@ MODULE_AUTHOR("Paul Diefenbaugh");
74MODULE_DESCRIPTION("ACPI Thermal Zone Driver"); 75MODULE_DESCRIPTION("ACPI Thermal Zone Driver");
75MODULE_LICENSE("GPL"); 76MODULE_LICENSE("GPL");
76 77
78static int act;
79module_param(act, int, 0644);
80MODULE_PARM_DESC(act, "Disable or override all lowest active trip points.\n");
81
77static int tzp; 82static int tzp;
78module_param(tzp, int, 0); 83module_param(tzp, int, 0444);
79MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n"); 84MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n");
80 85
86static int nocrt;
87module_param(nocrt, int, 0);
88MODULE_PARM_DESC(nocrt, "Set to disable action on ACPI thermal zone critical and hot trips.\n");
89
90static int off;
91module_param(off, int, 0);
92MODULE_PARM_DESC(off, "Set to disable ACPI thermal support.\n");
93
94static int psv;
95module_param(psv, int, 0644);
96MODULE_PARM_DESC(psv, "Disable or override all passive trip points.\n");
97
81static int acpi_thermal_add(struct acpi_device *device); 98static int acpi_thermal_add(struct acpi_device *device);
82static int acpi_thermal_remove(struct acpi_device *device, int type); 99static int acpi_thermal_remove(struct acpi_device *device, int type);
83static int acpi_thermal_resume(struct acpi_device *device); 100static int acpi_thermal_resume(struct acpi_device *device);
@@ -339,9 +356,16 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
339 356
340 /* Passive: Processors (optional) */ 357 /* Passive: Processors (optional) */
341 358
342 status = 359 if (psv == -1) {
343 acpi_evaluate_integer(tz->device->handle, "_PSV", NULL, 360 status = AE_SUPPORT;
344 &tz->trips.passive.temperature); 361 } else if (psv > 0) {
362 tz->trips.passive.temperature = CELSIUS_TO_KELVIN(psv);
363 status = AE_OK;
364 } else {
365 status = acpi_evaluate_integer(tz->device->handle,
366 "_PSV", NULL, &tz->trips.passive.temperature);
367 }
368
345 if (ACPI_FAILURE(status)) { 369 if (ACPI_FAILURE(status)) {
346 tz->trips.passive.flags.valid = 0; 370 tz->trips.passive.flags.valid = 0;
347 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No passive threshold\n")); 371 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No passive threshold\n"));
@@ -386,11 +410,33 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
386 410
387 char name[5] = { '_', 'A', 'C', ('0' + i), '\0' }; 411 char name[5] = { '_', 'A', 'C', ('0' + i), '\0' };
388 412
389 status = 413 if (act == -1)
390 acpi_evaluate_integer(tz->device->handle, name, NULL, 414 break; /* disable all active trip points */
391 &tz->trips.active[i].temperature); 415
392 if (ACPI_FAILURE(status)) 416 status = acpi_evaluate_integer(tz->device->handle,
417 name, NULL, &tz->trips.active[i].temperature);
418
419 if (ACPI_FAILURE(status)) {
420 if (i == 0) /* no active trip points */
421 break;
422 if (act <= 0) /* no override requested */
423 break;
424 if (i == 1) { /* 1 trip point */
425 tz->trips.active[0].temperature =
426 CELSIUS_TO_KELVIN(act);
427 } else { /* multiple trips */
428 /*
429 * Don't allow override higher than
430 * the next higher trip point
431 */
432 tz->trips.active[i - 1].temperature =
433 (tz->trips.active[i - 2].temperature <
434 CELSIUS_TO_KELVIN(act) ?
435 tz->trips.active[i - 2].temperature :
436 CELSIUS_TO_KELVIN(act));
437 }
393 break; 438 break;
439 }
394 440
395 name[2] = 'L'; 441 name[2] = 'L';
396 status = 442 status =
@@ -427,7 +473,7 @@ static int acpi_thermal_get_devices(struct acpi_thermal *tz)
427 473
428static int acpi_thermal_critical(struct acpi_thermal *tz) 474static int acpi_thermal_critical(struct acpi_thermal *tz)
429{ 475{
430 if (!tz || !tz->trips.critical.flags.valid) 476 if (!tz || !tz->trips.critical.flags.valid || nocrt)
431 return -EINVAL; 477 return -EINVAL;
432 478
433 if (tz->temperature >= tz->trips.critical.temperature) { 479 if (tz->temperature >= tz->trips.critical.temperature) {
@@ -449,7 +495,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
449 495
450static int acpi_thermal_hot(struct acpi_thermal *tz) 496static int acpi_thermal_hot(struct acpi_thermal *tz)
451{ 497{
452 if (!tz || !tz->trips.hot.flags.valid) 498 if (!tz || !tz->trips.hot.flags.valid || nocrt)
453 return -EINVAL; 499 return -EINVAL;
454 500
455 if (tz->temperature >= tz->trips.hot.temperature) { 501 if (tz->temperature >= tz->trips.hot.temperature) {
@@ -824,12 +870,14 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
824 goto end; 870 goto end;
825 871
826 if (tz->trips.critical.flags.valid) 872 if (tz->trips.critical.flags.valid)
827 seq_printf(seq, "critical (S5): %ld C\n", 873 seq_printf(seq, "critical (S5): %ld C%s",
828 KELVIN_TO_CELSIUS(tz->trips.critical.temperature)); 874 KELVIN_TO_CELSIUS(tz->trips.critical.temperature),
875 nocrt ? " <disabled>\n" : "\n");
829 876
830 if (tz->trips.hot.flags.valid) 877 if (tz->trips.hot.flags.valid)
831 seq_printf(seq, "hot (S4): %ld C\n", 878 seq_printf(seq, "hot (S4): %ld C%s",
832 KELVIN_TO_CELSIUS(tz->trips.hot.temperature)); 879 KELVIN_TO_CELSIUS(tz->trips.hot.temperature),
880 nocrt ? " <disabled>\n" : "\n");
833 881
834 if (tz->trips.passive.flags.valid) { 882 if (tz->trips.passive.flags.valid) {
835 seq_printf(seq, 883 seq_printf(seq,
@@ -1281,11 +1329,78 @@ static int acpi_thermal_resume(struct acpi_device *device)
1281 return AE_OK; 1329 return AE_OK;
1282} 1330}
1283 1331
1332#ifdef CONFIG_DMI
1333static int thermal_act(struct dmi_system_id *d) {
1334
1335 if (act == 0) {
1336 printk(KERN_NOTICE "ACPI: %s detected: "
1337 "disabling all active thermal trip points\n", d->ident);
1338 act = -1;
1339 }
1340 return 0;
1341}
1342static int thermal_tzp(struct dmi_system_id *d) {
1343
1344 if (tzp == 0) {
1345 printk(KERN_NOTICE "ACPI: %s detected: "
1346 "enabling thermal zone polling\n", d->ident);
1347 tzp = 300; /* 300 dS = 30 Seconds */
1348 }
1349 return 0;
1350}
1351static int thermal_psv(struct dmi_system_id *d) {
1352
1353 if (psv == 0) {
1354 printk(KERN_NOTICE "ACPI: %s detected: "
1355 "disabling all passive thermal trip points\n", d->ident);
1356 psv = -1;
1357 }
1358 return 0;
1359}
1360
1361static struct dmi_system_id thermal_dmi_table[] __initdata = {
1362 /*
1363 * Award BIOS on this AOpen makes thermal control almost worthless.
1364 * http://bugzilla.kernel.org/show_bug.cgi?id=8842
1365 */
1366 {
1367 .callback = thermal_act,
1368 .ident = "AOpen i915GMm-HFS",
1369 .matches = {
1370 DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
1371 DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
1372 },
1373 },
1374 {
1375 .callback = thermal_psv,
1376 .ident = "AOpen i915GMm-HFS",
1377 .matches = {
1378 DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
1379 DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
1380 },
1381 },
1382 {
1383 .callback = thermal_tzp,
1384 .ident = "AOpen i915GMm-HFS",
1385 .matches = {
1386 DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
1387 DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
1388 },
1389 },
1390 {}
1391};
1392#endif /* CONFIG_DMI */
1393
1284static int __init acpi_thermal_init(void) 1394static int __init acpi_thermal_init(void)
1285{ 1395{
1286 int result = 0; 1396 int result = 0;
1287 1397
1398 dmi_check_system(thermal_dmi_table);
1288 1399
1400 if (off) {
1401 printk(KERN_NOTICE "ACPI: thermal control disabled\n");
1402 return -ENODEV;
1403 }
1289 acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); 1404 acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
1290 if (!acpi_thermal_dir) 1405 if (!acpi_thermal_dir)
1291 return -ENODEV; 1406 return -ENODEV;
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index a78832ea81fa..071d274afaab 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -436,7 +436,7 @@ static const struct piix_map_db ich8_map_db = {
436 /* PM PS SM SS MAP */ 436 /* PM PS SM SS MAP */
437 { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */ 437 { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */
438 { RV, RV, RV, RV }, 438 { RV, RV, RV, RV },
439 { IDE, IDE, NA, NA }, /* 10b (IDE mode) */ 439 { P0, P2, IDE, IDE }, /* 10b (IDE mode) */
440 { RV, RV, RV, RV }, 440 { RV, RV, RV, RV },
441 }, 441 },
442}; 442};
@@ -901,6 +901,13 @@ static int piix_broken_suspend(void)
901 }, 901 },
902 }, 902 },
903 { 903 {
904 .ident = "TECRA M7",
905 .matches = {
906 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
907 DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M7"),
908 },
909 },
910 {
904 .ident = "Satellite U205", 911 .ident = "Satellite U205",
905 .matches = { 912 .matches = {
906 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 913 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 60e78bef469f..99d4fbffb0df 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1723,7 +1723,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
1723 tf.protocol = ATA_PROT_NODATA; 1723 tf.protocol = ATA_PROT_NODATA;
1724 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 1724 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1725 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); 1725 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
1726 if (err_mask) { 1726 if (err_mask && id[2] != 0x738c) {
1727 rc = -EIO; 1727 rc = -EIO;
1728 reason = "SPINUP failed"; 1728 reason = "SPINUP failed";
1729 goto err_out; 1729 goto err_out;
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index ce589d96ca42..b5352ebecef9 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -2,6 +2,7 @@
2 * pata_artop.c - ARTOP ATA controller driver 2 * pata_artop.c - ARTOP ATA controller driver
3 * 3 *
4 * (C) 2006 Red Hat <alan@redhat.com> 4 * (C) 2006 Red Hat <alan@redhat.com>
5 * (C) 2007 Bartlomiej Zolnierkiewicz
5 * 6 *
6 * Based in part on drivers/ide/pci/aec62xx.c 7 * Based in part on drivers/ide/pci/aec62xx.c
7 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> 8 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org>
@@ -28,7 +29,7 @@
28#include <linux/ata.h> 29#include <linux/ata.h>
29 30
30#define DRV_NAME "pata_artop" 31#define DRV_NAME "pata_artop"
31#define DRV_VERSION "0.4.3" 32#define DRV_VERSION "0.4.4"
32 33
33/* 34/*
34 * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we 35 * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we
@@ -430,7 +431,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
430 .udma_mask = ATA_UDMA4, 431 .udma_mask = ATA_UDMA4,
431 .port_ops = &artop6260_ops, 432 .port_ops = &artop6260_ops,
432 }; 433 };
433 static const struct ata_port_info info_626x_fast = { 434 static const struct ata_port_info info_628x = {
434 .sht = &artop_sht, 435 .sht = &artop_sht,
435 .flags = ATA_FLAG_SLAVE_POSS, 436 .flags = ATA_FLAG_SLAVE_POSS,
436 .pio_mask = 0x1f, /* pio0-4 */ 437 .pio_mask = 0x1f, /* pio0-4 */
@@ -438,6 +439,14 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
438 .udma_mask = ATA_UDMA5, 439 .udma_mask = ATA_UDMA5,
439 .port_ops = &artop6260_ops, 440 .port_ops = &artop6260_ops,
440 }; 441 };
442 static const struct ata_port_info info_628x_fast = {
443 .sht = &artop_sht,
444 .flags = ATA_FLAG_SLAVE_POSS,
445 .pio_mask = 0x1f, /* pio0-4 */
446 .mwdma_mask = 0x07, /* mwdma0-2 */
447 .udma_mask = ATA_UDMA6,
448 .port_ops = &artop6260_ops,
449 };
441 const struct ata_port_info *ppi[] = { NULL, NULL }; 450 const struct ata_port_info *ppi[] = { NULL, NULL };
442 451
443 if (!printed_version++) 452 if (!printed_version++)
@@ -455,13 +464,13 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
455 } 464 }
456 else if (id->driver_data == 1) /* 6260 */ 465 else if (id->driver_data == 1) /* 6260 */
457 ppi[0] = &info_626x; 466 ppi[0] = &info_626x;
458 else if (id->driver_data == 2) { /* 6260 or 6260 + fast */ 467 else if (id->driver_data == 2) { /* 6280 or 6280 + fast */
459 unsigned long io = pci_resource_start(pdev, 4); 468 unsigned long io = pci_resource_start(pdev, 4);
460 u8 reg; 469 u8 reg;
461 470
462 ppi[0] = &info_626x; 471 ppi[0] = &info_628x;
463 if (inb(io) & 0x10) 472 if (inb(io) & 0x10)
464 ppi[0] = &info_626x_fast; 473 ppi[0] = &info_628x_fast;
465 /* Mac systems come up with some registers not set as we 474 /* Mac systems come up with some registers not set as we
466 will need them */ 475 will need them */
467 476
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index 84d9c5568567..c5ddd937dbf2 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -8,12 +8,10 @@
8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
9 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 9 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
10 * Portions Copyright (C) 2003 Red Hat Inc 10 * Portions Copyright (C) 2003 Red Hat Inc
11 * Portions Copyright (C) 2005-2006 MontaVista Software, Inc. 11 * Portions Copyright (C) 2005-2007 MontaVista Software, Inc.
12 * 12 *
13 * TODO 13 * TODO
14 * PLL mode 14 * Look into engine reset on timeout errors. Should not be required.
15 * Look into engine reset on timeout errors. Should not be
16 * required.
17 */ 15 */
18 16
19#include <linux/kernel.h> 17#include <linux/kernel.h>
@@ -26,7 +24,7 @@
26#include <linux/libata.h> 24#include <linux/libata.h>
27 25
28#define DRV_NAME "pata_hpt37x" 26#define DRV_NAME "pata_hpt37x"
29#define DRV_VERSION "0.6.7" 27#define DRV_VERSION "0.6.9"
30 28
31struct hpt_clock { 29struct hpt_clock {
32 u8 xfer_speed; 30 u8 xfer_speed;
@@ -1092,9 +1090,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1092 int dpll, adjust; 1090 int dpll, adjust;
1093 1091
1094 /* Compute DPLL */ 1092 /* Compute DPLL */
1095 dpll = 2; 1093 dpll = (port->udma_mask & 0xC0) ? 3 : 2;
1096 if (port->udma_mask & 0xE0)
1097 dpll = 3;
1098 1094
1099 f_low = (MHz[clock_slot] * 48) / MHz[dpll]; 1095 f_low = (MHz[clock_slot] * 48) / MHz[dpll];
1100 f_high = f_low + 2; 1096 f_high = f_low + 2;
@@ -1116,7 +1112,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1116 pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100); 1112 pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100);
1117 } 1113 }
1118 if (adjust == 8) { 1114 if (adjust == 8) {
1119 printk(KERN_WARNING "hpt37x: DPLL did not stabilize.\n"); 1115 printk(KERN_ERR "pata_hpt37x: DPLL did not stabilize!\n");
1120 return -ENODEV; 1116 return -ENODEV;
1121 } 1117 }
1122 if (dpll == 3) 1118 if (dpll == 3)
@@ -1124,7 +1120,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1124 else 1120 else
1125 private_data = (void *)hpt37x_timings_50; 1121 private_data = (void *)hpt37x_timings_50;
1126 1122
1127 printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[dpll]); 1123 printk(KERN_INFO "pata_hpt37x: bus clock %dMHz, using %dMHz DPLL.\n",
1124 MHz[clock_slot], MHz[dpll]);
1128 } else { 1125 } else {
1129 private_data = (void *)chip_table->clocks[clock_slot]; 1126 private_data = (void *)chip_table->clocks[clock_slot];
1130 /* 1127 /*
@@ -1137,7 +1134,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1137 port = &info_hpt370_33; 1134 port = &info_hpt370_33;
1138 if (clock_slot < 2 && port == &info_hpt370a) 1135 if (clock_slot < 2 && port == &info_hpt370a)
1139 port = &info_hpt370a_33; 1136 port = &info_hpt370a_33;
1140 printk(KERN_INFO "hpt37x: %s: Bus clock %dMHz.\n", chip_table->name, MHz[clock_slot]); 1137 printk(KERN_INFO "pata_hpt37x: %s using %dMHz bus clock.\n",
1138 chip_table->name, MHz[clock_slot]);
1141 } 1139 }
1142 1140
1143 /* Now kick off ATA set up */ 1141 /* Now kick off ATA set up */
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index aa29cde09f8b..f8f234bfc8ce 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -8,7 +8,7 @@
8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
9 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 9 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
10 * Portions Copyright (C) 2003 Red Hat Inc 10 * Portions Copyright (C) 2003 Red Hat Inc
11 * Portions Copyright (C) 2005-2006 MontaVista Software, Inc. 11 * Portions Copyright (C) 2005-2007 MontaVista Software, Inc.
12 * 12 *
13 * 13 *
14 * TODO 14 * TODO
@@ -25,7 +25,7 @@
25#include <linux/libata.h> 25#include <linux/libata.h>
26 26
27#define DRV_NAME "pata_hpt3x2n" 27#define DRV_NAME "pata_hpt3x2n"
28#define DRV_VERSION "0.3.3" 28#define DRV_VERSION "0.3.4"
29 29
30enum { 30enum {
31 HPT_PCI_FAST = (1 << 31), 31 HPT_PCI_FAST = (1 << 31),
@@ -579,10 +579,12 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
579 pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); 579 pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low);
580 } 580 }
581 if (adjust == 8) { 581 if (adjust == 8) {
582 printk(KERN_WARNING "hpt3x2n: DPLL did not stabilize.\n"); 582 printk(KERN_ERR "pata_hpt3x2n: DPLL did not stabilize!\n");
583 return -ENODEV; 583 return -ENODEV;
584 } 584 }
585 585
586 printk(KERN_INFO "pata_hpt37x: bus clock %dMHz, using 66MHz DPLL.\n",
587 pci_mhz);
586 /* Set our private data up. We only need a few flags so we use 588 /* Set our private data up. We only need a few flags so we use
587 it directly */ 589 it directly */
588 port.private_data = NULL; 590 port.private_data = NULL;
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index 321d98b0bed2..64a711776c45 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -330,17 +330,12 @@ static void ata_dummy_noret(struct ata_port *port)
330{ 330{
331} 331}
332 332
333/* 333static void pata_icside_postreset(struct ata_port *ap, unsigned int *classes)
334 * We need to shut down unused ports to prevent spurious interrupts.
335 * FIXME: the libata core doesn't call this function for PATA interfaces.
336 */
337static void pata_icside_port_disable(struct ata_port *ap)
338{ 334{
339 struct pata_icside_state *state = ap->host->private_data; 335 struct pata_icside_state *state = ap->host->private_data;
340 336
341 ata_port_printk(ap, KERN_ERR, "disabling icside port\n"); 337 if (classes[0] != ATA_DEV_NONE || classes[1] != ATA_DEV_NONE)
342 338 return ata_std_postreset(ap, classes);
343 ata_port_disable(ap);
344 339
345 state->port[ap->port_no].disabled = 1; 340 state->port[ap->port_no].disabled = 1;
346 341
@@ -356,6 +351,12 @@ static void pata_icside_port_disable(struct ata_port *ap)
356 } 351 }
357} 352}
358 353
354static void pata_icside_error_handler(struct ata_port *ap)
355{
356 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, NULL,
357 pata_icside_postreset);
358}
359
359static u8 pata_icside_irq_ack(struct ata_port *ap, unsigned int chk_drq) 360static u8 pata_icside_irq_ack(struct ata_port *ap, unsigned int chk_drq)
360{ 361{
361 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; 362 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
@@ -374,7 +375,7 @@ static u8 pata_icside_irq_ack(struct ata_port *ap, unsigned int chk_drq)
374} 375}
375 376
376static struct ata_port_operations pata_icside_port_ops = { 377static struct ata_port_operations pata_icside_port_ops = {
377 .port_disable = pata_icside_port_disable, 378 .port_disable = ata_port_disable,
378 379
379 .set_dmamode = pata_icside_set_dmamode, 380 .set_dmamode = pata_icside_set_dmamode,
380 381
@@ -397,7 +398,7 @@ static struct ata_port_operations pata_icside_port_ops = {
397 398
398 .freeze = ata_bmdma_freeze, 399 .freeze = ata_bmdma_freeze,
399 .thaw = ata_bmdma_thaw, 400 .thaw = ata_bmdma_thaw,
400 .error_handler = ata_bmdma_error_handler, 401 .error_handler = pata_icside_error_handler,
401 .post_internal_cmd = pata_icside_bmdma_stop, 402 .post_internal_cmd = pata_icside_bmdma_stop,
402 403
403 .irq_clear = ata_dummy_noret, 404 .irq_clear = ata_dummy_noret,
@@ -484,13 +485,6 @@ static int __devinit pata_icside_register_v6(struct pata_icside_info *info)
484 state->port[0].port_sel = sel; 485 state->port[0].port_sel = sel;
485 state->port[1].port_sel = sel | 1; 486 state->port[1].port_sel = sel | 1;
486 487
487 /*
488 * FIXME: work around libata's aversion to calling port_disable.
489 * This permanently disables interrupts on port 0 - bad luck if
490 * you have a drive on that port.
491 */
492 state->port[0].disabled = 1;
493
494 info->base = easi_base; 488 info->base = easi_base;
495 info->irqops = &pata_icside_ops_arcin_v6; 489 info->irqops = &pata_icside_ops_arcin_v6;
496 info->nr_ports = 2; 490 info->nr_ports = 2;
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 5525518204e6..91a396fa5b20 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -139,6 +139,8 @@ static struct pnp_device_id isapnp_devices[] = {
139 {.id = ""} 139 {.id = ""}
140}; 140};
141 141
142MODULE_DEVICE_TABLE(pnp, isapnp_devices);
143
142static struct pnp_driver isapnp_driver = { 144static struct pnp_driver isapnp_driver = {
143 .name = DRV_NAME, 145 .name = DRV_NAME,
144 .id_table = isapnp_devices, 146 .id_table = isapnp_devices,
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 8ec520885b95..3acf65e75eb2 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -621,6 +621,9 @@ static const struct pci_device_id mv_pci_tbl[] = {
621 { PCI_VDEVICE(MARVELL, 0x5041), chip_504x }, 621 { PCI_VDEVICE(MARVELL, 0x5041), chip_504x },
622 { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 }, 622 { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 },
623 { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, 623 { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
624 /* RocketRAID 1740/174x have different identifiers */
625 { PCI_VDEVICE(TTI, 0x1740), chip_508x },
626 { PCI_VDEVICE(TTI, 0x1742), chip_508x },
624 627
625 { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, 628 { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
626 { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, 629 { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 405ee5e09221..8b12925fe7a4 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -2435,7 +2435,7 @@ fore200e_init_cmd_queue(struct fore200e* fore200e)
2435} 2435}
2436 2436
2437 2437
2438static void __init 2438static void __devinit
2439fore200e_param_bs_queue(struct fore200e* fore200e, 2439fore200e_param_bs_queue(struct fore200e* fore200e,
2440 enum buffer_scheme scheme, enum buffer_magn magn, 2440 enum buffer_scheme scheme, enum buffer_magn magn,
2441 int queue_length, int pool_size, int supply_blksize) 2441 int queue_length, int pool_size, int supply_blksize)
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index a3b605a0ca17..ef52452640e0 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -1601,14 +1601,14 @@ static int rx_init(struct atm_dev *dev)
1601 1601
1602 skb_queue_head_init(&iadev->rx_dma_q); 1602 skb_queue_head_init(&iadev->rx_dma_q);
1603 iadev->rx_free_desc_qhead = NULL; 1603 iadev->rx_free_desc_qhead = NULL;
1604 iadev->rx_open = kmalloc(4*iadev->num_vc,GFP_KERNEL); 1604
1605 if (!iadev->rx_open) 1605 iadev->rx_open = kzalloc(4 * iadev->num_vc, GFP_KERNEL);
1606 { 1606 if (!iadev->rx_open) {
1607 printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n", 1607 printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n",
1608 dev->number); 1608 dev->number);
1609 goto err_free_dle; 1609 goto err_free_dle;
1610 } 1610 }
1611 memset(iadev->rx_open, 0, 4*iadev->num_vc); 1611
1612 iadev->rxing = 1; 1612 iadev->rxing = 1;
1613 iadev->rx_pkt_cnt = 0; 1613 iadev->rx_pkt_cnt = 0;
1614 /* Mode Register */ 1614 /* Mode Register */
@@ -3171,12 +3171,12 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
3171 unsigned long flags; 3171 unsigned long flags;
3172 int ret; 3172 int ret;
3173 3173
3174 iadev = kmalloc(sizeof(*iadev), GFP_KERNEL); 3174 iadev = kzalloc(sizeof(*iadev), GFP_KERNEL);
3175 if (!iadev) { 3175 if (!iadev) {
3176 ret = -ENOMEM; 3176 ret = -ENOMEM;
3177 goto err_out; 3177 goto err_out;
3178 } 3178 }
3179 memset(iadev, 0, sizeof(*iadev)); 3179
3180 iadev->pci = pdev; 3180 iadev->pci = pdev;
3181 3181
3182 IF_INIT(printk("ia detected at bus:%d dev: %d function:%d\n", 3182 IF_INIT(printk("ia detected at bus:%d dev: %d function:%d\n",
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 55fd1b4543fd..144a49f15220 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -65,7 +65,6 @@
65#include <linux/init.h> 65#include <linux/init.h>
66#include <linux/delay.h> 66#include <linux/delay.h>
67#include <linux/interrupt.h> 67#include <linux/interrupt.h>
68#include <linux/dma-mapping.h>
69 68
70/* -------------------- TUNABLE PARAMATERS: */ 69/* -------------------- TUNABLE PARAMATERS: */
71 70
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index a11b2bd54bbe..084358a828e9 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1977,12 +1977,13 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
1977{ 1977{
1978 ReadCapdata_struct *buf; 1978 ReadCapdata_struct *buf;
1979 int return_code; 1979 int return_code;
1980 buf = kmalloc(sizeof(ReadCapdata_struct), GFP_KERNEL); 1980
1981 if (buf == NULL) { 1981 buf = kzalloc(sizeof(ReadCapdata_struct), GFP_KERNEL);
1982 if (!buf) {
1982 printk(KERN_WARNING "cciss: out of memory\n"); 1983 printk(KERN_WARNING "cciss: out of memory\n");
1983 return; 1984 return;
1984 } 1985 }
1985 memset(buf, 0, sizeof(ReadCapdata_struct)); 1986
1986 if (withirq) 1987 if (withirq)
1987 return_code = sendcmd_withirq(CCISS_READ_CAPACITY, 1988 return_code = sendcmd_withirq(CCISS_READ_CAPACITY,
1988 ctlr, buf, sizeof(ReadCapdata_struct), 1989 ctlr, buf, sizeof(ReadCapdata_struct),
@@ -2003,7 +2004,6 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
2003 printk(KERN_INFO " blocks= %llu block_size= %d\n", 2004 printk(KERN_INFO " blocks= %llu block_size= %d\n",
2004 (unsigned long long)*total_size+1, *block_size); 2005 (unsigned long long)*total_size+1, *block_size);
2005 kfree(buf); 2006 kfree(buf);
2006 return;
2007} 2007}
2008 2008
2009static void 2009static void
@@ -2011,12 +2011,13 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
2011{ 2011{
2012 ReadCapdata_struct_16 *buf; 2012 ReadCapdata_struct_16 *buf;
2013 int return_code; 2013 int return_code;
2014 buf = kmalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL); 2014
2015 if (buf == NULL) { 2015 buf = kzalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL);
2016 if (!buf) {
2016 printk(KERN_WARNING "cciss: out of memory\n"); 2017 printk(KERN_WARNING "cciss: out of memory\n");
2017 return; 2018 return;
2018 } 2019 }
2019 memset(buf, 0, sizeof(ReadCapdata_struct_16)); 2020
2020 if (withirq) { 2021 if (withirq) {
2021 return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16, 2022 return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16,
2022 ctlr, buf, sizeof(ReadCapdata_struct_16), 2023 ctlr, buf, sizeof(ReadCapdata_struct_16),
@@ -2038,7 +2039,6 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
2038 printk(KERN_INFO " blocks= %llu block_size= %d\n", 2039 printk(KERN_INFO " blocks= %llu block_size= %d\n",
2039 (unsigned long long)*total_size+1, *block_size); 2040 (unsigned long long)*total_size+1, *block_size);
2040 kfree(buf); 2041 kfree(buf);
2041 return;
2042} 2042}
2043 2043
2044static int cciss_revalidate(struct gendisk *disk) 2044static int cciss_revalidate(struct gendisk *disk)
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index be4e3477d83b..eb9799acf65b 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -420,18 +420,17 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev)
420 goto Enomem2; 420 goto Enomem2;
421 } 421 }
422 422
423 hba[i]->cmd_pool = (cmdlist_t *)pci_alloc_consistent( 423 hba[i]->cmd_pool = pci_alloc_consistent(
424 hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t), 424 hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t),
425 &(hba[i]->cmd_pool_dhandle)); 425 &(hba[i]->cmd_pool_dhandle));
426 hba[i]->cmd_pool_bits = kmalloc( 426 hba[i]->cmd_pool_bits = kcalloc(
427 ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long), 427 (NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG, sizeof(unsigned long),
428 GFP_KERNEL); 428 GFP_KERNEL);
429 429
430 if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) 430 if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool)
431 goto Enomem1; 431 goto Enomem1;
432 432
433 memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t)); 433 memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t));
434 memset(hba[i]->cmd_pool_bits, 0, ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long));
435 printk(KERN_INFO "cpqarray: Finding drives on %s", 434 printk(KERN_INFO "cpqarray: Finding drives on %s",
436 hba[i]->devname); 435 hba[i]->devname);
437 436
@@ -1660,45 +1659,30 @@ static void getgeometry(int ctlr)
1660 1659
1661 info_p->log_drv_map = 0; 1660 info_p->log_drv_map = 0;
1662 1661
1663 id_ldrive = kmalloc(sizeof(id_log_drv_t), GFP_KERNEL); 1662 id_ldrive = kzalloc(sizeof(id_log_drv_t), GFP_KERNEL);
1664 if(id_ldrive == NULL) 1663 if (!id_ldrive) {
1665 {
1666 printk( KERN_ERR "cpqarray: out of memory.\n"); 1664 printk( KERN_ERR "cpqarray: out of memory.\n");
1667 return; 1665 goto err_0;
1668 } 1666 }
1669 1667
1670 id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL); 1668 id_ctlr_buf = kzalloc(sizeof(id_ctlr_t), GFP_KERNEL);
1671 if(id_ctlr_buf == NULL) 1669 if (!id_ctlr_buf) {
1672 {
1673 kfree(id_ldrive);
1674 printk( KERN_ERR "cpqarray: out of memory.\n"); 1670 printk( KERN_ERR "cpqarray: out of memory.\n");
1675 return; 1671 goto err_1;
1676 } 1672 }
1677 1673
1678 id_lstatus_buf = kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); 1674 id_lstatus_buf = kzalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL);
1679 if(id_lstatus_buf == NULL) 1675 if (!id_lstatus_buf) {
1680 {
1681 kfree(id_ctlr_buf);
1682 kfree(id_ldrive);
1683 printk( KERN_ERR "cpqarray: out of memory.\n"); 1676 printk( KERN_ERR "cpqarray: out of memory.\n");
1684 return; 1677 goto err_2;
1685 } 1678 }
1686 1679
1687 sense_config_buf = kmalloc(sizeof(config_t), GFP_KERNEL); 1680 sense_config_buf = kzalloc(sizeof(config_t), GFP_KERNEL);
1688 if(sense_config_buf == NULL) 1681 if (!sense_config_buf) {
1689 {
1690 kfree(id_lstatus_buf);
1691 kfree(id_ctlr_buf);
1692 kfree(id_ldrive);
1693 printk( KERN_ERR "cpqarray: out of memory.\n"); 1682 printk( KERN_ERR "cpqarray: out of memory.\n");
1694 return; 1683 goto err_3;
1695 } 1684 }
1696 1685
1697 memset(id_ldrive, 0, sizeof(id_log_drv_t));
1698 memset(id_ctlr_buf, 0, sizeof(id_ctlr_t));
1699 memset(id_lstatus_buf, 0, sizeof(sense_log_drv_stat_t));
1700 memset(sense_config_buf, 0, sizeof(config_t));
1701
1702 info_p->phys_drives = 0; 1686 info_p->phys_drives = 0;
1703 info_p->log_drv_map = 0; 1687 info_p->log_drv_map = 0;
1704 info_p->drv_assign_map = 0; 1688 info_p->drv_assign_map = 0;
@@ -1712,13 +1696,8 @@ static void getgeometry(int ctlr)
1712 * so the idastubopen will fail on all logical drives 1696 * so the idastubopen will fail on all logical drives
1713 * on the controller. 1697 * on the controller.
1714 */ 1698 */
1715 /* Free all the buffers and return */
1716 printk(KERN_ERR "cpqarray: error sending ID controller\n"); 1699 printk(KERN_ERR "cpqarray: error sending ID controller\n");
1717 kfree(sense_config_buf); 1700 goto err_4;
1718 kfree(id_lstatus_buf);
1719 kfree(id_ctlr_buf);
1720 kfree(id_ldrive);
1721 return;
1722 } 1701 }
1723 1702
1724 info_p->log_drives = id_ctlr_buf->nr_drvs; 1703 info_p->log_drives = id_ctlr_buf->nr_drvs;
@@ -1764,12 +1743,7 @@ static void getgeometry(int ctlr)
1764 " failed to report status of logical drive %d\n" 1743 " failed to report status of logical drive %d\n"
1765 "Access to this controller has been disabled\n", 1744 "Access to this controller has been disabled\n",
1766 ctlr, log_unit); 1745 ctlr, log_unit);
1767 /* Free all the buffers and return */ 1746 goto err_4;
1768 kfree(sense_config_buf);
1769 kfree(id_lstatus_buf);
1770 kfree(id_ctlr_buf);
1771 kfree(id_ldrive);
1772 return;
1773 } 1747 }
1774 /* 1748 /*
1775 Make sure the logical drive is configured 1749 Make sure the logical drive is configured
@@ -1798,14 +1772,8 @@ static void getgeometry(int ctlr)
1798 sizeof(config_t), 0, 0, log_unit); 1772 sizeof(config_t), 0, 0, log_unit);
1799 if (ret_code == IO_ERROR) { 1773 if (ret_code == IO_ERROR) {
1800 info_p->log_drv_map = 0; 1774 info_p->log_drv_map = 0;
1801 /* Free all the buffers and return */
1802 printk(KERN_ERR "cpqarray: error sending sense config\n"); 1775 printk(KERN_ERR "cpqarray: error sending sense config\n");
1803 kfree(sense_config_buf); 1776 goto err_4;
1804 kfree(id_lstatus_buf);
1805 kfree(id_ctlr_buf);
1806 kfree(id_ldrive);
1807 return;
1808
1809 } 1777 }
1810 1778
1811 info_p->phys_drives = 1779 info_p->phys_drives =
@@ -1820,12 +1788,18 @@ static void getgeometry(int ctlr)
1820 log_index = log_index + 1; 1788 log_index = log_index + 1;
1821 } /* end of if logical drive configured */ 1789 } /* end of if logical drive configured */
1822 } /* end of for log_unit */ 1790 } /* end of for log_unit */
1791
1792 /* Free all the buffers and return */
1793err_4:
1823 kfree(sense_config_buf); 1794 kfree(sense_config_buf);
1824 kfree(id_ldrive); 1795err_3:
1825 kfree(id_lstatus_buf); 1796 kfree(id_lstatus_buf);
1797err_2:
1826 kfree(id_ctlr_buf); 1798 kfree(id_ctlr_buf);
1799err_1:
1800 kfree(id_ldrive);
1801err_0:
1827 return; 1802 return;
1828
1829} 1803}
1830 1804
1831static void __exit cpqarray_exit(void) 1805static void __exit cpqarray_exit(void)
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index 85916e2665d4..af3969a9c963 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -41,7 +41,6 @@
41#include <linux/dma-mapping.h> 41#include <linux/dma-mapping.h>
42#include <linux/completion.h> 42#include <linux/completion.h>
43#include <linux/device.h> 43#include <linux/device.h>
44#include <linux/kernel.h>
45 44
46#include <asm/uaccess.h> 45#include <asm/uaccess.h>
47#include <asm/vio.h> 46#include <asm/vio.h>
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index cb27e8863d7c..3ede0b63da13 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -902,26 +902,17 @@ static int ace_release(struct inode *inode, struct file *filp)
902 return 0; 902 return 0;
903} 903}
904 904
905static int ace_ioctl(struct inode *inode, struct file *filp, 905static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo)
906 unsigned int cmd, unsigned long arg)
907{ 906{
908 struct ace_device *ace = inode->i_bdev->bd_disk->private_data; 907 struct ace_device *ace = bdev->bd_disk->private_data;
909 struct hd_geometry __user *geo = (struct hd_geometry __user *)arg;
910 struct hd_geometry g;
911 dev_dbg(ace->dev, "ace_ioctl()\n");
912
913 switch (cmd) {
914 case HDIO_GETGEO:
915 g.heads = ace->cf_id.heads;
916 g.sectors = ace->cf_id.sectors;
917 g.cylinders = ace->cf_id.cyls;
918 g.start = 0;
919 return copy_to_user(geo, &g, sizeof(g)) ? -EFAULT : 0;
920 908
921 default: 909 dev_dbg(ace->dev, "ace_getgeo()\n");
922 return -ENOTTY; 910
923 } 911 geo->heads = ace->cf_id.heads;
924 return -ENOTTY; 912 geo->sectors = ace->cf_id.sectors;
913 geo->cylinders = ace->cf_id.cyls;
914
915 return 0;
925} 916}
926 917
927static struct block_device_operations ace_fops = { 918static struct block_device_operations ace_fops = {
@@ -930,7 +921,7 @@ static struct block_device_operations ace_fops = {
930 .release = ace_release, 921 .release = ace_release,
931 .media_changed = ace_media_changed, 922 .media_changed = ace_media_changed,
932 .revalidate_disk = ace_revalidate_disk, 923 .revalidate_disk = ace_revalidate_disk,
933 .ioctl = ace_ioctl, 924 .getgeo = ace_getgeo,
934}; 925};
935 926
936/* -------------------------------------------------------------------- 927/* --------------------------------------------------------------------
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index 3359cc2b9736..8e7d713a5a15 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -184,6 +184,8 @@ static int i915_initialize(struct drm_device * dev,
184 * private backbuffer/depthbuffer usage. 184 * private backbuffer/depthbuffer usage.
185 */ 185 */
186 dev_priv->use_mi_batchbuffer_start = 0; 186 dev_priv->use_mi_batchbuffer_start = 0;
187 if (IS_I965G(dev)) /* 965 doesn't support older method */
188 dev_priv->use_mi_batchbuffer_start = 1;
187 189
188 /* Allow hardware batchbuffers unless told otherwise. 190 /* Allow hardware batchbuffers unless told otherwise.
189 */ 191 */
@@ -517,8 +519,13 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev,
517 519
518 if (dev_priv->use_mi_batchbuffer_start) { 520 if (dev_priv->use_mi_batchbuffer_start) {
519 BEGIN_LP_RING(2); 521 BEGIN_LP_RING(2);
520 OUT_RING(MI_BATCH_BUFFER_START | (2 << 6)); 522 if (IS_I965G(dev)) {
521 OUT_RING(batch->start | MI_BATCH_NON_SECURE); 523 OUT_RING(MI_BATCH_BUFFER_START | (2 << 6) | MI_BATCH_NON_SECURE_I965);
524 OUT_RING(batch->start);
525 } else {
526 OUT_RING(MI_BATCH_BUFFER_START | (2 << 6));
527 OUT_RING(batch->start | MI_BATCH_NON_SECURE);
528 }
522 ADVANCE_LP_RING(); 529 ADVANCE_LP_RING();
523 } else { 530 } else {
524 BEGIN_LP_RING(4); 531 BEGIN_LP_RING(4);
@@ -735,7 +742,8 @@ static int i915_setparam(DRM_IOCTL_ARGS)
735 742
736 switch (param.param) { 743 switch (param.param) {
737 case I915_SETPARAM_USE_MI_BATCHBUFFER_START: 744 case I915_SETPARAM_USE_MI_BATCHBUFFER_START:
738 dev_priv->use_mi_batchbuffer_start = param.value; 745 if (!IS_I965G(dev))
746 dev_priv->use_mi_batchbuffer_start = param.value;
739 break; 747 break;
740 case I915_SETPARAM_TEX_LRU_LOG_GRANULARITY: 748 case I915_SETPARAM_TEX_LRU_LOG_GRANULARITY:
741 dev_priv->tex_lru_log_granularity = param.value; 749 dev_priv->tex_lru_log_granularity = param.value;
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h
index fd918565f4e5..737088bd0780 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -282,6 +282,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
282#define MI_BATCH_BUFFER_START (0x31<<23) 282#define MI_BATCH_BUFFER_START (0x31<<23)
283#define MI_BATCH_BUFFER_END (0xA<<23) 283#define MI_BATCH_BUFFER_END (0xA<<23)
284#define MI_BATCH_NON_SECURE (1) 284#define MI_BATCH_NON_SECURE (1)
285#define MI_BATCH_NON_SECURE_I965 (1<<8)
285 286
286#define MI_WAIT_FOR_EVENT ((0x3<<23)) 287#define MI_WAIT_FOR_EVENT ((0x3<<23))
287#define MI_WAIT_FOR_PLANE_A_FLIP (1<<2) 288#define MI_WAIT_FOR_PLANE_A_FLIP (1<<2)
diff --git a/drivers/char/hvc_lguest.c b/drivers/char/hvc_lguest.c
index feeccbaec438..3d6bd0baa56d 100644
--- a/drivers/char/hvc_lguest.c
+++ b/drivers/char/hvc_lguest.c
@@ -35,6 +35,7 @@
35#include <linux/err.h> 35#include <linux/err.h>
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/lguest_bus.h> 37#include <linux/lguest_bus.h>
38#include <asm/paravirt.h>
38#include "hvc_console.h" 39#include "hvc_console.h"
39 40
40/*D:340 This is our single console input buffer, with associated "struct 41/*D:340 This is our single console input buffer, with associated "struct
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index fee58e03dbe2..4177f6db83e9 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1629,7 +1629,7 @@ static int cmm_open(struct inode *inode, struct file *filp)
1629{ 1629{
1630 struct cm4000_dev *dev; 1630 struct cm4000_dev *dev;
1631 struct pcmcia_device *link; 1631 struct pcmcia_device *link;
1632 int rc, minor = iminor(inode); 1632 int minor = iminor(inode);
1633 1633
1634 if (minor >= CM4000_MAX_DEV) 1634 if (minor >= CM4000_MAX_DEV)
1635 return -ENODEV; 1635 return -ENODEV;
@@ -1668,7 +1668,6 @@ static int cmm_open(struct inode *inode, struct file *filp)
1668 start_monitor(dev); 1668 start_monitor(dev);
1669 1669
1670 link->open = 1; /* only one open per device */ 1670 link->open = 1; /* only one open per device */
1671 rc = 0;
1672 1671
1673 DEBUGP(2, dev, "<- cmm_open\n"); 1672 DEBUGP(2, dev, "<- cmm_open\n");
1674 return nonseekable_open(inode, filp); 1673 return nonseekable_open(inode, filp);
@@ -1824,7 +1823,7 @@ static int cm4000_resume(struct pcmcia_device *link)
1824 1823
1825static void cm4000_release(struct pcmcia_device *link) 1824static void cm4000_release(struct pcmcia_device *link)
1826{ 1825{
1827 cmm_cm4000_release(link->priv); /* delay release until device closed */ 1826 cmm_cm4000_release(link); /* delay release until device closed */
1828 pcmcia_disable_device(link); 1827 pcmcia_disable_device(link);
1829} 1828}
1830 1829
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index af88181a17f4..b24a3e7bbb9f 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -599,7 +599,7 @@ cs_release:
599 599
600static void reader_release(struct pcmcia_device *link) 600static void reader_release(struct pcmcia_device *link)
601{ 601{
602 cm4040_reader_release(link->priv); 602 cm4040_reader_release(link);
603 pcmcia_disable_device(link); 603 pcmcia_disable_device(link);
604} 604}
605 605
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 73037a4d3c50..aeec67e27264 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -1147,10 +1147,15 @@ static int sonypi_acpi_remove(struct acpi_device *device, int type)
1147 return 0; 1147 return 0;
1148} 1148}
1149 1149
1150const static struct acpi_device_id sonypi_device_ids[] = {
1151 {"SNY6001", 0},
1152 {"", 0},
1153};
1154
1150static struct acpi_driver sonypi_acpi_driver = { 1155static struct acpi_driver sonypi_acpi_driver = {
1151 .name = "sonypi", 1156 .name = "sonypi",
1152 .class = "hkey", 1157 .class = "hkey",
1153 .ids = "SNY6001", 1158 .ids = sonypi_device_ids,
1154 .ops = { 1159 .ops = {
1155 .add = sonypi_acpi_add, 1160 .add = sonypi_acpi_add,
1156 .remove = sonypi_acpi_remove, 1161 .remove = sonypi_acpi_remove,
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index de37ebc3a4cf..51ea93cab6c4 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -369,25 +369,54 @@ static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b)
369} 369}
370 370
371/** 371/**
372 * tty_buffer_flush - flush full tty buffers 372 * __tty_buffer_flush - flush full tty buffers
373 * @tty: tty to flush 373 * @tty: tty to flush
374 * 374 *
375 * flush all the buffers containing receive data 375 * flush all the buffers containing receive data. Caller must
376 * hold the buffer lock and must have ensured no parallel flush to
377 * ldisc is running.
376 * 378 *
377 * Locking: none 379 * Locking: Caller must hold tty->buf.lock
378 */ 380 */
379 381
380static void tty_buffer_flush(struct tty_struct *tty) 382static void __tty_buffer_flush(struct tty_struct *tty)
381{ 383{
382 struct tty_buffer *thead; 384 struct tty_buffer *thead;
383 unsigned long flags;
384 385
385 spin_lock_irqsave(&tty->buf.lock, flags);
386 while((thead = tty->buf.head) != NULL) { 386 while((thead = tty->buf.head) != NULL) {
387 tty->buf.head = thead->next; 387 tty->buf.head = thead->next;
388 tty_buffer_free(tty, thead); 388 tty_buffer_free(tty, thead);
389 } 389 }
390 tty->buf.tail = NULL; 390 tty->buf.tail = NULL;
391}
392
393/**
394 * tty_buffer_flush - flush full tty buffers
395 * @tty: tty to flush
396 *
397 * flush all the buffers containing receive data. If the buffer is
398 * being processed by flush_to_ldisc then we defer the processing
399 * to that function
400 *
401 * Locking: none
402 */
403
404static void tty_buffer_flush(struct tty_struct *tty)
405{
406 unsigned long flags;
407 spin_lock_irqsave(&tty->buf.lock, flags);
408
409 /* If the data is being pushed to the tty layer then we can't
410 process it here. Instead set a flag and the flush_to_ldisc
411 path will process the flush request before it exits */
412 if (test_bit(TTY_FLUSHING, &tty->flags)) {
413 set_bit(TTY_FLUSHPENDING, &tty->flags);
414 spin_unlock_irqrestore(&tty->buf.lock, flags);
415 wait_event(tty->read_wait,
416 test_bit(TTY_FLUSHPENDING, &tty->flags) == 0);
417 return;
418 } else
419 __tty_buffer_flush(tty);
391 spin_unlock_irqrestore(&tty->buf.lock, flags); 420 spin_unlock_irqrestore(&tty->buf.lock, flags);
392} 421}
393 422
@@ -3594,6 +3623,7 @@ static void flush_to_ldisc(struct work_struct *work)
3594 return; 3623 return;
3595 3624
3596 spin_lock_irqsave(&tty->buf.lock, flags); 3625 spin_lock_irqsave(&tty->buf.lock, flags);
3626 set_bit(TTY_FLUSHING, &tty->flags); /* So we know a flush is running */
3597 head = tty->buf.head; 3627 head = tty->buf.head;
3598 if (head != NULL) { 3628 if (head != NULL) {
3599 tty->buf.head = NULL; 3629 tty->buf.head = NULL;
@@ -3607,6 +3637,11 @@ static void flush_to_ldisc(struct work_struct *work)
3607 tty_buffer_free(tty, tbuf); 3637 tty_buffer_free(tty, tbuf);
3608 continue; 3638 continue;
3609 } 3639 }
3640 /* Ldisc or user is trying to flush the buffers
3641 we are feeding to the ldisc, stop feeding the
3642 line discipline as we want to empty the queue */
3643 if (test_bit(TTY_FLUSHPENDING, &tty->flags))
3644 break;
3610 if (!tty->receive_room) { 3645 if (!tty->receive_room) {
3611 schedule_delayed_work(&tty->buf.work, 1); 3646 schedule_delayed_work(&tty->buf.work, 1);
3612 break; 3647 break;
@@ -3620,8 +3655,17 @@ static void flush_to_ldisc(struct work_struct *work)
3620 disc->receive_buf(tty, char_buf, flag_buf, count); 3655 disc->receive_buf(tty, char_buf, flag_buf, count);
3621 spin_lock_irqsave(&tty->buf.lock, flags); 3656 spin_lock_irqsave(&tty->buf.lock, flags);
3622 } 3657 }
3658 /* Restore the queue head */
3623 tty->buf.head = head; 3659 tty->buf.head = head;
3624 } 3660 }
3661 /* We may have a deferred request to flush the input buffer,
3662 if so pull the chain under the lock and empty the queue */
3663 if (test_bit(TTY_FLUSHPENDING, &tty->flags)) {
3664 __tty_buffer_flush(tty);
3665 clear_bit(TTY_FLUSHPENDING, &tty->flags);
3666 wake_up(&tty->read_wait);
3667 }
3668 clear_bit(TTY_FLUSHING, &tty->flags);
3625 spin_unlock_irqrestore(&tty->buf.lock, flags); 3669 spin_unlock_irqrestore(&tty->buf.lock, flags);
3626 3670
3627 tty_ldisc_deref(disc); 3671 tty_ldisc_deref(disc);
diff --git a/drivers/dma/ioatdma.c b/drivers/dma/ioatdma.c
index 5fbe56b5cea0..2d1f17865b64 100644
--- a/drivers/dma/ioatdma.c
+++ b/drivers/dma/ioatdma.c
@@ -347,8 +347,7 @@ ioat_dma_prep_memcpy(struct dma_chan *chan, size_t len, int int_en)
347 new->async_tx.ack = 0; /* client is in control of this ack */ 347 new->async_tx.ack = 0; /* client is in control of this ack */
348 new->async_tx.cookie = -EBUSY; 348 new->async_tx.cookie = -EBUSY;
349 349
350 pci_unmap_len_set(new, src_len, orig_len); 350 pci_unmap_len_set(new, len, orig_len);
351 pci_unmap_len_set(new, dst_len, orig_len);
352 spin_unlock_bh(&ioat_chan->desc_lock); 351 spin_unlock_bh(&ioat_chan->desc_lock);
353 352
354 return new ? &new->async_tx : NULL; 353 return new ? &new->async_tx : NULL;
@@ -423,11 +422,11 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *chan)
423 */ 422 */
424 pci_unmap_page(chan->device->pdev, 423 pci_unmap_page(chan->device->pdev,
425 pci_unmap_addr(desc, dst), 424 pci_unmap_addr(desc, dst),
426 pci_unmap_len(desc, dst_len), 425 pci_unmap_len(desc, len),
427 PCI_DMA_FROMDEVICE); 426 PCI_DMA_FROMDEVICE);
428 pci_unmap_page(chan->device->pdev, 427 pci_unmap_page(chan->device->pdev,
429 pci_unmap_addr(desc, src), 428 pci_unmap_addr(desc, src),
430 pci_unmap_len(desc, src_len), 429 pci_unmap_len(desc, len),
431 PCI_DMA_TODEVICE); 430 PCI_DMA_TODEVICE);
432 } 431 }
433 432
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h
index d3726478031a..bf4dad70e0f5 100644
--- a/drivers/dma/ioatdma.h
+++ b/drivers/dma/ioatdma.h
@@ -111,10 +111,9 @@ struct ioat_desc_sw {
111 struct ioat_dma_descriptor *hw; 111 struct ioat_dma_descriptor *hw;
112 struct list_head node; 112 struct list_head node;
113 int tx_cnt; 113 int tx_cnt;
114 DECLARE_PCI_UNMAP_LEN(len)
114 DECLARE_PCI_UNMAP_ADDR(src) 115 DECLARE_PCI_UNMAP_ADDR(src)
115 DECLARE_PCI_UNMAP_LEN(src_len)
116 DECLARE_PCI_UNMAP_ADDR(dst) 116 DECLARE_PCI_UNMAP_ADDR(dst)
117 DECLARE_PCI_UNMAP_LEN(dst_len)
118 struct dma_async_tx_descriptor async_tx; 117 struct dma_async_tx_descriptor async_tx;
119}; 118};
120 119
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index db703758db98..7e427b4c74b5 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -907,6 +907,8 @@ static void bus_reset_tasklet(unsigned long data)
907 int self_id_count, i, j, reg; 907 int self_id_count, i, j, reg;
908 int generation, new_generation; 908 int generation, new_generation;
909 unsigned long flags; 909 unsigned long flags;
910 void *free_rom = NULL;
911 dma_addr_t free_rom_bus = 0;
910 912
911 reg = reg_read(ohci, OHCI1394_NodeID); 913 reg = reg_read(ohci, OHCI1394_NodeID);
912 if (!(reg & OHCI1394_NodeID_idValid)) { 914 if (!(reg & OHCI1394_NodeID_idValid)) {
@@ -970,8 +972,8 @@ static void bus_reset_tasklet(unsigned long data)
970 */ 972 */
971 973
972 if (ohci->next_config_rom != NULL) { 974 if (ohci->next_config_rom != NULL) {
973 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, 975 free_rom = ohci->config_rom;
974 ohci->config_rom, ohci->config_rom_bus); 976 free_rom_bus = ohci->config_rom_bus;
975 ohci->config_rom = ohci->next_config_rom; 977 ohci->config_rom = ohci->next_config_rom;
976 ohci->config_rom_bus = ohci->next_config_rom_bus; 978 ohci->config_rom_bus = ohci->next_config_rom_bus;
977 ohci->next_config_rom = NULL; 979 ohci->next_config_rom = NULL;
@@ -990,6 +992,10 @@ static void bus_reset_tasklet(unsigned long data)
990 992
991 spin_unlock_irqrestore(&ohci->lock, flags); 993 spin_unlock_irqrestore(&ohci->lock, flags);
992 994
995 if (free_rom)
996 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
997 free_rom, free_rom_bus);
998
993 fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation, 999 fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation,
994 self_id_count, ohci->self_id_buffer); 1000 self_id_count, ohci->self_id_buffer);
995} 1001}
@@ -1186,7 +1192,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
1186{ 1192{
1187 struct fw_ohci *ohci; 1193 struct fw_ohci *ohci;
1188 unsigned long flags; 1194 unsigned long flags;
1189 int retval = 0; 1195 int retval = -EBUSY;
1190 __be32 *next_config_rom; 1196 __be32 *next_config_rom;
1191 dma_addr_t next_config_rom_bus; 1197 dma_addr_t next_config_rom_bus;
1192 1198
@@ -1240,10 +1246,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
1240 1246
1241 reg_write(ohci, OHCI1394_ConfigROMmap, 1247 reg_write(ohci, OHCI1394_ConfigROMmap,
1242 ohci->next_config_rom_bus); 1248 ohci->next_config_rom_bus);
1243 } else { 1249 retval = 0;
1244 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
1245 next_config_rom, next_config_rom_bus);
1246 retval = -EBUSY;
1247 } 1250 }
1248 1251
1249 spin_unlock_irqrestore(&ohci->lock, flags); 1252 spin_unlock_irqrestore(&ohci->lock, flags);
@@ -1257,6 +1260,9 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
1257 */ 1260 */
1258 if (retval == 0) 1261 if (retval == 0)
1259 fw_core_initiate_bus_reset(&ohci->card, 1); 1262 fw_core_initiate_bus_reset(&ohci->card, 1);
1263 else
1264 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
1265 next_config_rom, next_config_rom_bus);
1260 1266
1261 return retval; 1267 return retval;
1262} 1268}
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 3e4a369d0057..ba816ef6def1 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -984,6 +984,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
984 struct fw_unit *unit = sd->unit; 984 struct fw_unit *unit = sd->unit;
985 struct fw_device *device = fw_device(unit->device.parent); 985 struct fw_device *device = fw_device(unit->device.parent);
986 struct sbp2_command_orb *orb; 986 struct sbp2_command_orb *orb;
987 unsigned max_payload;
987 988
988 /* 989 /*
989 * Bidirectional commands are not yet implemented, and unknown 990 * Bidirectional commands are not yet implemented, and unknown
@@ -1017,8 +1018,10 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1017 * specifies the max payload size as 2 ^ (max_payload + 2), so 1018 * specifies the max payload size as 2 ^ (max_payload + 2), so
1018 * if we set this to max_speed + 7, we get the right value. 1019 * if we set this to max_speed + 7, we get the right value.
1019 */ 1020 */
1021 max_payload = min(device->max_speed + 7,
1022 device->card->max_receive - 1);
1020 orb->request.misc = 1023 orb->request.misc =
1021 COMMAND_ORB_MAX_PAYLOAD(device->max_speed + 7) | 1024 COMMAND_ORB_MAX_PAYLOAD(max_payload) |
1022 COMMAND_ORB_SPEED(device->max_speed) | 1025 COMMAND_ORB_SPEED(device->max_speed) |
1023 COMMAND_ORB_NOTIFY; 1026 COMMAND_ORB_NOTIFY;
1024 1027
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 3ce8e2fbe15f..3e1cb12e43cd 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -734,7 +734,7 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
734} 734}
735EXPORT_SYMBOL(fw_core_handle_response); 735EXPORT_SYMBOL(fw_core_handle_response);
736 736
737const struct fw_address_region topology_map_region = 737static const struct fw_address_region topology_map_region =
738 { .start = 0xfffff0001000ull, .end = 0xfffff0001400ull, }; 738 { .start = 0xfffff0001000ull, .end = 0xfffff0001400ull, };
739 739
740static void 740static void
@@ -772,7 +772,7 @@ static struct fw_address_handler topology_map = {
772 .address_callback = handle_topology_map, 772 .address_callback = handle_topology_map,
773}; 773};
774 774
775const struct fw_address_region registers_region = 775static const struct fw_address_region registers_region =
776 { .start = 0xfffff0000000ull, .end = 0xfffff0000400ull, }; 776 { .start = 0xfffff0000000ull, .end = 0xfffff0000400ull, };
777 777
778static void 778static void
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index 5ceaccd10564..fa7967b57408 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -231,7 +231,7 @@ struct fw_card {
231 unsigned long reset_jiffies; 231 unsigned long reset_jiffies;
232 232
233 unsigned long long guid; 233 unsigned long long guid;
234 int max_receive; 234 unsigned max_receive;
235 int link_speed; 235 int link_speed;
236 int config_rom_generation; 236 int config_rom_generation;
237 237
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 8f5c686123b8..289816db52ae 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -272,11 +272,11 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
272 /* Make sure the SMBus host is ready to start transmitting */ 272 /* Make sure the SMBus host is ready to start transmitting */
273 temp = inb_p(SMBHSTSTS); 273 temp = inb_p(SMBHSTSTS);
274 if (i == 1) { 274 if (i == 1) {
275 /* Erronenous conditions before transaction: 275 /* Erroneous conditions before transaction:
276 * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ 276 * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */
277 errmask = 0x9f; 277 errmask = 0x9f;
278 } else { 278 } else {
279 /* Erronenous conditions during transaction: 279 /* Erroneous conditions during transaction:
280 * Failed, Bus_Err, Dev_Err, Intr */ 280 * Failed, Bus_Err, Dev_Err, Intr */
281 errmask = 0x1e; 281 errmask = 0x1e;
282 } 282 }
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index 440342bc62e1..ace644e21b14 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -490,6 +490,7 @@ iop3xx_i2c_probe(struct platform_device *pdev)
490 memcpy(new_adapter->name, pdev->name, strlen(pdev->name)); 490 memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
491 new_adapter->id = I2C_HW_IOP3XX; 491 new_adapter->id = I2C_HW_IOP3XX;
492 new_adapter->owner = THIS_MODULE; 492 new_adapter->owner = THIS_MODULE;
493 new_adapter->class = I2C_CLASS_HWMON;
493 new_adapter->dev.parent = &pdev->dev; 494 new_adapter->dev.parent = &pdev->dev;
494 new_adapter->nr = pdev->id; 495 new_adapter->nr = pdev->id;
495 496
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 851c3ed513d0..d8de4ac88b7d 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -105,6 +105,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
105 schedule(); 105 schedule();
106 if (time_after(jiffies, orig_jiffies + timeout)) { 106 if (time_after(jiffies, orig_jiffies + timeout)) {
107 pr_debug("I2C: timeout\n"); 107 pr_debug("I2C: timeout\n");
108 writeccr(i2c, 0);
108 result = -EIO; 109 result = -EIO;
109 break; 110 break;
110 } 111 }
@@ -116,10 +117,12 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
116 result = wait_event_interruptible_timeout(i2c->queue, 117 result = wait_event_interruptible_timeout(i2c->queue,
117 (i2c->interrupt & CSR_MIF), timeout * HZ); 118 (i2c->interrupt & CSR_MIF), timeout * HZ);
118 119
119 if (unlikely(result < 0)) 120 if (unlikely(result < 0)) {
120 pr_debug("I2C: wait interrupted\n"); 121 pr_debug("I2C: wait interrupted\n");
121 else if (unlikely(!(i2c->interrupt & CSR_MIF))) { 122 writeccr(i2c, 0);
123 } else if (unlikely(!(i2c->interrupt & CSR_MIF))) {
122 pr_debug("I2C: wait timeout\n"); 124 pr_debug("I2C: wait timeout\n");
125 writeccr(i2c, 0);
123 result = -ETIMEDOUT; 126 result = -ETIMEDOUT;
124 } 127 }
125 128
@@ -172,7 +175,6 @@ static void mpc_i2c_start(struct mpc_i2c *i2c)
172static void mpc_i2c_stop(struct mpc_i2c *i2c) 175static void mpc_i2c_stop(struct mpc_i2c *i2c)
173{ 176{
174 writeccr(i2c, CCR_MEN); 177 writeccr(i2c, CCR_MEN);
175 writeccr(i2c, 0);
176} 178}
177 179
178static int mpc_write(struct mpc_i2c *i2c, int target, 180static int mpc_write(struct mpc_i2c *i2c, int target,
@@ -261,6 +263,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
261 while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) { 263 while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) {
262 if (signal_pending(current)) { 264 if (signal_pending(current)) {
263 pr_debug("I2C: Interrupted\n"); 265 pr_debug("I2C: Interrupted\n");
266 writeccr(i2c, 0);
264 return -EINTR; 267 return -EINTR;
265 } 268 }
266 if (time_after(jiffies, orig_jiffies + HZ)) { 269 if (time_after(jiffies, orig_jiffies + HZ)) {
@@ -362,7 +365,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)
362 365
363 fail_add: 366 fail_add:
364 if (i2c->irq != 0) 367 if (i2c->irq != 0)
365 free_irq(i2c->irq, NULL); 368 free_irq(i2c->irq, i2c);
366 fail_irq: 369 fail_irq:
367 iounmap(i2c->base); 370 iounmap(i2c->base);
368 fail_map: 371 fail_map:
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 251154ae5d97..bb7bf68a7fb6 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -107,6 +107,21 @@ struct mv64xxx_i2c_data {
107 * 107 *
108 ***************************************************************************** 108 *****************************************************************************
109 */ 109 */
110
111/* Reset hardware and initialize FSM */
112static void
113mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data)
114{
115 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SOFT_RESET);
116 writel((((drv_data->freq_m & 0xf) << 3) | (drv_data->freq_n & 0x7)),
117 drv_data->reg_base + MV64XXX_I2C_REG_BAUD);
118 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SLAVE_ADDR);
119 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_EXT_SLAVE_ADDR);
120 writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP,
121 drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
122 drv_data->state = MV64XXX_I2C_STATE_IDLE;
123}
124
110static void 125static void
111mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) 126mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
112{ 127{
@@ -203,7 +218,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
203 drv_data->state, status, drv_data->msg->addr, 218 drv_data->state, status, drv_data->msg->addr,
204 drv_data->msg->flags); 219 drv_data->msg->flags);
205 drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; 220 drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
206 drv_data->state = MV64XXX_I2C_STATE_IDLE; 221 mv64xxx_i2c_hw_init(drv_data);
207 drv_data->rc = -EIO; 222 drv_data->rc = -EIO;
208 } 223 }
209} 224}
@@ -367,6 +382,7 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data)
367 "mv64xxx: I2C bus locked, block: %d, " 382 "mv64xxx: I2C bus locked, block: %d, "
368 "time_left: %d\n", drv_data->block, 383 "time_left: %d\n", drv_data->block,
369 (int)time_left); 384 (int)time_left);
385 mv64xxx_i2c_hw_init(drv_data);
370 } 386 }
371 } else 387 } else
372 spin_unlock_irqrestore(&drv_data->lock, flags); 388 spin_unlock_irqrestore(&drv_data->lock, flags);
@@ -443,19 +459,6 @@ static const struct i2c_algorithm mv64xxx_i2c_algo = {
443 * 459 *
444 ***************************************************************************** 460 *****************************************************************************
445 */ 461 */
446static void __devinit
447mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data)
448{
449 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SOFT_RESET);
450 writel((((drv_data->freq_m & 0xf) << 3) | (drv_data->freq_n & 0x7)),
451 drv_data->reg_base + MV64XXX_I2C_REG_BAUD);
452 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SLAVE_ADDR);
453 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_EXT_SLAVE_ADDR);
454 writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP,
455 drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
456 drv_data->state = MV64XXX_I2C_STATE_IDLE;
457}
458
459static int __devinit 462static int __devinit
460mv64xxx_i2c_map_regs(struct platform_device *pd, 463mv64xxx_i2c_map_regs(struct platform_device *pd,
461 struct mv64xxx_i2c_data *drv_data) 464 struct mv64xxx_i2c_data *drv_data)
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index e4540fcf6476..c44ada5f4292 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -39,8 +39,8 @@
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#include <asm/arch/regs-gpio.h> 41#include <asm/arch/regs-gpio.h>
42#include <asm/arch/regs-iic.h> 42#include <asm/plat-s3c/regs-iic.h>
43#include <asm/arch/iic.h> 43#include <asm/plat-s3c/iic.h>
44 44
45/* i2c controller state */ 45/* i2c controller state */
46 46
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c
index 9fafadb92510..fe04e46991aa 100644
--- a/drivers/i2c/chips/isp1301_omap.c
+++ b/drivers/i2c/chips/isp1301_omap.c
@@ -18,8 +18,6 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21#undef DEBUG
22#undef VERBOSE
23 21
24#include <linux/kernel.h> 22#include <linux/kernel.h>
25#include <linux/module.h> 23#include <linux/module.h>
@@ -44,7 +42,7 @@
44 42
45 43
46#define DRIVER_VERSION "24 August 2004" 44#define DRIVER_VERSION "24 August 2004"
47#define DRIVER_NAME (isp1301_driver.name) 45#define DRIVER_NAME (isp1301_driver.driver.name)
48 46
49MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver"); 47MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver");
50MODULE_LICENSE("GPL"); 48MODULE_LICENSE("GPL");
@@ -55,6 +53,7 @@ struct isp1301 {
55 void (*i2c_release)(struct device *dev); 53 void (*i2c_release)(struct device *dev);
56 54
57 int irq; 55 int irq;
56 int irq_type;
58 57
59 u32 last_otg_ctrl; 58 u32 last_otg_ctrl;
60 unsigned working:1; 59 unsigned working:1;
@@ -63,7 +62,7 @@ struct isp1301 {
63 62
64 /* use keventd context to change the state for us */ 63 /* use keventd context to change the state for us */
65 struct work_struct work; 64 struct work_struct work;
66 65
67 unsigned long todo; 66 unsigned long todo;
68# define WORK_UPDATE_ISP 0 /* update ISP from OTG */ 67# define WORK_UPDATE_ISP 0 /* update ISP from OTG */
69# define WORK_UPDATE_OTG 1 /* update OTG from ISP */ 68# define WORK_UPDATE_OTG 1 /* update OTG from ISP */
@@ -94,7 +93,7 @@ struct isp1301 {
94 93
95/* board-specific PM hooks */ 94/* board-specific PM hooks */
96 95
97#include <asm/arch/gpio.h> 96#include <asm/gpio.h>
98#include <asm/arch/mux.h> 97#include <asm/arch/mux.h>
99#include <asm/mach-types.h> 98#include <asm/mach-types.h>
100 99
@@ -291,7 +290,7 @@ static void power_up(struct isp1301 *isp)
291{ 290{
292 // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); 291 // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
293 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG); 292 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG);
294 293
295 /* do this only when cpu is driving transceiver, 294 /* do this only when cpu is driving transceiver,
296 * so host won't see a low speed device... 295 * so host won't see a low speed device...
297 */ 296 */
@@ -799,7 +798,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
799 /* role is host */ 798 /* role is host */
800 } else { 799 } else {
801 if (!(otg_ctrl & OTG_ID)) { 800 if (!(otg_ctrl & OTG_ID)) {
802 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; 801 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
803 OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ; 802 OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ;
804 } 803 }
805 804
@@ -1100,9 +1099,9 @@ static u8 isp1301_clear_latch(struct isp1301 *isp)
1100} 1099}
1101 1100
1102static void 1101static void
1103isp1301_work(void *data) 1102isp1301_work(struct work_struct *work)
1104{ 1103{
1105 struct isp1301 *isp = data; 1104 struct isp1301 *isp = container_of(work, struct isp1301, work);
1106 int stop; 1105 int stop;
1107 1106
1108 /* implicit lock: we're the only task using this device */ 1107 /* implicit lock: we're the only task using this device */
@@ -1244,7 +1243,7 @@ static int isp1301_detach_client(struct i2c_client *i2c)
1244 * - DEVICE mode, for when there's a B/Mini-B (device) connector 1243 * - DEVICE mode, for when there's a B/Mini-B (device) connector
1245 * 1244 *
1246 * As a rule, you won't have an isp1301 chip unless it's there to 1245 * As a rule, you won't have an isp1301 chip unless it's there to
1247 * support the OTG mode. Other modes help testing USB controllers 1246 * support the OTG mode. Other modes help testing USB controllers
1248 * in isolation from (full) OTG support, or maybe so later board 1247 * in isolation from (full) OTG support, or maybe so later board
1249 * revisions can help to support those feature. 1248 * revisions can help to support those feature.
1250 */ 1249 */
@@ -1260,9 +1259,9 @@ static int isp1301_otg_enable(struct isp1301 *isp)
1260 * a few more interrupts than are strictly needed. 1259 * a few more interrupts than are strictly needed.
1261 */ 1260 */
1262 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, 1261 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
1263 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); 1262 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
1264 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, 1263 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
1265 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); 1264 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
1266 1265
1267 dev_info(&isp->client.dev, "ready for dual-role USB ...\n"); 1266 dev_info(&isp->client.dev, "ready for dual-role USB ...\n");
1268 1267
@@ -1306,9 +1305,9 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host)
1306 1305
1307 dev_info(&isp->client.dev, "A-Host sessions ok\n"); 1306 dev_info(&isp->client.dev, "A-Host sessions ok\n");
1308 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, 1307 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
1309 INTR_ID_GND); 1308 INTR_ID_GND);
1310 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, 1309 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
1311 INTR_ID_GND); 1310 INTR_ID_GND);
1312 1311
1313 /* If this has a Mini-AB connector, this mode is highly 1312 /* If this has a Mini-AB connector, this mode is highly
1314 * nonstandard ... but can be handy for testing, especially with 1313 * nonstandard ... but can be handy for testing, especially with
@@ -1368,9 +1367,9 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
1368 isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); 1367 isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
1369 1368
1370 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, 1369 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
1371 INTR_SESS_VLD); 1370 INTR_SESS_VLD);
1372 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, 1371 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
1373 INTR_VBUS_VLD); 1372 INTR_VBUS_VLD);
1374 dev_info(&isp->client.dev, "B-Peripheral sessions ok\n"); 1373 dev_info(&isp->client.dev, "B-Peripheral sessions ok\n");
1375 dump_regs(isp, __FUNCTION__); 1374 dump_regs(isp, __FUNCTION__);
1376 1375
@@ -1494,7 +1493,7 @@ static int isp1301_probe(struct i2c_adapter *bus, int address, int kind)
1494 if (!isp) 1493 if (!isp)
1495 return 0; 1494 return 0;
1496 1495
1497 INIT_WORK(&isp->work, isp1301_work, isp); 1496 INIT_WORK(&isp->work, isp1301_work);
1498 init_timer(&isp->timer); 1497 init_timer(&isp->timer);
1499 isp->timer.function = isp1301_timer; 1498 isp->timer.function = isp1301_timer;
1500 isp->timer.data = (unsigned long) isp; 1499 isp->timer.data = (unsigned long) isp;
@@ -1572,13 +1571,14 @@ fail1:
1572 /* IRQ wired at M14 */ 1571 /* IRQ wired at M14 */
1573 omap_cfg_reg(M14_1510_GPIO2); 1572 omap_cfg_reg(M14_1510_GPIO2);
1574 isp->irq = OMAP_GPIO_IRQ(2); 1573 isp->irq = OMAP_GPIO_IRQ(2);
1575 omap_request_gpio(2); 1574 if (gpio_request(2, "isp1301") == 0)
1576 omap_set_gpio_direction(2, 1); 1575 gpio_direction_input(2);
1577 omap_set_gpio_edge_ctrl(2, OMAP_GPIO_FALLING_EDGE); 1576 isp->irq_type = IRQF_TRIGGER_FALLING;
1578 } 1577 }
1579 1578
1579 isp->irq_type |= IRQF_SAMPLE_RANDOM;
1580 status = request_irq(isp->irq, isp1301_irq, 1580 status = request_irq(isp->irq, isp1301_irq,
1581 IRQF_SAMPLE_RANDOM, DRIVER_NAME, isp); 1581 isp->irq_type, DRIVER_NAME, isp);
1582 if (status < 0) { 1582 if (status < 0) {
1583 dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n", 1583 dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n",
1584 isp->irq, status); 1584 isp->irq, status);
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c
index 48a7e2f0bdd3..d9c92c5e0077 100644
--- a/drivers/i2c/chips/menelaus.c
+++ b/drivers/i2c/chips/menelaus.c
@@ -1,4 +1,3 @@
1#define DEBUG
2/* 1/*
3 * Copyright (C) 2004 Texas Instruments, Inc. 2 * Copyright (C) 2004 Texas Instruments, Inc.
4 * 3 *
@@ -933,7 +932,7 @@ static int menelaus_set_time(struct device *dev, struct rtc_time *t)
933 return status; 932 return status;
934 status = menelaus_write_reg(MENELAUS_RTC_WKDAY, BIN2BCD(t->tm_wday)); 933 status = menelaus_write_reg(MENELAUS_RTC_WKDAY, BIN2BCD(t->tm_wday));
935 if (status < 0) { 934 if (status < 0) {
936 dev_err(&the_menelaus->client->dev, "rtc write reg %02x", 935 dev_err(&the_menelaus->client->dev, "rtc write reg %02x "
937 "err %d\n", MENELAUS_RTC_WKDAY, status); 936 "err %d\n", MENELAUS_RTC_WKDAY, status);
938 return status; 937 return status;
939 } 938 }
diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig
index 8012b3b0ce75..545663ef820b 100644
--- a/drivers/ieee1394/Kconfig
+++ b/drivers/ieee1394/Kconfig
@@ -97,7 +97,7 @@ config IEEE1394_SBP2
97 97
98config IEEE1394_SBP2_PHYS_DMA 98config IEEE1394_SBP2_PHYS_DMA
99 bool "Enable replacement for physical DMA in SBP2" 99 bool "Enable replacement for physical DMA in SBP2"
100 depends on IEEE1394 && IEEE1394_SBP2 && EXPERIMENTAL && (X86_32 || PPC_32) 100 depends on IEEE1394_SBP2 && VIRT_TO_BUS && EXPERIMENTAL
101 help 101 help
102 This builds sbp2 for use with non-OHCI host adapters which do not 102 This builds sbp2 for use with non-OHCI host adapters which do not
103 support physical DMA or for when ohci1394 is run with phys_dma=0. 103 support physical DMA or for when ohci1394 is run with phys_dma=0.
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index e882cb951b47..47dbe8f17e82 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -773,11 +773,6 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud)
773 SBP2_ERR("failed to register lower 4GB address range"); 773 SBP2_ERR("failed to register lower 4GB address range");
774 goto failed_alloc; 774 goto failed_alloc;
775 } 775 }
776#else
777 if (dma_set_mask(hi->host->device.parent, DMA_32BIT_MASK)) {
778 SBP2_ERR("failed to set 4GB DMA mask");
779 goto failed_alloc;
780 }
781#endif 776#endif
782 } 777 }
783 778
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 1f979cb0df31..4b8a0cc9665e 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -1217,11 +1217,13 @@ twobyte_insn:
1217 } 1217 }
1218 break; 1218 break;
1219 case 0x21: /* mov from dr to reg */ 1219 case 0x21: /* mov from dr to reg */
1220 no_wb = 1;
1220 if (modrm_mod != 3) 1221 if (modrm_mod != 3)
1221 goto cannot_emulate; 1222 goto cannot_emulate;
1222 rc = emulator_get_dr(ctxt, modrm_reg, &_regs[modrm_rm]); 1223 rc = emulator_get_dr(ctxt, modrm_reg, &_regs[modrm_rm]);
1223 break; 1224 break;
1224 case 0x23: /* mov from reg to dr */ 1225 case 0x23: /* mov from reg to dr */
1226 no_wb = 1;
1225 if (modrm_mod != 3) 1227 if (modrm_mod != 3)
1226 goto cannot_emulate; 1228 goto cannot_emulate;
1227 rc = emulator_set_dr(ctxt, modrm_reg, _regs[modrm_rm]); 1229 rc = emulator_set_dr(ctxt, modrm_reg, _regs[modrm_rm]);
diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig
index 888205c3f76b..fd6925f41647 100644
--- a/drivers/lguest/Kconfig
+++ b/drivers/lguest/Kconfig
@@ -21,8 +21,10 @@ config LGUEST_GUEST
21 21
22config LGUEST_NET 22config LGUEST_NET
23 tristate 23 tristate
24 default y
24 depends on LGUEST_GUEST && NET 25 depends on LGUEST_GUEST && NET
25 26
26config LGUEST_BLOCK 27config LGUEST_BLOCK
27 tristate 28 tristate
29 default y
28 depends on LGUEST_GUEST && BLOCK 30 depends on LGUEST_GUEST && BLOCK
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 0a46e8837d9a..4a315f08a567 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -453,6 +453,11 @@ static void run_guest_once(struct lguest *lg, struct lguest_pages *pages)
453 * lguest_pages". */ 453 * lguest_pages". */
454 copy_in_guest_info(lg, pages); 454 copy_in_guest_info(lg, pages);
455 455
456 /* Set the trap number to 256 (impossible value). If we fault while
457 * switching to the Guest (bad segment registers or bug), this will
458 * cause us to abort the Guest. */
459 lg->regs->trapnum = 256;
460
456 /* Now: we push the "eflags" register on the stack, then do an "lcall". 461 /* Now: we push the "eflags" register on the stack, then do an "lcall".
457 * This is how we change from using the kernel code segment to using 462 * This is how we change from using the kernel code segment to using
458 * the dedicated lguest code segment, as well as jumping into the 463 * the dedicated lguest code segment, as well as jumping into the
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c
index 49787e964a0d..49aa55577d0d 100644
--- a/drivers/lguest/interrupts_and_traps.c
+++ b/drivers/lguest/interrupts_and_traps.c
@@ -195,13 +195,16 @@ static int has_err(unsigned int trap)
195/* deliver_trap() returns true if it could deliver the trap. */ 195/* deliver_trap() returns true if it could deliver the trap. */
196int deliver_trap(struct lguest *lg, unsigned int num) 196int deliver_trap(struct lguest *lg, unsigned int num)
197{ 197{
198 u32 lo = lg->idt[num].a, hi = lg->idt[num].b; 198 /* Trap numbers are always 8 bit, but we set an impossible trap number
199 * for traps inside the Switcher, so check that here. */
200 if (num >= ARRAY_SIZE(lg->idt))
201 return 0;
199 202
200 /* Early on the Guest hasn't set the IDT entries (or maybe it put a 203 /* Early on the Guest hasn't set the IDT entries (or maybe it put a
201 * bogus one in): if we fail here, the Guest will be killed. */ 204 * bogus one in): if we fail here, the Guest will be killed. */
202 if (!idt_present(lo, hi)) 205 if (!idt_present(lg->idt[num].a, lg->idt[num].b))
203 return 0; 206 return 0;
204 set_guest_interrupt(lg, lo, hi, has_err(num)); 207 set_guest_interrupt(lg, lg->idt[num].a, lg->idt[num].b, has_err(num));
205 return 1; 208 return 1;
206} 209}
207 210
diff --git a/drivers/lguest/lguest.c b/drivers/lguest/lguest.c
index 1bc1546c7fd0..6e135ac0834f 100644
--- a/drivers/lguest/lguest.c
+++ b/drivers/lguest/lguest.c
@@ -323,9 +323,12 @@ static void lguest_write_gdt_entry(struct desc_struct *dt,
323 * __thread variables). So we have a hypercall specifically for this case. */ 323 * __thread variables). So we have a hypercall specifically for this case. */
324static void lguest_load_tls(struct thread_struct *t, unsigned int cpu) 324static void lguest_load_tls(struct thread_struct *t, unsigned int cpu)
325{ 325{
326 /* There's one problem which normal hardware doesn't have: the Host
327 * can't handle us removing entries we're currently using. So we clear
328 * the GS register here: if it's needed it'll be reloaded anyway. */
329 loadsegment(gs, 0);
326 lazy_hcall(LHCALL_LOAD_TLS, __pa(&t->tls_array), cpu, 0); 330 lazy_hcall(LHCALL_LOAD_TLS, __pa(&t->tls_array), cpu, 0);
327} 331}
328/*:*/
329 332
330/*G:038 That's enough excitement for now, back to ploughing through each of 333/*G:038 That's enough excitement for now, back to ploughing through each of
331 * the paravirt_ops (we're about 1/3 of the way through). 334 * the paravirt_ops (we're about 1/3 of the way through).
@@ -687,7 +690,8 @@ static struct clocksource lguest_clock = {
687 .rating = 400, 690 .rating = 400,
688 .read = lguest_clock_read, 691 .read = lguest_clock_read,
689 .mask = CLOCKSOURCE_MASK(64), 692 .mask = CLOCKSOURCE_MASK(64),
690 .mult = 1, 693 .mult = 1 << 22,
694 .shift = 22,
691}; 695};
692 696
693/* The "scheduler clock" is just our real clock, adjusted to start at zero */ 697/* The "scheduler clock" is just our real clock, adjusted to start at zero */
@@ -770,7 +774,6 @@ static void lguest_time_init(void)
770 * way, the "rating" is initialized so high that it's always chosen 774 * way, the "rating" is initialized so high that it's always chosen
771 * over any other clocksource. */ 775 * over any other clocksource. */
772 if (lguest_data.tsc_khz) { 776 if (lguest_data.tsc_khz) {
773 lguest_clock.shift = 22;
774 lguest_clock.mult = clocksource_khz2mult(lguest_data.tsc_khz, 777 lguest_clock.mult = clocksource_khz2mult(lguest_data.tsc_khz,
775 lguest_clock.shift); 778 lguest_clock.shift);
776 lguest_clock.flags = CLOCK_SOURCE_IS_CONTINUOUS; 779 lguest_clock.flags = CLOCK_SOURCE_IS_CONTINUOUS;
@@ -933,23 +936,24 @@ static const struct lguest_insns
933/* Now our patch routine is fairly simple (based on the native one in 936/* Now our patch routine is fairly simple (based on the native one in
934 * paravirt.c). If we have a replacement, we copy it in and return how much of 937 * paravirt.c). If we have a replacement, we copy it in and return how much of
935 * the available space we used. */ 938 * the available space we used. */
936static unsigned lguest_patch(u8 type, u16 clobber, void *insns, unsigned len) 939static unsigned lguest_patch(u8 type, u16 clobber, void *ibuf,
940 unsigned long addr, unsigned len)
937{ 941{
938 unsigned int insn_len; 942 unsigned int insn_len;
939 943
940 /* Don't do anything special if we don't have a replacement */ 944 /* Don't do anything special if we don't have a replacement */
941 if (type >= ARRAY_SIZE(lguest_insns) || !lguest_insns[type].start) 945 if (type >= ARRAY_SIZE(lguest_insns) || !lguest_insns[type].start)
942 return paravirt_patch_default(type, clobber, insns, len); 946 return paravirt_patch_default(type, clobber, ibuf, addr, len);
943 947
944 insn_len = lguest_insns[type].end - lguest_insns[type].start; 948 insn_len = lguest_insns[type].end - lguest_insns[type].start;
945 949
946 /* Similarly if we can't fit replacement (shouldn't happen, but let's 950 /* Similarly if we can't fit replacement (shouldn't happen, but let's
947 * be thorough). */ 951 * be thorough). */
948 if (len < insn_len) 952 if (len < insn_len)
949 return paravirt_patch_default(type, clobber, insns, len); 953 return paravirt_patch_default(type, clobber, ibuf, addr, len);
950 954
951 /* Copy in our instructions. */ 955 /* Copy in our instructions. */
952 memcpy(insns, lguest_insns[type].start, insn_len); 956 memcpy(ibuf, lguest_insns[type].start, insn_len);
953 return insn_len; 957 return insn_len;
954} 958}
955 959
diff --git a/drivers/lguest/lguest_bus.c b/drivers/lguest/lguest_bus.c
index 55a7940ca732..9e7752cc8002 100644
--- a/drivers/lguest/lguest_bus.c
+++ b/drivers/lguest/lguest_bus.c
@@ -5,6 +5,7 @@
5#include <linux/bootmem.h> 5#include <linux/bootmem.h>
6#include <linux/lguest_bus.h> 6#include <linux/lguest_bus.h>
7#include <asm/io.h> 7#include <asm/io.h>
8#include <asm/paravirt.h>
8 9
9static ssize_t type_show(struct device *_dev, 10static ssize_t type_show(struct device *_dev,
10 struct device_attribute *attr, char *buf) 11 struct device_attribute *attr, char *buf)
diff --git a/drivers/lguest/segments.c b/drivers/lguest/segments.c
index f675a41a80da..9b81119f46e9 100644
--- a/drivers/lguest/segments.c
+++ b/drivers/lguest/segments.c
@@ -43,22 +43,6 @@
43 * begin. 43 * begin.
44 */ 44 */
45 45
46/* Is the descriptor the Guest wants us to put in OK?
47 *
48 * The flag which Intel says must be zero: must be zero. The descriptor must
49 * be present, (this is actually checked earlier but is here for thorougness),
50 * and the descriptor type must be 1 (a memory segment). */
51static int desc_ok(const struct desc_struct *gdt)
52{
53 return ((gdt->b & 0x00209000) == 0x00009000);
54}
55
56/* Is the segment present? (Otherwise it can't be used by the Guest). */
57static int segment_present(const struct desc_struct *gdt)
58{
59 return gdt->b & 0x8000;
60}
61
62/* There are several entries we don't let the Guest set. The TSS entry is the 46/* There are several entries we don't let the Guest set. The TSS entry is the
63 * "Task State Segment" which controls all kinds of delicate things. The 47 * "Task State Segment" which controls all kinds of delicate things. The
64 * LGUEST_CS and LGUEST_DS entries are reserved for the Switcher, and the 48 * LGUEST_CS and LGUEST_DS entries are reserved for the Switcher, and the
@@ -71,37 +55,11 @@ static int ignored_gdt(unsigned int num)
71 || num == GDT_ENTRY_DOUBLEFAULT_TSS); 55 || num == GDT_ENTRY_DOUBLEFAULT_TSS);
72} 56}
73 57
74/* If the Guest asks us to remove an entry from the GDT, we have to be careful. 58/*H:610 Once the GDT has been changed, we fix the new entries up a little. We
75 * If one of the segment registers is pointing at that entry the Switcher will 59 * don't care if they're invalid: the worst that can happen is a General
76 * crash when it tries to reload the segment registers for the Guest. 60 * Protection Fault in the Switcher when it restores a Guest segment register
77 * 61 * which tries to use that entry. Then we kill the Guest for causing such a
78 * It doesn't make much sense for the Guest to try to remove its own code, data 62 * mess: the message will be "unhandled trap 256". */
79 * or stack segments while they're in use: assume that's a Guest bug. If it's
80 * one of the lesser segment registers using the removed entry, we simply set
81 * that register to 0 (unusable). */
82static void check_segment_use(struct lguest *lg, unsigned int desc)
83{
84 /* GDT entries are 8 bytes long, so we divide to get the index and
85 * ignore the bottom bits. */
86 if (lg->regs->gs / 8 == desc)
87 lg->regs->gs = 0;
88 if (lg->regs->fs / 8 == desc)
89 lg->regs->fs = 0;
90 if (lg->regs->es / 8 == desc)
91 lg->regs->es = 0;
92 if (lg->regs->ds / 8 == desc
93 || lg->regs->cs / 8 == desc
94 || lg->regs->ss / 8 == desc)
95 kill_guest(lg, "Removed live GDT entry %u", desc);
96}
97/*:*/
98/*M:009 We wouldn't need to check for removal of in-use segments if we handled
99 * faults in the Switcher. However, it's probably not a worthwhile
100 * optimization. :*/
101
102/*H:610 Once the GDT has been changed, we look through the changed entries and
103 * see if they're OK. If not, we'll call kill_guest() and the Guest will never
104 * get to use the invalid entries. */
105static void fixup_gdt_table(struct lguest *lg, unsigned start, unsigned end) 63static void fixup_gdt_table(struct lguest *lg, unsigned start, unsigned end)
106{ 64{
107 unsigned int i; 65 unsigned int i;
@@ -112,16 +70,6 @@ static void fixup_gdt_table(struct lguest *lg, unsigned start, unsigned end)
112 if (ignored_gdt(i)) 70 if (ignored_gdt(i))
113 continue; 71 continue;
114 72
115 /* We could fault in switch_to_guest if they are using
116 * a removed segment. */
117 if (!segment_present(&lg->gdt[i])) {
118 check_segment_use(lg, i);
119 continue;
120 }
121
122 if (!desc_ok(&lg->gdt[i]))
123 kill_guest(lg, "Bad GDT descriptor %i", i);
124
125 /* Segment descriptors contain a privilege level: the Guest is 73 /* Segment descriptors contain a privilege level: the Guest is
126 * sometimes careless and leaves this as 0, even though it's 74 * sometimes careless and leaves this as 0, even though it's
127 * running at privilege level 1. If so, we fix it here. */ 75 * running at privilege level 1. If so, we fix it here. */
diff --git a/drivers/lguest/switcher.S b/drivers/lguest/switcher.S
index d418179ea6b5..7c9c230cc845 100644
--- a/drivers/lguest/switcher.S
+++ b/drivers/lguest/switcher.S
@@ -47,6 +47,7 @@
47// Down here in the depths of assembler code. 47// Down here in the depths of assembler code.
48#include <linux/linkage.h> 48#include <linux/linkage.h>
49#include <asm/asm-offsets.h> 49#include <asm/asm-offsets.h>
50#include <asm/page.h>
50#include "lg.h" 51#include "lg.h"
51 52
52// We mark the start of the code to copy 53// We mark the start of the code to copy
@@ -182,13 +183,15 @@ ENTRY(switch_to_guest)
182 movl $(LGUEST_DS), %eax; \ 183 movl $(LGUEST_DS), %eax; \
183 movl %eax, %ds; \ 184 movl %eax, %ds; \
184 /* So where are we? Which CPU, which struct? \ 185 /* So where are we? Which CPU, which struct? \
185 * The stack is our clue: our TSS sets \ 186 * The stack is our clue: our TSS starts \
186 * It at the end of "struct lguest_pages" \ 187 * It at the end of "struct lguest_pages". \
187 * And we then pushed and pushed and pushed Guest regs: \ 188 * Or we may have stumbled while restoring \
188 * Now stack points atop the "struct lguest_regs". \ 189 * Our Guest segment regs while in switch_to_guest, \
189 * Subtract that offset, and we find our struct. */ \ 190 * The fault pushed atop that part-unwound stack. \
191 * If we round the stack down to the page start \
192 * We're at the start of "struct lguest_pages". */ \
190 movl %esp, %eax; \ 193 movl %esp, %eax; \
191 subl $LGUEST_PAGES_regs, %eax; \ 194 andl $(~(1 << PAGE_SHIFT - 1)), %eax; \
192 /* Save our trap number: the switch will obscure it \ 195 /* Save our trap number: the switch will obscure it \
193 * (The Guest regs are not mapped here in the Host) \ 196 * (The Guest regs are not mapped here in the Host) \
194 * %ebx holds it safe for deliver_to_host */ \ 197 * %ebx holds it safe for deliver_to_host */ \
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 141ff9fa296e..2120155929a6 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -580,8 +580,8 @@ static void __map_bio(struct dm_target *ti, struct bio *clone,
580 /* the bio has been remapped so dispatch it */ 580 /* the bio has been remapped so dispatch it */
581 581
582 blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, 582 blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone,
583 tio->io->bio->bi_bdev->bd_dev, sector, 583 tio->io->bio->bi_bdev->bd_dev,
584 clone->bi_sector); 584 clone->bi_sector, sector);
585 585
586 generic_make_request(clone); 586 generic_make_request(clone);
587 } else if (r < 0 || r == DM_MAPIO_REQUEUE) { 587 } else if (r < 0 || r == DM_MAPIO_REQUEUE) {
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index e866dacde7e5..414c109f4cf5 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -88,7 +88,9 @@ module_param(mpt_channel_mapping, int, 0);
88MODULE_PARM_DESC(mpt_channel_mapping, " Mapping id's to channels (default=0)"); 88MODULE_PARM_DESC(mpt_channel_mapping, " Mapping id's to channels (default=0)");
89 89
90static int mpt_debug_level; 90static int mpt_debug_level;
91module_param(mpt_debug_level, int, 0); 91static int mpt_set_debug_level(const char *val, struct kernel_param *kp);
92module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int,
93 &mpt_debug_level, 0600);
92MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)"); 94MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)");
93 95
94#ifdef MFCNT 96#ifdef MFCNT
@@ -220,6 +222,19 @@ pci_enable_io_access(struct pci_dev *pdev)
220 pci_write_config_word(pdev, PCI_COMMAND, command_reg); 222 pci_write_config_word(pdev, PCI_COMMAND, command_reg);
221} 223}
222 224
225static int mpt_set_debug_level(const char *val, struct kernel_param *kp)
226{
227 int ret = param_set_int(val, kp);
228 MPT_ADAPTER *ioc;
229
230 if (ret)
231 return ret;
232
233 list_for_each_entry(ioc, &ioc_list, list)
234 ioc->debug_level = mpt_debug_level;
235 return 0;
236}
237
223/* 238/*
224 * Process turbo (context) reply... 239 * Process turbo (context) reply...
225 */ 240 */
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 29add83da588..b9c69bff218c 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1312,11 +1312,137 @@ mptsas_get_bay_identifier(struct sas_rphy *rphy)
1312 return rc; 1312 return rc;
1313} 1313}
1314 1314
1315static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
1316 struct request *req)
1317{
1318 MPT_ADAPTER *ioc = ((MPT_SCSI_HOST *) shost->hostdata)->ioc;
1319 MPT_FRAME_HDR *mf;
1320 SmpPassthroughRequest_t *smpreq;
1321 struct request *rsp = req->next_rq;
1322 int ret;
1323 int flagsLength;
1324 unsigned long timeleft;
1325 char *psge;
1326 dma_addr_t dma_addr_in = 0;
1327 dma_addr_t dma_addr_out = 0;
1328 u64 sas_address = 0;
1329
1330 if (!rsp) {
1331 printk(KERN_ERR "%s: the smp response space is missing\n",
1332 __FUNCTION__);
1333 return -EINVAL;
1334 }
1335
1336 /* do we need to support multiple segments? */
1337 if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) {
1338 printk(KERN_ERR "%s: multiple segments req %u %u, rsp %u %u\n",
1339 __FUNCTION__, req->bio->bi_vcnt, req->data_len,
1340 rsp->bio->bi_vcnt, rsp->data_len);
1341 return -EINVAL;
1342 }
1343
1344 ret = mutex_lock_interruptible(&ioc->sas_mgmt.mutex);
1345 if (ret)
1346 goto out;
1347
1348 mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc);
1349 if (!mf) {
1350 ret = -ENOMEM;
1351 goto out_unlock;
1352 }
1353
1354 smpreq = (SmpPassthroughRequest_t *)mf;
1355 memset(smpreq, 0, sizeof(*smpreq));
1356
1357 smpreq->RequestDataLength = cpu_to_le16(req->data_len - 4);
1358 smpreq->Function = MPI_FUNCTION_SMP_PASSTHROUGH;
1359
1360 if (rphy)
1361 sas_address = rphy->identify.sas_address;
1362 else {
1363 struct mptsas_portinfo *port_info;
1364
1365 mutex_lock(&ioc->sas_topology_mutex);
1366 port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle);
1367 if (port_info && port_info->phy_info)
1368 sas_address =
1369 port_info->phy_info[0].phy->identify.sas_address;
1370 mutex_unlock(&ioc->sas_topology_mutex);
1371 }
1372
1373 *((u64 *)&smpreq->SASAddress) = cpu_to_le64(sas_address);
1374
1375 psge = (char *)
1376 (((int *) mf) + (offsetof(SmpPassthroughRequest_t, SGL) / 4));
1377
1378 /* request */
1379 flagsLength = (MPI_SGE_FLAGS_SIMPLE_ELEMENT |
1380 MPI_SGE_FLAGS_END_OF_BUFFER |
1381 MPI_SGE_FLAGS_DIRECTION |
1382 mpt_addr_size()) << MPI_SGE_FLAGS_SHIFT;
1383 flagsLength |= (req->data_len - 4);
1384
1385 dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio),
1386 req->data_len, PCI_DMA_BIDIRECTIONAL);
1387 if (!dma_addr_out)
1388 goto put_mf;
1389 mpt_add_sge(psge, flagsLength, dma_addr_out);
1390 psge += (sizeof(u32) + sizeof(dma_addr_t));
1391
1392 /* response */
1393 flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ;
1394 flagsLength |= rsp->data_len + 4;
1395 dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio),
1396 rsp->data_len, PCI_DMA_BIDIRECTIONAL);
1397 if (!dma_addr_in)
1398 goto unmap;
1399 mpt_add_sge(psge, flagsLength, dma_addr_in);
1400
1401 mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf);
1402
1403 timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ);
1404 if (!timeleft) {
1405 printk(KERN_ERR "%s: smp timeout!\n", __FUNCTION__);
1406 /* On timeout reset the board */
1407 mpt_HardResetHandler(ioc, CAN_SLEEP);
1408 ret = -ETIMEDOUT;
1409 goto unmap;
1410 }
1411 mf = NULL;
1412
1413 if (ioc->sas_mgmt.status & MPT_IOCTL_STATUS_RF_VALID) {
1414 SmpPassthroughReply_t *smprep;
1415
1416 smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply;
1417 memcpy(req->sense, smprep, sizeof(*smprep));
1418 req->sense_len = sizeof(*smprep);
1419 } else {
1420 printk(KERN_ERR "%s: smp passthru reply failed to be returned\n",
1421 __FUNCTION__);
1422 ret = -ENXIO;
1423 }
1424unmap:
1425 if (dma_addr_out)
1426 pci_unmap_single(ioc->pcidev, dma_addr_out, req->data_len,
1427 PCI_DMA_BIDIRECTIONAL);
1428 if (dma_addr_in)
1429 pci_unmap_single(ioc->pcidev, dma_addr_in, rsp->data_len,
1430 PCI_DMA_BIDIRECTIONAL);
1431put_mf:
1432 if (mf)
1433 mpt_free_msg_frame(ioc, mf);
1434out_unlock:
1435 mutex_unlock(&ioc->sas_mgmt.mutex);
1436out:
1437 return ret;
1438}
1439
1315static struct sas_function_template mptsas_transport_functions = { 1440static struct sas_function_template mptsas_transport_functions = {
1316 .get_linkerrors = mptsas_get_linkerrors, 1441 .get_linkerrors = mptsas_get_linkerrors,
1317 .get_enclosure_identifier = mptsas_get_enclosure_identifier, 1442 .get_enclosure_identifier = mptsas_get_enclosure_identifier,
1318 .get_bay_identifier = mptsas_get_bay_identifier, 1443 .get_bay_identifier = mptsas_get_bay_identifier,
1319 .phy_reset = mptsas_phy_reset, 1444 .phy_reset = mptsas_phy_reset,
1445 .smp_handler = mptsas_smp_handler,
1320}; 1446};
1321 1447
1322static struct scsi_transport_template *mptsas_transport_template; 1448static struct scsi_transport_template *mptsas_transport_template;
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index aaaa61ea4217..518d5d335464 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -200,14 +200,22 @@ config THINKPAD_ACPI_BAY
200config THINKPAD_ACPI_INPUT_ENABLED 200config THINKPAD_ACPI_INPUT_ENABLED
201 bool "Enable input layer support by default" 201 bool "Enable input layer support by default"
202 depends on THINKPAD_ACPI 202 depends on THINKPAD_ACPI
203 default y 203 default n
204 ---help--- 204 ---help---
205 Enables hot key handling over the input layer by default. If unset, 205 This option enables thinkpad-acpi hot key handling over the input
206 the driver does not enable any hot key handling by default, and also 206 layer at driver load time. When it is unset, the driver does not
207 starts up with a mostly empty keymap. 207 enable hot key handling by default, and also starts up with a mostly
208 208 empty keymap.
209 If you are not sure, say Y here. Say N to retain the deprecated 209
210 behavior of ibm-acpi, and thinkpad-acpi for kernels up to 2.6.21. 210 This option should be enabled if you have a new enough HAL or other
211 userspace support that properly handles the thinkpad-acpi event
212 device. It auto-tunes the hot key support to those reported by the
213 firmware and enables it automatically.
214
215 If unsure, say N here to retain the old behaviour of ibm-acpi, and
216 thinkpad-acpi up to kernel 2.6.21: userspace will have to enable and
217 set up the thinkpad-acpi hot key handling using the sysfs interace
218 after loading the driver.
211 219
212 220
213endif # MISC_DEVICES 221endif # MISC_DEVICES
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 14ee06c8f127..91da6880ae93 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -845,7 +845,7 @@ static struct sony_nc_event sony_C_events[] = {
845}; 845};
846 846
847/* SNC-only model map */ 847/* SNC-only model map */
848struct dmi_system_id sony_nc_ids[] = { 848static struct dmi_system_id sony_nc_ids[] = {
849 { 849 {
850 .ident = "Sony Vaio FE Series", 850 .ident = "Sony Vaio FE Series",
851 .callback = sony_nc_C_enable, 851 .callback = sony_nc_C_enable,
@@ -942,6 +942,11 @@ static int sony_nc_resume(struct acpi_device *device)
942 } 942 }
943 } 943 }
944 944
945 /* set the last requested brightness level */
946 if (sony_backlight_device &&
947 !sony_backlight_update_status(sony_backlight_device))
948 printk(KERN_WARNING DRV_PFX "unable to restore brightness level");
949
945 /* re-initialize models with specific requirements */ 950 /* re-initialize models with specific requirements */
946 dmi_check_system(sony_nc_ids); 951 dmi_check_system(sony_nc_ids);
947 952
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index fa80f355e522..f6cd34a3dbac 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -4668,12 +4668,15 @@ static int __init thinkpad_acpi_module_init(void)
4668 thinkpad_acpi_module_exit(); 4668 thinkpad_acpi_module_exit();
4669 return ret; 4669 return ret;
4670 } 4670 }
4671 tp_features.platform_drv_registered = 1;
4672
4671 ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver); 4673 ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver);
4672 if (ret) { 4674 if (ret) {
4673 printk(IBM_ERR "unable to create sysfs driver attributes\n"); 4675 printk(IBM_ERR "unable to create sysfs driver attributes\n");
4674 thinkpad_acpi_module_exit(); 4676 thinkpad_acpi_module_exit();
4675 return ret; 4677 return ret;
4676 } 4678 }
4679 tp_features.platform_drv_attrs_registered = 1;
4677 4680
4678 4681
4679 /* Device initialization */ 4682 /* Device initialization */
@@ -4756,8 +4759,11 @@ static void thinkpad_acpi_module_exit(void)
4756 if (tpacpi_pdev) 4759 if (tpacpi_pdev)
4757 platform_device_unregister(tpacpi_pdev); 4760 platform_device_unregister(tpacpi_pdev);
4758 4761
4759 tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver); 4762 if (tp_features.platform_drv_attrs_registered)
4760 platform_driver_unregister(&tpacpi_pdriver); 4763 tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver);
4764
4765 if (tp_features.platform_drv_registered)
4766 platform_driver_unregister(&tpacpi_pdriver);
4761 4767
4762 if (proc_dir) 4768 if (proc_dir)
4763 remove_proc_entry(IBM_PROC_DIR, acpi_root_dir); 4769 remove_proc_entry(IBM_PROC_DIR, acpi_root_dir);
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 88af089d6494..eee8809a50d9 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -246,6 +246,8 @@ static struct {
246 u16 wan:1; 246 u16 wan:1;
247 u16 fan_ctrl_status_undef:1; 247 u16 fan_ctrl_status_undef:1;
248 u16 input_device_registered:1; 248 u16 input_device_registered:1;
249 u16 platform_drv_registered:1;
250 u16 platform_drv_attrs_registered:1;
249} tp_features; 251} tp_features;
250 252
251struct thinkpad_id_data { 253struct thinkpad_id_data {
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index c9a289c6c139..b0abc7d92805 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -117,7 +117,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
117 struct mmc_host *host = card->host; 117 struct mmc_host *host = card->host;
118 u64 limit = BLK_BOUNCE_HIGH; 118 u64 limit = BLK_BOUNCE_HIGH;
119 int ret; 119 int ret;
120 unsigned int bouncesz;
121 120
122 if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask) 121 if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
123 limit = *mmc_dev(host)->dma_mask; 122 limit = *mmc_dev(host)->dma_mask;
@@ -134,6 +133,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
134 133
135#ifdef CONFIG_MMC_BLOCK_BOUNCE 134#ifdef CONFIG_MMC_BLOCK_BOUNCE
136 if (host->max_hw_segs == 1) { 135 if (host->max_hw_segs == 1) {
136 unsigned int bouncesz;
137
137 bouncesz = MMC_QUEUE_BOUNCESZ; 138 bouncesz = MMC_QUEUE_BOUNCESZ;
138 139
139 if (bouncesz > host->max_req_size) 140 if (bouncesz > host->max_req_size)
@@ -156,14 +157,14 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
156 GFP_KERNEL); 157 GFP_KERNEL);
157 if (!mq->sg) { 158 if (!mq->sg) {
158 ret = -ENOMEM; 159 ret = -ENOMEM;
159 goto free_bounce_buf; 160 goto cleanup_queue;
160 } 161 }
161 162
162 mq->bounce_sg = kmalloc(sizeof(struct scatterlist) * 163 mq->bounce_sg = kmalloc(sizeof(struct scatterlist) *
163 bouncesz / 512, GFP_KERNEL); 164 bouncesz / 512, GFP_KERNEL);
164 if (!mq->bounce_sg) { 165 if (!mq->bounce_sg) {
165 ret = -ENOMEM; 166 ret = -ENOMEM;
166 goto free_sg; 167 goto cleanup_queue;
167 } 168 }
168 } 169 }
169 } 170 }
@@ -197,14 +198,13 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
197 if (mq->bounce_sg) 198 if (mq->bounce_sg)
198 kfree(mq->bounce_sg); 199 kfree(mq->bounce_sg);
199 mq->bounce_sg = NULL; 200 mq->bounce_sg = NULL;
200 free_sg: 201 cleanup_queue:
201 kfree(mq->sg); 202 if (mq->sg)
203 kfree(mq->sg);
202 mq->sg = NULL; 204 mq->sg = NULL;
203 free_bounce_buf:
204 if (mq->bounce_buf) 205 if (mq->bounce_buf)
205 kfree(mq->bounce_buf); 206 kfree(mq->bounce_buf);
206 mq->bounce_buf = NULL; 207 mq->bounce_buf = NULL;
207 cleanup_queue:
208 blk_cleanup_queue(mq->queue); 208 blk_cleanup_queue(mq->queue);
209 return ret; 209 return ret;
210} 210}
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 62564ccde03a..bfebd2fa7ada 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -83,7 +83,7 @@
83 83
84#define AT91_MCI_ERRORS (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE \ 84#define AT91_MCI_ERRORS (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE \
85 | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE \ 85 | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE \
86 | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE) 86 | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)
87 87
88#define at91_mci_read(host, reg) __raw_readl((host)->baseaddr + (reg)) 88#define at91_mci_read(host, reg) __raw_readl((host)->baseaddr + (reg))
89#define at91_mci_write(host, reg, val) __raw_writel((val), (host)->baseaddr + (reg)) 89#define at91_mci_write(host, reg, val) __raw_writel((val), (host)->baseaddr + (reg))
@@ -676,15 +676,15 @@ static irqreturn_t at91_mci_irq(int irq, void *devid)
676 676
677 int_status = at91_mci_read(host, AT91_MCI_SR); 677 int_status = at91_mci_read(host, AT91_MCI_SR);
678 int_mask = at91_mci_read(host, AT91_MCI_IMR); 678 int_mask = at91_mci_read(host, AT91_MCI_IMR);
679 679
680 pr_debug("MCI irq: status = %08X, %08X, %08X\n", int_status, int_mask, 680 pr_debug("MCI irq: status = %08X, %08X, %08X\n", int_status, int_mask,
681 int_status & int_mask); 681 int_status & int_mask);
682 682
683 int_status = int_status & int_mask; 683 int_status = int_status & int_mask;
684 684
685 if (int_status & AT91_MCI_ERRORS) { 685 if (int_status & AT91_MCI_ERRORS) {
686 completed = 1; 686 completed = 1;
687 687
688 if (int_status & AT91_MCI_UNRE) 688 if (int_status & AT91_MCI_UNRE)
689 pr_debug("MMC: Underrun error\n"); 689 pr_debug("MMC: Underrun error\n");
690 if (int_status & AT91_MCI_OVRE) 690 if (int_status & AT91_MCI_OVRE)
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index e0c9808fd424..9bf2a877113b 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -1266,7 +1266,7 @@ static int __devinit wbsd_alloc_mmc(struct device *dev)
1266 return 0; 1266 return 0;
1267} 1267}
1268 1268
1269static void __devexit wbsd_free_mmc(struct device *dev) 1269static void wbsd_free_mmc(struct device *dev)
1270{ 1270{
1271 struct mmc_host *mmc; 1271 struct mmc_host *mmc;
1272 struct wbsd_host *host; 1272 struct wbsd_host *host;
@@ -1358,7 +1358,7 @@ static int __devinit wbsd_request_region(struct wbsd_host *host, int base)
1358 return 0; 1358 return 0;
1359} 1359}
1360 1360
1361static void __devexit wbsd_release_regions(struct wbsd_host *host) 1361static void wbsd_release_regions(struct wbsd_host *host)
1362{ 1362{
1363 if (host->base) 1363 if (host->base)
1364 release_region(host->base, 8); 1364 release_region(host->base, 8);
@@ -1434,7 +1434,7 @@ err:
1434 "Falling back on FIFO.\n", dma); 1434 "Falling back on FIFO.\n", dma);
1435} 1435}
1436 1436
1437static void __devexit wbsd_release_dma(struct wbsd_host *host) 1437static void wbsd_release_dma(struct wbsd_host *host)
1438{ 1438{
1439 if (host->dma_addr) { 1439 if (host->dma_addr) {
1440 dma_unmap_single(mmc_dev(host->mmc), host->dma_addr, 1440 dma_unmap_single(mmc_dev(host->mmc), host->dma_addr,
@@ -1484,7 +1484,7 @@ static int __devinit wbsd_request_irq(struct wbsd_host *host, int irq)
1484 return 0; 1484 return 0;
1485} 1485}
1486 1486
1487static void __devexit wbsd_release_irq(struct wbsd_host *host) 1487static void wbsd_release_irq(struct wbsd_host *host)
1488{ 1488{
1489 if (!host->irq) 1489 if (!host->irq)
1490 return; 1490 return;
@@ -1535,7 +1535,7 @@ static int __devinit wbsd_request_resources(struct wbsd_host *host,
1535 * Release all resources for the host. 1535 * Release all resources for the host.
1536 */ 1536 */
1537 1537
1538static void __devexit wbsd_release_resources(struct wbsd_host *host) 1538static void wbsd_release_resources(struct wbsd_host *host)
1539{ 1539{
1540 wbsd_release_dma(host); 1540 wbsd_release_dma(host);
1541 wbsd_release_irq(host); 1541 wbsd_release_irq(host);
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 451adcc52b3c..6d958a4566ff 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -3,9 +3,9 @@
3# 3#
4 4
5# Core functionality. 5# Core functionality.
6obj-$(CONFIG_MTD) += mtd.o
6mtd-y := mtdcore.o mtdsuper.o 7mtd-y := mtdcore.o mtdsuper.o
7mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o 8mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o
8obj-$(CONFIG_MTD) += $(mtd-y)
9 9
10obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o 10obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
11obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o 11obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 8c86b802f212..d091b2430b48 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -7,6 +7,7 @@
7 7
8#include <linux/device.h> 8#include <linux/device.h>
9#include <linux/fs.h> 9#include <linux/fs.h>
10#include <linux/mm.h>
10#include <linux/err.h> 11#include <linux/err.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 9c6236852942..6174a97d7902 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -560,7 +560,3 @@ int parse_mtd_partitions(struct mtd_info *master, const char **types,
560EXPORT_SYMBOL_GPL(parse_mtd_partitions); 560EXPORT_SYMBOL_GPL(parse_mtd_partitions);
561EXPORT_SYMBOL_GPL(register_mtd_parser); 561EXPORT_SYMBOL_GPL(register_mtd_parser);
562EXPORT_SYMBOL_GPL(deregister_mtd_parser); 562EXPORT_SYMBOL_GPL(deregister_mtd_parser);
563
564MODULE_LICENSE("GPL");
565MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>");
566MODULE_DESCRIPTION("Generic support for partitioning of MTD devices");
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 001c66dd3a94..a8c0f436cdd2 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -1555,6 +1555,7 @@ vortex_up(struct net_device *dev)
1555 mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR); 1555 mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
1556 mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA); 1556 mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA);
1557 vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0); 1557 vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0);
1558 vp->mii.full_duplex = vp->full_duplex;
1558 1559
1559 vortex_check_media(dev, 1); 1560 vortex_check_media(dev, 1);
1560 } 1561 }
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 56f6389a300e..3c1984ecf36c 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1704,10 +1704,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1704 } 1704 }
1705 } 1705 }
1706 1706
1707 local_irq_save(flags); 1707 if (!spin_trylock_irqsave(&adapter->lock, flags)) {
1708 if (!spin_trylock(&adapter->lock)) {
1709 /* Can't get lock - tell upper layer to requeue */ 1708 /* Can't get lock - tell upper layer to requeue */
1710 local_irq_restore(flags);
1711 dev_printk(KERN_DEBUG, &adapter->pdev->dev, "tx locked\n"); 1709 dev_printk(KERN_DEBUG, &adapter->pdev->dev, "tx locked\n");
1712 return NETDEV_TX_LOCKED; 1710 return NETDEV_TX_LOCKED;
1713 } 1711 }
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 83da1770bafb..90e0734e6037 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -821,8 +821,9 @@ static int ax_probe(struct platform_device *pdev)
821 dev->base_addr = (unsigned long)ei_status.mem; 821 dev->base_addr = (unsigned long)ei_status.mem;
822 822
823 if (ei_status.mem == NULL) { 823 if (ei_status.mem == NULL) {
824 dev_err(&pdev->dev, "Cannot ioremap area (%08zx,%08zx)\n", 824 dev_err(&pdev->dev, "Cannot ioremap area (%08llx,%08llx)\n",
825 res->start, res->end); 825 (unsigned long long)res->start,
826 (unsigned long long)res->end);
826 827
827 ret = -ENXIO; 828 ret = -ENXIO;
828 goto exit_req; 829 goto exit_req;
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index d53dfc5bbae0..24e7f9ab3f5a 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "1.6.3" 57#define DRV_MODULE_VERSION "1.6.4"
58#define DRV_MODULE_RELDATE "July 16, 2007" 58#define DRV_MODULE_RELDATE "August 3, 2007"
59 59
60#define RUN_AT(x) (jiffies + (x)) 60#define RUN_AT(x) (jiffies + (x))
61 61
@@ -6937,6 +6937,11 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
6937 struct bnx2 *bp = netdev_priv(dev); 6937 struct bnx2 *bp = netdev_priv(dev);
6938 u32 reset_code; 6938 u32 reset_code;
6939 6939
6940 /* PCI register 4 needs to be saved whether netif_running() or not.
6941 * MSI address and data need to be saved if using MSI and
6942 * netif_running().
6943 */
6944 pci_save_state(pdev);
6940 if (!netif_running(dev)) 6945 if (!netif_running(dev))
6941 return 0; 6946 return 0;
6942 6947
@@ -6952,7 +6957,6 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
6952 reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; 6957 reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
6953 bnx2_reset_chip(bp, reset_code); 6958 bnx2_reset_chip(bp, reset_code);
6954 bnx2_free_skbs(bp); 6959 bnx2_free_skbs(bp);
6955 pci_save_state(pdev);
6956 bnx2_set_power_state(bp, pci_choose_state(pdev, state)); 6960 bnx2_set_power_state(bp, pci_choose_state(pdev, state));
6957 return 0; 6961 return 0;
6958} 6962}
@@ -6963,10 +6967,10 @@ bnx2_resume(struct pci_dev *pdev)
6963 struct net_device *dev = pci_get_drvdata(pdev); 6967 struct net_device *dev = pci_get_drvdata(pdev);
6964 struct bnx2 *bp = netdev_priv(dev); 6968 struct bnx2 *bp = netdev_priv(dev);
6965 6969
6970 pci_restore_state(pdev);
6966 if (!netif_running(dev)) 6971 if (!netif_running(dev))
6967 return 0; 6972 return 0;
6968 6973
6969 pci_restore_state(pdev);
6970 bnx2_set_power_state(bp, PCI_D0); 6974 bnx2_set_power_state(bp, PCI_D0);
6971 netif_device_attach(dev); 6975 netif_device_attach(dev);
6972 bnx2_init_nic(bp); 6976 bnx2_init_nic(bp);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 070b78d959cc..1afda3230def 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1202,43 +1202,35 @@ static int bond_sethwaddr(struct net_device *bond_dev,
1202 return 0; 1202 return 0;
1203} 1203}
1204 1204
1205#define BOND_INTERSECT_FEATURES \ 1205#define BOND_VLAN_FEATURES \
1206 (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_TSO | NETIF_F_UFO) 1206 (NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX | \
1207 NETIF_F_HW_VLAN_FILTER)
1207 1208
1208/* 1209/*
1209 * Compute the common dev->feature set available to all slaves. Some 1210 * Compute the common dev->feature set available to all slaves. Some
1210 * feature bits are managed elsewhere, so preserve feature bits set on 1211 * feature bits are managed elsewhere, so preserve those feature bits
1211 * master device that are not part of the examined set. 1212 * on the master device.
1212 */ 1213 */
1213static int bond_compute_features(struct bonding *bond) 1214static int bond_compute_features(struct bonding *bond)
1214{ 1215{
1215 unsigned long features = BOND_INTERSECT_FEATURES;
1216 struct slave *slave; 1216 struct slave *slave;
1217 struct net_device *bond_dev = bond->dev; 1217 struct net_device *bond_dev = bond->dev;
1218 unsigned long features = bond_dev->features;
1218 unsigned short max_hard_header_len = ETH_HLEN; 1219 unsigned short max_hard_header_len = ETH_HLEN;
1219 int i; 1220 int i;
1220 1221
1222 features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES);
1223 features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
1224 NETIF_F_GSO_MASK | NETIF_F_NO_CSUM;
1225
1221 bond_for_each_slave(bond, slave, i) { 1226 bond_for_each_slave(bond, slave, i) {
1222 features &= (slave->dev->features & BOND_INTERSECT_FEATURES); 1227 features = netdev_compute_features(features,
1228 slave->dev->features);
1223 if (slave->dev->hard_header_len > max_hard_header_len) 1229 if (slave->dev->hard_header_len > max_hard_header_len)
1224 max_hard_header_len = slave->dev->hard_header_len; 1230 max_hard_header_len = slave->dev->hard_header_len;
1225 } 1231 }
1226 1232
1227 if ((features & NETIF_F_SG) && 1233 features |= (bond_dev->features & BOND_VLAN_FEATURES);
1228 !(features & NETIF_F_ALL_CSUM))
1229 features &= ~NETIF_F_SG;
1230
1231 /*
1232 * features will include NETIF_F_TSO (NETIF_F_UFO) iff all
1233 * slave devices support NETIF_F_TSO (NETIF_F_UFO), which
1234 * implies that all slaves also support scatter-gather
1235 * (NETIF_F_SG), which implies that features also includes
1236 * NETIF_F_SG. So no need to check whether we have an
1237 * illegal combination of NETIF_F_{TSO,UFO} and
1238 * !NETIF_F_SG
1239 */
1240
1241 features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES);
1242 bond_dev->features = features; 1234 bond_dev->features = features;
1243 bond_dev->hard_header_len = max_hard_header_len; 1235 bond_dev->hard_header_len = max_hard_header_len;
1244 1236
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index c90c92e72d2a..4c3785c9d4b8 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1706,6 +1706,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol
1706 case E1000_DEV_ID_82545EM_COPPER: 1706 case E1000_DEV_ID_82545EM_COPPER:
1707 case E1000_DEV_ID_82546GB_QUAD_COPPER: 1707 case E1000_DEV_ID_82546GB_QUAD_COPPER:
1708 case E1000_DEV_ID_82546GB_PCIE: 1708 case E1000_DEV_ID_82546GB_PCIE:
1709 case E1000_DEV_ID_82571EB_SERDES_QUAD:
1709 /* these don't support WoL at all */ 1710 /* these don't support WoL at all */
1710 wol->supported = 0; 1711 wol->supported = 0;
1711 break; 1712 break;
@@ -1723,6 +1724,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol
1723 retval = 0; 1724 retval = 0;
1724 break; 1725 break;
1725 case E1000_DEV_ID_82571EB_QUAD_COPPER: 1726 case E1000_DEV_ID_82571EB_QUAD_COPPER:
1727 case E1000_DEV_ID_82571EB_QUAD_FIBER:
1726 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: 1728 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
1727 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: 1729 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
1728 /* quad port adapters only support WoL on port A */ 1730 /* quad port adapters only support WoL on port A */
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 9be44699300b..ba120f7fb0be 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -384,7 +384,10 @@ e1000_set_mac_type(struct e1000_hw *hw)
384 case E1000_DEV_ID_82571EB_COPPER: 384 case E1000_DEV_ID_82571EB_COPPER:
385 case E1000_DEV_ID_82571EB_FIBER: 385 case E1000_DEV_ID_82571EB_FIBER:
386 case E1000_DEV_ID_82571EB_SERDES: 386 case E1000_DEV_ID_82571EB_SERDES:
387 case E1000_DEV_ID_82571EB_SERDES_DUAL:
388 case E1000_DEV_ID_82571EB_SERDES_QUAD:
387 case E1000_DEV_ID_82571EB_QUAD_COPPER: 389 case E1000_DEV_ID_82571EB_QUAD_COPPER:
390 case E1000_DEV_ID_82571EB_QUAD_FIBER:
388 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: 391 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
389 hw->mac_type = e1000_82571; 392 hw->mac_type = e1000_82571;
390 break; 393 break;
@@ -485,6 +488,8 @@ e1000_set_media_type(struct e1000_hw *hw)
485 case E1000_DEV_ID_82545GM_SERDES: 488 case E1000_DEV_ID_82545GM_SERDES:
486 case E1000_DEV_ID_82546GB_SERDES: 489 case E1000_DEV_ID_82546GB_SERDES:
487 case E1000_DEV_ID_82571EB_SERDES: 490 case E1000_DEV_ID_82571EB_SERDES:
491 case E1000_DEV_ID_82571EB_SERDES_DUAL:
492 case E1000_DEV_ID_82571EB_SERDES_QUAD:
488 case E1000_DEV_ID_82572EI_SERDES: 493 case E1000_DEV_ID_82572EI_SERDES:
489 case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: 494 case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
490 hw->media_type = e1000_media_type_internal_serdes; 495 hw->media_type = e1000_media_type_internal_serdes;
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index bd000b802ee7..fe8714655c90 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -475,7 +475,10 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw);
475#define E1000_DEV_ID_82571EB_FIBER 0x105F 475#define E1000_DEV_ID_82571EB_FIBER 0x105F
476#define E1000_DEV_ID_82571EB_SERDES 0x1060 476#define E1000_DEV_ID_82571EB_SERDES 0x1060
477#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4 477#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4
478#define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5
478#define E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE 0x10BC 479#define E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE 0x10BC
480#define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9
481#define E1000_DEV_ID_82571EB_SERDES_QUAD 0x10DA
479#define E1000_DEV_ID_82572EI_COPPER 0x107D 482#define E1000_DEV_ID_82572EI_COPPER 0x107D
480#define E1000_DEV_ID_82572EI_FIBER 0x107E 483#define E1000_DEV_ID_82572EI_FIBER 0x107E
481#define E1000_DEV_ID_82572EI_SERDES 0x107F 484#define E1000_DEV_ID_82572EI_SERDES 0x107F
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index f48b659e0c2b..4a225950fb43 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -100,6 +100,7 @@ static struct pci_device_id e1000_pci_tbl[] = {
100 INTEL_E1000_ETHERNET_DEVICE(0x1099), 100 INTEL_E1000_ETHERNET_DEVICE(0x1099),
101 INTEL_E1000_ETHERNET_DEVICE(0x109A), 101 INTEL_E1000_ETHERNET_DEVICE(0x109A),
102 INTEL_E1000_ETHERNET_DEVICE(0x10A4), 102 INTEL_E1000_ETHERNET_DEVICE(0x10A4),
103 INTEL_E1000_ETHERNET_DEVICE(0x10A5),
103 INTEL_E1000_ETHERNET_DEVICE(0x10B5), 104 INTEL_E1000_ETHERNET_DEVICE(0x10B5),
104 INTEL_E1000_ETHERNET_DEVICE(0x10B9), 105 INTEL_E1000_ETHERNET_DEVICE(0x10B9),
105 INTEL_E1000_ETHERNET_DEVICE(0x10BA), 106 INTEL_E1000_ETHERNET_DEVICE(0x10BA),
@@ -107,6 +108,8 @@ static struct pci_device_id e1000_pci_tbl[] = {
107 INTEL_E1000_ETHERNET_DEVICE(0x10BC), 108 INTEL_E1000_ETHERNET_DEVICE(0x10BC),
108 INTEL_E1000_ETHERNET_DEVICE(0x10C4), 109 INTEL_E1000_ETHERNET_DEVICE(0x10C4),
109 INTEL_E1000_ETHERNET_DEVICE(0x10C5), 110 INTEL_E1000_ETHERNET_DEVICE(0x10C5),
111 INTEL_E1000_ETHERNET_DEVICE(0x10D9),
112 INTEL_E1000_ETHERNET_DEVICE(0x10DA),
110 /* required last entry */ 113 /* required last entry */
111 {0,} 114 {0,}
112}; 115};
@@ -1096,6 +1099,7 @@ e1000_probe(struct pci_dev *pdev,
1096 break; 1099 break;
1097 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: 1100 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
1098 case E1000_DEV_ID_82571EB_QUAD_COPPER: 1101 case E1000_DEV_ID_82571EB_QUAD_COPPER:
1102 case E1000_DEV_ID_82571EB_QUAD_FIBER:
1099 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: 1103 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
1100 /* if quad port adapter, disable WoL on all but port A */ 1104 /* if quad port adapter, disable WoL on all but port A */
1101 if (global_quad_port_a != 0) 1105 if (global_quad_port_a != 0)
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 8ee2c2c86b42..d67f97bfa3a4 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -39,7 +39,7 @@
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#define DRV_NAME "ehea" 41#define DRV_NAME "ehea"
42#define DRV_VERSION "EHEA_0072" 42#define DRV_VERSION "EHEA_0073"
43 43
44/* eHEA capability flags */ 44/* eHEA capability flags */
45#define DLPAR_PORT_ADD_REM 1 45#define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 58702f54c3fb..9756211e83ce 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -1326,7 +1326,6 @@ static void write_swqe2_TSO(struct sk_buff *skb,
1326 u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0]; 1326 u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0];
1327 int skb_data_size = skb->len - skb->data_len; 1327 int skb_data_size = skb->len - skb->data_len;
1328 int headersize; 1328 int headersize;
1329 u64 tmp_addr;
1330 1329
1331 /* Packet is TCP with TSO enabled */ 1330 /* Packet is TCP with TSO enabled */
1332 swqe->tx_control |= EHEA_SWQE_TSO; 1331 swqe->tx_control |= EHEA_SWQE_TSO;
@@ -1347,9 +1346,8 @@ static void write_swqe2_TSO(struct sk_buff *skb,
1347 /* set sg1entry data */ 1346 /* set sg1entry data */
1348 sg1entry->l_key = lkey; 1347 sg1entry->l_key = lkey;
1349 sg1entry->len = skb_data_size - headersize; 1348 sg1entry->len = skb_data_size - headersize;
1350 1349 sg1entry->vaddr =
1351 tmp_addr = (u64)(skb->data + headersize); 1350 ehea_map_vaddr(skb->data + headersize);
1352 sg1entry->vaddr = ehea_map_vaddr(tmp_addr);
1353 swqe->descriptors++; 1351 swqe->descriptors++;
1354 } 1352 }
1355 } else 1353 } else
@@ -1362,7 +1360,6 @@ static void write_swqe2_nonTSO(struct sk_buff *skb,
1362 int skb_data_size = skb->len - skb->data_len; 1360 int skb_data_size = skb->len - skb->data_len;
1363 u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0]; 1361 u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0];
1364 struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry; 1362 struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry;
1365 u64 tmp_addr;
1366 1363
1367 /* Packet is any nonTSO type 1364 /* Packet is any nonTSO type
1368 * 1365 *
@@ -1379,8 +1376,8 @@ static void write_swqe2_nonTSO(struct sk_buff *skb,
1379 /* copy sg1entry data */ 1376 /* copy sg1entry data */
1380 sg1entry->l_key = lkey; 1377 sg1entry->l_key = lkey;
1381 sg1entry->len = skb_data_size - SWQE2_MAX_IMM; 1378 sg1entry->len = skb_data_size - SWQE2_MAX_IMM;
1382 tmp_addr = (u64)(skb->data + SWQE2_MAX_IMM); 1379 sg1entry->vaddr =
1383 sg1entry->vaddr = ehea_map_vaddr(tmp_addr); 1380 ehea_map_vaddr(skb->data + SWQE2_MAX_IMM);
1384 swqe->descriptors++; 1381 swqe->descriptors++;
1385 } 1382 }
1386 } else { 1383 } else {
@@ -1395,7 +1392,6 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev,
1395 struct ehea_vsgentry *sg_list, *sg1entry, *sgentry; 1392 struct ehea_vsgentry *sg_list, *sg1entry, *sgentry;
1396 skb_frag_t *frag; 1393 skb_frag_t *frag;
1397 int nfrags, sg1entry_contains_frag_data, i; 1394 int nfrags, sg1entry_contains_frag_data, i;
1398 u64 tmp_addr;
1399 1395
1400 nfrags = skb_shinfo(skb)->nr_frags; 1396 nfrags = skb_shinfo(skb)->nr_frags;
1401 sg1entry = &swqe->u.immdata_desc.sg_entry; 1397 sg1entry = &swqe->u.immdata_desc.sg_entry;
@@ -1417,9 +1413,9 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev,
1417 /* copy sg1entry data */ 1413 /* copy sg1entry data */
1418 sg1entry->l_key = lkey; 1414 sg1entry->l_key = lkey;
1419 sg1entry->len = frag->size; 1415 sg1entry->len = frag->size;
1420 tmp_addr = (u64)(page_address(frag->page) 1416 sg1entry->vaddr =
1421 + frag->page_offset); 1417 ehea_map_vaddr(page_address(frag->page)
1422 sg1entry->vaddr = ehea_map_vaddr(tmp_addr); 1418 + frag->page_offset);
1423 swqe->descriptors++; 1419 swqe->descriptors++;
1424 sg1entry_contains_frag_data = 1; 1420 sg1entry_contains_frag_data = 1;
1425 } 1421 }
@@ -1431,10 +1427,9 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev,
1431 1427
1432 sgentry->l_key = lkey; 1428 sgentry->l_key = lkey;
1433 sgentry->len = frag->size; 1429 sgentry->len = frag->size;
1434 1430 sgentry->vaddr =
1435 tmp_addr = (u64)(page_address(frag->page) 1431 ehea_map_vaddr(page_address(frag->page)
1436 + frag->page_offset); 1432 + frag->page_offset);
1437 sgentry->vaddr = ehea_map_vaddr(tmp_addr);
1438 swqe->descriptors++; 1433 swqe->descriptors++;
1439 } 1434 }
1440 } 1435 }
@@ -2165,24 +2160,18 @@ static int ehea_clean_all_portres(struct ehea_port *port)
2165 return ret; 2160 return ret;
2166} 2161}
2167 2162
2168static void ehea_remove_adapter_mr (struct ehea_adapter *adapter) 2163static void ehea_remove_adapter_mr(struct ehea_adapter *adapter)
2169{ 2164{
2170 int i; 2165 if (adapter->active_ports)
2171 2166 return;
2172 for (i=0; i < EHEA_MAX_PORTS; i++)
2173 if (adapter->port[i])
2174 return;
2175 2167
2176 ehea_rem_mr(&adapter->mr); 2168 ehea_rem_mr(&adapter->mr);
2177} 2169}
2178 2170
2179static int ehea_add_adapter_mr (struct ehea_adapter *adapter) 2171static int ehea_add_adapter_mr(struct ehea_adapter *adapter)
2180{ 2172{
2181 int i; 2173 if (adapter->active_ports)
2182 2174 return 0;
2183 for (i=0; i < EHEA_MAX_PORTS; i++)
2184 if (adapter->port[i])
2185 return 0;
2186 2175
2187 return ehea_reg_kernel_mr(adapter, &adapter->mr); 2176 return ehea_reg_kernel_mr(adapter, &adapter->mr);
2188} 2177}
@@ -3099,6 +3088,7 @@ out:
3099 3088
3100static void __exit ehea_module_exit(void) 3089static void __exit ehea_module_exit(void)
3101{ 3090{
3091 destroy_workqueue(ehea_driver_wq);
3102 driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); 3092 driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
3103 ibmebus_unregister_driver(&ehea_driver); 3093 ibmebus_unregister_driver(&ehea_driver);
3104 ehea_destroy_busmap(); 3094 ehea_destroy_busmap();
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index d96eb7229548..acba90f1638e 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -963,7 +963,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
963{ 963{
964 int rc, i; 964 int rc, i;
965 struct net_device *netdev; 965 struct net_device *netdev;
966 struct ibmveth_adapter *adapter = NULL; 966 struct ibmveth_adapter *adapter;
967 967
968 unsigned char *mac_addr_p; 968 unsigned char *mac_addr_p;
969 unsigned int *mcastFilterSize_p; 969 unsigned int *mcastFilterSize_p;
@@ -997,7 +997,6 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
997 SET_MODULE_OWNER(netdev); 997 SET_MODULE_OWNER(netdev);
998 998
999 adapter = netdev->priv; 999 adapter = netdev->priv;
1000 memset(adapter, 0, sizeof(adapter));
1001 dev->dev.driver_data = netdev; 1000 dev->dev.driver_data = netdev;
1002 1001
1003 adapter->vdev = dev; 1002 adapter->vdev = dev;
@@ -1280,24 +1279,28 @@ const char * buf, size_t count)
1280 int i; 1279 int i;
1281 /* Make sure there is a buffer pool with buffers that 1280 /* Make sure there is a buffer pool with buffers that
1282 can hold a packet of the size of the MTU */ 1281 can hold a packet of the size of the MTU */
1283 for(i = 0; i<IbmVethNumBufferPools; i++) { 1282 for (i = 0; i < IbmVethNumBufferPools; i++) {
1284 if (pool == &adapter->rx_buff_pool[i]) 1283 if (pool == &adapter->rx_buff_pool[i])
1285 continue; 1284 continue;
1286 if (!adapter->rx_buff_pool[i].active) 1285 if (!adapter->rx_buff_pool[i].active)
1287 continue; 1286 continue;
1288 if (mtu < adapter->rx_buff_pool[i].buff_size) { 1287 if (mtu <= adapter->rx_buff_pool[i].buff_size)
1289 pool->active = 0; 1288 break;
1290 h_free_logical_lan_buffer(adapter->
1291 vdev->
1292 unit_address,
1293 pool->
1294 buff_size);
1295 }
1296 } 1289 }
1297 if (pool->active) { 1290
1291 if (i == IbmVethNumBufferPools) {
1298 ibmveth_error_printk("no active pool >= MTU\n"); 1292 ibmveth_error_printk("no active pool >= MTU\n");
1299 return -EPERM; 1293 return -EPERM;
1300 } 1294 }
1295
1296 pool->active = 0;
1297 if (netif_running(netdev)) {
1298 adapter->pool_config = 1;
1299 ibmveth_close(netdev);
1300 adapter->pool_config = 0;
1301 if ((rc = ibmveth_open(netdev)))
1302 return rc;
1303 }
1301 } 1304 }
1302 } else if (attr == &veth_num_attr) { 1305 } else if (attr == &veth_num_attr) {
1303 if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT) 1306 if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT)
diff --git a/drivers/net/ibmveth.h b/drivers/net/ibmveth.h
index bb69ccae8ace..72cc15a6cab7 100644
--- a/drivers/net/ibmveth.h
+++ b/drivers/net/ibmveth.h
@@ -73,9 +73,6 @@ static inline long h_send_logical_lan(unsigned long unit_address,
73#define h_change_logical_lan_mac(ua, mac) \ 73#define h_change_logical_lan_mac(ua, mac) \
74 plpar_hcall_norets(H_CHANGE_LOGICAL_LAN_MAC, ua, mac) 74 plpar_hcall_norets(H_CHANGE_LOGICAL_LAN_MAC, ua, mac)
75 75
76#define h_free_logical_lan_buffer(ua, bufsize) \
77 plpar_hcall_norets(H_FREE_LOGICAL_LAN_BUFFER, ua, bufsize)
78
79#define IbmVethNumBufferPools 5 76#define IbmVethNumBufferPools 5
80#define IBMVETH_BUFF_OH 22 /* Overhead: 14 ethernet header + 8 opaque handle */ 77#define IBMVETH_BUFF_OH 22 /* Overhead: 14 ethernet header + 8 opaque handle */
81#define IBMVETH_MAX_MTU 68 78#define IBMVETH_MAX_MTU 68
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 0ac240ca905b..3b0fd83fa266 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1561,10 +1561,9 @@ static inline struct irda_class_desc *irda_usb_find_class_desc(struct usb_interf
1561 struct irda_class_desc *desc; 1561 struct irda_class_desc *desc;
1562 int ret; 1562 int ret;
1563 1563
1564 desc = kmalloc(sizeof (*desc), GFP_KERNEL); 1564 desc = kzalloc(sizeof(*desc), GFP_KERNEL);
1565 if (desc == NULL) 1565 if (!desc)
1566 return NULL; 1566 return NULL;
1567 memset(desc, 0, sizeof(*desc));
1568 1567
1569 /* USB-IrDA class spec 1.0: 1568 /* USB-IrDA class spec 1.0:
1570 * 6.1.3: Standard "Get Descriptor" Device Request is not 1569 * 6.1.3: Standard "Get Descriptor" Device Request is not
@@ -1617,7 +1616,7 @@ static int irda_usb_probe(struct usb_interface *intf,
1617{ 1616{
1618 struct net_device *net; 1617 struct net_device *net;
1619 struct usb_device *dev = interface_to_usbdev(intf); 1618 struct usb_device *dev = interface_to_usbdev(intf);
1620 struct irda_usb_cb *self = NULL; 1619 struct irda_usb_cb *self;
1621 struct usb_host_interface *interface; 1620 struct usb_host_interface *interface;
1622 struct irda_class_desc *irda_desc; 1621 struct irda_class_desc *irda_desc;
1623 int ret = -ENOMEM; 1622 int ret = -ENOMEM;
@@ -1655,7 +1654,7 @@ static int irda_usb_probe(struct usb_interface *intf,
1655 self->header_length = USB_IRDA_HEADER; 1654 self->header_length = USB_IRDA_HEADER;
1656 } 1655 }
1657 1656
1658 self->rx_urb = kzalloc(self->max_rx_urb * sizeof(struct urb *), 1657 self->rx_urb = kcalloc(self->max_rx_urb, sizeof(struct urb *),
1659 GFP_KERNEL); 1658 GFP_KERNEL);
1660 1659
1661 for (i = 0; i < self->max_rx_urb; i++) { 1660 for (i = 0; i < self->max_rx_urb; i++) {
@@ -1715,7 +1714,7 @@ static int irda_usb_probe(struct usb_interface *intf,
1715 /* Find IrDA class descriptor */ 1714 /* Find IrDA class descriptor */
1716 irda_desc = irda_usb_find_class_desc(intf); 1715 irda_desc = irda_usb_find_class_desc(intf);
1717 ret = -ENODEV; 1716 ret = -ENODEV;
1718 if (irda_desc == NULL) 1717 if (!irda_desc)
1719 goto err_out_3; 1718 goto err_out_3;
1720 1719
1721 if (self->needspatch) { 1720 if (self->needspatch) {
@@ -1738,15 +1737,13 @@ static int irda_usb_probe(struct usb_interface *intf,
1738 /* Don't change this buffer size and allocation without doing 1737 /* Don't change this buffer size and allocation without doing
1739 * some heavy and complete testing. Don't ask why :-( 1738 * some heavy and complete testing. Don't ask why :-(
1740 * Jean II */ 1739 * Jean II */
1741 self->speed_buff = kmalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); 1740 self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL);
1742 if (self->speed_buff == NULL) 1741 if (!self->speed_buff)
1743 goto err_out_3; 1742 goto err_out_3;
1744 1743
1745 memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU);
1746
1747 self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length, 1744 self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length,
1748 GFP_KERNEL); 1745 GFP_KERNEL);
1749 if (self->tx_buff == NULL) 1746 if (!self->tx_buff)
1750 goto err_out_4; 1747 goto err_out_4;
1751 1748
1752 ret = irda_usb_open(self); 1749 ret = irda_usb_open(self);
@@ -1767,12 +1764,11 @@ static int irda_usb_probe(struct usb_interface *intf,
1767 1764
1768 /* replace IrDA class descriptor with what patched device is now reporting */ 1765 /* replace IrDA class descriptor with what patched device is now reporting */
1769 irda_desc = irda_usb_find_class_desc (self->usbintf); 1766 irda_desc = irda_usb_find_class_desc (self->usbintf);
1770 if (irda_desc == NULL) { 1767 if (!irda_desc) {
1771 ret = -ENODEV; 1768 ret = -ENODEV;
1772 goto err_out_6; 1769 goto err_out_6;
1773 } 1770 }
1774 if (self->irda_desc) 1771 kfree(self->irda_desc);
1775 kfree (self->irda_desc);
1776 self->irda_desc = irda_desc; 1772 self->irda_desc = irda_desc;
1777 irda_usb_init_qos(self); 1773 irda_usb_init_qos(self);
1778 } 1774 }
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index deca65330b0f..ae9bb7b7fd67 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -191,6 +191,7 @@ struct myri10ge_priv {
191 struct timer_list watchdog_timer; 191 struct timer_list watchdog_timer;
192 int watchdog_tx_done; 192 int watchdog_tx_done;
193 int watchdog_tx_req; 193 int watchdog_tx_req;
194 int watchdog_pause;
194 int watchdog_resets; 195 int watchdog_resets;
195 int tx_linearized; 196 int tx_linearized;
196 int pause; 197 int pause;
@@ -2800,6 +2801,7 @@ static void myri10ge_watchdog(struct work_struct *work)
2800static void myri10ge_watchdog_timer(unsigned long arg) 2801static void myri10ge_watchdog_timer(unsigned long arg)
2801{ 2802{
2802 struct myri10ge_priv *mgp; 2803 struct myri10ge_priv *mgp;
2804 u32 rx_pause_cnt;
2803 2805
2804 mgp = (struct myri10ge_priv *)arg; 2806 mgp = (struct myri10ge_priv *)arg;
2805 2807
@@ -2816,19 +2818,28 @@ static void myri10ge_watchdog_timer(unsigned long arg)
2816 myri10ge_fill_thresh) 2818 myri10ge_fill_thresh)
2817 mgp->rx_big.watchdog_needed = 0; 2819 mgp->rx_big.watchdog_needed = 0;
2818 } 2820 }
2821 rx_pause_cnt = ntohl(mgp->fw_stats->dropped_pause);
2819 2822
2820 if (mgp->tx.req != mgp->tx.done && 2823 if (mgp->tx.req != mgp->tx.done &&
2821 mgp->tx.done == mgp->watchdog_tx_done && 2824 mgp->tx.done == mgp->watchdog_tx_done &&
2822 mgp->watchdog_tx_req != mgp->watchdog_tx_done) 2825 mgp->watchdog_tx_req != mgp->watchdog_tx_done) {
2823 /* nic seems like it might be stuck.. */ 2826 /* nic seems like it might be stuck.. */
2824 schedule_work(&mgp->watchdog_work); 2827 if (rx_pause_cnt != mgp->watchdog_pause) {
2825 else 2828 if (net_ratelimit())
2826 /* rearm timer */ 2829 printk(KERN_WARNING "myri10ge %s:"
2827 mod_timer(&mgp->watchdog_timer, 2830 "TX paused, check link partner\n",
2828 jiffies + myri10ge_watchdog_timeout * HZ); 2831 mgp->dev->name);
2829 2832 } else {
2833 schedule_work(&mgp->watchdog_work);
2834 return;
2835 }
2836 }
2837 /* rearm timer */
2838 mod_timer(&mgp->watchdog_timer,
2839 jiffies + myri10ge_watchdog_timeout * HZ);
2830 mgp->watchdog_tx_done = mgp->tx.done; 2840 mgp->watchdog_tx_done = mgp->tx.done;
2831 mgp->watchdog_tx_req = mgp->tx.req; 2841 mgp->watchdog_tx_req = mgp->tx.req;
2842 mgp->watchdog_pause = rx_pause_cnt;
2832} 2843}
2833 2844
2834static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 2845static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 6bb48ba80964..b47a12d684f9 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -2438,13 +2438,16 @@ static void netdev_error(struct net_device *dev, int intr_status)
2438 dev->name); 2438 dev->name);
2439 } 2439 }
2440 np->stats.rx_fifo_errors++; 2440 np->stats.rx_fifo_errors++;
2441 np->stats.rx_errors++;
2441 } 2442 }
2442 /* Hmmmmm, it's not clear how to recover from PCI faults. */ 2443 /* Hmmmmm, it's not clear how to recover from PCI faults. */
2443 if (intr_status & IntrPCIErr) { 2444 if (intr_status & IntrPCIErr) {
2444 printk(KERN_NOTICE "%s: PCI error %#08x\n", dev->name, 2445 printk(KERN_NOTICE "%s: PCI error %#08x\n", dev->name,
2445 intr_status & IntrPCIErr); 2446 intr_status & IntrPCIErr);
2446 np->stats.tx_fifo_errors++; 2447 np->stats.tx_fifo_errors++;
2448 np->stats.tx_errors++;
2447 np->stats.rx_fifo_errors++; 2449 np->stats.rx_fifo_errors++;
2450 np->stats.rx_errors++;
2448 } 2451 }
2449 spin_unlock(&np->lock); 2452 spin_unlock(&np->lock);
2450} 2453}
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index f71dab347667..e323efd4ed18 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -261,7 +261,7 @@ void phy_sanitize_settings(struct phy_device *phydev)
261 261
262 /* Sanitize settings based on PHY capabilities */ 262 /* Sanitize settings based on PHY capabilities */
263 if ((features & SUPPORTED_Autoneg) == 0) 263 if ((features & SUPPORTED_Autoneg) == 0)
264 phydev->autoneg = 0; 264 phydev->autoneg = AUTONEG_DISABLE;
265 265
266 idx = phy_find_valid(phy_find_setting(phydev->speed, phydev->duplex), 266 idx = phy_find_valid(phy_find_setting(phydev->speed, phydev->duplex),
267 features); 267 features);
@@ -374,7 +374,7 @@ int phy_mii_ioctl(struct phy_device *phydev,
374 if (mii_data->phy_id == phydev->addr) { 374 if (mii_data->phy_id == phydev->addr) {
375 switch(mii_data->reg_num) { 375 switch(mii_data->reg_num) {
376 case MII_BMCR: 376 case MII_BMCR:
377 if (val & (BMCR_RESET|BMCR_ANENABLE)) 377 if ((val & (BMCR_RESET|BMCR_ANENABLE)) == 0)
378 phydev->autoneg = AUTONEG_DISABLE; 378 phydev->autoneg = AUTONEG_DISABLE;
379 else 379 else
380 phydev->autoneg = AUTONEG_ENABLE; 380 phydev->autoneg = AUTONEG_ENABLE;
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index c9333b9dd51a..b85ab4a8f2a3 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -725,6 +725,12 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
725 725
726 auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; 726 auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
727 727
728 if (tp->mac_version == RTL_GIGA_MAC_VER_12) {
729 /* Vendor specific (0x1f) and reserved (0x0e) MII registers. */
730 mdio_write(ioaddr, 0x1f, 0x0000);
731 mdio_write(ioaddr, 0x0e, 0x0000);
732 }
733
728 tp->phy_auto_nego_reg = auto_nego; 734 tp->phy_auto_nego_reg = auto_nego;
729 tp->phy_1000_ctrl_reg = giga_ctrl; 735 tp->phy_1000_ctrl_reg = giga_ctrl;
730 736
@@ -2760,14 +2766,16 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
2760 rtl8169_check_link_status(dev, tp, ioaddr); 2766 rtl8169_check_link_status(dev, tp, ioaddr);
2761 2767
2762#ifdef CONFIG_R8169_NAPI 2768#ifdef CONFIG_R8169_NAPI
2763 RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event); 2769 if (status & tp->napi_event) {
2764 tp->intr_mask = ~tp->napi_event; 2770 RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event);
2765 2771 tp->intr_mask = ~tp->napi_event;
2766 if (likely(netif_rx_schedule_prep(dev))) 2772
2767 __netif_rx_schedule(dev); 2773 if (likely(netif_rx_schedule_prep(dev)))
2768 else if (netif_msg_intr(tp)) { 2774 __netif_rx_schedule(dev);
2769 printk(KERN_INFO "%s: interrupt %04x taken in poll\n", 2775 else if (netif_msg_intr(tp)) {
2770 dev->name, status); 2776 printk(KERN_INFO "%s: interrupt %04x in poll\n",
2777 dev->name, status);
2778 }
2771 } 2779 }
2772 break; 2780 break;
2773#else 2781#else
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 2be0a0f1b48f..24feb00600ee 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -2430,7 +2430,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
2430 (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) { 2430 (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) {
2431 pci_unmap_single 2431 pci_unmap_single
2432 (nic->pdev, 2432 (nic->pdev,
2433 (dma_addr_t)skb->data, 2433 (dma_addr_t)rxdp3->Buffer2_ptr,
2434 dev->mtu + 4, 2434 dev->mtu + 4,
2435 PCI_DMA_FROMDEVICE); 2435 PCI_DMA_FROMDEVICE);
2436 goto pci_map_failed; 2436 goto pci_map_failed;
@@ -6211,7 +6211,7 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6211 if( (rxdp3->Buffer0_ptr == 0) || 6211 if( (rxdp3->Buffer0_ptr == 0) ||
6212 (rxdp3->Buffer0_ptr == DMA_ERROR_CODE)) { 6212 (rxdp3->Buffer0_ptr == DMA_ERROR_CODE)) {
6213 pci_unmap_single (sp->pdev, 6213 pci_unmap_single (sp->pdev,
6214 (dma_addr_t)(*skb)->data, 6214 (dma_addr_t)rxdp3->Buffer2_ptr,
6215 dev->mtu + 4, PCI_DMA_FROMDEVICE); 6215 dev->mtu + 4, PCI_DMA_FROMDEVICE);
6216 goto memalloc_failed; 6216 goto memalloc_failed;
6217 } 6217 }
@@ -6224,7 +6224,10 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6224 if( (rxdp3->Buffer1_ptr == 0) || 6224 if( (rxdp3->Buffer1_ptr == 0) ||
6225 (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) { 6225 (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) {
6226 pci_unmap_single (sp->pdev, 6226 pci_unmap_single (sp->pdev,
6227 (dma_addr_t)(*skb)->data, 6227 (dma_addr_t)rxdp3->Buffer0_ptr,
6228 BUF0_LEN, PCI_DMA_FROMDEVICE);
6229 pci_unmap_single (sp->pdev,
6230 (dma_addr_t)rxdp3->Buffer2_ptr,
6228 dev->mtu + 4, PCI_DMA_FROMDEVICE); 6231 dev->mtu + 4, PCI_DMA_FROMDEVICE);
6229 goto memalloc_failed; 6232 goto memalloc_failed;
6230 } 6233 }
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index ec2ad9f0efa2..d470b19c0810 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -1593,6 +1593,9 @@ static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev,
1593 pci_name(pdev)); 1593 pci_name(pdev));
1594 1594
1595 isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0965, NULL); 1595 isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0965, NULL);
1596 if (!isa_bridge)
1597 isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0966, NULL);
1598
1596 if (!isa_bridge) { 1599 if (!isa_bridge) {
1597 net_probe(tp, KERN_INFO "%s: Can not find ISA bridge.\n", 1600 net_probe(tp, KERN_INFO "%s: Can not find ISA bridge.\n",
1598 pci_name(pdev)); 1601 pci_name(pdev));
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index f8429449dc1e..6ff3a1627af8 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -299,7 +299,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
299 299
300#define SMC_CAN_USE_8BIT 1 300#define SMC_CAN_USE_8BIT 1
301#define SMC_CAN_USE_16BIT 1 301#define SMC_CAN_USE_16BIT 1
302#define SMC_CAN_USE_32BIT 1 302#define SMC_CAN_USE_32BIT 0
303 303
304#define SMC_inb(a, r) inb((a) + (r)) 304#define SMC_inb(a, r) inb((a) + (r))
305#define SMC_inw(a, r) inw((a) + (r)) 305#define SMC_inw(a, r) inw((a) + (r))
@@ -310,8 +310,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
310 310
311#endif /* BOARDS */ 311#endif /* BOARDS */
312 312
313#define set_irq_type(irq, type) do {} while (0)
314
315#elif defined(CONFIG_M32R) 313#elif defined(CONFIG_M32R)
316 314
317#define SMC_CAN_USE_8BIT 0 315#define SMC_CAN_USE_8BIT 0
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index dc41c055ebb5..58740428dd07 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.79" 67#define DRV_MODULE_VERSION "3.80"
68#define DRV_MODULE_RELDATE "July 18, 2007" 68#define DRV_MODULE_RELDATE "August 2, 2007"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -12111,6 +12111,12 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
12111 struct tg3 *tp = netdev_priv(dev); 12111 struct tg3 *tp = netdev_priv(dev);
12112 int err; 12112 int err;
12113 12113
12114 /* PCI register 4 needs to be saved whether netif_running() or not.
12115 * MSI address and data need to be saved if using MSI and
12116 * netif_running().
12117 */
12118 pci_save_state(pdev);
12119
12114 if (!netif_running(dev)) 12120 if (!netif_running(dev))
12115 return 0; 12121 return 0;
12116 12122
@@ -12130,9 +12136,6 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
12130 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; 12136 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
12131 tg3_full_unlock(tp); 12137 tg3_full_unlock(tp);
12132 12138
12133 /* Save MSI address and data for resume. */
12134 pci_save_state(pdev);
12135
12136 err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); 12139 err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
12137 if (err) { 12140 if (err) {
12138 tg3_full_lock(tp, 0); 12141 tg3_full_lock(tp, 0);
@@ -12160,11 +12163,11 @@ static int tg3_resume(struct pci_dev *pdev)
12160 struct tg3 *tp = netdev_priv(dev); 12163 struct tg3 *tp = netdev_priv(dev);
12161 int err; 12164 int err;
12162 12165
12166 pci_restore_state(tp->pdev);
12167
12163 if (!netif_running(dev)) 12168 if (!netif_running(dev))
12164 return 0; 12169 return 0;
12165 12170
12166 pci_restore_state(tp->pdev);
12167
12168 err = tg3_set_power_state(tp, PCI_D0); 12171 err = tg3_set_power_state(tp, PCI_D0);
12169 if (err) 12172 if (err)
12170 return err; 12173 return err;
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index a8994c7b8583..64bef7c12365 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -379,7 +379,6 @@ static const struct ethtool_ops uec_ethtool_ops = {
379 .get_stats_count = uec_get_stats_count, 379 .get_stats_count = uec_get_stats_count,
380 .get_strings = uec_get_strings, 380 .get_strings = uec_get_strings,
381 .get_ethtool_stats = uec_get_ethtool_stats, 381 .get_ethtool_stats = uec_get_ethtool_stats,
382 .get_perm_addr = ethtool_op_get_perm_addr,
383}; 382};
384 383
385void uec_set_ethtool_ops(struct net_device *netdev) 384void uec_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 5f8c2d30a328..6c257b88ce51 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -272,7 +272,8 @@ int __init uec_mdio_init(void)
272 return of_register_platform_driver(&uec_mdio_driver); 272 return of_register_platform_driver(&uec_mdio_driver);
273} 273}
274 274
275void __exit uec_mdio_exit(void) 275/* called from __init ucc_geth_init, therefore can not be __exit */
276void uec_mdio_exit(void)
276{ 277{
277 of_unregister_platform_driver(&uec_mdio_driver); 278 of_unregister_platform_driver(&uec_mdio_driver);
278} 279}
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index c3fe230695a0..b56dff26772d 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -42,7 +42,13 @@ static int max_interrupt_work = 20;
42 42
43/* Set the copy breakpoint for the copy-only-tiny-frames scheme. 43/* Set the copy breakpoint for the copy-only-tiny-frames scheme.
44 Setting to > 1518 effectively disables this feature. */ 44 Setting to > 1518 effectively disables this feature. */
45#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \
46 || defined(CONFIG_SPARC) || defined(__ia64__) \
47 || defined(__sh__) || defined(__mips__)
48static int rx_copybreak = 1518;
49#else
45static int rx_copybreak; 50static int rx_copybreak;
51#endif
46 52
47/* Work-around for broken BIOSes: they are unable to get the chip back out of 53/* Work-around for broken BIOSes: they are unable to get the chip back out of
48 power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */ 54 power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index 15b6e07a4382..071a64cacd5c 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -212,14 +212,13 @@ static pvc_device* add_pvc(struct net_device *dev, u16 dlci)
212 pvc_p = &(*pvc_p)->next; 212 pvc_p = &(*pvc_p)->next;
213 } 213 }
214 214
215 pvc = kmalloc(sizeof(pvc_device), GFP_ATOMIC); 215 pvc = kzalloc(sizeof(pvc_device), GFP_ATOMIC);
216#ifdef DEBUG_PVC 216#ifdef DEBUG_PVC
217 printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); 217 printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev);
218#endif 218#endif
219 if (!pvc) 219 if (!pvc)
220 return NULL; 220 return NULL;
221 221
222 memset(pvc, 0, sizeof(pvc_device));
223 pvc->dlci = dlci; 222 pvc->dlci = dlci;
224 pvc->frad = dev; 223 pvc->frad = dev;
225 pvc->next = *pvc_p; /* Put it in the chain */ 224 pvc->next = *pvc_p; /* Put it in the chain */
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index d779199c30d0..b37f1e348700 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -1638,7 +1638,7 @@ void bcm43xx_phy_set_baseband_attenuation(struct bcm43xx_private *bcm,
1638 return; 1638 return;
1639 } 1639 }
1640 1640
1641 if (phy->analog == 1) { 1641 if (phy->analog > 1) {
1642 value = bcm43xx_phy_read(bcm, 0x0060) & ~0x003C; 1642 value = bcm43xx_phy_read(bcm, 0x0060) & ~0x003C;
1643 value |= (baseband_attenuation << 2) & 0x003C; 1643 value |= (baseband_attenuation << 2) & 0x003C;
1644 } else { 1644 } else {
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index cea85894b7f2..e61c6d5ba1a9 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -466,7 +466,7 @@ static int rtl8187_add_interface(struct ieee80211_hw *dev,
466 return -EOPNOTSUPP; 466 return -EOPNOTSUPP;
467 } 467 }
468 468
469 priv->hwaddr = conf->mac_addr; 469 priv->hwaddr = conf->mac_addr ? conf->mac_addr : dev->wiphy->perm_addr;
470 470
471 return 0; 471 return 0;
472} 472}
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index f6c487aa8246..26869d107e52 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -822,7 +822,7 @@ static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs,
822 cs->control |= ZD_CS_MULTICAST; 822 cs->control |= ZD_CS_MULTICAST;
823 823
824 /* PS-POLL */ 824 /* PS-POLL */
825 if (stype == IEEE80211_STYPE_PSPOLL) 825 if (ftype == IEEE80211_FTYPE_CTL && stype == IEEE80211_STYPE_PSPOLL)
826 cs->control |= ZD_CS_PS_POLL_FRAME; 826 cs->control |= ZD_CS_PS_POLL_FRAME;
827 827
828 /* Unicast data frames over the threshold should have RTS */ 828 /* Unicast data frames over the threshold should have RTS */
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 489f69c5d6ca..4445810335a8 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -566,6 +566,10 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
566 if (notify) 566 if (notify)
567 notify_remote_via_irq(np->netdev->irq); 567 notify_remote_via_irq(np->netdev->irq);
568 568
569 np->stats.tx_bytes += skb->len;
570 np->stats.tx_packets++;
571
572 /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */
569 xennet_tx_buf_gc(dev); 573 xennet_tx_buf_gc(dev);
570 574
571 if (!netfront_tx_slot_available(np)) 575 if (!netfront_tx_slot_available(np))
@@ -573,9 +577,6 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
573 577
574 spin_unlock_irq(&np->tx_lock); 578 spin_unlock_irq(&np->tx_lock);
575 579
576 np->stats.tx_bytes += skb->len;
577 np->stats.tx_packets++;
578
579 return 0; 580 return 0;
580 581
581 drop: 582 drop:
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 3f6e176e6ea1..58c806e9c58a 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -38,7 +38,7 @@ config BATTERY_DS2760
38 38
39config BATTERY_PMU 39config BATTERY_PMU
40 tristate "Apple PMU battery" 40 tristate "Apple PMU battery"
41 depends on ADB_PMU 41 depends on PPC32 && ADB_PMU
42 help 42 help
43 Say Y here to expose battery information on Apple machines 43 Say Y here to expose battery information on Apple machines
44 through the generic battery class. 44 through the generic battery class.
diff --git a/drivers/s390/char/monwriter.c b/drivers/s390/char/monwriter.c
index 268598ef3efe..20442fbf9346 100644
--- a/drivers/s390/char/monwriter.c
+++ b/drivers/s390/char/monwriter.c
@@ -17,6 +17,7 @@
17#include <linux/miscdevice.h> 17#include <linux/miscdevice.h>
18#include <linux/ctype.h> 18#include <linux/ctype.h>
19#include <linux/poll.h> 19#include <linux/poll.h>
20#include <linux/mutex.h>
20#include <asm/uaccess.h> 21#include <asm/uaccess.h>
21#include <asm/ebcdic.h> 22#include <asm/ebcdic.h>
22#include <asm/io.h> 23#include <asm/io.h>
@@ -41,6 +42,7 @@ struct mon_private {
41 size_t hdr_to_read; 42 size_t hdr_to_read;
42 size_t data_to_read; 43 size_t data_to_read;
43 struct mon_buf *current_buf; 44 struct mon_buf *current_buf;
45 struct mutex thread_mutex;
44}; 46};
45 47
46/* 48/*
@@ -179,6 +181,7 @@ static int monwrite_open(struct inode *inode, struct file *filp)
179 return -ENOMEM; 181 return -ENOMEM;
180 INIT_LIST_HEAD(&monpriv->list); 182 INIT_LIST_HEAD(&monpriv->list);
181 monpriv->hdr_to_read = sizeof(monpriv->hdr); 183 monpriv->hdr_to_read = sizeof(monpriv->hdr);
184 mutex_init(&monpriv->thread_mutex);
182 filp->private_data = monpriv; 185 filp->private_data = monpriv;
183 return nonseekable_open(inode, filp); 186 return nonseekable_open(inode, filp);
184} 187}
@@ -209,6 +212,7 @@ static ssize_t monwrite_write(struct file *filp, const char __user *data,
209 void *to; 212 void *to;
210 int rc; 213 int rc;
211 214
215 mutex_lock(&monpriv->thread_mutex);
212 for (written = 0; written < count; ) { 216 for (written = 0; written < count; ) {
213 if (monpriv->hdr_to_read) { 217 if (monpriv->hdr_to_read) {
214 len = min(count - written, monpriv->hdr_to_read); 218 len = min(count - written, monpriv->hdr_to_read);
@@ -247,11 +251,13 @@ static ssize_t monwrite_write(struct file *filp, const char __user *data,
247 } 251 }
248 monpriv->hdr_to_read = sizeof(monpriv->hdr); 252 monpriv->hdr_to_read = sizeof(monpriv->hdr);
249 } 253 }
254 mutex_unlock(&monpriv->thread_mutex);
250 return written; 255 return written;
251 256
252out_error: 257out_error:
253 monpriv->data_to_read = 0; 258 monpriv->data_to_read = 0;
254 monpriv->hdr_to_read = sizeof(struct monwrite_hdr); 259 monpriv->hdr_to_read = sizeof(struct monwrite_hdr);
260 mutex_unlock(&monpriv->thread_mutex);
255 return rc; 261 return rc;
256} 262}
257 263
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 161867cebd8c..04b19bdc09da 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -119,10 +119,12 @@ static void urdev_put(struct urdev *urd)
119/* 119/*
120 * Low-level functions to do I/O to a ur device. 120 * Low-level functions to do I/O to a ur device.
121 * alloc_chan_prog 121 * alloc_chan_prog
122 * free_chan_prog
122 * do_ur_io 123 * do_ur_io
123 * ur_int_handler 124 * ur_int_handler
124 * 125 *
125 * alloc_chan_prog allocates and builds the channel program 126 * alloc_chan_prog allocates and builds the channel program
127 * free_chan_prog frees memory of the channel program
126 * 128 *
127 * do_ur_io issues the channel program to the device and blocks waiting 129 * do_ur_io issues the channel program to the device and blocks waiting
128 * on a completion event it publishes at urd->io_done. The function 130 * on a completion event it publishes at urd->io_done. The function
@@ -137,6 +139,16 @@ static void urdev_put(struct urdev *urd)
137 * address pointer that alloc_chan_prog returned. 139 * address pointer that alloc_chan_prog returned.
138 */ 140 */
139 141
142static void free_chan_prog(struct ccw1 *cpa)
143{
144 struct ccw1 *ptr = cpa;
145
146 while (ptr->cda) {
147 kfree((void *)(addr_t) ptr->cda);
148 ptr++;
149 }
150 kfree(cpa);
151}
140 152
141/* 153/*
142 * alloc_chan_prog 154 * alloc_chan_prog
@@ -144,44 +156,45 @@ static void urdev_put(struct urdev *urd)
144 * with a final NOP CCW command-chained on (which ensures that CE and DE 156 * with a final NOP CCW command-chained on (which ensures that CE and DE
145 * are presented together in a single interrupt instead of as separate 157 * are presented together in a single interrupt instead of as separate
146 * interrupts unless an incorrect length indication kicks in first). The 158 * interrupts unless an incorrect length indication kicks in first). The
147 * data length in each CCW is reclen. The caller must ensure that count 159 * data length in each CCW is reclen.
148 * is an integral multiple of reclen.
149 * The channel program pointer returned by this function must be freed
150 * with kfree. The caller is responsible for checking that
151 * count/reclen is not ridiculously large.
152 */ 160 */
153static struct ccw1 *alloc_chan_prog(char *buf, size_t count, size_t reclen) 161static struct ccw1 *alloc_chan_prog(const char __user *ubuf, int rec_count,
162 int reclen)
154{ 163{
155 size_t num_ccws;
156 struct ccw1 *cpa; 164 struct ccw1 *cpa;
165 void *kbuf;
157 int i; 166 int i;
158 167
159 TRACE("alloc_chan_prog(%p, %zu, %zu)\n", buf, count, reclen); 168 TRACE("alloc_chan_prog(%p, %i, %i)\n", ubuf, rec_count, reclen);
160 169
161 /* 170 /*
162 * We chain a NOP onto the writes to force CE+DE together. 171 * We chain a NOP onto the writes to force CE+DE together.
163 * That means we allocate room for CCWs to cover count/reclen 172 * That means we allocate room for CCWs to cover count/reclen
164 * records plus a NOP. 173 * records plus a NOP.
165 */ 174 */
166 num_ccws = count / reclen + 1; 175 cpa = kzalloc((rec_count + 1) * sizeof(struct ccw1),
167 cpa = kmalloc(num_ccws * sizeof(struct ccw1), GFP_KERNEL | GFP_DMA); 176 GFP_KERNEL | GFP_DMA);
168 if (!cpa) 177 if (!cpa)
169 return NULL; 178 return ERR_PTR(-ENOMEM);
170 179
171 for (i = 0; count; i++) { 180 for (i = 0; i < rec_count; i++) {
172 cpa[i].cmd_code = WRITE_CCW_CMD; 181 cpa[i].cmd_code = WRITE_CCW_CMD;
173 cpa[i].flags = CCW_FLAG_CC | CCW_FLAG_SLI; 182 cpa[i].flags = CCW_FLAG_CC | CCW_FLAG_SLI;
174 cpa[i].count = reclen; 183 cpa[i].count = reclen;
175 cpa[i].cda = __pa(buf); 184 kbuf = kmalloc(reclen, GFP_KERNEL | GFP_DMA);
176 buf += reclen; 185 if (!kbuf) {
177 count -= reclen; 186 free_chan_prog(cpa);
187 return ERR_PTR(-ENOMEM);
188 }
189 cpa[i].cda = (u32)(addr_t) kbuf;
190 if (copy_from_user(kbuf, ubuf, reclen)) {
191 free_chan_prog(cpa);
192 return ERR_PTR(-EFAULT);
193 }
194 ubuf += reclen;
178 } 195 }
179 /* The following NOP CCW forces CE+DE to be presented together */ 196 /* The following NOP CCW forces CE+DE to be presented together */
180 cpa[i].cmd_code = CCW_CMD_NOOP; 197 cpa[i].cmd_code = CCW_CMD_NOOP;
181 cpa[i].flags = 0;
182 cpa[i].count = 0;
183 cpa[i].cda = 0;
184
185 return cpa; 198 return cpa;
186} 199}
187 200
@@ -189,7 +202,7 @@ static int do_ur_io(struct urdev *urd, struct ccw1 *cpa)
189{ 202{
190 int rc; 203 int rc;
191 struct ccw_device *cdev = urd->cdev; 204 struct ccw_device *cdev = urd->cdev;
192 DECLARE_COMPLETION(event); 205 DECLARE_COMPLETION_ONSTACK(event);
193 206
194 TRACE("do_ur_io: cpa=%p\n", cpa); 207 TRACE("do_ur_io: cpa=%p\n", cpa);
195 208
@@ -325,24 +338,11 @@ static ssize_t do_write(struct urdev *urd, const char __user *udata,
325 size_t count, size_t reclen, loff_t *ppos) 338 size_t count, size_t reclen, loff_t *ppos)
326{ 339{
327 struct ccw1 *cpa; 340 struct ccw1 *cpa;
328 char *buf;
329 int rc; 341 int rc;
330 342
331 /* Data buffer must be under 2GB line for fmt1 CCWs: hence GFP_DMA */ 343 cpa = alloc_chan_prog(udata, count / reclen, reclen);
332 buf = kmalloc(count, GFP_KERNEL | GFP_DMA); 344 if (IS_ERR(cpa))
333 if (!buf) 345 return PTR_ERR(cpa);
334 return -ENOMEM;
335
336 if (copy_from_user(buf, udata, count)) {
337 rc = -EFAULT;
338 goto fail_kfree_buf;
339 }
340
341 cpa = alloc_chan_prog(buf, count, reclen);
342 if (!cpa) {
343 rc = -ENOMEM;
344 goto fail_kfree_buf;
345 }
346 346
347 rc = do_ur_io(urd, cpa); 347 rc = do_ur_io(urd, cpa);
348 if (rc) 348 if (rc)
@@ -354,10 +354,9 @@ static ssize_t do_write(struct urdev *urd, const char __user *udata,
354 } 354 }
355 *ppos += count; 355 *ppos += count;
356 rc = count; 356 rc = count;
357
357fail_kfree_cpa: 358fail_kfree_cpa:
358 kfree(cpa); 359 free_chan_prog(cpa);
359fail_kfree_buf:
360 kfree(buf);
361 return rc; 360 return rc;
362} 361}
363 362
@@ -473,7 +472,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count,
473 return rc; 472 return rc;
474 473
475 len = min((size_t) PAGE_SIZE, count); 474 len = min((size_t) PAGE_SIZE, count);
476 buf = kmalloc(PAGE_SIZE, GFP_KERNEL); 475 buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
477 if (!buf) 476 if (!buf)
478 return -ENOMEM; 477 return -ENOMEM;
479 478
@@ -500,7 +499,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count,
500 *offs += copied; 499 *offs += copied;
501 rc = copied; 500 rc = copied;
502fail: 501fail:
503 kfree(buf); 502 free_page((unsigned long) buf);
504 return rc; 503 return rc;
505} 504}
506 505
@@ -543,56 +542,97 @@ static int diag_read_next_file_info(struct file_control_block *buf, int spid)
543 } 542 }
544} 543}
545 544
546static int verify_device(struct urdev *urd) 545static int verify_uri_device(struct urdev *urd)
547{ 546{
548 struct file_control_block fcb; 547 struct file_control_block *fcb;
549 char *buf; 548 char *buf;
550 int rc; 549 int rc;
551 550
551 fcb = kmalloc(sizeof(*fcb), GFP_KERNEL | GFP_DMA);
552 if (!fcb)
553 return -ENOMEM;
554
555 /* check for empty reader device (beginning of chain) */
556 rc = diag_read_next_file_info(fcb, 0);
557 if (rc)
558 goto fail_free_fcb;
559
560 /* if file is in hold status, we do not read it */
561 if (fcb->file_stat & (FLG_SYSTEM_HOLD | FLG_USER_HOLD)) {
562 rc = -EPERM;
563 goto fail_free_fcb;
564 }
565
566 /* open file on virtual reader */
567 buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
568 if (!buf) {
569 rc = -ENOMEM;
570 goto fail_free_fcb;
571 }
572 rc = diag_read_file(urd->dev_id.devno, buf);
573 if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */
574 goto fail_free_buf;
575
576 /* check if the file on top of the queue is open now */
577 rc = diag_read_next_file_info(fcb, 0);
578 if (rc)
579 goto fail_free_buf;
580 if (!(fcb->file_stat & FLG_IN_USE)) {
581 rc = -EMFILE;
582 goto fail_free_buf;
583 }
584 rc = 0;
585
586fail_free_buf:
587 free_page((unsigned long) buf);
588fail_free_fcb:
589 kfree(fcb);
590 return rc;
591}
592
593static int verify_device(struct urdev *urd)
594{
552 switch (urd->class) { 595 switch (urd->class) {
553 case DEV_CLASS_UR_O: 596 case DEV_CLASS_UR_O:
554 return 0; /* no check needed here */ 597 return 0; /* no check needed here */
555 case DEV_CLASS_UR_I: 598 case DEV_CLASS_UR_I:
556 /* check for empty reader device (beginning of chain) */ 599 return verify_uri_device(urd);
557 rc = diag_read_next_file_info(&fcb, 0);
558 if (rc)
559 return rc;
560
561 /* open file on virtual reader */
562 buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
563 if (!buf)
564 return -ENOMEM;
565 rc = diag_read_file(urd->dev_id.devno, buf);
566 kfree(buf);
567
568 if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */
569 return rc;
570 return 0;
571 default: 600 default:
572 return -ENOTSUPP; 601 return -ENOTSUPP;
573 } 602 }
574} 603}
575 604
576static int get_file_reclen(struct urdev *urd) 605static int get_uri_file_reclen(struct urdev *urd)
577{ 606{
578 struct file_control_block fcb; 607 struct file_control_block *fcb;
579 int rc; 608 int rc;
580 609
610 fcb = kmalloc(sizeof(*fcb), GFP_KERNEL | GFP_DMA);
611 if (!fcb)
612 return -ENOMEM;
613 rc = diag_read_next_file_info(fcb, 0);
614 if (rc)
615 goto fail_free;
616 if (fcb->file_stat & FLG_CP_DUMP)
617 rc = 0;
618 else
619 rc = fcb->rec_len;
620
621fail_free:
622 kfree(fcb);
623 return rc;
624}
625
626static int get_file_reclen(struct urdev *urd)
627{
581 switch (urd->class) { 628 switch (urd->class) {
582 case DEV_CLASS_UR_O: 629 case DEV_CLASS_UR_O:
583 return 0; 630 return 0;
584 case DEV_CLASS_UR_I: 631 case DEV_CLASS_UR_I:
585 rc = diag_read_next_file_info(&fcb, 0); 632 return get_uri_file_reclen(urd);
586 if (rc)
587 return rc;
588 break;
589 default: 633 default:
590 return -ENOTSUPP; 634 return -ENOTSUPP;
591 } 635 }
592 if (fcb.file_stat & FLG_CP_DUMP)
593 return 0;
594
595 return fcb.rec_len;
596} 636}
597 637
598static int ur_open(struct inode *inode, struct file *file) 638static int ur_open(struct inode *inode, struct file *file)
diff --git a/drivers/s390/char/vmur.h b/drivers/s390/char/vmur.h
index 16d0a4e38e40..2b3c564e0472 100644
--- a/drivers/s390/char/vmur.h
+++ b/drivers/s390/char/vmur.h
@@ -50,7 +50,10 @@ struct file_control_block {
50 char rest[200]; 50 char rest[200];
51} __attribute__ ((packed)); 51} __attribute__ ((packed));
52 52
53#define FLG_CP_DUMP 0x10 53#define FLG_SYSTEM_HOLD 0x04
54#define FLG_CP_DUMP 0x10
55#define FLG_USER_HOLD 0x20
56#define FLG_IN_USE 0x80
54 57
55/* 58/*
56 * A struct urdev is created for each ur device that is made available 59 * A struct urdev is created for each ur device that is made available
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 1c27a5a06b49..5635e656c1a3 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -79,6 +79,7 @@ css_alloc_subchannel(struct subchannel_id schid)
79 sch->schib.pmcw.intparm = (__u32)(unsigned long)sch; 79 sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;
80 ret = cio_modify(sch); 80 ret = cio_modify(sch);
81 if (ret) { 81 if (ret) {
82 kfree(sch->lock);
82 kfree(sch); 83 kfree(sch);
83 return ERR_PTR(ret); 84 return ERR_PTR(ret);
84 } 85 }
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index ed026a1dc324..03347aed2b3e 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -81,6 +81,7 @@ static __u32 volatile spare_indicator;
81static atomic_t spare_indicator_usecount; 81static atomic_t spare_indicator_usecount;
82#define QDIO_MEMPOOL_SCSSC_ELEMENTS 2 82#define QDIO_MEMPOOL_SCSSC_ELEMENTS 2
83static mempool_t *qdio_mempool_scssc; 83static mempool_t *qdio_mempool_scssc;
84static struct kmem_cache *qdio_q_cache;
84 85
85static debug_info_t *qdio_dbf_setup; 86static debug_info_t *qdio_dbf_setup;
86static debug_info_t *qdio_dbf_sbal; 87static debug_info_t *qdio_dbf_sbal;
@@ -1617,23 +1618,21 @@ static void
1617qdio_release_irq_memory(struct qdio_irq *irq_ptr) 1618qdio_release_irq_memory(struct qdio_irq *irq_ptr)
1618{ 1619{
1619 int i; 1620 int i;
1621 struct qdio_q *q;
1620 1622
1621 for (i=0;i<QDIO_MAX_QUEUES_PER_IRQ;i++) { 1623 for (i = 0; i < QDIO_MAX_QUEUES_PER_IRQ; i++) {
1622 if (!irq_ptr->input_qs[i]) 1624 q = irq_ptr->input_qs[i];
1623 goto next; 1625 if (q) {
1624 1626 free_page((unsigned long) q->slib);
1625 kfree(irq_ptr->input_qs[i]->slib); 1627 kmem_cache_free(qdio_q_cache, q);
1626 kfree(irq_ptr->input_qs[i]); 1628 }
1627 1629 q = irq_ptr->output_qs[i];
1628next: 1630 if (q) {
1629 if (!irq_ptr->output_qs[i]) 1631 free_page((unsigned long) q->slib);
1630 continue; 1632 kmem_cache_free(qdio_q_cache, q);
1631 1633 }
1632 kfree(irq_ptr->output_qs[i]->slib);
1633 kfree(irq_ptr->output_qs[i]);
1634
1635 } 1634 }
1636 kfree(irq_ptr->qdr); 1635 free_page((unsigned long) irq_ptr->qdr);
1637 free_page((unsigned long) irq_ptr); 1636 free_page((unsigned long) irq_ptr);
1638} 1637}
1639 1638
@@ -1680,44 +1679,35 @@ qdio_alloc_qs(struct qdio_irq *irq_ptr,
1680{ 1679{
1681 int i; 1680 int i;
1682 struct qdio_q *q; 1681 struct qdio_q *q;
1683 int result=-ENOMEM;
1684
1685 for (i=0;i<no_input_qs;i++) {
1686 q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL);
1687 1682
1688 if (!q) { 1683 for (i = 0; i < no_input_qs; i++) {
1689 QDIO_PRINT_ERR("kmalloc of q failed!\n"); 1684 q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL);
1690 goto out; 1685 if (!q)
1691 } 1686 return -ENOMEM;
1687 memset(q, 0, sizeof(*q));
1692 1688
1693 q->slib = kmalloc(PAGE_SIZE, GFP_KERNEL); 1689 q->slib = (struct slib *) __get_free_page(GFP_KERNEL);
1694 if (!q->slib) { 1690 if (!q->slib) {
1695 QDIO_PRINT_ERR("kmalloc of slib failed!\n"); 1691 kmem_cache_free(qdio_q_cache, q);
1696 goto out; 1692 return -ENOMEM;
1697 } 1693 }
1698
1699 irq_ptr->input_qs[i]=q; 1694 irq_ptr->input_qs[i]=q;
1700 } 1695 }
1701 1696
1702 for (i=0;i<no_output_qs;i++) { 1697 for (i = 0; i < no_output_qs; i++) {
1703 q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL); 1698 q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL);
1704 1699 if (!q)
1705 if (!q) { 1700 return -ENOMEM;
1706 goto out; 1701 memset(q, 0, sizeof(*q));
1707 }
1708 1702
1709 q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL); 1703 q->slib = (struct slib *) __get_free_page(GFP_KERNEL);
1710 if (!q->slib) { 1704 if (!q->slib) {
1711 QDIO_PRINT_ERR("kmalloc of slib failed!\n"); 1705 kmem_cache_free(qdio_q_cache, q);
1712 goto out; 1706 return -ENOMEM;
1713 } 1707 }
1714
1715 irq_ptr->output_qs[i]=q; 1708 irq_ptr->output_qs[i]=q;
1716 } 1709 }
1717 1710 return 0;
1718 result=0;
1719out:
1720 return result;
1721} 1711}
1722 1712
1723static void 1713static void
@@ -2985,17 +2975,17 @@ qdio_allocate(struct qdio_initialize *init_data)
2985 QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*)); 2975 QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*));
2986 2976
2987 if (!irq_ptr) { 2977 if (!irq_ptr) {
2988 QDIO_PRINT_ERR("kmalloc of irq_ptr failed!\n"); 2978 QDIO_PRINT_ERR("allocation of irq_ptr failed!\n");
2989 return -ENOMEM; 2979 return -ENOMEM;
2990 } 2980 }
2991 2981
2992 init_MUTEX(&irq_ptr->setting_up_sema); 2982 init_MUTEX(&irq_ptr->setting_up_sema);
2993 2983
2994 /* QDR must be in DMA area since CCW data address is only 32 bit */ 2984 /* QDR must be in DMA area since CCW data address is only 32 bit */
2995 irq_ptr->qdr=kmalloc(sizeof(struct qdr), GFP_KERNEL | GFP_DMA); 2985 irq_ptr->qdr = (struct qdr *) __get_free_page(GFP_KERNEL | GFP_DMA);
2996 if (!(irq_ptr->qdr)) { 2986 if (!(irq_ptr->qdr)) {
2997 free_page((unsigned long) irq_ptr); 2987 free_page((unsigned long) irq_ptr);
2998 QDIO_PRINT_ERR("kmalloc of irq_ptr->qdr failed!\n"); 2988 QDIO_PRINT_ERR("allocation of irq_ptr->qdr failed!\n");
2999 return -ENOMEM; 2989 return -ENOMEM;
3000 } 2990 }
3001 QDIO_DBF_TEXT0(0,setup,"qdr:"); 2991 QDIO_DBF_TEXT0(0,setup,"qdr:");
@@ -3004,6 +2994,7 @@ qdio_allocate(struct qdio_initialize *init_data)
3004 if (qdio_alloc_qs(irq_ptr, 2994 if (qdio_alloc_qs(irq_ptr,
3005 init_data->no_input_qs, 2995 init_data->no_input_qs,
3006 init_data->no_output_qs)) { 2996 init_data->no_output_qs)) {
2997 QDIO_PRINT_ERR("queue allocation failed!\n");
3007 qdio_release_irq_memory(irq_ptr); 2998 qdio_release_irq_memory(irq_ptr);
3008 return -ENOMEM; 2999 return -ENOMEM;
3009 } 3000 }
@@ -3895,9 +3886,19 @@ init_QDIO(void)
3895 if (res) 3886 if (res)
3896 return res; 3887 return res;
3897 3888
3889 qdio_q_cache = kmem_cache_create("qdio_q", sizeof(struct qdio_q),
3890 256, 0, NULL);
3891 if (!qdio_q_cache) {
3892 qdio_release_qdio_memory();
3893 return -ENOMEM;
3894 }
3895
3898 res = qdio_register_dbf_views(); 3896 res = qdio_register_dbf_views();
3899 if (res) 3897 if (res) {
3898 kmem_cache_destroy(qdio_q_cache);
3899 qdio_release_qdio_memory();
3900 return res; 3900 return res;
3901 }
3901 3902
3902 QDIO_DBF_TEXT0(0,setup,"initQDIO"); 3903 QDIO_DBF_TEXT0(0,setup,"initQDIO");
3903 res = bus_create_file(&ccw_bus_type, &bus_attr_qdio_performance_stats); 3904 res = bus_create_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
@@ -3929,6 +3930,7 @@ cleanup_QDIO(void)
3929 qdio_release_qdio_memory(); 3930 qdio_release_qdio_memory();
3930 qdio_unregister_dbf_views(); 3931 qdio_unregister_dbf_views();
3931 mempool_destroy(qdio_mempool_scssc); 3932 mempool_destroy(qdio_mempool_scssc);
3933 kmem_cache_destroy(qdio_q_cache);
3932 bus_remove_file(&ccw_bus_type, &bus_attr_qdio_performance_stats); 3934 bus_remove_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
3933 printk("qdio: %s: module removed\n",version); 3935 printk("qdio: %s: module removed\n",version);
3934} 3936}
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index b240800b78d7..99299976e891 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -4154,8 +4154,9 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
4154 fcp_rsp_iu->fcp_resid, 4154 fcp_rsp_iu->fcp_resid,
4155 (int) zfcp_get_fcp_dl(fcp_cmnd_iu)); 4155 (int) zfcp_get_fcp_dl(fcp_cmnd_iu));
4156 4156
4157 scpnt->resid = fcp_rsp_iu->fcp_resid; 4157 scsi_set_resid(scpnt, fcp_rsp_iu->fcp_resid);
4158 if (scpnt->request_bufflen - scpnt->resid < scpnt->underflow) 4158 if (scsi_bufflen(scpnt) - scsi_get_resid(scpnt) <
4159 scpnt->underflow)
4159 set_host_byte(&scpnt->result, DID_ERROR); 4160 set_host_byte(&scpnt->result, DID_ERROR);
4160 } 4161 }
4161 4162
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
index c408badd2ae9..81daa8204bfe 100644
--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -36,8 +36,6 @@ static void zfcp_qdio_sbale_fill
36 (struct zfcp_fsf_req *, unsigned long, void *, int); 36 (struct zfcp_fsf_req *, unsigned long, void *, int);
37static int zfcp_qdio_sbals_from_segment 37static int zfcp_qdio_sbals_from_segment
38 (struct zfcp_fsf_req *, unsigned long, void *, unsigned long); 38 (struct zfcp_fsf_req *, unsigned long, void *, unsigned long);
39static int zfcp_qdio_sbals_from_buffer
40 (struct zfcp_fsf_req *, unsigned long, void *, unsigned long, int);
41 39
42static qdio_handler_t zfcp_qdio_request_handler; 40static qdio_handler_t zfcp_qdio_request_handler;
43static qdio_handler_t zfcp_qdio_response_handler; 41static qdio_handler_t zfcp_qdio_response_handler;
@@ -632,28 +630,6 @@ out:
632 630
633 631
634/** 632/**
635 * zfcp_qdio_sbals_from_buffer - fill SBALs from buffer
636 * @fsf_req: request to be processed
637 * @sbtype: SBALE flags
638 * @buffer: data buffer
639 * @length: length of buffer
640 * @max_sbals: upper bound for number of SBALs to be used
641 */
642static int
643zfcp_qdio_sbals_from_buffer(struct zfcp_fsf_req *fsf_req, unsigned long sbtype,
644 void *buffer, unsigned long length, int max_sbals)
645{
646 struct scatterlist sg_segment;
647
648 zfcp_address_to_sg(buffer, &sg_segment);
649 sg_segment.length = length;
650
651 return zfcp_qdio_sbals_from_sg(fsf_req, sbtype, &sg_segment, 1,
652 max_sbals);
653}
654
655
656/**
657 * zfcp_qdio_sbals_from_scsicmnd - fill SBALs from scsi command 633 * zfcp_qdio_sbals_from_scsicmnd - fill SBALs from scsi command
658 * @fsf_req: request to be processed 634 * @fsf_req: request to be processed
659 * @sbtype: SBALE flags 635 * @sbtype: SBALE flags
@@ -664,18 +640,13 @@ int
664zfcp_qdio_sbals_from_scsicmnd(struct zfcp_fsf_req *fsf_req, 640zfcp_qdio_sbals_from_scsicmnd(struct zfcp_fsf_req *fsf_req,
665 unsigned long sbtype, struct scsi_cmnd *scsi_cmnd) 641 unsigned long sbtype, struct scsi_cmnd *scsi_cmnd)
666{ 642{
667 if (scsi_cmnd->use_sg) { 643 if (scsi_sg_count(scsi_cmnd))
668 return zfcp_qdio_sbals_from_sg(fsf_req, sbtype, 644 return zfcp_qdio_sbals_from_sg(fsf_req, sbtype,
669 (struct scatterlist *) 645 scsi_sglist(scsi_cmnd),
670 scsi_cmnd->request_buffer, 646 scsi_sg_count(scsi_cmnd),
671 scsi_cmnd->use_sg, 647 ZFCP_MAX_SBALS_PER_REQ);
672 ZFCP_MAX_SBALS_PER_REQ); 648 else
673 } else { 649 return 0;
674 return zfcp_qdio_sbals_from_buffer(fsf_req, sbtype,
675 scsi_cmnd->request_buffer,
676 scsi_cmnd->request_bufflen,
677 ZFCP_MAX_SBALS_PER_REQ);
678 }
679} 650}
680 651
681/** 652/**
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 813556c60007..a7f42a17b5c7 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1110,7 +1110,9 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
1110 __aac_shutdown(aac); 1110 __aac_shutdown(aac);
1111 out_unmap: 1111 out_unmap:
1112 aac_fib_map_free(aac); 1112 aac_fib_map_free(aac);
1113 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys); 1113 if (aac->comm_addr)
1114 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr,
1115 aac->comm_phys);
1114 kfree(aac->queues); 1116 kfree(aac->queues);
1115 aac_adapter_ioremap(aac, 0); 1117 aac_adapter_ioremap(aac, 0);
1116 kfree(aac->fibs); 1118 kfree(aac->fibs);
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 85f2394ffc3e..d30a30786dda 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -289,18 +289,18 @@ static LIST_HEAD(aha152x_host_list);
289 if(spin_is_locked(&QLOCK)) { \ 289 if(spin_is_locked(&QLOCK)) { \
290 DPRINTK(debug_intr, DEBUG_LEAD "(%s:%d) already locked at %s:%d\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \ 290 DPRINTK(debug_intr, DEBUG_LEAD "(%s:%d) already locked at %s:%d\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \
291 } \ 291 } \
292 DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) locking\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \ 292 DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locking\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
293 spin_lock_irqsave(&QLOCK,flags); \ 293 spin_lock_irqsave(&QLOCK,flags); \
294 DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) locked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \ 294 DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
295 QLOCKER=__FUNCTION__; \ 295 QLOCKER=__FUNCTION__; \
296 QLOCKERL=__LINE__; \ 296 QLOCKERL=__LINE__; \
297 } while(0) 297 } while(0)
298 298
299#define DO_UNLOCK(flags) \ 299#define DO_UNLOCK(flags) \
300 do { \ 300 do { \
301 DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) unlocking (locked at %s:%d)\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \ 301 DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocking (locked at %s:%d)\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \
302 spin_unlock_irqrestore(&QLOCK,flags); \ 302 spin_unlock_irqrestore(&QLOCK,flags); \
303 DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) unlocked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \ 303 DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
304 QLOCKER="(not locked)"; \ 304 QLOCKER="(not locked)"; \
305 QLOCKERL=0; \ 305 QLOCKERL=0; \
306 } while(0) 306 } while(0)
@@ -322,6 +322,12 @@ static LIST_HEAD(aha152x_host_list);
322 (cmd) ? ((cmd)->device->id & 0x0f) : -1, \ 322 (cmd) ? ((cmd)->device->id & 0x0f) : -1, \
323 (cmd) ? ((cmd)->device->lun & 0x07) : -1 323 (cmd) ? ((cmd)->device->lun & 0x07) : -1
324 324
325static inline void
326CMD_INC_RESID(struct scsi_cmnd *cmd, int inc)
327{
328 scsi_set_resid(cmd, scsi_get_resid(cmd) + inc);
329}
330
325#define DELAY_DEFAULT 1000 331#define DELAY_DEFAULT 1000
326 332
327#if defined(PCMCIA) 333#if defined(PCMCIA)
@@ -552,14 +558,11 @@ struct aha152x_hostdata {
552struct aha152x_scdata { 558struct aha152x_scdata {
553 Scsi_Cmnd *next; /* next sc in queue */ 559 Scsi_Cmnd *next; /* next sc in queue */
554 struct completion *done;/* semaphore to block on */ 560 struct completion *done;/* semaphore to block on */
555 unsigned char cmd_len; 561 unsigned char aha_orig_cmd_len;
556 unsigned char cmnd[MAX_COMMAND_SIZE]; 562 unsigned char aha_orig_cmnd[MAX_COMMAND_SIZE];
557 unsigned short use_sg; 563 int aha_orig_resid;
558 unsigned request_bufflen;
559 void *request_buffer;
560}; 564};
561 565
562
563/* access macros for hostdata */ 566/* access macros for hostdata */
564 567
565#define HOSTDATA(shpnt) ((struct aha152x_hostdata *) &shpnt->hostdata) 568#define HOSTDATA(shpnt) ((struct aha152x_hostdata *) &shpnt->hostdata)
@@ -978,15 +981,15 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
978#if defined(AHA152X_DEBUG) 981#if defined(AHA152X_DEBUG)
979 if (HOSTDATA(shpnt)->debug & debug_queue) { 982 if (HOSTDATA(shpnt)->debug & debug_queue) {
980 printk(INFO_LEAD "queue: %p; cmd_len=%d pieces=%d size=%u cmnd=", 983 printk(INFO_LEAD "queue: %p; cmd_len=%d pieces=%d size=%u cmnd=",
981 CMDINFO(SCpnt), SCpnt, SCpnt->cmd_len, SCpnt->use_sg, SCpnt->request_bufflen); 984 CMDINFO(SCpnt), SCpnt, SCpnt->cmd_len,
985 scsi_sg_count(SCpnt), scsi_bufflen(SCpnt));
982 __scsi_print_command(SCpnt->cmnd); 986 __scsi_print_command(SCpnt->cmnd);
983 } 987 }
984#endif 988#endif
985 989
986 SCpnt->scsi_done = done; 990 SCpnt->scsi_done = done;
987 SCpnt->resid = SCpnt->request_bufflen;
988 SCpnt->SCp.phase = not_issued | phase; 991 SCpnt->SCp.phase = not_issued | phase;
989 SCpnt->SCp.Status = CHECK_CONDITION; 992 SCpnt->SCp.Status = 0x1; /* Ilegal status by SCSI standard */
990 SCpnt->SCp.Message = 0; 993 SCpnt->SCp.Message = 0;
991 SCpnt->SCp.have_data_in = 0; 994 SCpnt->SCp.have_data_in = 0;
992 SCpnt->SCp.sent_command = 0; 995 SCpnt->SCp.sent_command = 0;
@@ -997,20 +1000,11 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
997 return FAILED; 1000 return FAILED;
998 } 1001 }
999 } else { 1002 } else {
1000 struct aha152x_scdata *sc;
1001
1002 SCpnt->host_scribble = kmalloc(sizeof(struct aha152x_scdata), GFP_ATOMIC); 1003 SCpnt->host_scribble = kmalloc(sizeof(struct aha152x_scdata), GFP_ATOMIC);
1003 if(SCpnt->host_scribble==0) { 1004 if(SCpnt->host_scribble==0) {
1004 printk(ERR_LEAD "allocation failed\n", CMDINFO(SCpnt)); 1005 printk(ERR_LEAD "allocation failed\n", CMDINFO(SCpnt));
1005 return FAILED; 1006 return FAILED;
1006 } 1007 }
1007
1008 sc = SCDATA(SCpnt);
1009 memcpy(sc->cmnd, SCpnt->cmnd, sizeof(sc->cmnd));
1010 sc->request_buffer = SCpnt->request_buffer;
1011 sc->request_bufflen = SCpnt->request_bufflen;
1012 sc->use_sg = SCpnt->use_sg;
1013 sc->cmd_len = SCpnt->cmd_len;
1014 } 1008 }
1015 1009
1016 SCNEXT(SCpnt) = NULL; 1010 SCNEXT(SCpnt) = NULL;
@@ -1022,16 +1016,25 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
1022 SCp.buffer : next buffer 1016 SCp.buffer : next buffer
1023 SCp.buffers_residual : left buffers in list 1017 SCp.buffers_residual : left buffers in list
1024 SCp.phase : current state of the command */ 1018 SCp.phase : current state of the command */
1025 if (SCpnt->use_sg) { 1019
1026 SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; 1020 if ((phase & (check_condition|resetting)) || !scsi_sglist(SCpnt)) {
1027 SCpnt->SCp.ptr = SG_ADDRESS(SCpnt->SCp.buffer); 1021 if (phase & check_condition) {
1028 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; 1022 SCpnt->SCp.ptr = SCpnt->sense_buffer;
1029 SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; 1023 SCpnt->SCp.this_residual = sizeof(SCpnt->sense_buffer);
1030 } else { 1024 scsi_set_resid(SCpnt, sizeof(SCpnt->sense_buffer));
1031 SCpnt->SCp.ptr = (char *) SCpnt->request_buffer; 1025 } else {
1032 SCpnt->SCp.this_residual = SCpnt->request_bufflen; 1026 SCpnt->SCp.ptr = NULL;
1027 SCpnt->SCp.this_residual = 0;
1028 scsi_set_resid(SCpnt, 0);
1029 }
1033 SCpnt->SCp.buffer = NULL; 1030 SCpnt->SCp.buffer = NULL;
1034 SCpnt->SCp.buffers_residual = 0; 1031 SCpnt->SCp.buffers_residual = 0;
1032 } else {
1033 scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
1034 SCpnt->SCp.buffer = scsi_sglist(SCpnt);
1035 SCpnt->SCp.ptr = SG_ADDRESS(SCpnt->SCp.buffer);
1036 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
1037 SCpnt->SCp.buffers_residual = scsi_sg_count(SCpnt) - 1;
1035 } 1038 }
1036 1039
1037 DO_LOCK(flags); 1040 DO_LOCK(flags);
@@ -1150,9 +1153,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
1150 DECLARE_COMPLETION(done); 1153 DECLARE_COMPLETION(done);
1151 int ret, issued, disconnected; 1154 int ret, issued, disconnected;
1152 unsigned char old_cmd_len = SCpnt->cmd_len; 1155 unsigned char old_cmd_len = SCpnt->cmd_len;
1153 unsigned short old_use_sg = SCpnt->use_sg;
1154 void *old_buffer = SCpnt->request_buffer;
1155 unsigned old_bufflen = SCpnt->request_bufflen;
1156 unsigned long flags; 1156 unsigned long flags;
1157 unsigned long timeleft; 1157 unsigned long timeleft;
1158 1158
@@ -1174,9 +1174,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
1174 DO_UNLOCK(flags); 1174 DO_UNLOCK(flags);
1175 1175
1176 SCpnt->cmd_len = 0; 1176 SCpnt->cmd_len = 0;
1177 SCpnt->use_sg = 0;
1178 SCpnt->request_buffer = NULL;
1179 SCpnt->request_bufflen = 0;
1180 1177
1181 aha152x_internal_queue(SCpnt, &done, resetting, reset_done); 1178 aha152x_internal_queue(SCpnt, &done, resetting, reset_done);
1182 1179
@@ -1189,9 +1186,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
1189 } 1186 }
1190 1187
1191 SCpnt->cmd_len = old_cmd_len; 1188 SCpnt->cmd_len = old_cmd_len;
1192 SCpnt->use_sg = old_use_sg;
1193 SCpnt->request_buffer = old_buffer;
1194 SCpnt->request_bufflen = old_bufflen;
1195 1189
1196 DO_LOCK(flags); 1190 DO_LOCK(flags);
1197 1191
@@ -1531,8 +1525,8 @@ static void busfree_run(struct Scsi_Host *shpnt)
1531 /* target sent DISCONNECT */ 1525 /* target sent DISCONNECT */
1532 DPRINTK(debug_selection, DEBUG_LEAD "target disconnected at %d/%d\n", 1526 DPRINTK(debug_selection, DEBUG_LEAD "target disconnected at %d/%d\n",
1533 CMDINFO(CURRENT_SC), 1527 CMDINFO(CURRENT_SC),
1534 CURRENT_SC->resid, 1528 scsi_get_resid(CURRENT_SC),
1535 CURRENT_SC->request_bufflen); 1529 scsi_bufflen(CURRENT_SC));
1536#if defined(AHA152X_STAT) 1530#if defined(AHA152X_STAT)
1537 HOSTDATA(shpnt)->disconnections++; 1531 HOSTDATA(shpnt)->disconnections++;
1538#endif 1532#endif
@@ -1568,18 +1562,16 @@ static void busfree_run(struct Scsi_Host *shpnt)
1568#endif 1562#endif
1569 1563
1570 /* restore old command */ 1564 /* restore old command */
1571 memcpy(cmd->cmnd, sc->cmnd, sizeof(sc->cmnd)); 1565 memcpy(cmd->cmnd, sc->aha_orig_cmnd, sizeof(cmd->cmnd));
1572 cmd->request_buffer = sc->request_buffer; 1566 cmd->cmd_len = sc->aha_orig_cmd_len;
1573 cmd->request_bufflen = sc->request_bufflen; 1567 scsi_set_resid(cmd, sc->aha_orig_resid);
1574 cmd->use_sg = sc->use_sg;
1575 cmd->cmd_len = sc->cmd_len;
1576 1568
1577 cmd->SCp.Status = 0x02; 1569 cmd->SCp.Status = SAM_STAT_CHECK_CONDITION;
1578 1570
1579 HOSTDATA(shpnt)->commands--; 1571 HOSTDATA(shpnt)->commands--;
1580 if (!HOSTDATA(shpnt)->commands) 1572 if (!HOSTDATA(shpnt)->commands)
1581 SETPORT(PORTA, 0); /* turn led off */ 1573 SETPORT(PORTA, 0); /* turn led off */
1582 } else if(DONE_SC->SCp.Status==0x02) { 1574 } else if(DONE_SC->SCp.Status==SAM_STAT_CHECK_CONDITION) {
1583#if defined(AHA152X_STAT) 1575#if defined(AHA152X_STAT)
1584 HOSTDATA(shpnt)->busfree_with_check_condition++; 1576 HOSTDATA(shpnt)->busfree_with_check_condition++;
1585#endif 1577#endif
@@ -1587,13 +1579,23 @@ static void busfree_run(struct Scsi_Host *shpnt)
1587 DPRINTK(debug_eh, ERR_LEAD "CHECK CONDITION found\n", CMDINFO(DONE_SC)); 1579 DPRINTK(debug_eh, ERR_LEAD "CHECK CONDITION found\n", CMDINFO(DONE_SC));
1588#endif 1580#endif
1589 1581
1590 if(!(DONE_SC->SCp.Status & not_issued)) { 1582 if(!(DONE_SC->SCp.phase & not_issued)) {
1583 struct aha152x_scdata *sc;
1591 Scsi_Cmnd *ptr = DONE_SC; 1584 Scsi_Cmnd *ptr = DONE_SC;
1592 DONE_SC=NULL; 1585 DONE_SC=NULL;
1593#if 0 1586#if 0
1594 DPRINTK(debug_eh, ERR_LEAD "requesting sense\n", CMDINFO(ptr)); 1587 DPRINTK(debug_eh, ERR_LEAD "requesting sense\n", CMDINFO(ptr));
1595#endif 1588#endif
1596 1589
1590 /* save old command */
1591 sc = SCDATA(ptr);
1592 /* It was allocated in aha152x_internal_queue? */
1593 BUG_ON(!sc);
1594 memcpy(sc->aha_orig_cmnd, ptr->cmnd,
1595 sizeof(ptr->cmnd));
1596 sc->aha_orig_cmd_len = ptr->cmd_len;
1597 sc->aha_orig_resid = scsi_get_resid(ptr);
1598
1597 ptr->cmnd[0] = REQUEST_SENSE; 1599 ptr->cmnd[0] = REQUEST_SENSE;
1598 ptr->cmnd[1] = 0; 1600 ptr->cmnd[1] = 0;
1599 ptr->cmnd[2] = 0; 1601 ptr->cmnd[2] = 0;
@@ -1601,10 +1603,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
1601 ptr->cmnd[4] = sizeof(ptr->sense_buffer); 1603 ptr->cmnd[4] = sizeof(ptr->sense_buffer);
1602 ptr->cmnd[5] = 0; 1604 ptr->cmnd[5] = 0;
1603 ptr->cmd_len = 6; 1605 ptr->cmd_len = 6;
1604 ptr->use_sg = 0; 1606
1605 ptr->request_buffer = ptr->sense_buffer;
1606 ptr->request_bufflen = sizeof(ptr->sense_buffer);
1607
1608 DO_UNLOCK(flags); 1607 DO_UNLOCK(flags);
1609 aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done); 1608 aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done);
1610 DO_LOCK(flags); 1609 DO_LOCK(flags);
@@ -2180,7 +2179,8 @@ static void datai_init(struct Scsi_Host *shpnt)
2180 DATA_LEN=0; 2179 DATA_LEN=0;
2181 DPRINTK(debug_datai, 2180 DPRINTK(debug_datai,
2182 DEBUG_LEAD "datai_init: request_bufflen=%d resid=%d\n", 2181 DEBUG_LEAD "datai_init: request_bufflen=%d resid=%d\n",
2183 CMDINFO(CURRENT_SC), CURRENT_SC->request_bufflen, CURRENT_SC->resid); 2182 CMDINFO(CURRENT_SC), scsi_bufflen(CURRENT_SC),
2183 scsi_get_resid(CURRENT_SC));
2184} 2184}
2185 2185
2186static void datai_run(struct Scsi_Host *shpnt) 2186static void datai_run(struct Scsi_Host *shpnt)
@@ -2293,11 +2293,12 @@ static void datai_run(struct Scsi_Host *shpnt)
2293 2293
2294static void datai_end(struct Scsi_Host *shpnt) 2294static void datai_end(struct Scsi_Host *shpnt)
2295{ 2295{
2296 CURRENT_SC->resid -= GETSTCNT(); 2296 CMD_INC_RESID(CURRENT_SC, -GETSTCNT());
2297 2297
2298 DPRINTK(debug_datai, 2298 DPRINTK(debug_datai,
2299 DEBUG_LEAD "datai_end: request_bufflen=%d resid=%d stcnt=%d\n", 2299 DEBUG_LEAD "datai_end: request_bufflen=%d resid=%d stcnt=%d\n",
2300 CMDINFO(CURRENT_SC), CURRENT_SC->request_bufflen, CURRENT_SC->resid, GETSTCNT()); 2300 CMDINFO(CURRENT_SC), scsi_bufflen(CURRENT_SC),
2301 scsi_get_resid(CURRENT_SC), GETSTCNT());
2301 2302
2302 SETPORT(SXFRCTL0, CH1|CLRSTCNT); 2303 SETPORT(SXFRCTL0, CH1|CLRSTCNT);
2303 SETPORT(DMACNTRL0, 0); 2304 SETPORT(DMACNTRL0, 0);
@@ -2318,11 +2319,12 @@ static void datao_init(struct Scsi_Host *shpnt)
2318 SETPORT(SIMODE0, 0); 2319 SETPORT(SIMODE0, 0);
2319 SETPORT(SIMODE1, ENSCSIPERR | ENSCSIRST | ENPHASEMIS | ENBUSFREE ); 2320 SETPORT(SIMODE1, ENSCSIPERR | ENSCSIRST | ENPHASEMIS | ENBUSFREE );
2320 2321
2321 DATA_LEN = CURRENT_SC->resid; 2322 DATA_LEN = scsi_get_resid(CURRENT_SC);
2322 2323
2323 DPRINTK(debug_datao, 2324 DPRINTK(debug_datao,
2324 DEBUG_LEAD "datao_init: request_bufflen=%d; resid=%d\n", 2325 DEBUG_LEAD "datao_init: request_bufflen=%d; resid=%d\n",
2325 CMDINFO(CURRENT_SC), CURRENT_SC->request_bufflen, CURRENT_SC->resid); 2326 CMDINFO(CURRENT_SC), scsi_bufflen(CURRENT_SC),
2327 scsi_get_resid(CURRENT_SC));
2326} 2328}
2327 2329
2328static void datao_run(struct Scsi_Host *shpnt) 2330static void datao_run(struct Scsi_Host *shpnt)
@@ -2346,7 +2348,7 @@ static void datao_run(struct Scsi_Host *shpnt)
2346 SETPORT(DMACNTRL0,WRITE_READ|ENDMA|_8BIT); 2348 SETPORT(DMACNTRL0,WRITE_READ|ENDMA|_8BIT);
2347 SETPORT(DATAPORT, *CURRENT_SC->SCp.ptr++); 2349 SETPORT(DATAPORT, *CURRENT_SC->SCp.ptr++);
2348 CURRENT_SC->SCp.this_residual--; 2350 CURRENT_SC->SCp.this_residual--;
2349 CURRENT_SC->resid--; 2351 CMD_INC_RESID(CURRENT_SC, -1);
2350 SETPORT(DMACNTRL0,WRITE_READ|ENDMA); 2352 SETPORT(DMACNTRL0,WRITE_READ|ENDMA);
2351 } 2353 }
2352 2354
@@ -2355,7 +2357,7 @@ static void datao_run(struct Scsi_Host *shpnt)
2355 outsw(DATAPORT, CURRENT_SC->SCp.ptr, data_count); 2357 outsw(DATAPORT, CURRENT_SC->SCp.ptr, data_count);
2356 CURRENT_SC->SCp.ptr += 2 * data_count; 2358 CURRENT_SC->SCp.ptr += 2 * data_count;
2357 CURRENT_SC->SCp.this_residual -= 2 * data_count; 2359 CURRENT_SC->SCp.this_residual -= 2 * data_count;
2358 CURRENT_SC->resid -= 2 * data_count; 2360 CMD_INC_RESID(CURRENT_SC, -2 * data_count);
2359 } 2361 }
2360 2362
2361 if(CURRENT_SC->SCp.this_residual==0 && CURRENT_SC->SCp.buffers_residual>0) { 2363 if(CURRENT_SC->SCp.this_residual==0 && CURRENT_SC->SCp.buffers_residual>0) {
@@ -2381,35 +2383,34 @@ static void datao_run(struct Scsi_Host *shpnt)
2381static void datao_end(struct Scsi_Host *shpnt) 2383static void datao_end(struct Scsi_Host *shpnt)
2382{ 2384{
2383 if(TESTLO(DMASTAT, DFIFOEMP)) { 2385 if(TESTLO(DMASTAT, DFIFOEMP)) {
2384 int data_count = (DATA_LEN - CURRENT_SC->resid) - GETSTCNT(); 2386 int data_count = (DATA_LEN - scsi_get_resid(CURRENT_SC)) -
2387 GETSTCNT();
2385 2388
2386 DPRINTK(debug_datao, DEBUG_LEAD "datao: %d bytes to resend (%d written, %d transferred)\n", 2389 DPRINTK(debug_datao, DEBUG_LEAD "datao: %d bytes to resend (%d written, %d transferred)\n",
2387 CMDINFO(CURRENT_SC), 2390 CMDINFO(CURRENT_SC),
2388 data_count, 2391 data_count,
2389 DATA_LEN-CURRENT_SC->resid, 2392 DATA_LEN - scsi_get_resid(CURRENT_SC),
2390 GETSTCNT()); 2393 GETSTCNT());
2391 2394
2392 CURRENT_SC->resid += data_count; 2395 CMD_INC_RESID(CURRENT_SC, data_count);
2393 2396
2394 if(CURRENT_SC->use_sg) { 2397 data_count -= CURRENT_SC->SCp.ptr -
2395 data_count -= CURRENT_SC->SCp.ptr - SG_ADDRESS(CURRENT_SC->SCp.buffer); 2398 SG_ADDRESS(CURRENT_SC->SCp.buffer);
2396 while(data_count>0) { 2399 while(data_count>0) {
2397 CURRENT_SC->SCp.buffer--; 2400 CURRENT_SC->SCp.buffer--;
2398 CURRENT_SC->SCp.buffers_residual++; 2401 CURRENT_SC->SCp.buffers_residual++;
2399 data_count -= CURRENT_SC->SCp.buffer->length; 2402 data_count -= CURRENT_SC->SCp.buffer->length;
2400 }
2401 CURRENT_SC->SCp.ptr = SG_ADDRESS(CURRENT_SC->SCp.buffer) - data_count;
2402 CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length + data_count;
2403 } else {
2404 CURRENT_SC->SCp.ptr -= data_count;
2405 CURRENT_SC->SCp.this_residual += data_count;
2406 } 2403 }
2404 CURRENT_SC->SCp.ptr = SG_ADDRESS(CURRENT_SC->SCp.buffer) -
2405 data_count;
2406 CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length +
2407 data_count;
2407 } 2408 }
2408 2409
2409 DPRINTK(debug_datao, DEBUG_LEAD "datao_end: request_bufflen=%d; resid=%d; stcnt=%d\n", 2410 DPRINTK(debug_datao, DEBUG_LEAD "datao_end: request_bufflen=%d; resid=%d; stcnt=%d\n",
2410 CMDINFO(CURRENT_SC), 2411 CMDINFO(CURRENT_SC),
2411 CURRENT_SC->request_bufflen, 2412 scsi_bufflen(CURRENT_SC),
2412 CURRENT_SC->resid, 2413 scsi_get_resid(CURRENT_SC),
2413 GETSTCNT()); 2414 GETSTCNT());
2414 2415
2415 SETPORT(SXFRCTL0, CH1|CLRCH1|CLRSTCNT); 2416 SETPORT(SXFRCTL0, CH1|CLRCH1|CLRSTCNT);
@@ -2936,7 +2937,7 @@ static void show_command(Scsi_Cmnd *ptr)
2936 __scsi_print_command(ptr->cmnd); 2937 __scsi_print_command(ptr->cmnd);
2937 2938
2938 printk(KERN_DEBUG "); request_bufflen=%d; resid=%d; phase |", 2939 printk(KERN_DEBUG "); request_bufflen=%d; resid=%d; phase |",
2939 ptr->request_bufflen, ptr->resid); 2940 scsi_bufflen(ptr), scsi_get_resid(ptr));
2940 2941
2941 if (ptr->SCp.phase & not_issued) 2942 if (ptr->SCp.phase & not_issued)
2942 printk("not issued|"); 2943 printk("not issued|");
@@ -3006,7 +3007,8 @@ static int get_command(char *pos, Scsi_Cmnd * ptr)
3006 SPRINTF("0x%02x ", ptr->cmnd[i]); 3007 SPRINTF("0x%02x ", ptr->cmnd[i]);
3007 3008
3008 SPRINTF("); resid=%d; residual=%d; buffers=%d; phase |", 3009 SPRINTF("); resid=%d; residual=%d; buffers=%d; phase |",
3009 ptr->resid, ptr->SCp.this_residual, ptr->SCp.buffers_residual); 3010 scsi_get_resid(ptr), ptr->SCp.this_residual,
3011 ptr->SCp.buffers_residual);
3010 3012
3011 if (ptr->SCp.phase & not_issued) 3013 if (ptr->SCp.phase & not_issued)
3012 SPRINTF("not issued|"); 3014 SPRINTF("not issued|");
@@ -3395,7 +3397,7 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start
3395 PDEBUG(debug_datai, "data in"); 3397 PDEBUG(debug_datai, "data in");
3396 PDEBUG(debug_datao, "data out"); 3398 PDEBUG(debug_datao, "data out");
3397 PDEBUG(debug_eh, "eh"); 3399 PDEBUG(debug_eh, "eh");
3398 PDEBUG(debug_locks, "locks"); 3400 PDEBUG(debug_locking, "locks");
3399 PDEBUG(debug_phases, "phases"); 3401 PDEBUG(debug_phases, "phases");
3400 3402
3401 SPRINTF("\n"); 3403 SPRINTF("\n");
@@ -3474,6 +3476,12 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start
3474 return thislength < length ? thislength : length; 3476 return thislength < length ? thislength : length;
3475} 3477}
3476 3478
3479static int aha152x_adjust_queue(struct scsi_device *device)
3480{
3481 blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
3482 return 0;
3483}
3484
3477static struct scsi_host_template aha152x_driver_template = { 3485static struct scsi_host_template aha152x_driver_template = {
3478 .module = THIS_MODULE, 3486 .module = THIS_MODULE,
3479 .name = AHA152X_REVID, 3487 .name = AHA152X_REVID,
@@ -3490,6 +3498,7 @@ static struct scsi_host_template aha152x_driver_template = {
3490 .sg_tablesize = SG_ALL, 3498 .sg_tablesize = SG_ALL,
3491 .cmd_per_lun = 1, 3499 .cmd_per_lun = 1,
3492 .use_clustering = DISABLE_CLUSTERING, 3500 .use_clustering = DISABLE_CLUSTERING,
3501 .slave_alloc = aha152x_adjust_queue,
3493}; 3502};
3494 3503
3495#if !defined(PCMCIA) 3504#if !defined(PCMCIA)
diff --git a/drivers/scsi/aha152x.h b/drivers/scsi/aha152x.h
index d2add24d02a3..ac4bfa438bf2 100644
--- a/drivers/scsi/aha152x.h
+++ b/drivers/scsi/aha152x.h
@@ -298,7 +298,7 @@ typedef union {
298enum { 298enum {
299 debug_procinfo = 0x0001, 299 debug_procinfo = 0x0001,
300 debug_queue = 0x0002, 300 debug_queue = 0x0002,
301 debug_locks = 0x0004, 301 debug_locking = 0x0004,
302 debug_intr = 0x0008, 302 debug_intr = 0x0008,
303 debug_selection = 0x0010, 303 debug_selection = 0x0010,
304 debug_msgo = 0x0020, 304 debug_msgo = 0x0020,
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 75733b09f27a..f350b5e89e76 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -1701,7 +1701,16 @@ ahc_find_syncrate(struct ahc_softc *ahc, u_int *period,
1701 if ((*ppr_options & MSG_EXT_PPR_DT_REQ) == 0 1701 if ((*ppr_options & MSG_EXT_PPR_DT_REQ) == 0
1702 && maxsync < AHC_SYNCRATE_ULTRA2) 1702 && maxsync < AHC_SYNCRATE_ULTRA2)
1703 maxsync = AHC_SYNCRATE_ULTRA2; 1703 maxsync = AHC_SYNCRATE_ULTRA2;
1704 1704
1705 /* Now set the maxsync based on the card capabilities
1706 * DT is already done above */
1707 if ((ahc->features & (AHC_DT | AHC_ULTRA2)) == 0
1708 && maxsync < AHC_SYNCRATE_ULTRA)
1709 maxsync = AHC_SYNCRATE_ULTRA;
1710 if ((ahc->features & (AHC_DT | AHC_ULTRA2 | AHC_ULTRA)) == 0
1711 && maxsync < AHC_SYNCRATE_FAST)
1712 maxsync = AHC_SYNCRATE_FAST;
1713
1705 for (syncrate = &ahc_syncrates[maxsync]; 1714 for (syncrate = &ahc_syncrates[maxsync];
1706 syncrate->rate != NULL; 1715 syncrate->rate != NULL;
1707 syncrate++) { 1716 syncrate++) {
@@ -1765,6 +1774,17 @@ ahc_find_period(struct ahc_softc *ahc, u_int scsirate, u_int maxsync)
1765 else 1774 else
1766 scsirate &= SXFR; 1775 scsirate &= SXFR;
1767 1776
1777 /* now set maxsync based on card capabilities */
1778 if ((ahc->features & AHC_DT) == 0 && maxsync < AHC_SYNCRATE_ULTRA2)
1779 maxsync = AHC_SYNCRATE_ULTRA2;
1780 if ((ahc->features & (AHC_DT | AHC_ULTRA2)) == 0
1781 && maxsync < AHC_SYNCRATE_ULTRA)
1782 maxsync = AHC_SYNCRATE_ULTRA;
1783 if ((ahc->features & (AHC_DT | AHC_ULTRA2 | AHC_ULTRA)) == 0
1784 && maxsync < AHC_SYNCRATE_FAST)
1785 maxsync = AHC_SYNCRATE_FAST;
1786
1787
1768 syncrate = &ahc_syncrates[maxsync]; 1788 syncrate = &ahc_syncrates[maxsync];
1769 while (syncrate->rate != NULL) { 1789 while (syncrate->rate != NULL) {
1770 1790
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 2e2362d787ca..502732ac270d 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -173,20 +173,20 @@ static struct pci_device_id dptids[] = {
173}; 173};
174MODULE_DEVICE_TABLE(pci,dptids); 174MODULE_DEVICE_TABLE(pci,dptids);
175 175
176static int adpt_detect(struct scsi_host_template* sht) 176static void adpt_exit(void);
177
178static int adpt_detect(void)
177{ 179{
178 struct pci_dev *pDev = NULL; 180 struct pci_dev *pDev = NULL;
179 adpt_hba* pHba; 181 adpt_hba* pHba;
180 182
181 adpt_init();
182
183 PINFO("Detecting Adaptec I2O RAID controllers...\n"); 183 PINFO("Detecting Adaptec I2O RAID controllers...\n");
184 184
185 /* search for all Adatpec I2O RAID cards */ 185 /* search for all Adatpec I2O RAID cards */
186 while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) { 186 while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
187 if(pDev->device == PCI_DPT_DEVICE_ID || 187 if(pDev->device == PCI_DPT_DEVICE_ID ||
188 pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){ 188 pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){
189 if(adpt_install_hba(sht, pDev) ){ 189 if(adpt_install_hba(pDev) ){
190 PERROR("Could not Init an I2O RAID device\n"); 190 PERROR("Could not Init an I2O RAID device\n");
191 PERROR("Will not try to detect others.\n"); 191 PERROR("Will not try to detect others.\n");
192 return hba_count-1; 192 return hba_count-1;
@@ -248,34 +248,33 @@ rebuild_sys_tab:
248 } 248 }
249 249
250 for (pHba = hba_chain; pHba; pHba = pHba->next) { 250 for (pHba = hba_chain; pHba; pHba = pHba->next) {
251 if( adpt_scsi_register(pHba,sht) < 0){ 251 if (adpt_scsi_register(pHba) < 0) {
252 adpt_i2o_delete_hba(pHba); 252 adpt_i2o_delete_hba(pHba);
253 continue; 253 continue;
254 } 254 }
255 pHba->initialized = TRUE; 255 pHba->initialized = TRUE;
256 pHba->state &= ~DPTI_STATE_RESET; 256 pHba->state &= ~DPTI_STATE_RESET;
257 scsi_scan_host(pHba->host);
257 } 258 }
258 259
259 // Register our control device node 260 // Register our control device node
260 // nodes will need to be created in /dev to access this 261 // nodes will need to be created in /dev to access this
261 // the nodes can not be created from within the driver 262 // the nodes can not be created from within the driver
262 if (hba_count && register_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER, &adpt_fops)) { 263 if (hba_count && register_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER, &adpt_fops)) {
263 adpt_i2o_sys_shutdown(); 264 adpt_exit();
264 return 0; 265 return 0;
265 } 266 }
266 return hba_count; 267 return hba_count;
267} 268}
268 269
269 270
270/* 271static int adpt_release(adpt_hba *pHba)
271 * scsi_unregister will be called AFTER we return.
272 */
273static int adpt_release(struct Scsi_Host *host)
274{ 272{
275 adpt_hba* pHba = (adpt_hba*) host->hostdata[0]; 273 struct Scsi_Host *shost = pHba->host;
274 scsi_remove_host(shost);
276// adpt_i2o_quiesce_hba(pHba); 275// adpt_i2o_quiesce_hba(pHba);
277 adpt_i2o_delete_hba(pHba); 276 adpt_i2o_delete_hba(pHba);
278 scsi_unregister(host); 277 scsi_host_put(shost);
279 return 0; 278 return 0;
280} 279}
281 280
@@ -882,7 +881,7 @@ static int adpt_reboot_event(struct notifier_block *n, ulong code, void *p)
882#endif 881#endif
883 882
884 883
885static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) 884static int adpt_install_hba(struct pci_dev* pDev)
886{ 885{
887 886
888 adpt_hba* pHba = NULL; 887 adpt_hba* pHba = NULL;
@@ -1031,8 +1030,6 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1031 1030
1032 1031
1033 mutex_lock(&adpt_configuration_lock); 1032 mutex_lock(&adpt_configuration_lock);
1034 // scsi_unregister calls our adpt_release which
1035 // does a quiese
1036 if(pHba->host){ 1033 if(pHba->host){
1037 free_irq(pHba->host->irq, pHba); 1034 free_irq(pHba->host->irq, pHba);
1038 } 1035 }
@@ -1084,17 +1081,6 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1084} 1081}
1085 1082
1086 1083
1087static int adpt_init(void)
1088{
1089 printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
1090#ifdef REBOOT_NOTIFIER
1091 register_reboot_notifier(&adpt_reboot_notifier);
1092#endif
1093
1094 return 0;
1095}
1096
1097
1098static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun) 1084static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun)
1099{ 1085{
1100 struct adpt_device* d; 1086 struct adpt_device* d;
@@ -2180,37 +2166,6 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d
2180} 2166}
2181 2167
2182 2168
2183static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht)
2184{
2185 struct Scsi_Host *host = NULL;
2186
2187 host = scsi_register(sht, sizeof(adpt_hba*));
2188 if (host == NULL) {
2189 printk ("%s: scsi_register returned NULL\n",pHba->name);
2190 return -1;
2191 }
2192 host->hostdata[0] = (unsigned long)pHba;
2193 pHba->host = host;
2194
2195 host->irq = pHba->pDev->irq;
2196 /* no IO ports, so don't have to set host->io_port and
2197 * host->n_io_port
2198 */
2199 host->io_port = 0;
2200 host->n_io_port = 0;
2201 /* see comments in scsi_host.h */
2202 host->max_id = 16;
2203 host->max_lun = 256;
2204 host->max_channel = pHba->top_scsi_channel + 1;
2205 host->cmd_per_lun = 1;
2206 host->unique_id = (uint) pHba;
2207 host->sg_tablesize = pHba->sg_tablesize;
2208 host->can_queue = pHba->post_fifo_size;
2209
2210 return 0;
2211}
2212
2213
2214static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd) 2169static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
2215{ 2170{
2216 adpt_hba* pHba; 2171 adpt_hba* pHba;
@@ -3329,12 +3284,10 @@ static static void adpt_delay(int millisec)
3329 3284
3330#endif 3285#endif
3331 3286
3332static struct scsi_host_template driver_template = { 3287static struct scsi_host_template adpt_template = {
3333 .name = "dpt_i2o", 3288 .name = "dpt_i2o",
3334 .proc_name = "dpt_i2o", 3289 .proc_name = "dpt_i2o",
3335 .proc_info = adpt_proc_info, 3290 .proc_info = adpt_proc_info,
3336 .detect = adpt_detect,
3337 .release = adpt_release,
3338 .info = adpt_info, 3291 .info = adpt_info,
3339 .queuecommand = adpt_queue, 3292 .queuecommand = adpt_queue,
3340 .eh_abort_handler = adpt_abort, 3293 .eh_abort_handler = adpt_abort,
@@ -3348,5 +3301,62 @@ static struct scsi_host_template driver_template = {
3348 .cmd_per_lun = 1, 3301 .cmd_per_lun = 1,
3349 .use_clustering = ENABLE_CLUSTERING, 3302 .use_clustering = ENABLE_CLUSTERING,
3350}; 3303};
3351#include "scsi_module.c" 3304
3305static s32 adpt_scsi_register(adpt_hba* pHba)
3306{
3307 struct Scsi_Host *host;
3308
3309 host = scsi_host_alloc(&adpt_template, sizeof(adpt_hba*));
3310 if (host == NULL) {
3311 printk ("%s: scsi_host_alloc returned NULL\n",pHba->name);
3312 return -1;
3313 }
3314 host->hostdata[0] = (unsigned long)pHba;
3315 pHba->host = host;
3316
3317 host->irq = pHba->pDev->irq;
3318 /* no IO ports, so don't have to set host->io_port and
3319 * host->n_io_port
3320 */
3321 host->io_port = 0;
3322 host->n_io_port = 0;
3323 /* see comments in scsi_host.h */
3324 host->max_id = 16;
3325 host->max_lun = 256;
3326 host->max_channel = pHba->top_scsi_channel + 1;
3327 host->cmd_per_lun = 1;
3328 host->unique_id = (uint) pHba;
3329 host->sg_tablesize = pHba->sg_tablesize;
3330 host->can_queue = pHba->post_fifo_size;
3331
3332 if (scsi_add_host(host, &pHba->pDev->dev)) {
3333 scsi_host_put(host);
3334 return -1;
3335 }
3336
3337 return 0;
3338}
3339
3340static int __init adpt_init(void)
3341{
3342 int count;
3343
3344 printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
3345#ifdef REBOOT_NOTIFIER
3346 register_reboot_notifier(&adpt_reboot_notifier);
3347#endif
3348
3349 count = adpt_detect();
3350
3351 return count > 0 ? 0 : -ENODEV;
3352}
3353
3354static void __exit adpt_exit(void)
3355{
3356 while (hba_chain)
3357 adpt_release(hba_chain);
3358}
3359
3360module_init(adpt_init);
3361module_exit(adpt_exit);
3352MODULE_LICENSE("GPL"); 3362MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h
index fd79068c5869..0892f6c70319 100644
--- a/drivers/scsi/dpti.h
+++ b/drivers/scsi/dpti.h
@@ -28,11 +28,9 @@
28 * SCSI interface function Prototypes 28 * SCSI interface function Prototypes
29 */ 29 */
30 30
31static int adpt_detect(struct scsi_host_template * sht);
32static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *)); 31static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *));
33static int adpt_abort(struct scsi_cmnd * cmd); 32static int adpt_abort(struct scsi_cmnd * cmd);
34static int adpt_reset(struct scsi_cmnd* cmd); 33static int adpt_reset(struct scsi_cmnd* cmd);
35static int adpt_release(struct Scsi_Host *host);
36static int adpt_slave_configure(struct scsi_device *); 34static int adpt_slave_configure(struct scsi_device *);
37 35
38static const char *adpt_info(struct Scsi_Host *pSHost); 36static const char *adpt_info(struct Scsi_Host *pSHost);
@@ -49,8 +47,6 @@ static int adpt_device_reset(struct scsi_cmnd* cmd);
49 47
50#define DPT_DRIVER_NAME "Adaptec I2O RAID" 48#define DPT_DRIVER_NAME "Adaptec I2O RAID"
51 49
52#ifndef HOSTS_C
53
54#include "dpt/sys_info.h" 50#include "dpt/sys_info.h"
55#include <linux/wait.h> 51#include <linux/wait.h>
56#include "dpt/dpti_i2o.h" 52#include "dpt/dpti_i2o.h"
@@ -289,7 +285,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba);
289static s32 adpt_i2o_hrt_get(adpt_hba* pHba); 285static s32 adpt_i2o_hrt_get(adpt_hba* pHba);
290static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice); 286static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice);
291static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd); 287static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd);
292static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht); 288static s32 adpt_scsi_register(adpt_hba* pHba);
293static s32 adpt_hba_reset(adpt_hba* pHba); 289static s32 adpt_hba_reset(adpt_hba* pHba);
294static s32 adpt_i2o_reset_hba(adpt_hba* pHba); 290static s32 adpt_i2o_reset_hba(adpt_hba* pHba);
295static s32 adpt_rescan(adpt_hba* pHba); 291static s32 adpt_rescan(adpt_hba* pHba);
@@ -299,7 +295,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba);
299static void adpt_inquiry(adpt_hba* pHba); 295static void adpt_inquiry(adpt_hba* pHba);
300static void adpt_fail_posted_scbs(adpt_hba* pHba); 296static void adpt_fail_posted_scbs(adpt_hba* pHba);
301static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun); 297static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun);
302static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) ; 298static int adpt_install_hba(struct pci_dev* pDev) ;
303static int adpt_i2o_online_hba(adpt_hba* pHba); 299static int adpt_i2o_online_hba(adpt_hba* pHba);
304static void adpt_i2o_post_wait_complete(u32, int); 300static void adpt_i2o_post_wait_complete(u32, int);
305static int adpt_i2o_systab_send(adpt_hba* pHba); 301static int adpt_i2o_systab_send(adpt_hba* pHba);
@@ -343,5 +339,4 @@ static void adpt_i386_info(sysInfo_S* si);
343#define FW_DEBUG_BLED_OFFSET 8 339#define FW_DEBUG_BLED_OFFSET 8
344 340
345#define FW_DEBUG_FLAGS_NO_HEADERS_B 0x01 341#define FW_DEBUG_FLAGS_NO_HEADERS_B 0x01
346#endif /* !HOSTS_C */
347#endif /* _DPT_H */ 342#endif /* _DPT_H */
diff --git a/drivers/scsi/esp_scsi.h b/drivers/scsi/esp_scsi.h
index 856e38b14861..d5576d54ce76 100644
--- a/drivers/scsi/esp_scsi.h
+++ b/drivers/scsi/esp_scsi.h
@@ -220,7 +220,7 @@
220#define ESP_BUSID_RESELID 0x10 220#define ESP_BUSID_RESELID 0x10
221#define ESP_BUSID_CTR32BIT 0x40 221#define ESP_BUSID_CTR32BIT 0x40
222 222
223#define ESP_BUS_TIMEOUT 275 /* In milli-seconds */ 223#define ESP_BUS_TIMEOUT 250 /* In milli-seconds */
224#define ESP_TIMEO_CONST 8192 224#define ESP_TIMEO_CONST 8192
225#define ESP_NEG_DEFP(mhz, cfact) \ 225#define ESP_NEG_DEFP(mhz, cfact) \
226 ((ESP_BUS_TIMEOUT * ((mhz) / 1000)) / (8192 * (cfact))) 226 ((ESP_BUS_TIMEOUT * ((mhz) / 1000)) / (8192 * (cfact)))
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index d0b95ce0ba00..55e4d2dc2bbe 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -902,11 +902,6 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt,
902 return; 902 return;
903 /* GDT PCI controller found, resources are already in pdev */ 903 /* GDT PCI controller found, resources are already in pdev */
904 pcistr[*cnt].pdev = pdev; 904 pcistr[*cnt].pdev = pdev;
905 pcistr[*cnt].vendor_id = vendor;
906 pcistr[*cnt].device_id = device;
907 pcistr[*cnt].subdevice_id = pdev->subsystem_device;
908 pcistr[*cnt].bus = pdev->bus->number;
909 pcistr[*cnt].device_fn = pdev->devfn;
910 pcistr[*cnt].irq = pdev->irq; 905 pcistr[*cnt].irq = pdev->irq;
911 base0 = pci_resource_flags(pdev, 0); 906 base0 = pci_resource_flags(pdev, 0);
912 base1 = pci_resource_flags(pdev, 1); 907 base1 = pci_resource_flags(pdev, 1);
@@ -926,7 +921,8 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt,
926 pcistr[*cnt].io = pci_resource_start(pdev, 1); 921 pcistr[*cnt].io = pci_resource_start(pdev, 1);
927 } 922 }
928 TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n", 923 TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n",
929 pcistr[*cnt].bus, PCI_SLOT(pcistr[*cnt].device_fn), 924 pcistr[*cnt].pdev->bus->number,
925 PCI_SLOT(pcistr[*cnt].pdev->devfn),
930 pcistr[*cnt].irq, pcistr[*cnt].dpmem)); 926 pcistr[*cnt].irq, pcistr[*cnt].dpmem));
931 (*cnt)++; 927 (*cnt)++;
932 } 928 }
@@ -946,20 +942,20 @@ static void __init gdth_sort_pci(gdth_pci_str *pcistr, int cnt)
946 changed = FALSE; 942 changed = FALSE;
947 for (i = 0; i < cnt-1; ++i) { 943 for (i = 0; i < cnt-1; ++i) {
948 if (!reverse_scan) { 944 if (!reverse_scan) {
949 if ((pcistr[i].bus > pcistr[i+1].bus) || 945 if ((pcistr[i].pdev->bus->number > pcistr[i+1].pdev->bus->number) ||
950 (pcistr[i].bus == pcistr[i+1].bus && 946 (pcistr[i].pdev->bus->number == pcistr[i+1].pdev->bus->number &&
951 PCI_SLOT(pcistr[i].device_fn) > 947 PCI_SLOT(pcistr[i].pdev->devfn) >
952 PCI_SLOT(pcistr[i+1].device_fn))) { 948 PCI_SLOT(pcistr[i+1].pdev->devfn))) {
953 temp = pcistr[i]; 949 temp = pcistr[i];
954 pcistr[i] = pcistr[i+1]; 950 pcistr[i] = pcistr[i+1];
955 pcistr[i+1] = temp; 951 pcistr[i+1] = temp;
956 changed = TRUE; 952 changed = TRUE;
957 } 953 }
958 } else { 954 } else {
959 if ((pcistr[i].bus < pcistr[i+1].bus) || 955 if ((pcistr[i].pdev->bus->number < pcistr[i+1].pdev->bus->number) ||
960 (pcistr[i].bus == pcistr[i+1].bus && 956 (pcistr[i].pdev->bus->number == pcistr[i+1].pdev->bus->number &&
961 PCI_SLOT(pcistr[i].device_fn) < 957 PCI_SLOT(pcistr[i].pdev->devfn) <
962 PCI_SLOT(pcistr[i+1].device_fn))) { 958 PCI_SLOT(pcistr[i+1].pdev->devfn))) {
963 temp = pcistr[i]; 959 temp = pcistr[i];
964 pcistr[i] = pcistr[i+1]; 960 pcistr[i] = pcistr[i+1];
965 pcistr[i+1] = temp; 961 pcistr[i+1] = temp;
@@ -1176,17 +1172,16 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)
1176 1172
1177 TRACE(("gdth_init_pci()\n")); 1173 TRACE(("gdth_init_pci()\n"));
1178 1174
1179 if (pcistr->vendor_id == PCI_VENDOR_ID_INTEL) 1175 if (pcistr->pdev->vendor == PCI_VENDOR_ID_INTEL)
1180 ha->oem_id = OEM_ID_INTEL; 1176 ha->oem_id = OEM_ID_INTEL;
1181 else 1177 else
1182 ha->oem_id = OEM_ID_ICP; 1178 ha->oem_id = OEM_ID_ICP;
1183 ha->brd_phys = (pcistr->bus << 8) | (pcistr->device_fn & 0xf8); 1179 ha->brd_phys = (pcistr->pdev->bus->number << 8) | (pcistr->pdev->devfn & 0xf8);
1184 ha->stype = (ulong32)pcistr->device_id; 1180 ha->stype = (ulong32)pcistr->pdev->device;
1185 ha->subdevice_id = pcistr->subdevice_id;
1186 ha->irq = pcistr->irq; 1181 ha->irq = pcistr->irq;
1187 ha->pdev = pcistr->pdev; 1182 ha->pdev = pcistr->pdev;
1188 1183
1189 if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */ 1184 if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */
1190 TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); 1185 TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq));
1191 ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str)); 1186 ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str));
1192 if (ha->brd == NULL) { 1187 if (ha->brd == NULL) {
@@ -1293,7 +1288,7 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)
1293 1288
1294 ha->dma64_support = 0; 1289 ha->dma64_support = 0;
1295 1290
1296 } else if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */ 1291 } else if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */
1297 ha->plx = (gdt6c_plx_regs *)pcistr->io; 1292 ha->plx = (gdt6c_plx_regs *)pcistr->io;
1298 TRACE2(("init_pci_new() dpmem %lx irq %d\n", 1293 TRACE2(("init_pci_new() dpmem %lx irq %d\n",
1299 pcistr->dpmem,ha->irq)); 1294 pcistr->dpmem,ha->irq));
@@ -4601,7 +4596,8 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
4601 } 4596 }
4602 /* controller found and initialized */ 4597 /* controller found and initialized */
4603 printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n", 4598 printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n",
4604 pcistr[ctr].bus,PCI_SLOT(pcistr[ctr].device_fn),ha->irq); 4599 pcistr[ctr].pdev->bus->number,
4600 PCI_SLOT(pcistr[ctr].pdev->devfn), ha->irq);
4605 4601
4606 if (request_irq(ha->irq, gdth_interrupt, 4602 if (request_irq(ha->irq, gdth_interrupt,
4607 IRQF_DISABLED|IRQF_SHARED, "gdth", ha)) 4603 IRQF_DISABLED|IRQF_SHARED, "gdth", ha))
@@ -4637,7 +4633,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
4637#endif 4633#endif
4638 ha->scratch_busy = FALSE; 4634 ha->scratch_busy = FALSE;
4639 ha->req_first = NULL; 4635 ha->req_first = NULL;
4640 ha->tid_cnt = pcistr[ctr].device_id >= 0x200 ? MAXID : MAX_HDRIVES; 4636 ha->tid_cnt = pcistr[ctr].pdev->device >= 0x200 ? MAXID : MAX_HDRIVES;
4641 if (max_ids > 0 && max_ids < ha->tid_cnt) 4637 if (max_ids > 0 && max_ids < ha->tid_cnt)
4642 ha->tid_cnt = max_ids; 4638 ha->tid_cnt = max_ids;
4643 for (i=0; i<GDTH_MAXCMDS; ++i) 4639 for (i=0; i<GDTH_MAXCMDS; ++i)
@@ -4810,7 +4806,7 @@ static const char *gdth_ctr_name(int hanum)
4810 } else if (ha->type == GDT_ISA) { 4806 } else if (ha->type == GDT_ISA) {
4811 return("GDT2000/2020"); 4807 return("GDT2000/2020");
4812 } else if (ha->type == GDT_PCI) { 4808 } else if (ha->type == GDT_PCI) {
4813 switch (ha->stype) { 4809 switch (ha->pdev->device) {
4814 case PCI_DEVICE_ID_VORTEX_GDT60x0: 4810 case PCI_DEVICE_ID_VORTEX_GDT60x0:
4815 return("GDT6000/6020/6050"); 4811 return("GDT6000/6020/6050");
4816 case PCI_DEVICE_ID_VORTEX_GDT6000B: 4812 case PCI_DEVICE_ID_VORTEX_GDT6000B:
@@ -5448,12 +5444,12 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
5448 ctrt.type = 5444 ctrt.type =
5449 (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe); 5445 (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe);
5450 if (ha->stype >= 0x300) 5446 if (ha->stype >= 0x300)
5451 ctrt.ext_type = 0x6000 | ha->subdevice_id; 5447 ctrt.ext_type = 0x6000 | ha->pdev->subsystem_device;
5452 else 5448 else
5453 ctrt.ext_type = 0x6000 | ha->stype; 5449 ctrt.ext_type = 0x6000 | ha->stype;
5454 } 5450 }
5455 ctrt.device_id = ha->stype; 5451 ctrt.device_id = ha->pdev->device;
5456 ctrt.sub_device_id = ha->subdevice_id; 5452 ctrt.sub_device_id = ha->pdev->subsystem_device;
5457 } 5453 }
5458 ctrt.info = ha->brd_phys; 5454 ctrt.info = ha->brd_phys;
5459 ctrt.oem_id = ha->oem_id; 5455 ctrt.oem_id = ha->oem_id;
diff --git a/drivers/scsi/gdth.h b/drivers/scsi/gdth.h
index 8c29eafd51c5..37423300592e 100644
--- a/drivers/scsi/gdth.h
+++ b/drivers/scsi/gdth.h
@@ -845,11 +845,6 @@ typedef struct {
845/* PCI resources */ 845/* PCI resources */
846typedef struct { 846typedef struct {
847 struct pci_dev *pdev; 847 struct pci_dev *pdev;
848 ushort vendor_id; /* vendor (ICP, Intel, ..) */
849 ushort device_id; /* device ID (0,..,9) */
850 ushort subdevice_id; /* sub device ID */
851 unchar bus; /* PCI bus */
852 unchar device_fn; /* PCI device/function no. */
853 ulong dpmem; /* DPRAM address */ 848 ulong dpmem; /* DPRAM address */
854 ulong io; /* IO address */ 849 ulong io; /* IO address */
855 ulong io_mm; /* IO address mem. mapped */ 850 ulong io_mm; /* IO address mem. mapped */
@@ -862,7 +857,6 @@ typedef struct {
862 ushort oem_id; /* OEM */ 857 ushort oem_id; /* OEM */
863 ushort type; /* controller class */ 858 ushort type; /* controller class */
864 ulong32 stype; /* subtype (PCI: device ID) */ 859 ulong32 stype; /* subtype (PCI: device ID) */
865 ushort subdevice_id; /* sub device ID (PCI) */
866 ushort fw_vers; /* firmware version */ 860 ushort fw_vers; /* firmware version */
867 ushort cache_feat; /* feat. cache serv. (s/g,..)*/ 861 ushort cache_feat; /* feat. cache serv. (s/g,..)*/
868 ushort raw_feat; /* feat. raw service (s/g,..)*/ 862 ushort raw_feat; /* feat. raw service (s/g,..)*/
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index bd8e7f323c69..96bc31266c98 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -220,7 +220,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
220 get_device(&shost->shost_gendev); 220 get_device(&shost->shost_gendev);
221 221
222 if (shost->transportt->host_size && 222 if (shost->transportt->host_size &&
223 (shost->shost_data = kmalloc(shost->transportt->host_size, 223 (shost->shost_data = kzalloc(shost->transportt->host_size,
224 GFP_KERNEL)) == NULL) 224 GFP_KERNEL)) == NULL)
225 goto out_del_classdev; 225 goto out_del_classdev;
226 226
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 5870866abc99..5ecc63d1b436 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -393,12 +393,6 @@ static int map_sg_data(struct scsi_cmnd *cmd,
393 return 1; 393 return 1;
394 else if (sg_mapped < 0) 394 else if (sg_mapped < 0)
395 return 0; 395 return 0;
396 else if (sg_mapped > SG_ALL) {
397 printk(KERN_ERR
398 "ibmvscsi: More than %d mapped sg entries, got %d\n",
399 SG_ALL, sg_mapped);
400 return 0;
401 }
402 396
403 set_srp_direction(cmd, srp_cmd, sg_mapped); 397 set_srp_direction(cmd, srp_cmd, sg_mapped);
404 398
@@ -708,8 +702,7 @@ static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd,
708 struct srp_cmd *srp_cmd; 702 struct srp_cmd *srp_cmd;
709 struct srp_event_struct *evt_struct; 703 struct srp_event_struct *evt_struct;
710 struct srp_indirect_buf *indirect; 704 struct srp_indirect_buf *indirect;
711 struct ibmvscsi_host_data *hostdata = 705 struct ibmvscsi_host_data *hostdata = shost_priv(cmnd->device->host);
712 (struct ibmvscsi_host_data *)&cmnd->device->host->hostdata;
713 u16 lun = lun_from_dev(cmnd->device); 706 u16 lun = lun_from_dev(cmnd->device);
714 u8 out_fmt, in_fmt; 707 u8 out_fmt, in_fmt;
715 708
@@ -960,8 +953,7 @@ static void sync_completion(struct srp_event_struct *evt_struct)
960 */ 953 */
961static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd) 954static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
962{ 955{
963 struct ibmvscsi_host_data *hostdata = 956 struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host);
964 (struct ibmvscsi_host_data *)cmd->device->host->hostdata;
965 struct srp_tsk_mgmt *tsk_mgmt; 957 struct srp_tsk_mgmt *tsk_mgmt;
966 struct srp_event_struct *evt; 958 struct srp_event_struct *evt;
967 struct srp_event_struct *tmp_evt, *found_evt; 959 struct srp_event_struct *tmp_evt, *found_evt;
@@ -1084,9 +1076,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
1084 */ 1076 */
1085static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd) 1077static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
1086{ 1078{
1087 struct ibmvscsi_host_data *hostdata = 1079 struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host);
1088 (struct ibmvscsi_host_data *)cmd->device->host->hostdata;
1089
1090 struct srp_tsk_mgmt *tsk_mgmt; 1080 struct srp_tsk_mgmt *tsk_mgmt;
1091 struct srp_event_struct *evt; 1081 struct srp_event_struct *evt;
1092 struct srp_event_struct *tmp_evt, *pos; 1082 struct srp_event_struct *tmp_evt, *pos;
@@ -1183,8 +1173,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
1183static int ibmvscsi_eh_host_reset_handler(struct scsi_cmnd *cmd) 1173static int ibmvscsi_eh_host_reset_handler(struct scsi_cmnd *cmd)
1184{ 1174{
1185 unsigned long wait_switch = 0; 1175 unsigned long wait_switch = 0;
1186 struct ibmvscsi_host_data *hostdata = 1176 struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host);
1187 (struct ibmvscsi_host_data *)cmd->device->host->hostdata;
1188 1177
1189 dev_err(hostdata->dev, "Resetting connection due to error recovery\n"); 1178 dev_err(hostdata->dev, "Resetting connection due to error recovery\n");
1190 1179
@@ -1412,8 +1401,7 @@ static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth)
1412static ssize_t show_host_srp_version(struct class_device *class_dev, char *buf) 1401static ssize_t show_host_srp_version(struct class_device *class_dev, char *buf)
1413{ 1402{
1414 struct Scsi_Host *shost = class_to_shost(class_dev); 1403 struct Scsi_Host *shost = class_to_shost(class_dev);
1415 struct ibmvscsi_host_data *hostdata = 1404 struct ibmvscsi_host_data *hostdata = shost_priv(shost);
1416 (struct ibmvscsi_host_data *)shost->hostdata;
1417 int len; 1405 int len;
1418 1406
1419 len = snprintf(buf, PAGE_SIZE, "%s\n", 1407 len = snprintf(buf, PAGE_SIZE, "%s\n",
@@ -1433,8 +1421,7 @@ static ssize_t show_host_partition_name(struct class_device *class_dev,
1433 char *buf) 1421 char *buf)
1434{ 1422{
1435 struct Scsi_Host *shost = class_to_shost(class_dev); 1423 struct Scsi_Host *shost = class_to_shost(class_dev);
1436 struct ibmvscsi_host_data *hostdata = 1424 struct ibmvscsi_host_data *hostdata = shost_priv(shost);
1437 (struct ibmvscsi_host_data *)shost->hostdata;
1438 int len; 1425 int len;
1439 1426
1440 len = snprintf(buf, PAGE_SIZE, "%s\n", 1427 len = snprintf(buf, PAGE_SIZE, "%s\n",
@@ -1454,8 +1441,7 @@ static ssize_t show_host_partition_number(struct class_device *class_dev,
1454 char *buf) 1441 char *buf)
1455{ 1442{
1456 struct Scsi_Host *shost = class_to_shost(class_dev); 1443 struct Scsi_Host *shost = class_to_shost(class_dev);
1457 struct ibmvscsi_host_data *hostdata = 1444 struct ibmvscsi_host_data *hostdata = shost_priv(shost);
1458 (struct ibmvscsi_host_data *)shost->hostdata;
1459 int len; 1445 int len;
1460 1446
1461 len = snprintf(buf, PAGE_SIZE, "%d\n", 1447 len = snprintf(buf, PAGE_SIZE, "%d\n",
@@ -1474,8 +1460,7 @@ static struct class_device_attribute ibmvscsi_host_partition_number = {
1474static ssize_t show_host_mad_version(struct class_device *class_dev, char *buf) 1460static ssize_t show_host_mad_version(struct class_device *class_dev, char *buf)
1475{ 1461{
1476 struct Scsi_Host *shost = class_to_shost(class_dev); 1462 struct Scsi_Host *shost = class_to_shost(class_dev);
1477 struct ibmvscsi_host_data *hostdata = 1463 struct ibmvscsi_host_data *hostdata = shost_priv(shost);
1478 (struct ibmvscsi_host_data *)shost->hostdata;
1479 int len; 1464 int len;
1480 1465
1481 len = snprintf(buf, PAGE_SIZE, "%d\n", 1466 len = snprintf(buf, PAGE_SIZE, "%d\n",
@@ -1494,8 +1479,7 @@ static struct class_device_attribute ibmvscsi_host_mad_version = {
1494static ssize_t show_host_os_type(struct class_device *class_dev, char *buf) 1479static ssize_t show_host_os_type(struct class_device *class_dev, char *buf)
1495{ 1480{
1496 struct Scsi_Host *shost = class_to_shost(class_dev); 1481 struct Scsi_Host *shost = class_to_shost(class_dev);
1497 struct ibmvscsi_host_data *hostdata = 1482 struct ibmvscsi_host_data *hostdata = shost_priv(shost);
1498 (struct ibmvscsi_host_data *)shost->hostdata;
1499 int len; 1483 int len;
1500 1484
1501 len = snprintf(buf, PAGE_SIZE, "%d\n", hostdata->madapter_info.os_type); 1485 len = snprintf(buf, PAGE_SIZE, "%d\n", hostdata->madapter_info.os_type);
@@ -1513,8 +1497,7 @@ static struct class_device_attribute ibmvscsi_host_os_type = {
1513static ssize_t show_host_config(struct class_device *class_dev, char *buf) 1497static ssize_t show_host_config(struct class_device *class_dev, char *buf)
1514{ 1498{
1515 struct Scsi_Host *shost = class_to_shost(class_dev); 1499 struct Scsi_Host *shost = class_to_shost(class_dev);
1516 struct ibmvscsi_host_data *hostdata = 1500 struct ibmvscsi_host_data *hostdata = shost_priv(shost);
1517 (struct ibmvscsi_host_data *)shost->hostdata;
1518 1501
1519 /* returns null-terminated host config data */ 1502 /* returns null-terminated host config data */
1520 if (ibmvscsi_do_host_config(hostdata, buf, PAGE_SIZE) == 0) 1503 if (ibmvscsi_do_host_config(hostdata, buf, PAGE_SIZE) == 0)
@@ -1582,7 +1565,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
1582 goto scsi_host_alloc_failed; 1565 goto scsi_host_alloc_failed;
1583 } 1566 }
1584 1567
1585 hostdata = (struct ibmvscsi_host_data *)host->hostdata; 1568 hostdata = shost_priv(host);
1586 memset(hostdata, 0x00, sizeof(*hostdata)); 1569 memset(hostdata, 0x00, sizeof(*hostdata));
1587 INIT_LIST_HEAD(&hostdata->sent); 1570 INIT_LIST_HEAD(&hostdata->sent);
1588 hostdata->host = host; 1571 hostdata->host = host;
diff --git a/drivers/scsi/libsas/Kconfig b/drivers/scsi/libsas/Kconfig
index 3a3c1ac9c6cd..c01a40d321d4 100644
--- a/drivers/scsi/libsas/Kconfig
+++ b/drivers/scsi/libsas/Kconfig
@@ -32,7 +32,8 @@ config SCSI_SAS_LIBSAS
32 32
33config SCSI_SAS_ATA 33config SCSI_SAS_ATA
34 bool "ATA support for libsas (requires libata)" 34 bool "ATA support for libsas (requires libata)"
35 depends on SCSI_SAS_LIBSAS && ATA 35 depends on SCSI_SAS_LIBSAS
36 depends on ATA = y || ATA = SCSI_SAS_LIBSAS
36 help 37 help
37 Builds in ATA support into libsas. Will necessitate 38 Builds in ATA support into libsas. Will necessitate
38 the loading of libata along with libsas. 39 the loading of libata along with libsas.
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index f8f64d6485cd..ba3ecab9baf3 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -45,7 +45,7 @@ struct lpfc_sli2_slim;
45#define LPFC_DISC_IOCB_BUFF_COUNT 20 45#define LPFC_DISC_IOCB_BUFF_COUNT 20
46 46
47#define LPFC_HB_MBOX_INTERVAL 5 /* Heart beat interval in seconds. */ 47#define LPFC_HB_MBOX_INTERVAL 5 /* Heart beat interval in seconds. */
48#define LPFC_HB_MBOX_TIMEOUT 30 /* Heart beat timeout in seconds. */ 48#define LPFC_HB_MBOX_TIMEOUT 30 /* Heart beat timeout in seconds. */
49 49
50/* Define macros for 64 bit support */ 50/* Define macros for 64 bit support */
51#define putPaddrLow(addr) ((uint32_t) (0xffffffff & (u64)(addr))) 51#define putPaddrLow(addr) ((uint32_t) (0xffffffff & (u64)(addr)))
@@ -78,6 +78,7 @@ struct lpfc_dma_pool {
78 78
79struct hbq_dmabuf { 79struct hbq_dmabuf {
80 struct lpfc_dmabuf dbuf; 80 struct lpfc_dmabuf dbuf;
81 uint32_t size;
81 uint32_t tag; 82 uint32_t tag;
82}; 83};
83 84
@@ -329,13 +330,30 @@ struct lpfc_vport {
329#define FC_LOADING 0x1 /* HBA in process of loading drvr */ 330#define FC_LOADING 0x1 /* HBA in process of loading drvr */
330#define FC_UNLOADING 0x2 /* HBA in process of unloading drvr */ 331#define FC_UNLOADING 0x2 /* HBA in process of unloading drvr */
331 char *vname; /* Application assigned name */ 332 char *vname; /* Application assigned name */
333
334 /* Vport Config Parameters */
335 uint32_t cfg_scan_down;
336 uint32_t cfg_lun_queue_depth;
337 uint32_t cfg_nodev_tmo;
338 uint32_t cfg_devloss_tmo;
339 uint32_t cfg_restrict_login;
340 uint32_t cfg_peer_port_login;
341 uint32_t cfg_fcp_class;
342 uint32_t cfg_use_adisc;
343 uint32_t cfg_fdmi_on;
344 uint32_t cfg_discovery_threads;
345 uint32_t cfg_log_verbose;
346 uint32_t cfg_max_luns;
347
348 uint32_t dev_loss_tmo_changed;
349
332 struct fc_vport *fc_vport; 350 struct fc_vport *fc_vport;
333 351
334#ifdef CONFIG_LPFC_DEBUG_FS 352#ifdef CONFIG_LPFC_DEBUG_FS
335 struct dentry *debug_disc_trc; 353 struct dentry *debug_disc_trc;
336 struct dentry *debug_nodelist; 354 struct dentry *debug_nodelist;
337 struct dentry *vport_debugfs_root; 355 struct dentry *vport_debugfs_root;
338 struct lpfc_disc_trc *disc_trc; 356 struct lpfc_debugfs_trc *disc_trc;
339 atomic_t disc_trc_cnt; 357 atomic_t disc_trc_cnt;
340#endif 358#endif
341}; 359};
@@ -345,17 +363,25 @@ struct hbq_s {
345 uint32_t next_hbqPutIdx; /* Index to next HBQ slot to use */ 363 uint32_t next_hbqPutIdx; /* Index to next HBQ slot to use */
346 uint32_t hbqPutIdx; /* HBQ slot to use */ 364 uint32_t hbqPutIdx; /* HBQ slot to use */
347 uint32_t local_hbqGetIdx; /* Local copy of Get index from Port */ 365 uint32_t local_hbqGetIdx; /* Local copy of Get index from Port */
366 void *hbq_virt; /* Virtual ptr to this hbq */
367 struct list_head hbq_buffer_list; /* buffers assigned to this HBQ */
368 /* Callback for HBQ buffer allocation */
369 struct hbq_dmabuf *(*hbq_alloc_buffer) (struct lpfc_hba *);
370 /* Callback for HBQ buffer free */
371 void (*hbq_free_buffer) (struct lpfc_hba *,
372 struct hbq_dmabuf *);
348}; 373};
349 374
350#define LPFC_MAX_HBQS 16 375#define LPFC_MAX_HBQS 4
351/* this matches the possition in the lpfc_hbq_defs array */ 376/* this matches the position in the lpfc_hbq_defs array */
352#define LPFC_ELS_HBQ 0 377#define LPFC_ELS_HBQ 0
378#define LPFC_EXTRA_HBQ 1
353 379
354struct lpfc_hba { 380struct lpfc_hba {
355 struct lpfc_sli sli; 381 struct lpfc_sli sli;
356 uint32_t sli_rev; /* SLI2 or SLI3 */ 382 uint32_t sli_rev; /* SLI2 or SLI3 */
357 uint32_t sli3_options; /* Mask of enabled SLI3 options */ 383 uint32_t sli3_options; /* Mask of enabled SLI3 options */
358#define LPFC_SLI3_ENABLED 0x01 384#define LPFC_SLI3_ENABLED 0x01
359#define LPFC_SLI3_HBQ_ENABLED 0x02 385#define LPFC_SLI3_HBQ_ENABLED 0x02
360#define LPFC_SLI3_NPIV_ENABLED 0x04 386#define LPFC_SLI3_NPIV_ENABLED 0x04
361#define LPFC_SLI3_VPORT_TEARDOWN 0x08 387#define LPFC_SLI3_VPORT_TEARDOWN 0x08
@@ -364,7 +390,7 @@ struct lpfc_hba {
364 390
365 enum hba_state link_state; 391 enum hba_state link_state;
366 uint32_t link_flag; /* link state flags */ 392 uint32_t link_flag; /* link state flags */
367#define LS_LOOPBACK_MODE 0x1 /* NPort is in Loopback mode */ 393#define LS_LOOPBACK_MODE 0x1 /* NPort is in Loopback mode */
368 /* This flag is set while issuing */ 394 /* This flag is set while issuing */
369 /* INIT_LINK mailbox command */ 395 /* INIT_LINK mailbox command */
370#define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */ 396#define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */
@@ -413,28 +439,16 @@ struct lpfc_hba {
413 uint8_t wwpn[8]; 439 uint8_t wwpn[8];
414 uint32_t RandomData[7]; 440 uint32_t RandomData[7];
415 441
416 uint32_t cfg_log_verbose; 442 /* HBA Config Parameters */
417 uint32_t cfg_lun_queue_depth;
418 uint32_t cfg_nodev_tmo;
419 uint32_t cfg_devloss_tmo;
420 uint32_t cfg_hba_queue_depth;
421 uint32_t cfg_peer_port_login;
422 uint32_t cfg_vport_restrict_login;
423 uint32_t cfg_npiv_enable;
424 uint32_t cfg_fcp_class;
425 uint32_t cfg_use_adisc;
426 uint32_t cfg_ack0; 443 uint32_t cfg_ack0;
444 uint32_t cfg_enable_npiv;
427 uint32_t cfg_topology; 445 uint32_t cfg_topology;
428 uint32_t cfg_scan_down;
429 uint32_t cfg_link_speed; 446 uint32_t cfg_link_speed;
430 uint32_t cfg_cr_delay; 447 uint32_t cfg_cr_delay;
431 uint32_t cfg_cr_count; 448 uint32_t cfg_cr_count;
432 uint32_t cfg_multi_ring_support; 449 uint32_t cfg_multi_ring_support;
433 uint32_t cfg_multi_ring_rctl; 450 uint32_t cfg_multi_ring_rctl;
434 uint32_t cfg_multi_ring_type; 451 uint32_t cfg_multi_ring_type;
435 uint32_t cfg_fdmi_on;
436 uint32_t cfg_discovery_threads;
437 uint32_t cfg_max_luns;
438 uint32_t cfg_poll; 452 uint32_t cfg_poll;
439 uint32_t cfg_poll_tmo; 453 uint32_t cfg_poll_tmo;
440 uint32_t cfg_use_msi; 454 uint32_t cfg_use_msi;
@@ -442,8 +456,8 @@ struct lpfc_hba {
442 uint32_t cfg_sg_dma_buf_size; 456 uint32_t cfg_sg_dma_buf_size;
443 uint64_t cfg_soft_wwnn; 457 uint64_t cfg_soft_wwnn;
444 uint64_t cfg_soft_wwpn; 458 uint64_t cfg_soft_wwpn;
459 uint32_t cfg_hba_queue_depth;
445 460
446 uint32_t dev_loss_tmo_changed;
447 461
448 lpfc_vpd_t vpd; /* vital product data */ 462 lpfc_vpd_t vpd; /* vital product data */
449 463
@@ -457,7 +471,6 @@ struct lpfc_hba {
457 wait_queue_head_t *work_wait; 471 wait_queue_head_t *work_wait;
458 struct task_struct *worker_thread; 472 struct task_struct *worker_thread;
459 473
460 struct list_head hbq_buffer_list;
461 uint32_t hbq_count; /* Count of configured HBQs */ 474 uint32_t hbq_count; /* Count of configured HBQs */
462 struct hbq_s hbqs[LPFC_MAX_HBQS]; /* local copy of hbq indicies */ 475 struct hbq_s hbqs[LPFC_MAX_HBQS]; /* local copy of hbq indicies */
463 476
@@ -526,12 +539,14 @@ struct lpfc_hba {
526 mempool_t *nlp_mem_pool; 539 mempool_t *nlp_mem_pool;
527 540
528 struct fc_host_statistics link_stats; 541 struct fc_host_statistics link_stats;
542 uint8_t using_msi;
529 543
530 struct list_head port_list; 544 struct list_head port_list;
531 struct lpfc_vport *pport; /* physical lpfc_vport pointer */ 545 struct lpfc_vport *pport; /* physical lpfc_vport pointer */
532 uint16_t max_vpi; /* Maximum virtual nports */ 546 uint16_t max_vpi; /* Maximum virtual nports */
533#define LPFC_MAX_VPI 100 /* Max number of VPorts supported */ 547#define LPFC_MAX_VPI 100 /* Max number of VPI supported */
534 unsigned long *vpi_bmask; /* vpi allocation table */ 548#define LPFC_MAX_VPORTS (LPFC_MAX_VPI+1)/* Max number of VPorts supported */
549 unsigned long *vpi_bmask; /* vpi allocation table */
535 550
536 /* Data structure used by fabric iocb scheduler */ 551 /* Data structure used by fabric iocb scheduler */
537 struct list_head fabric_iocb_list; 552 struct list_head fabric_iocb_list;
@@ -547,6 +562,11 @@ struct lpfc_hba {
547#ifdef CONFIG_LPFC_DEBUG_FS 562#ifdef CONFIG_LPFC_DEBUG_FS
548 struct dentry *hba_debugfs_root; 563 struct dentry *hba_debugfs_root;
549 atomic_t debugfs_vport_count; 564 atomic_t debugfs_vport_count;
565 struct dentry *debug_hbqinfo;
566 struct dentry *debug_dumpslim;
567 struct dentry *debug_slow_ring_trc;
568 struct lpfc_debugfs_trc *slow_ring_trc;
569 atomic_t slow_ring_trc_cnt;
550#endif 570#endif
551 571
552 /* Fields used for heart beat. */ 572 /* Fields used for heart beat. */
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 860a52c090f4..80a11218b9bb 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -68,12 +68,6 @@ lpfc_drvr_version_show(struct class_device *cdev, char *buf)
68} 68}
69 69
70static ssize_t 70static ssize_t
71management_version_show(struct class_device *cdev, char *buf)
72{
73 return snprintf(buf, PAGE_SIZE, DFC_API_VERSION "\n");
74}
75
76static ssize_t
77lpfc_info_show(struct class_device *cdev, char *buf) 71lpfc_info_show(struct class_device *cdev, char *buf)
78{ 72{
79 struct Scsi_Host *host = class_to_shost(cdev); 73 struct Scsi_Host *host = class_to_shost(cdev);
@@ -319,9 +313,8 @@ lpfc_do_offline(struct lpfc_hba *phba, uint32_t type)
319 if (cnt++ > 3000) { 313 if (cnt++ > 3000) {
320 lpfc_printf_log(phba, 314 lpfc_printf_log(phba,
321 KERN_WARNING, LOG_INIT, 315 KERN_WARNING, LOG_INIT,
322 "%d:0466 Outstanding IO when " 316 "0466 Outstanding IO when "
323 "bringing Adapter offline\n", 317 "bringing Adapter offline\n");
324 phba->brd_no);
325 break; 318 break;
326 } 319 }
327 } 320 }
@@ -437,7 +430,7 @@ lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count)
437 return -EIO; 430 return -EIO;
438} 431}
439 432
440int 433static int
441lpfc_get_hba_info(struct lpfc_hba *phba, 434lpfc_get_hba_info(struct lpfc_hba *phba,
442 uint32_t *mxri, uint32_t *axri, 435 uint32_t *mxri, uint32_t *axri,
443 uint32_t *mrpi, uint32_t *arpi, 436 uint32_t *mrpi, uint32_t *arpi,
@@ -694,9 +687,8 @@ lpfc_##attr##_init(struct lpfc_hba *phba, int val) \
694 return 0;\ 687 return 0;\
695 }\ 688 }\
696 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ 689 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \
697 "%d:0449 lpfc_"#attr" attribute cannot be set to %d, "\ 690 "0449 lpfc_"#attr" attribute cannot be set to %d, "\
698 "allowed range is ["#minval", "#maxval"]\n", \ 691 "allowed range is ["#minval", "#maxval"]\n", val); \
699 phba->brd_no, val); \
700 phba->cfg_##attr = default;\ 692 phba->cfg_##attr = default;\
701 return -EINVAL;\ 693 return -EINVAL;\
702} 694}
@@ -710,9 +702,8 @@ lpfc_##attr##_set(struct lpfc_hba *phba, int val) \
710 return 0;\ 702 return 0;\
711 }\ 703 }\
712 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ 704 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \
713 "%d:0450 lpfc_"#attr" attribute cannot be set to %d, "\ 705 "0450 lpfc_"#attr" attribute cannot be set to %d, "\
714 "allowed range is ["#minval", "#maxval"]\n", \ 706 "allowed range is ["#minval", "#maxval"]\n", val); \
715 phba->brd_no, val); \
716 return -EINVAL;\ 707 return -EINVAL;\
717} 708}
718 709
@@ -734,6 +725,75 @@ lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \
734 return -EINVAL;\ 725 return -EINVAL;\
735} 726}
736 727
728#define lpfc_vport_param_show(attr) \
729static ssize_t \
730lpfc_##attr##_show(struct class_device *cdev, char *buf) \
731{ \
732 struct Scsi_Host *shost = class_to_shost(cdev);\
733 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
734 int val = 0;\
735 val = vport->cfg_##attr;\
736 return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
737}
738
739#define lpfc_vport_param_hex_show(attr) \
740static ssize_t \
741lpfc_##attr##_show(struct class_device *cdev, char *buf) \
742{ \
743 struct Scsi_Host *shost = class_to_shost(cdev);\
744 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
745 int val = 0;\
746 val = vport->cfg_##attr;\
747 return snprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
748}
749
750#define lpfc_vport_param_init(attr, default, minval, maxval) \
751static int \
752lpfc_##attr##_init(struct lpfc_vport *vport, int val) \
753{ \
754 if (val >= minval && val <= maxval) {\
755 vport->cfg_##attr = val;\
756 return 0;\
757 }\
758 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \
759 "0449 lpfc_"#attr" attribute cannot be set to %d, "\
760 "allowed range is ["#minval", "#maxval"]\n", val); \
761 vport->cfg_##attr = default;\
762 return -EINVAL;\
763}
764
765#define lpfc_vport_param_set(attr, default, minval, maxval) \
766static int \
767lpfc_##attr##_set(struct lpfc_vport *vport, int val) \
768{ \
769 if (val >= minval && val <= maxval) {\
770 vport->cfg_##attr = val;\
771 return 0;\
772 }\
773 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \
774 "0450 lpfc_"#attr" attribute cannot be set to %d, "\
775 "allowed range is ["#minval", "#maxval"]\n", val); \
776 return -EINVAL;\
777}
778
779#define lpfc_vport_param_store(attr) \
780static ssize_t \
781lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \
782{ \
783 struct Scsi_Host *shost = class_to_shost(cdev);\
784 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
785 int val=0;\
786 if (!isdigit(buf[0]))\
787 return -EINVAL;\
788 if (sscanf(buf, "%i", &val) != 1)\
789 return -EINVAL;\
790 if (lpfc_##attr##_set(vport, val) == 0) \
791 return strlen(buf);\
792 else \
793 return -EINVAL;\
794}
795
796
737#define LPFC_ATTR(name, defval, minval, maxval, desc) \ 797#define LPFC_ATTR(name, defval, minval, maxval, desc) \
738static int lpfc_##name = defval;\ 798static int lpfc_##name = defval;\
739module_param(lpfc_##name, int, 0);\ 799module_param(lpfc_##name, int, 0);\
@@ -778,6 +838,50 @@ lpfc_param_store(name)\
778static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 838static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
779 lpfc_##name##_show, lpfc_##name##_store) 839 lpfc_##name##_show, lpfc_##name##_store)
780 840
841#define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \
842static int lpfc_##name = defval;\
843module_param(lpfc_##name, int, 0);\
844MODULE_PARM_DESC(lpfc_##name, desc);\
845lpfc_vport_param_init(name, defval, minval, maxval)
846
847#define LPFC_VPORT_ATTR_R(name, defval, minval, maxval, desc) \
848static int lpfc_##name = defval;\
849module_param(lpfc_##name, int, 0);\
850MODULE_PARM_DESC(lpfc_##name, desc);\
851lpfc_vport_param_show(name)\
852lpfc_vport_param_init(name, defval, minval, maxval)\
853static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
854
855#define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \
856static int lpfc_##name = defval;\
857module_param(lpfc_##name, int, 0);\
858MODULE_PARM_DESC(lpfc_##name, desc);\
859lpfc_vport_param_show(name)\
860lpfc_vport_param_init(name, defval, minval, maxval)\
861lpfc_vport_param_set(name, defval, minval, maxval)\
862lpfc_vport_param_store(name)\
863static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
864 lpfc_##name##_show, lpfc_##name##_store)
865
866#define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \
867static int lpfc_##name = defval;\
868module_param(lpfc_##name, int, 0);\
869MODULE_PARM_DESC(lpfc_##name, desc);\
870lpfc_vport_param_hex_show(name)\
871lpfc_vport_param_init(name, defval, minval, maxval)\
872static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
873
874#define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
875static int lpfc_##name = defval;\
876module_param(lpfc_##name, int, 0);\
877MODULE_PARM_DESC(lpfc_##name, desc);\
878lpfc_vport_param_hex_show(name)\
879lpfc_vport_param_init(name, defval, minval, maxval)\
880lpfc_vport_param_set(name, defval, minval, maxval)\
881lpfc_vport_param_store(name)\
882static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
883 lpfc_##name##_show, lpfc_##name##_store)
884
781static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); 885static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL);
782static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); 886static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL);
783static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); 887static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL);
@@ -794,8 +898,6 @@ static CLASS_DEVICE_ATTR(num_discovered_ports, S_IRUGO,
794static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); 898static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL);
795static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, 899static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show,
796 NULL); 900 NULL);
797static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show,
798 NULL);
799static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, 901static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR,
800 lpfc_board_mode_show, lpfc_board_mode_store); 902 lpfc_board_mode_show, lpfc_board_mode_store);
801static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); 903static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset);
@@ -908,17 +1010,15 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count)
908 stat1 = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); 1010 stat1 = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
909 if (stat1) 1011 if (stat1)
910 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1012 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
911 "%d:0463 lpfc_soft_wwpn attribute set failed to reinit " 1013 "0463 lpfc_soft_wwpn attribute set failed to "
912 "adapter - %d\n", phba->brd_no, stat1); 1014 "reinit adapter - %d\n", stat1);
913
914 init_completion(&online_compl); 1015 init_completion(&online_compl);
915 lpfc_workq_post_event(phba, &stat2, &online_compl, LPFC_EVT_ONLINE); 1016 lpfc_workq_post_event(phba, &stat2, &online_compl, LPFC_EVT_ONLINE);
916 wait_for_completion(&online_compl); 1017 wait_for_completion(&online_compl);
917 if (stat2) 1018 if (stat2)
918 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1019 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
919 "%d:0464 lpfc_soft_wwpn attribute set failed to reinit " 1020 "0464 lpfc_soft_wwpn attribute set failed to "
920 "adapter - %d\n", phba->brd_no, stat2); 1021 "reinit adapter - %d\n", stat2);
921
922 return (stat1 || stat2) ? -EIO : count; 1022 return (stat1 || stat2) ? -EIO : count;
923} 1023}
924static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ 1024static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\
@@ -927,8 +1027,8 @@ static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\
927static ssize_t 1027static ssize_t
928lpfc_soft_wwnn_show(struct class_device *cdev, char *buf) 1028lpfc_soft_wwnn_show(struct class_device *cdev, char *buf)
929{ 1029{
930 struct Scsi_Host *host = class_to_shost(cdev); 1030 struct Scsi_Host *shost = class_to_shost(cdev);
931 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; 1031 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
932 return snprintf(buf, PAGE_SIZE, "0x%llx\n", 1032 return snprintf(buf, PAGE_SIZE, "0x%llx\n",
933 (unsigned long long)phba->cfg_soft_wwnn); 1033 (unsigned long long)phba->cfg_soft_wwnn);
934} 1034}
@@ -937,8 +1037,8 @@ lpfc_soft_wwnn_show(struct class_device *cdev, char *buf)
937static ssize_t 1037static ssize_t
938lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count) 1038lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count)
939{ 1039{
940 struct Scsi_Host *host = class_to_shost(cdev); 1040 struct Scsi_Host *shost = class_to_shost(cdev);
941 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; 1041 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
942 unsigned int i, j, cnt=count; 1042 unsigned int i, j, cnt=count;
943 u8 wwnn[8]; 1043 u8 wwnn[8];
944 1044
@@ -1002,7 +1102,7 @@ MODULE_PARM_DESC(lpfc_sli_mode, "SLI mode selector:"
1002 " 2 - select SLI-2 even on SLI-3 capable HBAs," 1102 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
1003 " 3 - select SLI-3"); 1103 " 3 - select SLI-3");
1004 1104
1005LPFC_ATTR_R(npiv_enable, 0, 0, 1, "Enable NPIV functionality"); 1105LPFC_ATTR_R(enable_npiv, 0, 0, 1, "Enable NPIV functionality");
1006 1106
1007/* 1107/*
1008# lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear 1108# lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear
@@ -1019,90 +1119,75 @@ lpfc_nodev_tmo_show(struct class_device *cdev, char *buf)
1019{ 1119{
1020 struct Scsi_Host *shost = class_to_shost(cdev); 1120 struct Scsi_Host *shost = class_to_shost(cdev);
1021 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1121 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
1022 struct lpfc_hba *phba = vport->phba;
1023 int val = 0; 1122 int val = 0;
1024 val = phba->cfg_devloss_tmo; 1123 val = vport->cfg_devloss_tmo;
1025 return snprintf(buf, PAGE_SIZE, "%d\n", 1124 return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo);
1026 phba->cfg_devloss_tmo);
1027} 1125}
1028 1126
1029static int 1127static int
1030lpfc_nodev_tmo_init(struct lpfc_hba *phba, int val) 1128lpfc_nodev_tmo_init(struct lpfc_vport *vport, int val)
1031{ 1129{
1032 static int warned; 1130 if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) {
1033 if (phba->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { 1131 vport->cfg_nodev_tmo = vport->cfg_devloss_tmo;
1034 phba->cfg_nodev_tmo = phba->cfg_devloss_tmo; 1132 if (val != LPFC_DEF_DEVLOSS_TMO)
1035 if (!warned && val != LPFC_DEF_DEVLOSS_TMO) { 1133 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1036 warned = 1; 1134 "0402 Ignoring nodev_tmo module "
1037 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1135 "parameter because devloss_tmo is "
1038 "%d:0402 Ignoring nodev_tmo module " 1136 "set.\n");
1039 "parameter because devloss_tmo is"
1040 " set.\n",
1041 phba->brd_no);
1042 }
1043 return 0; 1137 return 0;
1044 } 1138 }
1045 1139
1046 if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { 1140 if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) {
1047 phba->cfg_nodev_tmo = val; 1141 vport->cfg_nodev_tmo = val;
1048 phba->cfg_devloss_tmo = val; 1142 vport->cfg_devloss_tmo = val;
1049 return 0; 1143 return 0;
1050 } 1144 }
1051 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1145 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1052 "%d:0400 lpfc_nodev_tmo attribute cannot be set to %d, " 1146 "0400 lpfc_nodev_tmo attribute cannot be set to"
1053 "allowed range is [%d, %d]\n", 1147 " %d, allowed range is [%d, %d]\n",
1054 phba->brd_no, val, 1148 val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
1055 LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); 1149 vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO;
1056 phba->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO;
1057 return -EINVAL; 1150 return -EINVAL;
1058} 1151}
1059 1152
1060static void 1153static void
1061lpfc_update_rport_devloss_tmo(struct lpfc_hba *phba) 1154lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport)
1062{ 1155{
1063 struct lpfc_vport *vport;
1064 struct Scsi_Host *shost; 1156 struct Scsi_Host *shost;
1065 struct lpfc_nodelist *ndlp; 1157 struct lpfc_nodelist *ndlp;
1066 1158
1067 list_for_each_entry(vport, &phba->port_list, listentry) { 1159 shost = lpfc_shost_from_vport(vport);
1068 shost = lpfc_shost_from_vport(vport); 1160 spin_lock_irq(shost->host_lock);
1069 spin_lock_irq(shost->host_lock); 1161 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp)
1070 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) 1162 if (ndlp->rport)
1071 if (ndlp->rport) 1163 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo;
1072 ndlp->rport->dev_loss_tmo = 1164 spin_unlock_irq(shost->host_lock);
1073 phba->cfg_devloss_tmo;
1074 spin_unlock_irq(shost->host_lock);
1075 }
1076} 1165}
1077 1166
1078static int 1167static int
1079lpfc_nodev_tmo_set(struct lpfc_hba *phba, int val) 1168lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val)
1080{ 1169{
1081 if (phba->dev_loss_tmo_changed || 1170 if (vport->dev_loss_tmo_changed ||
1082 (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) { 1171 (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) {
1083 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1172 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1084 "%d:0401 Ignoring change to nodev_tmo " 1173 "0401 Ignoring change to nodev_tmo "
1085 "because devloss_tmo is set.\n", 1174 "because devloss_tmo is set.\n");
1086 phba->brd_no);
1087 return 0; 1175 return 0;
1088 } 1176 }
1089
1090 if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { 1177 if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) {
1091 phba->cfg_nodev_tmo = val; 1178 vport->cfg_nodev_tmo = val;
1092 phba->cfg_devloss_tmo = val; 1179 vport->cfg_devloss_tmo = val;
1093 lpfc_update_rport_devloss_tmo(phba); 1180 lpfc_update_rport_devloss_tmo(vport);
1094 return 0; 1181 return 0;
1095 } 1182 }
1096 1183 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1097 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1184 "0403 lpfc_nodev_tmo attribute cannot be set to"
1098 "%d:0403 lpfc_nodev_tmo attribute cannot be set to %d, " 1185 "%d, allowed range is [%d, %d]\n",
1099 "allowed range is [%d, %d]\n", 1186 val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
1100 phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO,
1101 LPFC_MAX_DEVLOSS_TMO);
1102 return -EINVAL; 1187 return -EINVAL;
1103} 1188}
1104 1189
1105lpfc_param_store(nodev_tmo) 1190lpfc_vport_param_store(nodev_tmo)
1106 1191
1107static CLASS_DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, 1192static CLASS_DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR,
1108 lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); 1193 lpfc_nodev_tmo_show, lpfc_nodev_tmo_store);
@@ -1116,29 +1201,28 @@ module_param(lpfc_devloss_tmo, int, 0);
1116MODULE_PARM_DESC(lpfc_devloss_tmo, 1201MODULE_PARM_DESC(lpfc_devloss_tmo,
1117 "Seconds driver will hold I/O waiting " 1202 "Seconds driver will hold I/O waiting "
1118 "for a device to come back"); 1203 "for a device to come back");
1119lpfc_param_init(devloss_tmo, LPFC_DEF_DEVLOSS_TMO, 1204lpfc_vport_param_init(devloss_tmo, LPFC_DEF_DEVLOSS_TMO,
1120 LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO) 1205 LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO)
1121lpfc_param_show(devloss_tmo) 1206lpfc_vport_param_show(devloss_tmo)
1122static int 1207static int
1123lpfc_devloss_tmo_set(struct lpfc_hba *phba, int val) 1208lpfc_devloss_tmo_set(struct lpfc_vport *vport, int val)
1124{ 1209{
1125 if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { 1210 if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) {
1126 phba->cfg_nodev_tmo = val; 1211 vport->cfg_nodev_tmo = val;
1127 phba->cfg_devloss_tmo = val; 1212 vport->cfg_devloss_tmo = val;
1128 phba->dev_loss_tmo_changed = 1; 1213 vport->dev_loss_tmo_changed = 1;
1129 lpfc_update_rport_devloss_tmo(phba); 1214 lpfc_update_rport_devloss_tmo(vport);
1130 return 0; 1215 return 0;
1131 } 1216 }
1132 1217
1133 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1218 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1134 "%d:0404 lpfc_devloss_tmo attribute cannot be set to" 1219 "0404 lpfc_devloss_tmo attribute cannot be set to"
1135 " %d, allowed range is [%d, %d]\n", 1220 " %d, allowed range is [%d, %d]\n",
1136 phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO, 1221 val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
1137 LPFC_MAX_DEVLOSS_TMO);
1138 return -EINVAL; 1222 return -EINVAL;
1139} 1223}
1140 1224
1141lpfc_param_store(devloss_tmo) 1225lpfc_vport_param_store(devloss_tmo)
1142static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, 1226static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR,
1143 lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); 1227 lpfc_devloss_tmo_show, lpfc_devloss_tmo_store);
1144 1228
@@ -1160,14 +1244,15 @@ static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR,
1160# LOG_LIBDFC 0x2000 LIBDFC events 1244# LOG_LIBDFC 0x2000 LIBDFC events
1161# LOG_ALL_MSG 0xffff LOG all messages 1245# LOG_ALL_MSG 0xffff LOG all messages
1162*/ 1246*/
1163LPFC_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff, "Verbose logging bit-mask"); 1247LPFC_VPORT_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff,
1248 "Verbose logging bit-mask");
1164 1249
1165/* 1250/*
1166# lun_queue_depth: This parameter is used to limit the number of outstanding 1251# lun_queue_depth: This parameter is used to limit the number of outstanding
1167# commands per FCP LUN. Value range is [1,128]. Default value is 30. 1252# commands per FCP LUN. Value range is [1,128]. Default value is 30.
1168*/ 1253*/
1169LPFC_ATTR_R(lun_queue_depth, 30, 1, 128, 1254LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 128,
1170 "Max number of FCP commands we can queue to a specific LUN"); 1255 "Max number of FCP commands we can queue to a specific LUN");
1171 1256
1172/* 1257/*
1173# hba_queue_depth: This parameter is used to limit the number of outstanding 1258# hba_queue_depth: This parameter is used to limit the number of outstanding
@@ -1188,12 +1273,12 @@ LPFC_ATTR_R(hba_queue_depth, 8192, 32, 8192,
1188# are allowed to login to each other. 1273# are allowed to login to each other.
1189# Default value of this parameter is 0. 1274# Default value of this parameter is 0.
1190*/ 1275*/
1191LPFC_ATTR_R(peer_port_login, 0, 0, 1, 1276LPFC_VPORT_ATTR_R(peer_port_login, 0, 0, 1,
1192 "Allow peer ports on the same physical port to login to each " 1277 "Allow peer ports on the same physical port to login to each "
1193 "other."); 1278 "other.");
1194 1279
1195/* 1280/*
1196# vport_restrict_login: This parameter allows/prevents logins 1281# restrict_login: This parameter allows/prevents logins
1197# between Virtual Ports and remote initiators. 1282# between Virtual Ports and remote initiators.
1198# When this parameter is not set (0) Virtual Ports will accept PLOGIs from 1283# When this parameter is not set (0) Virtual Ports will accept PLOGIs from
1199# other initiators and will attempt to PLOGI all remote ports. 1284# other initiators and will attempt to PLOGI all remote ports.
@@ -1203,8 +1288,55 @@ LPFC_ATTR_R(peer_port_login, 0, 0, 1,
1203# This parameter does not restrict logins to Fabric resident remote ports. 1288# This parameter does not restrict logins to Fabric resident remote ports.
1204# Default value of this parameter is 1. 1289# Default value of this parameter is 1.
1205*/ 1290*/
1206LPFC_ATTR_RW(vport_restrict_login, 1, 0, 1, 1291static int lpfc_restrict_login = 1;
1207 "Restrict virtual ports login to remote initiators."); 1292module_param(lpfc_restrict_login, int, 0);
1293MODULE_PARM_DESC(lpfc_restrict_login,
1294 "Restrict virtual ports login to remote initiators.");
1295lpfc_vport_param_show(restrict_login);
1296
1297static int
1298lpfc_restrict_login_init(struct lpfc_vport *vport, int val)
1299{
1300 if (val < 0 || val > 1) {
1301 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1302 "0449 lpfc_restrict_login attribute cannot "
1303 "be set to %d, allowed range is [0, 1]\n",
1304 val);
1305 vport->cfg_restrict_login = 1;
1306 return -EINVAL;
1307 }
1308 if (vport->port_type == LPFC_PHYSICAL_PORT) {
1309 vport->cfg_restrict_login = 0;
1310 return 0;
1311 }
1312 vport->cfg_restrict_login = val;
1313 return 0;
1314}
1315
1316static int
1317lpfc_restrict_login_set(struct lpfc_vport *vport, int val)
1318{
1319 if (val < 0 || val > 1) {
1320 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1321 "0450 lpfc_restrict_login attribute cannot "
1322 "be set to %d, allowed range is [0, 1]\n",
1323 val);
1324 vport->cfg_restrict_login = 1;
1325 return -EINVAL;
1326 }
1327 if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) {
1328 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1329 "0468 lpfc_restrict_login must be 0 for "
1330 "Physical ports.\n");
1331 vport->cfg_restrict_login = 0;
1332 return 0;
1333 }
1334 vport->cfg_restrict_login = val;
1335 return 0;
1336}
1337lpfc_vport_param_store(restrict_login);
1338static CLASS_DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR,
1339 lpfc_restrict_login_show, lpfc_restrict_login_store);
1208 1340
1209/* 1341/*
1210# Some disk devices have a "select ID" or "select Target" capability. 1342# Some disk devices have a "select ID" or "select Target" capability.
@@ -1223,8 +1355,8 @@ LPFC_ATTR_RW(vport_restrict_login, 1, 0, 1,
1223# and will not work across a fabric. Also this parameter will take 1355# and will not work across a fabric. Also this parameter will take
1224# effect only in the case when ALPA map is not available.) 1356# effect only in the case when ALPA map is not available.)
1225*/ 1357*/
1226LPFC_ATTR_R(scan_down, 1, 0, 1, 1358LPFC_VPORT_ATTR_R(scan_down, 1, 0, 1,
1227 "Start scanning for devices from highest ALPA to lowest"); 1359 "Start scanning for devices from highest ALPA to lowest");
1228 1360
1229/* 1361/*
1230# lpfc_topology: link topology for init link 1362# lpfc_topology: link topology for init link
@@ -1255,15 +1387,15 @@ LPFC_ATTR_R(link_speed, 0, 0, 8, "Select link speed");
1255# lpfc_fcp_class: Determines FC class to use for the FCP protocol. 1387# lpfc_fcp_class: Determines FC class to use for the FCP protocol.
1256# Value range is [2,3]. Default value is 3. 1388# Value range is [2,3]. Default value is 3.
1257*/ 1389*/
1258LPFC_ATTR_R(fcp_class, 3, 2, 3, 1390LPFC_VPORT_ATTR_R(fcp_class, 3, 2, 3,
1259 "Select Fibre Channel class of service for FCP sequences"); 1391 "Select Fibre Channel class of service for FCP sequences");
1260 1392
1261/* 1393/*
1262# lpfc_use_adisc: Use ADISC for FCP rediscovery instead of PLOGI. Value range 1394# lpfc_use_adisc: Use ADISC for FCP rediscovery instead of PLOGI. Value range
1263# is [0,1]. Default value is 0. 1395# is [0,1]. Default value is 0.
1264*/ 1396*/
1265LPFC_ATTR_RW(use_adisc, 0, 0, 1, 1397LPFC_VPORT_ATTR_RW(use_adisc, 0, 0, 1,
1266 "Use ADISC on rediscovery to authenticate FCP devices"); 1398 "Use ADISC on rediscovery to authenticate FCP devices");
1267 1399
1268/* 1400/*
1269# lpfc_ack0: Use ACK0, instead of ACK1 for class 2 acknowledgement. Value 1401# lpfc_ack0: Use ACK0, instead of ACK1 for class 2 acknowledgement. Value
@@ -1315,13 +1447,13 @@ LPFC_ATTR_R(multi_ring_type, FC_LLC_SNAP, 1,
1315# 2 = support FDMI with attribute of hostname 1447# 2 = support FDMI with attribute of hostname
1316# Value range [0,2]. Default value is 0. 1448# Value range [0,2]. Default value is 0.
1317*/ 1449*/
1318LPFC_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support"); 1450LPFC_VPORT_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support");
1319 1451
1320/* 1452/*
1321# Specifies the maximum number of ELS cmds we can have outstanding (for 1453# Specifies the maximum number of ELS cmds we can have outstanding (for
1322# discovery). Value range is [1,64]. Default value = 32. 1454# discovery). Value range is [1,64]. Default value = 32.
1323*/ 1455*/
1324LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " 1456LPFC_VPORT_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands "
1325 "during discovery"); 1457 "during discovery");
1326 1458
1327/* 1459/*
@@ -1329,8 +1461,7 @@ LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands "
1329# Value range is [0,65535]. Default value is 255. 1461# Value range is [0,65535]. Default value is 255.
1330# NOTE: The SCSI layer might probe all allowed LUN on some old targets. 1462# NOTE: The SCSI layer might probe all allowed LUN on some old targets.
1331*/ 1463*/
1332LPFC_ATTR_R(max_luns, 255, 0, 65535, 1464LPFC_VPORT_ATTR_R(max_luns, 255, 0, 65535, "Maximum allowed LUN");
1333 "Maximum allowed LUN");
1334 1465
1335/* 1466/*
1336# lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. 1467# lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring.
@@ -1367,7 +1498,6 @@ struct class_device_attribute *lpfc_hba_attrs[] = {
1367 &class_device_attr_lpfc_lun_queue_depth, 1498 &class_device_attr_lpfc_lun_queue_depth,
1368 &class_device_attr_lpfc_hba_queue_depth, 1499 &class_device_attr_lpfc_hba_queue_depth,
1369 &class_device_attr_lpfc_peer_port_login, 1500 &class_device_attr_lpfc_peer_port_login,
1370 &class_device_attr_lpfc_vport_restrict_login,
1371 &class_device_attr_lpfc_nodev_tmo, 1501 &class_device_attr_lpfc_nodev_tmo,
1372 &class_device_attr_lpfc_devloss_tmo, 1502 &class_device_attr_lpfc_devloss_tmo,
1373 &class_device_attr_lpfc_fcp_class, 1503 &class_device_attr_lpfc_fcp_class,
@@ -1383,9 +1513,8 @@ struct class_device_attribute *lpfc_hba_attrs[] = {
1383 &class_device_attr_lpfc_multi_ring_type, 1513 &class_device_attr_lpfc_multi_ring_type,
1384 &class_device_attr_lpfc_fdmi_on, 1514 &class_device_attr_lpfc_fdmi_on,
1385 &class_device_attr_lpfc_max_luns, 1515 &class_device_attr_lpfc_max_luns,
1386 &class_device_attr_lpfc_npiv_enable, 1516 &class_device_attr_lpfc_enable_npiv,
1387 &class_device_attr_nport_evt_cnt, 1517 &class_device_attr_nport_evt_cnt,
1388 &class_device_attr_management_version,
1389 &class_device_attr_board_mode, 1518 &class_device_attr_board_mode,
1390 &class_device_attr_max_vpi, 1519 &class_device_attr_max_vpi,
1391 &class_device_attr_used_vpi, 1520 &class_device_attr_used_vpi,
@@ -1404,6 +1533,28 @@ struct class_device_attribute *lpfc_hba_attrs[] = {
1404 NULL, 1533 NULL,
1405}; 1534};
1406 1535
1536struct class_device_attribute *lpfc_vport_attrs[] = {
1537 &class_device_attr_info,
1538 &class_device_attr_state,
1539 &class_device_attr_num_discovered_ports,
1540 &class_device_attr_lpfc_drvr_version,
1541
1542 &class_device_attr_lpfc_log_verbose,
1543 &class_device_attr_lpfc_lun_queue_depth,
1544 &class_device_attr_lpfc_nodev_tmo,
1545 &class_device_attr_lpfc_devloss_tmo,
1546 &class_device_attr_lpfc_hba_queue_depth,
1547 &class_device_attr_lpfc_peer_port_login,
1548 &class_device_attr_lpfc_restrict_login,
1549 &class_device_attr_lpfc_fcp_class,
1550 &class_device_attr_lpfc_use_adisc,
1551 &class_device_attr_lpfc_fdmi_on,
1552 &class_device_attr_lpfc_max_luns,
1553 &class_device_attr_nport_evt_cnt,
1554 &class_device_attr_npiv_info,
1555 NULL,
1556};
1557
1407static ssize_t 1558static ssize_t
1408sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr, 1559sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr,
1409 char *buf, loff_t off, size_t count) 1560 char *buf, loff_t off, size_t count)
@@ -2243,7 +2394,6 @@ struct fc_function_template lpfc_vport_transport_functions = {
2243 .get_starget_port_name = lpfc_get_starget_port_name, 2394 .get_starget_port_name = lpfc_get_starget_port_name,
2244 .show_starget_port_name = 1, 2395 .show_starget_port_name = 1,
2245 2396
2246 .issue_fc_host_lip = lpfc_issue_lip,
2247 .dev_loss_tmo_callbk = lpfc_dev_loss_tmo_callbk, 2397 .dev_loss_tmo_callbk = lpfc_dev_loss_tmo_callbk,
2248 .terminate_rport_io = lpfc_terminate_rport_io, 2398 .terminate_rport_io = lpfc_terminate_rport_io,
2249 2399
@@ -2253,39 +2403,25 @@ struct fc_function_template lpfc_vport_transport_functions = {
2253void 2403void
2254lpfc_get_cfgparam(struct lpfc_hba *phba) 2404lpfc_get_cfgparam(struct lpfc_hba *phba)
2255{ 2405{
2256 lpfc_log_verbose_init(phba, lpfc_log_verbose);
2257 lpfc_cr_delay_init(phba, lpfc_cr_delay); 2406 lpfc_cr_delay_init(phba, lpfc_cr_delay);
2258 lpfc_cr_count_init(phba, lpfc_cr_count); 2407 lpfc_cr_count_init(phba, lpfc_cr_count);
2259 lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); 2408 lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support);
2260 lpfc_multi_ring_rctl_init(phba, lpfc_multi_ring_rctl); 2409 lpfc_multi_ring_rctl_init(phba, lpfc_multi_ring_rctl);
2261 lpfc_multi_ring_type_init(phba, lpfc_multi_ring_type); 2410 lpfc_multi_ring_type_init(phba, lpfc_multi_ring_type);
2262 lpfc_lun_queue_depth_init(phba, lpfc_lun_queue_depth);
2263 lpfc_fcp_class_init(phba, lpfc_fcp_class);
2264 lpfc_use_adisc_init(phba, lpfc_use_adisc);
2265 lpfc_ack0_init(phba, lpfc_ack0); 2411 lpfc_ack0_init(phba, lpfc_ack0);
2266 lpfc_topology_init(phba, lpfc_topology); 2412 lpfc_topology_init(phba, lpfc_topology);
2267 lpfc_scan_down_init(phba, lpfc_scan_down);
2268 lpfc_link_speed_init(phba, lpfc_link_speed); 2413 lpfc_link_speed_init(phba, lpfc_link_speed);
2269 lpfc_fdmi_on_init(phba, lpfc_fdmi_on);
2270 lpfc_discovery_threads_init(phba, lpfc_discovery_threads);
2271 lpfc_max_luns_init(phba, lpfc_max_luns);
2272 lpfc_poll_tmo_init(phba, lpfc_poll_tmo); 2414 lpfc_poll_tmo_init(phba, lpfc_poll_tmo);
2273 lpfc_peer_port_login_init(phba, lpfc_peer_port_login); 2415 lpfc_enable_npiv_init(phba, lpfc_enable_npiv);
2274 lpfc_npiv_enable_init(phba, lpfc_npiv_enable);
2275 lpfc_vport_restrict_login_init(phba, lpfc_vport_restrict_login);
2276 lpfc_use_msi_init(phba, lpfc_use_msi); 2416 lpfc_use_msi_init(phba, lpfc_use_msi);
2277 lpfc_devloss_tmo_init(phba, lpfc_devloss_tmo);
2278 lpfc_nodev_tmo_init(phba, lpfc_nodev_tmo);
2279 phba->cfg_poll = lpfc_poll; 2417 phba->cfg_poll = lpfc_poll;
2280 phba->cfg_soft_wwnn = 0L; 2418 phba->cfg_soft_wwnn = 0L;
2281 phba->cfg_soft_wwpn = 0L; 2419 phba->cfg_soft_wwpn = 0L;
2282
2283 /* 2420 /*
2284 * The total number of segments is the configuration value plus 2 2421 * The total number of segments is the configuration value plus 2
2285 * since the IOCB need a command and response bde. 2422 * since the IOCB need a command and response bde.
2286 */ 2423 */
2287 phba->cfg_sg_seg_cnt = LPFC_SG_SEG_CNT + 2; 2424 phba->cfg_sg_seg_cnt = LPFC_SG_SEG_CNT + 2;
2288
2289 /* 2425 /*
2290 * Since the sg_tablesize is module parameter, the sg_dma_buf_size 2426 * Since the sg_tablesize is module parameter, the sg_dma_buf_size
2291 * used to create the sg_dma_buf_pool must be dynamically calculated 2427 * used to create the sg_dma_buf_pool must be dynamically calculated
@@ -2293,9 +2429,24 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
2293 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + 2429 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) +
2294 sizeof(struct fcp_rsp) + 2430 sizeof(struct fcp_rsp) +
2295 (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); 2431 (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64));
2296
2297
2298 lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); 2432 lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth);
2433 return;
2434}
2299 2435
2436void
2437lpfc_get_vport_cfgparam(struct lpfc_vport *vport)
2438{
2439 lpfc_log_verbose_init(vport, lpfc_log_verbose);
2440 lpfc_lun_queue_depth_init(vport, lpfc_lun_queue_depth);
2441 lpfc_devloss_tmo_init(vport, lpfc_devloss_tmo);
2442 lpfc_nodev_tmo_init(vport, lpfc_nodev_tmo);
2443 lpfc_peer_port_login_init(vport, lpfc_peer_port_login);
2444 lpfc_restrict_login_init(vport, lpfc_restrict_login);
2445 lpfc_fcp_class_init(vport, lpfc_fcp_class);
2446 lpfc_use_adisc_init(vport, lpfc_use_adisc);
2447 lpfc_fdmi_on_init(vport, lpfc_fdmi_on);
2448 lpfc_discovery_threads_init(vport, lpfc_discovery_threads);
2449 lpfc_max_luns_init(vport, lpfc_max_luns);
2450 lpfc_scan_down_init(vport, lpfc_scan_down);
2300 return; 2451 return;
2301} 2452}
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index e19d1a746586..a599e1510710 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -40,6 +40,7 @@ void lpfc_reg_vpi(struct lpfc_hba *, uint16_t, uint32_t, LPFC_MBOXQ_t *);
40void lpfc_unreg_vpi(struct lpfc_hba *, uint16_t, LPFC_MBOXQ_t *); 40void lpfc_unreg_vpi(struct lpfc_hba *, uint16_t, LPFC_MBOXQ_t *);
41void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t); 41void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t);
42 42
43struct lpfc_vport *lpfc_find_vport_by_did(struct lpfc_hba *, uint32_t);
43void lpfc_cleanup_rpis(struct lpfc_vport *vport, int remove); 44void lpfc_cleanup_rpis(struct lpfc_vport *vport, int remove);
44int lpfc_linkdown(struct lpfc_hba *); 45int lpfc_linkdown(struct lpfc_hba *);
45void lpfc_mbx_cmpl_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *); 46void lpfc_mbx_cmpl_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *);
@@ -101,7 +102,7 @@ int lpfc_issue_els_scr(struct lpfc_vport *, uint32_t, uint8_t);
101int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *); 102int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
102int lpfc_ct_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *); 103int lpfc_ct_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
103int lpfc_els_rsp_acc(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *, 104int lpfc_els_rsp_acc(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *,
104 struct lpfc_nodelist *, LPFC_MBOXQ_t *, uint8_t); 105 struct lpfc_nodelist *, LPFC_MBOXQ_t *);
105int lpfc_els_rsp_reject(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *, 106int lpfc_els_rsp_reject(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *,
106 struct lpfc_nodelist *, LPFC_MBOXQ_t *); 107 struct lpfc_nodelist *, LPFC_MBOXQ_t *);
107int lpfc_els_rsp_adisc_acc(struct lpfc_vport *, struct lpfc_iocbq *, 108int lpfc_els_rsp_adisc_acc(struct lpfc_vport *, struct lpfc_iocbq *,
@@ -117,6 +118,7 @@ void lpfc_els_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
117int lpfc_els_handle_rscn(struct lpfc_vport *); 118int lpfc_els_handle_rscn(struct lpfc_vport *);
118void lpfc_els_flush_rscn(struct lpfc_vport *); 119void lpfc_els_flush_rscn(struct lpfc_vport *);
119int lpfc_rscn_payload_check(struct lpfc_vport *, uint32_t); 120int lpfc_rscn_payload_check(struct lpfc_vport *, uint32_t);
121void lpfc_els_flush_all_cmd(struct lpfc_hba *);
120void lpfc_els_flush_cmd(struct lpfc_vport *); 122void lpfc_els_flush_cmd(struct lpfc_vport *);
121int lpfc_els_disc_adisc(struct lpfc_vport *); 123int lpfc_els_disc_adisc(struct lpfc_vport *);
122int lpfc_els_disc_plogi(struct lpfc_vport *); 124int lpfc_els_disc_plogi(struct lpfc_vport *);
@@ -161,9 +163,11 @@ LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *);
161void lpfc_mbox_cmpl_put(struct lpfc_hba *, LPFC_MBOXQ_t *); 163void lpfc_mbox_cmpl_put(struct lpfc_hba *, LPFC_MBOXQ_t *);
162int lpfc_mbox_tmo_val(struct lpfc_hba *, int); 164int lpfc_mbox_tmo_val(struct lpfc_hba *, int);
163 165
164void lpfc_config_hbq(struct lpfc_hba *, struct lpfc_hbq_init *, uint32_t , 166void lpfc_config_hbq(struct lpfc_hba *, uint32_t, struct lpfc_hbq_init *,
165 LPFC_MBOXQ_t *); 167 uint32_t , LPFC_MBOXQ_t *);
166struct lpfc_hbq_entry * lpfc_sli_next_hbq_slot(struct lpfc_hba *, uint32_t); 168struct lpfc_hbq_entry * lpfc_sli_next_hbq_slot(struct lpfc_hba *, uint32_t);
169struct hbq_dmabuf *lpfc_els_hbq_alloc(struct lpfc_hba *);
170void lpfc_els_hbq_free(struct lpfc_hba *, struct hbq_dmabuf *);
167 171
168int lpfc_mem_alloc(struct lpfc_hba *); 172int lpfc_mem_alloc(struct lpfc_hba *);
169void lpfc_mem_free(struct lpfc_hba *); 173void lpfc_mem_free(struct lpfc_hba *);
@@ -200,6 +204,7 @@ int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *,
200struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *, 204struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *,
201 struct lpfc_sli_ring *, 205 struct lpfc_sli_ring *,
202 dma_addr_t); 206 dma_addr_t);
207int lpfc_sli_hbq_count(void);
203int lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *, uint32_t); 208int lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *, uint32_t);
204int lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *, uint32_t); 209int lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *, uint32_t);
205void lpfc_sli_hbqbuf_free_all(struct lpfc_hba *); 210void lpfc_sli_hbqbuf_free_all(struct lpfc_hba *);
@@ -207,10 +212,9 @@ struct hbq_dmabuf *lpfc_sli_hbqbuf_find(struct lpfc_hba *, uint32_t);
207int lpfc_sli_hbq_size(void); 212int lpfc_sli_hbq_size(void);
208int lpfc_sli_issue_abort_iotag(struct lpfc_hba *, struct lpfc_sli_ring *, 213int lpfc_sli_issue_abort_iotag(struct lpfc_hba *, struct lpfc_sli_ring *,
209 struct lpfc_iocbq *); 214 struct lpfc_iocbq *);
210int lpfc_sli_sum_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, 215int lpfc_sli_sum_iocb(struct lpfc_vport *, uint16_t, uint64_t, lpfc_ctx_cmd);
211 uint64_t, lpfc_ctx_cmd); 216int lpfc_sli_abort_iocb(struct lpfc_vport *, struct lpfc_sli_ring *, uint16_t,
212int lpfc_sli_abort_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, 217 uint64_t, lpfc_ctx_cmd);
213 uint64_t, uint32_t, lpfc_ctx_cmd);
214 218
215void lpfc_mbox_timeout(unsigned long); 219void lpfc_mbox_timeout(unsigned long);
216void lpfc_mbox_timeout_handler(struct lpfc_hba *); 220void lpfc_mbox_timeout_handler(struct lpfc_hba *);
@@ -234,8 +238,6 @@ void lpfc_sli_abort_fcp_cmpl(struct lpfc_hba * phba,
234 struct lpfc_iocbq * cmdiocb, 238 struct lpfc_iocbq * cmdiocb,
235 struct lpfc_iocbq * rspiocb); 239 struct lpfc_iocbq * rspiocb);
236 240
237void *lpfc_hbq_alloc(struct lpfc_hba *, int, dma_addr_t *);
238void lpfc_hbq_free(struct lpfc_hba *, void *, dma_addr_t);
239void lpfc_sli_free_hbq(struct lpfc_hba *, struct hbq_dmabuf *); 241void lpfc_sli_free_hbq(struct lpfc_hba *, struct hbq_dmabuf *);
240 242
241void *lpfc_mbuf_alloc(struct lpfc_hba *, int, dma_addr_t *); 243void *lpfc_mbuf_alloc(struct lpfc_hba *, int, dma_addr_t *);
@@ -248,10 +250,13 @@ const char* lpfc_info(struct Scsi_Host *);
248int lpfc_scan_finished(struct Scsi_Host *, unsigned long); 250int lpfc_scan_finished(struct Scsi_Host *, unsigned long);
249 251
250void lpfc_get_cfgparam(struct lpfc_hba *); 252void lpfc_get_cfgparam(struct lpfc_hba *);
253void lpfc_get_vport_cfgparam(struct lpfc_vport *);
251int lpfc_alloc_sysfs_attr(struct lpfc_vport *); 254int lpfc_alloc_sysfs_attr(struct lpfc_vport *);
252void lpfc_free_sysfs_attr(struct lpfc_vport *); 255void lpfc_free_sysfs_attr(struct lpfc_vport *);
253extern struct class_device_attribute *lpfc_hba_attrs[]; 256extern struct class_device_attribute *lpfc_hba_attrs[];
257extern struct class_device_attribute *lpfc_vport_attrs[];
254extern struct scsi_host_template lpfc_template; 258extern struct scsi_host_template lpfc_template;
259extern struct scsi_host_template lpfc_vport_template;
255extern struct fc_function_template lpfc_transport_functions; 260extern struct fc_function_template lpfc_transport_functions;
256extern struct fc_function_template lpfc_vport_transport_functions; 261extern struct fc_function_template lpfc_vport_transport_functions;
257extern int lpfc_sli_mode; 262extern int lpfc_sli_mode;
@@ -260,7 +265,7 @@ int lpfc_vport_symbolic_node_name(struct lpfc_vport *, char *, size_t);
260void lpfc_terminate_rport_io(struct fc_rport *); 265void lpfc_terminate_rport_io(struct fc_rport *);
261void lpfc_dev_loss_tmo_callbk(struct fc_rport *rport); 266void lpfc_dev_loss_tmo_callbk(struct fc_rport *rport);
262 267
263struct lpfc_vport *lpfc_create_port(struct lpfc_hba *, int, struct fc_vport *); 268struct lpfc_vport *lpfc_create_port(struct lpfc_hba *, int, struct device *);
264int lpfc_vport_disable(struct fc_vport *fc_vport, bool disable); 269int lpfc_vport_disable(struct fc_vport *fc_vport, bool disable);
265void lpfc_mbx_unreg_vpi(struct lpfc_vport *); 270void lpfc_mbx_unreg_vpi(struct lpfc_vport *);
266void destroy_port(struct lpfc_vport *); 271void destroy_port(struct lpfc_vport *);
@@ -271,6 +276,9 @@ extern void lpfc_debugfs_initialize(struct lpfc_vport *);
271extern void lpfc_debugfs_terminate(struct lpfc_vport *); 276extern void lpfc_debugfs_terminate(struct lpfc_vport *);
272extern void lpfc_debugfs_disc_trc(struct lpfc_vport *, int, char *, uint32_t, 277extern void lpfc_debugfs_disc_trc(struct lpfc_vport *, int, char *, uint32_t,
273 uint32_t, uint32_t); 278 uint32_t, uint32_t);
279extern void lpfc_debugfs_slow_ring_trc(struct lpfc_hba *, char *, uint32_t,
280 uint32_t, uint32_t);
281extern struct lpfc_hbq_init *lpfc_hbq_defs[];
274 282
275/* Interface exported by fabric iocb scheduler */ 283/* Interface exported by fabric iocb scheduler */
276int lpfc_issue_fabric_iocb(struct lpfc_hba *, struct lpfc_iocbq *); 284int lpfc_issue_fabric_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index ae9d6f385a6c..c701e4d611a9 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -257,6 +257,10 @@ lpfc_ct_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *ctiocb)
257{ 257{
258 struct lpfc_dmabuf *buf_ptr; 258 struct lpfc_dmabuf *buf_ptr;
259 259
260 if (ctiocb->context_un.ndlp) {
261 lpfc_nlp_put(ctiocb->context_un.ndlp);
262 ctiocb->context_un.ndlp = NULL;
263 }
260 if (ctiocb->context1) { 264 if (ctiocb->context1) {
261 buf_ptr = (struct lpfc_dmabuf *) ctiocb->context1; 265 buf_ptr = (struct lpfc_dmabuf *) ctiocb->context1;
262 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); 266 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys);
@@ -314,6 +318,7 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp,
314 /* Save for completion so we can release these resources */ 318 /* Save for completion so we can release these resources */
315 geniocb->context1 = (uint8_t *) inp; 319 geniocb->context1 = (uint8_t *) inp;
316 geniocb->context2 = (uint8_t *) outp; 320 geniocb->context2 = (uint8_t *) outp;
321 geniocb->context_un.ndlp = ndlp;
317 322
318 /* Fill in payload, bp points to frame payload */ 323 /* Fill in payload, bp points to frame payload */
319 icmd->ulpCommand = CMD_GEN_REQUEST64_CR; 324 icmd->ulpCommand = CMD_GEN_REQUEST64_CR;
@@ -341,11 +346,11 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp,
341 } 346 }
342 347
343 /* Issue GEN REQ IOCB for NPORT <did> */ 348 /* Issue GEN REQ IOCB for NPORT <did> */
344 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 349 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
345 "%d (%d):0119 Issue GEN REQ IOCB to NPORT x%x " 350 "0119 Issue GEN REQ IOCB to NPORT x%x "
346 "Data: x%x x%x\n", phba->brd_no, vport->vpi, 351 "Data: x%x x%x\n",
347 ndlp->nlp_DID, icmd->ulpIoTag, 352 ndlp->nlp_DID, icmd->ulpIoTag,
348 vport->port_state); 353 vport->port_state);
349 geniocb->iocb_cmpl = cmpl; 354 geniocb->iocb_cmpl = cmpl;
350 geniocb->drvrTimeout = icmd->ulpTimeout + LPFC_DRVR_TIMEOUT; 355 geniocb->drvrTimeout = icmd->ulpTimeout + LPFC_DRVR_TIMEOUT;
351 geniocb->vport = vport; 356 geniocb->vport = vport;
@@ -390,17 +395,19 @@ lpfc_ct_cmd(struct lpfc_vport *vport, struct lpfc_dmabuf *inmp,
390 return 0; 395 return 0;
391} 396}
392 397
393static struct lpfc_vport * 398struct lpfc_vport *
394lpfc_find_vport_by_did(struct lpfc_hba *phba, uint32_t did) { 399lpfc_find_vport_by_did(struct lpfc_hba *phba, uint32_t did) {
395
396 struct lpfc_vport *vport_curr; 400 struct lpfc_vport *vport_curr;
401 unsigned long flags;
397 402
403 spin_lock_irqsave(&phba->hbalock, flags);
398 list_for_each_entry(vport_curr, &phba->port_list, listentry) { 404 list_for_each_entry(vport_curr, &phba->port_list, listentry) {
399 if ((vport_curr->fc_myDID) && 405 if ((vport_curr->fc_myDID) && (vport_curr->fc_myDID == did)) {
400 (vport_curr->fc_myDID == did)) 406 spin_unlock_irqrestore(&phba->hbalock, flags);
401 return vport_curr; 407 return vport_curr;
408 }
402 } 409 }
403 410 spin_unlock_irqrestore(&phba->hbalock, flags);
404 return NULL; 411 return NULL;
405} 412}
406 413
@@ -449,10 +456,10 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size)
449 */ 456 */
450 if ((Did != vport->fc_myDID) && 457 if ((Did != vport->fc_myDID) &&
451 ((lpfc_find_vport_by_did(phba, Did) == NULL) || 458 ((lpfc_find_vport_by_did(phba, Did) == NULL) ||
452 phba->cfg_peer_port_login)) { 459 vport->cfg_peer_port_login)) {
453 if ((vport->port_type != LPFC_NPIV_PORT) || 460 if ((vport->port_type != LPFC_NPIV_PORT) ||
454 (vport->fc_flag & FC_RFF_NOT_SUPPORTED) || 461 (vport->fc_flag & FC_RFF_NOT_SUPPORTED) ||
455 (!phba->cfg_vport_restrict_login)) { 462 (!vport->cfg_restrict_login)) {
456 ndlp = lpfc_setup_disc_node(vport, Did); 463 ndlp = lpfc_setup_disc_node(vport, Did);
457 if (ndlp) { 464 if (ndlp) {
458 lpfc_debugfs_disc_trc(vport, 465 lpfc_debugfs_disc_trc(vport,
@@ -462,14 +469,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size)
462 Did, ndlp->nlp_flag, 469 Did, ndlp->nlp_flag,
463 vport->fc_flag); 470 vport->fc_flag);
464 471
465 lpfc_printf_log(phba, KERN_INFO, 472 lpfc_printf_vlog(vport,
473 KERN_INFO,
466 LOG_DISCOVERY, 474 LOG_DISCOVERY,
467 "%d (%d):0238 Process " 475 "0238 Process "
468 "x%x NameServer Rsp" 476 "x%x NameServer Rsp"
469 "Data: x%x x%x x%x\n", 477 "Data: x%x x%x x%x\n",
470 phba->brd_no, 478 Did, ndlp->nlp_flag,
471 vport->vpi, Did,
472 ndlp->nlp_flag,
473 vport->fc_flag, 479 vport->fc_flag,
474 vport->fc_rscn_id_cnt); 480 vport->fc_rscn_id_cnt);
475 } else { 481 } else {
@@ -480,14 +486,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size)
480 Did, vport->fc_flag, 486 Did, vport->fc_flag,
481 vport->fc_rscn_id_cnt); 487 vport->fc_rscn_id_cnt);
482 488
483 lpfc_printf_log(phba, KERN_INFO, 489 lpfc_printf_vlog(vport,
490 KERN_INFO,
484 LOG_DISCOVERY, 491 LOG_DISCOVERY,
485 "%d (%d):0239 Skip x%x " 492 "0239 Skip x%x "
486 "NameServer Rsp Data: " 493 "NameServer Rsp Data: "
487 "x%x x%x\n", 494 "x%x x%x\n",
488 phba->brd_no, 495 Did, vport->fc_flag,
489 vport->vpi, Did,
490 vport->fc_flag,
491 vport->fc_rscn_id_cnt); 496 vport->fc_rscn_id_cnt);
492 } 497 }
493 498
@@ -514,14 +519,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size)
514 Did, vport->fc_flag, 519 Did, vport->fc_flag,
515 vport->fc_rscn_id_cnt); 520 vport->fc_rscn_id_cnt);
516 521
517 lpfc_printf_log(phba, KERN_INFO, 522 lpfc_printf_vlog(vport,
523 KERN_INFO,
518 LOG_DISCOVERY, 524 LOG_DISCOVERY,
519 "%d (%d):0245 Skip x%x " 525 "0245 Skip x%x "
520 "NameServer Rsp Data: " 526 "NameServer Rsp Data: "
521 "x%x x%x\n", 527 "x%x x%x\n",
522 phba->brd_no, 528 Did, vport->fc_flag,
523 vport->vpi, Did,
524 vport->fc_flag,
525 vport->fc_rscn_id_cnt); 529 vport->fc_rscn_id_cnt);
526 } 530 }
527 } 531 }
@@ -549,8 +553,12 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
549 struct lpfc_dmabuf *bmp; 553 struct lpfc_dmabuf *bmp;
550 struct lpfc_dmabuf *outp; 554 struct lpfc_dmabuf *outp;
551 struct lpfc_sli_ct_request *CTrsp; 555 struct lpfc_sli_ct_request *CTrsp;
556 struct lpfc_nodelist *ndlp;
552 int rc; 557 int rc;
553 558
559 /* First save ndlp, before we overwrite it */
560 ndlp = cmdiocb->context_un.ndlp;
561
554 /* we pass cmdiocb to state machine which needs rspiocb as well */ 562 /* we pass cmdiocb to state machine which needs rspiocb as well */
555 cmdiocb->context_un.rsp_iocb = rspiocb; 563 cmdiocb->context_un.rsp_iocb = rspiocb;
556 564
@@ -568,9 +576,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
568 576
569 577
570 if (lpfc_els_chk_latt(vport) || lpfc_error_lost_link(irsp)) { 578 if (lpfc_els_chk_latt(vport) || lpfc_error_lost_link(irsp)) {
571 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 579 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
572 "%d (%d):0216 Link event during NS query\n", 580 "0216 Link event during NS query\n");
573 phba->brd_no, vport->vpi);
574 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 581 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
575 goto out; 582 goto out;
576 } 583 }
@@ -588,46 +595,61 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
588 goto out; 595 goto out;
589 } 596 }
590 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 597 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
591 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 598 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
592 "%d (%d):0257 GID_FT Query error: 0x%x 0x%x\n", 599 "0257 GID_FT Query error: 0x%x 0x%x\n",
593 phba->brd_no, vport->vpi, irsp->ulpStatus, 600 irsp->ulpStatus, vport->fc_ns_retry);
594 vport->fc_ns_retry);
595 } else { 601 } else {
596 /* Good status, continue checking */ 602 /* Good status, continue checking */
597 CTrsp = (struct lpfc_sli_ct_request *) outp->virt; 603 CTrsp = (struct lpfc_sli_ct_request *) outp->virt;
598 if (CTrsp->CommandResponse.bits.CmdRsp == 604 if (CTrsp->CommandResponse.bits.CmdRsp ==
599 be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { 605 be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) {
600 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 606 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
601 "%d (%d):0208 NameServer Rsp " 607 "0208 NameServer Rsp Data: x%x\n",
602 "Data: x%x\n", 608 vport->fc_flag);
603 phba->brd_no, vport->vpi,
604 vport->fc_flag);
605 lpfc_ns_rsp(vport, outp, 609 lpfc_ns_rsp(vport, outp,
606 (uint32_t) (irsp->un.genreq64.bdl.bdeSize)); 610 (uint32_t) (irsp->un.genreq64.bdl.bdeSize));
607 } else if (CTrsp->CommandResponse.bits.CmdRsp == 611 } else if (CTrsp->CommandResponse.bits.CmdRsp ==
608 be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { 612 be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) {
609 /* NameServer Rsp Error */ 613 /* NameServer Rsp Error */
610 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 614 if ((CTrsp->ReasonCode == SLI_CT_UNABLE_TO_PERFORM_REQ)
611 "%d (%d):0240 NameServer Rsp Error " 615 && (CTrsp->Explanation == SLI_CT_NO_FC4_TYPES)) {
616 lpfc_printf_vlog(vport, KERN_INFO,
617 LOG_DISCOVERY,
618 "0269 No NameServer Entries "
612 "Data: x%x x%x x%x x%x\n", 619 "Data: x%x x%x x%x x%x\n",
613 phba->brd_no, vport->vpi,
614 CTrsp->CommandResponse.bits.CmdRsp, 620 CTrsp->CommandResponse.bits.CmdRsp,
615 (uint32_t) CTrsp->ReasonCode, 621 (uint32_t) CTrsp->ReasonCode,
616 (uint32_t) CTrsp->Explanation, 622 (uint32_t) CTrsp->Explanation,
617 vport->fc_flag); 623 vport->fc_flag);
618 624
619 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, 625 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT,
626 "GID_FT no entry cmd:x%x rsn:x%x exp:x%x",
627 (uint32_t)CTrsp->CommandResponse.bits.CmdRsp,
628 (uint32_t) CTrsp->ReasonCode,
629 (uint32_t) CTrsp->Explanation);
630 } else {
631 lpfc_printf_vlog(vport, KERN_INFO,
632 LOG_DISCOVERY,
633 "0240 NameServer Rsp Error "
634 "Data: x%x x%x x%x x%x\n",
635 CTrsp->CommandResponse.bits.CmdRsp,
636 (uint32_t) CTrsp->ReasonCode,
637 (uint32_t) CTrsp->Explanation,
638 vport->fc_flag);
639
640 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT,
620 "GID_FT rsp err1 cmd:x%x rsn:x%x exp:x%x", 641 "GID_FT rsp err1 cmd:x%x rsn:x%x exp:x%x",
621 (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, 642 (uint32_t)CTrsp->CommandResponse.bits.CmdRsp,
622 (uint32_t) CTrsp->ReasonCode, 643 (uint32_t) CTrsp->ReasonCode,
623 (uint32_t) CTrsp->Explanation); 644 (uint32_t) CTrsp->Explanation);
645 }
646
624 647
625 } else { 648 } else {
626 /* NameServer Rsp Error */ 649 /* NameServer Rsp Error */
627 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 650 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
628 "%d (%d):0241 NameServer Rsp Error " 651 "0241 NameServer Rsp Error "
629 "Data: x%x x%x x%x x%x\n", 652 "Data: x%x x%x x%x x%x\n",
630 phba->brd_no, vport->vpi,
631 CTrsp->CommandResponse.bits.CmdRsp, 653 CTrsp->CommandResponse.bits.CmdRsp,
632 (uint32_t) CTrsp->ReasonCode, 654 (uint32_t) CTrsp->ReasonCode,
633 (uint32_t) CTrsp->Explanation, 655 (uint32_t) CTrsp->Explanation,
@@ -661,11 +683,12 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
661 lpfc_disc_start(vport); 683 lpfc_disc_start(vport);
662 } 684 }
663out: 685out:
686 cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */
664 lpfc_ct_free_iocb(phba, cmdiocb); 687 lpfc_ct_free_iocb(phba, cmdiocb);
665 return; 688 return;
666} 689}
667 690
668void 691static void
669lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, 692lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
670 struct lpfc_iocbq *rspiocb) 693 struct lpfc_iocbq *rspiocb)
671{ 694{
@@ -695,40 +718,37 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
695 be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { 718 be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) {
696 if ((fbits & FC4_FEATURE_INIT) && 719 if ((fbits & FC4_FEATURE_INIT) &&
697 !(fbits & FC4_FEATURE_TARGET)) { 720 !(fbits & FC4_FEATURE_TARGET)) {
698 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 721 lpfc_printf_vlog(vport, KERN_INFO,
699 "%d (%d):0245 Skip x%x GFF " 722 LOG_DISCOVERY,
700 "NameServer Rsp Data: (init) " 723 "0270 Skip x%x GFF "
701 "x%x x%x\n", phba->brd_no, 724 "NameServer Rsp Data: (init) "
702 vport->vpi, did, fbits, 725 "x%x x%x\n", did, fbits,
703 vport->fc_rscn_id_cnt); 726 vport->fc_rscn_id_cnt);
704 goto out; 727 goto out;
705 } 728 }
706 } 729 }
707 } 730 }
708 else { 731 else {
709 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 732 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
710 "%d (%d):0267 NameServer GFF Rsp" 733 "0267 NameServer GFF Rsp "
711 " x%x Error (%d %d) Data: x%x x%x\n", 734 "x%x Error (%d %d) Data: x%x x%x\n",
712 phba->brd_no, vport->vpi, did, 735 did, irsp->ulpStatus, irsp->un.ulpWord[4],
713 irsp->ulpStatus, irsp->un.ulpWord[4], 736 vport->fc_flag, vport->fc_rscn_id_cnt)
714 vport->fc_flag, vport->fc_rscn_id_cnt)
715 } 737 }
716 738
717 /* This is a target port, unregistered port, or the GFF_ID failed */ 739 /* This is a target port, unregistered port, or the GFF_ID failed */
718 ndlp = lpfc_setup_disc_node(vport, did); 740 ndlp = lpfc_setup_disc_node(vport, did);
719 if (ndlp) { 741 if (ndlp) {
720 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 742 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
721 "%d (%d):0242 Process x%x GFF " 743 "0242 Process x%x GFF "
722 "NameServer Rsp Data: x%x x%x x%x\n", 744 "NameServer Rsp Data: x%x x%x x%x\n",
723 phba->brd_no, vport->vpi, 745 did, ndlp->nlp_flag, vport->fc_flag,
724 did, ndlp->nlp_flag, vport->fc_flag, 746 vport->fc_rscn_id_cnt);
725 vport->fc_rscn_id_cnt);
726 } else { 747 } else {
727 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 748 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
728 "%d (%d):0243 Skip x%x GFF " 749 "0243 Skip x%x GFF "
729 "NameServer Rsp Data: x%x x%x\n", 750 "NameServer Rsp Data: x%x x%x\n", did,
730 phba->brd_no, vport->vpi, did, 751 vport->fc_flag, vport->fc_rscn_id_cnt);
731 vport->fc_flag, vport->fc_rscn_id_cnt);
732 } 752 }
733out: 753out:
734 /* Link up / RSCN discovery */ 754 /* Link up / RSCN discovery */
@@ -766,10 +786,14 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
766 struct lpfc_dmabuf *outp; 786 struct lpfc_dmabuf *outp;
767 IOCB_t *irsp; 787 IOCB_t *irsp;
768 struct lpfc_sli_ct_request *CTrsp; 788 struct lpfc_sli_ct_request *CTrsp;
789 struct lpfc_nodelist *ndlp;
769 int cmdcode, rc; 790 int cmdcode, rc;
770 uint8_t retry; 791 uint8_t retry;
771 uint32_t latt; 792 uint32_t latt;
772 793
794 /* First save ndlp, before we overwrite it */
795 ndlp = cmdiocb->context_un.ndlp;
796
773 /* we pass cmdiocb to state machine which needs rspiocb as well */ 797 /* we pass cmdiocb to state machine which needs rspiocb as well */
774 cmdiocb->context_un.rsp_iocb = rspiocb; 798 cmdiocb->context_un.rsp_iocb = rspiocb;
775 799
@@ -784,22 +808,21 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
784 latt = lpfc_els_chk_latt(vport); 808 latt = lpfc_els_chk_latt(vport);
785 809
786 /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */ 810 /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */
787 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 811 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
788 "%d (%d):0209 RFT request completes, latt %d, " 812 "0209 RFT request completes, latt %d, "
789 "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n", 813 "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n",
790 phba->brd_no, vport->vpi, latt, irsp->ulpStatus, 814 latt, irsp->ulpStatus,
791 CTrsp->CommandResponse.bits.CmdRsp, 815 CTrsp->CommandResponse.bits.CmdRsp,
792 cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag); 816 cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag);
793 817
794 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, 818 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT,
795 "CT cmd cmpl: status:x%x/x%x cmd:x%x", 819 "CT cmd cmpl: status:x%x/x%x cmd:x%x",
796 irsp->ulpStatus, irsp->un.ulpWord[4], cmdcode); 820 irsp->ulpStatus, irsp->un.ulpWord[4], cmdcode);
797 821
798 if (irsp->ulpStatus) { 822 if (irsp->ulpStatus) {
799 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 823 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
800 "%d (%d):0268 NS cmd %x Error (%d %d)\n", 824 "0268 NS cmd %x Error (%d %d)\n",
801 phba->brd_no, vport->vpi, cmdcode, 825 cmdcode, irsp->ulpStatus, irsp->un.ulpWord[4]);
802 irsp->ulpStatus, irsp->un.ulpWord[4]);
803 826
804 if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && 827 if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
805 ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) || 828 ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) ||
@@ -811,15 +834,15 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
811 goto out; 834 goto out;
812 835
813 retry++; 836 retry++;
814 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 837 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
815 "%d (%d):0216 Retrying NS cmd %x\n", 838 "0216 Retrying NS cmd %x\n", cmdcode);
816 phba->brd_no, vport->vpi, cmdcode);
817 rc = lpfc_ns_cmd(vport, cmdcode, retry, 0); 839 rc = lpfc_ns_cmd(vport, cmdcode, retry, 0);
818 if (rc == 0) 840 if (rc == 0)
819 goto out; 841 goto out;
820 } 842 }
821 843
822out: 844out:
845 cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */
823 lpfc_ct_free_iocb(phba, cmdiocb); 846 lpfc_ct_free_iocb(phba, cmdiocb);
824 return; 847 return;
825} 848}
@@ -862,7 +885,7 @@ lpfc_cmpl_ct_cmd_rff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
862 return; 885 return;
863} 886}
864 887
865int 888static int
866lpfc_vport_symbolic_port_name(struct lpfc_vport *vport, char *symbol, 889lpfc_vport_symbolic_port_name(struct lpfc_vport *vport, char *symbol,
867 size_t size) 890 size_t size)
868{ 891{
@@ -957,10 +980,9 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
957 } 980 }
958 981
959 /* NameServer Req */ 982 /* NameServer Req */
960 lpfc_printf_log(phba, KERN_INFO ,LOG_DISCOVERY, 983 lpfc_printf_vlog(vport, KERN_INFO ,LOG_DISCOVERY,
961 "%d (%d):0236 NameServer Req Data: x%x x%x x%x\n", 984 "0236 NameServer Req Data: x%x x%x x%x\n",
962 phba->brd_no, vport->vpi, cmdcode, vport->fc_flag, 985 cmdcode, vport->fc_flag, vport->fc_rscn_id_cnt);
963 vport->fc_rscn_id_cnt);
964 986
965 bpl = (struct ulp_bde64 *) bmp->virt; 987 bpl = (struct ulp_bde64 *) bmp->virt;
966 memset(bpl, 0, sizeof(struct ulp_bde64)); 988 memset(bpl, 0, sizeof(struct ulp_bde64));
@@ -1059,6 +1081,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
1059 cmpl = lpfc_cmpl_ct_cmd_rff_id; 1081 cmpl = lpfc_cmpl_ct_cmd_rff_id;
1060 break; 1082 break;
1061 } 1083 }
1084 lpfc_nlp_get(ndlp);
1062 1085
1063 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) { 1086 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) {
1064 /* On success, The cmpl function will free the buffers */ 1087 /* On success, The cmpl function will free the buffers */
@@ -1069,6 +1092,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
1069 } 1092 }
1070 1093
1071 rc=6; 1094 rc=6;
1095 lpfc_nlp_put(ndlp);
1072 lpfc_mbuf_free(phba, bmp->virt, bmp->phys); 1096 lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
1073ns_cmd_free_bmp: 1097ns_cmd_free_bmp:
1074 kfree(bmp); 1098 kfree(bmp);
@@ -1077,10 +1101,9 @@ ns_cmd_free_mpvirt:
1077ns_cmd_free_mp: 1101ns_cmd_free_mp:
1078 kfree(mp); 1102 kfree(mp);
1079ns_cmd_exit: 1103ns_cmd_exit:
1080 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 1104 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
1081 "%d (%d):0266 Issue NameServer Req x%x err %d Data: x%x x%x\n", 1105 "0266 Issue NameServer Req x%x err %d Data: x%x x%x\n",
1082 phba->brd_no, vport->vpi, cmdcode, rc, vport->fc_flag, 1106 cmdcode, rc, vport->fc_flag, vport->fc_rscn_id_cnt);
1083 vport->fc_rscn_id_cnt);
1084 return 1; 1107 return 1;
1085} 1108}
1086 1109
@@ -1106,12 +1129,11 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1106 irsp->ulpStatus, irsp->un.ulpWord[4], latt); 1129 irsp->ulpStatus, irsp->un.ulpWord[4], latt);
1107 1130
1108 if (latt || irsp->ulpStatus) { 1131 if (latt || irsp->ulpStatus) {
1109 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 1132 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
1110 "%d (%d):0229 FDMI cmd %04x failed, latt = %d " 1133 "0229 FDMI cmd %04x failed, latt = %d "
1111 "ulpStatus: x%x, rid x%x\n", 1134 "ulpStatus: x%x, rid x%x\n",
1112 phba->brd_no, vport->vpi, 1135 be16_to_cpu(fdmi_cmd), latt, irsp->ulpStatus,
1113 be16_to_cpu(fdmi_cmd), latt, irsp->ulpStatus, 1136 irsp->un.ulpWord[4]);
1114 irsp->un.ulpWord[4]);
1115 lpfc_ct_free_iocb(phba, cmdiocb); 1137 lpfc_ct_free_iocb(phba, cmdiocb);
1116 return; 1138 return;
1117 } 1139 }
@@ -1119,10 +1141,9 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1119 ndlp = lpfc_findnode_did(vport, FDMI_DID); 1141 ndlp = lpfc_findnode_did(vport, FDMI_DID);
1120 if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { 1142 if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) {
1121 /* FDMI rsp failed */ 1143 /* FDMI rsp failed */
1122 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 1144 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
1123 "%d (%d):0220 FDMI rsp failed Data: x%x\n", 1145 "0220 FDMI rsp failed Data: x%x\n",
1124 phba->brd_no, vport->vpi, 1146 be16_to_cpu(fdmi_cmd));
1125 be16_to_cpu(fdmi_cmd));
1126 } 1147 }
1127 1148
1128 switch (be16_to_cpu(fdmi_cmd)) { 1149 switch (be16_to_cpu(fdmi_cmd)) {
@@ -1185,11 +1206,9 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
1185 INIT_LIST_HEAD(&bmp->list); 1206 INIT_LIST_HEAD(&bmp->list);
1186 1207
1187 /* FDMI request */ 1208 /* FDMI request */
1188 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 1209 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
1189 "%d (%d):0218 FDMI Request Data: x%x x%x x%x\n", 1210 "0218 FDMI Request Data: x%x x%x x%x\n",
1190 phba->brd_no, vport->vpi, vport->fc_flag, 1211 vport->fc_flag, vport->port_state, cmdcode);
1191 vport->port_state, cmdcode);
1192
1193 CtReq = (struct lpfc_sli_ct_request *) mp->virt; 1212 CtReq = (struct lpfc_sli_ct_request *) mp->virt;
1194 1213
1195 memset(CtReq, 0, sizeof(struct lpfc_sli_ct_request)); 1214 memset(CtReq, 0, sizeof(struct lpfc_sli_ct_request));
@@ -1449,7 +1468,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
1449 pab->ab.EntryCnt++; 1468 pab->ab.EntryCnt++;
1450 size += FOURBYTES + len; 1469 size += FOURBYTES + len;
1451 1470
1452 if (phba->cfg_fdmi_on == 2) { 1471 if (vport->cfg_fdmi_on == 2) {
1453 /* #6 Port attribute entry */ 1472 /* #6 Port attribute entry */
1454 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab + 1473 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab +
1455 size); 1474 size);
@@ -1499,10 +1518,12 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
1499 bpl->tus.w = le32_to_cpu(bpl->tus.w); 1518 bpl->tus.w = le32_to_cpu(bpl->tus.w);
1500 1519
1501 cmpl = lpfc_cmpl_ct_cmd_fdmi; 1520 cmpl = lpfc_cmpl_ct_cmd_fdmi;
1521 lpfc_nlp_get(ndlp);
1502 1522
1503 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0)) 1523 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0))
1504 return 0; 1524 return 0;
1505 1525
1526 lpfc_nlp_put(ndlp);
1506 lpfc_mbuf_free(phba, bmp->virt, bmp->phys); 1527 lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
1507fdmi_cmd_free_bmp: 1528fdmi_cmd_free_bmp:
1508 kfree(bmp); 1529 kfree(bmp);
@@ -1512,9 +1533,9 @@ fdmi_cmd_free_mp:
1512 kfree(mp); 1533 kfree(mp);
1513fdmi_cmd_exit: 1534fdmi_cmd_exit:
1514 /* Issue FDMI request failed */ 1535 /* Issue FDMI request failed */
1515 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 1536 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
1516 "%d (%d):0244 Issue FDMI request failed Data: x%x\n", 1537 "0244 Issue FDMI request failed Data: x%x\n",
1517 phba->brd_no, vport->vpi, cmdcode); 1538 cmdcode);
1518 return 1; 1539 return 1;
1519} 1540}
1520 1541
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 673cfe11cc2b..2e3c01bebed6 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -71,15 +71,22 @@
71 * lpfc_debugfs_mask_disc_trc=Y Where Y is an event mask as defined in 71 * lpfc_debugfs_mask_disc_trc=Y Where Y is an event mask as defined in
72 * lpfc_debugfs.h . 72 * lpfc_debugfs.h .
73 */ 73 */
74static int lpfc_debugfs_enable = 0; 74static int lpfc_debugfs_enable = 1;
75module_param(lpfc_debugfs_enable, int, 0); 75module_param(lpfc_debugfs_enable, int, 0);
76MODULE_PARM_DESC(lpfc_debugfs_enable, "Enable debugfs services"); 76MODULE_PARM_DESC(lpfc_debugfs_enable, "Enable debugfs services");
77 77
78static int lpfc_debugfs_max_disc_trc = 0; /* This MUST be a power of 2 */ 78/* This MUST be a power of 2 */
79static int lpfc_debugfs_max_disc_trc = 0;
79module_param(lpfc_debugfs_max_disc_trc, int, 0); 80module_param(lpfc_debugfs_max_disc_trc, int, 0);
80MODULE_PARM_DESC(lpfc_debugfs_max_disc_trc, 81MODULE_PARM_DESC(lpfc_debugfs_max_disc_trc,
81 "Set debugfs discovery trace depth"); 82 "Set debugfs discovery trace depth");
82 83
84/* This MUST be a power of 2 */
85static int lpfc_debugfs_max_slow_ring_trc = 0;
86module_param(lpfc_debugfs_max_slow_ring_trc, int, 0);
87MODULE_PARM_DESC(lpfc_debugfs_max_slow_ring_trc,
88 "Set debugfs slow ring trace depth");
89
83static int lpfc_debugfs_mask_disc_trc = 0; 90static int lpfc_debugfs_mask_disc_trc = 0;
84module_param(lpfc_debugfs_mask_disc_trc, int, 0); 91module_param(lpfc_debugfs_mask_disc_trc, int, 0);
85MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, 92MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc,
@@ -87,28 +94,34 @@ MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc,
87 94
88#include <linux/debugfs.h> 95#include <linux/debugfs.h>
89 96
90/* size of discovery_trace output line */ 97/* size of output line, for discovery_trace and slow_ring_trace */
91#define LPFC_DISC_TRC_ENTRY_SIZE 80 98#define LPFC_DEBUG_TRC_ENTRY_SIZE 100
92 99
93/* nodelist output buffer size */ 100/* nodelist output buffer size */
94#define LPFC_NODELIST_SIZE 8192 101#define LPFC_NODELIST_SIZE 8192
95#define LPFC_NODELIST_ENTRY_SIZE 120 102#define LPFC_NODELIST_ENTRY_SIZE 120
96 103
104/* dumpslim output buffer size */
105#define LPFC_DUMPSLIM_SIZE 4096
106
107/* hbqinfo output buffer size */
108#define LPFC_HBQINFO_SIZE 8192
109
97struct lpfc_debug { 110struct lpfc_debug {
98 char *buffer; 111 char *buffer;
99 int len; 112 int len;
100}; 113};
101 114
102atomic_t lpfc_debugfs_disc_trc_cnt = ATOMIC_INIT(0); 115static atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0);
103unsigned long lpfc_debugfs_start_time = 0L; 116static unsigned long lpfc_debugfs_start_time = 0L;
104 117
105static int 118static int
106lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) 119lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
107{ 120{
108 int i, index, len, enable; 121 int i, index, len, enable;
109 uint32_t ms; 122 uint32_t ms;
110 struct lpfc_disc_trc *dtp; 123 struct lpfc_debugfs_trc *dtp;
111 char buffer[80]; 124 char buffer[LPFC_DEBUG_TRC_ENTRY_SIZE];
112 125
113 126
114 enable = lpfc_debugfs_enable; 127 enable = lpfc_debugfs_enable;
@@ -122,7 +135,8 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
122 if (!dtp->fmt) 135 if (!dtp->fmt)
123 continue; 136 continue;
124 ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); 137 ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time);
125 snprintf(buffer, 80, "%010d:%010d ms:%s\n", 138 snprintf(buffer,
139 LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
126 dtp->seq_cnt, ms, dtp->fmt); 140 dtp->seq_cnt, ms, dtp->fmt);
127 len += snprintf(buf+len, size-len, buffer, 141 len += snprintf(buf+len, size-len, buffer,
128 dtp->data1, dtp->data2, dtp->data3); 142 dtp->data1, dtp->data2, dtp->data3);
@@ -132,7 +146,8 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
132 if (!dtp->fmt) 146 if (!dtp->fmt)
133 continue; 147 continue;
134 ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); 148 ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time);
135 snprintf(buffer, 80, "%010d:%010d ms:%s\n", 149 snprintf(buffer,
150 LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
136 dtp->seq_cnt, ms, dtp->fmt); 151 dtp->seq_cnt, ms, dtp->fmt);
137 len += snprintf(buf+len, size-len, buffer, 152 len += snprintf(buf+len, size-len, buffer,
138 dtp->data1, dtp->data2, dtp->data3); 153 dtp->data1, dtp->data2, dtp->data3);
@@ -143,6 +158,236 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
143} 158}
144 159
145static int 160static int
161lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size)
162{
163 int i, index, len, enable;
164 uint32_t ms;
165 struct lpfc_debugfs_trc *dtp;
166 char buffer[LPFC_DEBUG_TRC_ENTRY_SIZE];
167
168
169 enable = lpfc_debugfs_enable;
170 lpfc_debugfs_enable = 0;
171
172 len = 0;
173 index = (atomic_read(&phba->slow_ring_trc_cnt) + 1) &
174 (lpfc_debugfs_max_slow_ring_trc - 1);
175 for (i = index; i < lpfc_debugfs_max_slow_ring_trc; i++) {
176 dtp = phba->slow_ring_trc + i;
177 if (!dtp->fmt)
178 continue;
179 ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time);
180 snprintf(buffer,
181 LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
182 dtp->seq_cnt, ms, dtp->fmt);
183 len += snprintf(buf+len, size-len, buffer,
184 dtp->data1, dtp->data2, dtp->data3);
185 }
186 for (i = 0; i < index; i++) {
187 dtp = phba->slow_ring_trc + i;
188 if (!dtp->fmt)
189 continue;
190 ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time);
191 snprintf(buffer,
192 LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
193 dtp->seq_cnt, ms, dtp->fmt);
194 len += snprintf(buf+len, size-len, buffer,
195 dtp->data1, dtp->data2, dtp->data3);
196 }
197
198 lpfc_debugfs_enable = enable;
199 return len;
200}
201
202static int lpfc_debugfs_last_hbq = -1;
203
204static int
205lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size)
206{
207 int len = 0;
208 int cnt, i, j, found, posted, low;
209 uint32_t phys, raw_index, getidx;
210 struct lpfc_hbq_init *hip;
211 struct hbq_s *hbqs;
212 struct lpfc_hbq_entry *hbqe;
213 struct lpfc_dmabuf *d_buf;
214 struct hbq_dmabuf *hbq_buf;
215
216 cnt = LPFC_HBQINFO_SIZE;
217 spin_lock_irq(&phba->hbalock);
218
219 /* toggle between multiple hbqs, if any */
220 i = lpfc_sli_hbq_count();
221 if (i > 1) {
222 lpfc_debugfs_last_hbq++;
223 if (lpfc_debugfs_last_hbq >= i)
224 lpfc_debugfs_last_hbq = 0;
225 }
226 else
227 lpfc_debugfs_last_hbq = 0;
228
229 i = lpfc_debugfs_last_hbq;
230
231 len += snprintf(buf+len, size-len, "HBQ %d Info\n", i);
232
233 hbqs = &phba->hbqs[i];
234 posted = 0;
235 list_for_each_entry(d_buf, &hbqs->hbq_buffer_list, list)
236 posted++;
237
238 hip = lpfc_hbq_defs[i];
239 len += snprintf(buf+len, size-len,
240 "idx:%d prof:%d rn:%d bufcnt:%d icnt:%d acnt:%d posted %d\n",
241 hip->hbq_index, hip->profile, hip->rn,
242 hip->buffer_count, hip->init_count, hip->add_count, posted);
243
244 raw_index = phba->hbq_get[i];
245 getidx = le32_to_cpu(raw_index);
246 len += snprintf(buf+len, size-len,
247 "entrys:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n",
248 hbqs->entry_count, hbqs->hbqPutIdx, hbqs->next_hbqPutIdx,
249 hbqs->local_hbqGetIdx, getidx);
250
251 hbqe = (struct lpfc_hbq_entry *) phba->hbqs[i].hbq_virt;
252 for (j=0; j<hbqs->entry_count; j++) {
253 len += snprintf(buf+len, size-len,
254 "%03d: %08x %04x %05x ", j,
255 hbqe->bde.addrLow, hbqe->bde.tus.w, hbqe->buffer_tag);
256
257 i = 0;
258 found = 0;
259
260 /* First calculate if slot has an associated posted buffer */
261 low = hbqs->hbqPutIdx - posted;
262 if (low >= 0) {
263 if ((j >= hbqs->hbqPutIdx) || (j < low)) {
264 len += snprintf(buf+len, size-len, "Unused\n");
265 goto skipit;
266 }
267 }
268 else {
269 if ((j >= hbqs->hbqPutIdx) &&
270 (j < (hbqs->entry_count+low))) {
271 len += snprintf(buf+len, size-len, "Unused\n");
272 goto skipit;
273 }
274 }
275
276 /* Get the Buffer info for the posted buffer */
277 list_for_each_entry(d_buf, &hbqs->hbq_buffer_list, list) {
278 hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
279 phys = ((uint64_t)hbq_buf->dbuf.phys & 0xffffffff);
280 if (phys == hbqe->bde.addrLow) {
281 len += snprintf(buf+len, size-len,
282 "Buf%d: %p %06x\n", i,
283 hbq_buf->dbuf.virt, hbq_buf->tag);
284 found = 1;
285 break;
286 }
287 i++;
288 }
289 if (!found) {
290 len += snprintf(buf+len, size-len, "No DMAinfo?\n");
291 }
292skipit:
293 hbqe++;
294 if (len > LPFC_HBQINFO_SIZE - 54)
295 break;
296 }
297 spin_unlock_irq(&phba->hbalock);
298 return len;
299}
300
301static int
302lpfc_debugfs_dumpslim_data(struct lpfc_hba *phba, char *buf, int size)
303{
304 int len = 0;
305 int cnt, i, off;
306 uint32_t word0, word1, word2, word3;
307 uint32_t *ptr;
308 struct lpfc_pgp *pgpp;
309 struct lpfc_sli *psli = &phba->sli;
310 struct lpfc_sli_ring *pring;
311
312 cnt = LPFC_DUMPSLIM_SIZE;
313 off = 0;
314 spin_lock_irq(&phba->hbalock);
315
316 len += snprintf(buf+len, size-len, "SLIM Mailbox\n");
317 ptr = (uint32_t *)phba->slim2p;
318 i = sizeof(MAILBOX_t);
319 while (i > 0) {
320 len += snprintf(buf+len, size-len,
321 "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
322 off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4),
323 *(ptr+5), *(ptr+6), *(ptr+7));
324 ptr += 8;
325 i -= (8 * sizeof(uint32_t));
326 off += (8 * sizeof(uint32_t));
327 }
328
329 len += snprintf(buf+len, size-len, "SLIM PCB\n");
330 ptr = (uint32_t *)&phba->slim2p->pcb;
331 i = sizeof(PCB_t);
332 while (i > 0) {
333 len += snprintf(buf+len, size-len,
334 "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
335 off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4),
336 *(ptr+5), *(ptr+6), *(ptr+7));
337 ptr += 8;
338 i -= (8 * sizeof(uint32_t));
339 off += (8 * sizeof(uint32_t));
340 }
341
342 pgpp = (struct lpfc_pgp *)&phba->slim2p->mbx.us.s3_pgp.port;
343 pring = &psli->ring[0];
344 len += snprintf(buf+len, size-len,
345 "Ring 0: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) "
346 "RSP PutInx:%d Max:%d\n",
347 pgpp->cmdGetInx, pring->numCiocb,
348 pring->next_cmdidx, pring->local_getidx, pring->flag,
349 pgpp->rspPutInx, pring->numRiocb);
350 pgpp++;
351
352 pring = &psli->ring[1];
353 len += snprintf(buf+len, size-len,
354 "Ring 1: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) "
355 "RSP PutInx:%d Max:%d\n",
356 pgpp->cmdGetInx, pring->numCiocb,
357 pring->next_cmdidx, pring->local_getidx, pring->flag,
358 pgpp->rspPutInx, pring->numRiocb);
359 pgpp++;
360
361 pring = &psli->ring[2];
362 len += snprintf(buf+len, size-len,
363 "Ring 2: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) "
364 "RSP PutInx:%d Max:%d\n",
365 pgpp->cmdGetInx, pring->numCiocb,
366 pring->next_cmdidx, pring->local_getidx, pring->flag,
367 pgpp->rspPutInx, pring->numRiocb);
368 pgpp++;
369
370 pring = &psli->ring[3];
371 len += snprintf(buf+len, size-len,
372 "Ring 3: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) "
373 "RSP PutInx:%d Max:%d\n",
374 pgpp->cmdGetInx, pring->numCiocb,
375 pring->next_cmdidx, pring->local_getidx, pring->flag,
376 pgpp->rspPutInx, pring->numRiocb);
377
378
379 ptr = (uint32_t *)&phba->slim2p->mbx.us.s3_pgp.hbq_get;
380 word0 = readl(phba->HAregaddr);
381 word1 = readl(phba->CAregaddr);
382 word2 = readl(phba->HSregaddr);
383 word3 = readl(phba->HCregaddr);
384 len += snprintf(buf+len, size-len, "HA:%08x CA:%08x HS:%08x HC:%08x\n",
385 word0, word1, word2, word3);
386 spin_unlock_irq(&phba->hbalock);
387 return len;
388}
389
390static int
146lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) 391lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
147{ 392{
148 int len = 0; 393 int len = 0;
@@ -204,7 +449,7 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
204 len += snprintf(buf+len, size-len, "RPI:%03d flag:x%08x ", 449 len += snprintf(buf+len, size-len, "RPI:%03d flag:x%08x ",
205 ndlp->nlp_rpi, ndlp->nlp_flag); 450 ndlp->nlp_rpi, ndlp->nlp_flag);
206 if (!ndlp->nlp_type) 451 if (!ndlp->nlp_type)
207 len += snprintf(buf+len, size-len, "UNKNOWN_TYPE"); 452 len += snprintf(buf+len, size-len, "UNKNOWN_TYPE ");
208 if (ndlp->nlp_type & NLP_FC_NODE) 453 if (ndlp->nlp_type & NLP_FC_NODE)
209 len += snprintf(buf+len, size-len, "FC_NODE "); 454 len += snprintf(buf+len, size-len, "FC_NODE ");
210 if (ndlp->nlp_type & NLP_FABRIC) 455 if (ndlp->nlp_type & NLP_FABRIC)
@@ -213,7 +458,9 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
213 len += snprintf(buf+len, size-len, "FCP_TGT sid:%d ", 458 len += snprintf(buf+len, size-len, "FCP_TGT sid:%d ",
214 ndlp->nlp_sid); 459 ndlp->nlp_sid);
215 if (ndlp->nlp_type & NLP_FCP_INITIATOR) 460 if (ndlp->nlp_type & NLP_FCP_INITIATOR)
216 len += snprintf(buf+len, size-len, "FCP_INITIATOR"); 461 len += snprintf(buf+len, size-len, "FCP_INITIATOR ");
462 len += snprintf(buf+len, size-len, "refcnt:%x",
463 atomic_read(&ndlp->kref.refcount));
217 len += snprintf(buf+len, size-len, "\n"); 464 len += snprintf(buf+len, size-len, "\n");
218 } 465 }
219 spin_unlock_irq(shost->host_lock); 466 spin_unlock_irq(shost->host_lock);
@@ -227,7 +474,7 @@ lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt,
227 uint32_t data1, uint32_t data2, uint32_t data3) 474 uint32_t data1, uint32_t data2, uint32_t data3)
228{ 475{
229#ifdef CONFIG_LPFC_DEBUG_FS 476#ifdef CONFIG_LPFC_DEBUG_FS
230 struct lpfc_disc_trc *dtp; 477 struct lpfc_debugfs_trc *dtp;
231 int index; 478 int index;
232 479
233 if (!(lpfc_debugfs_mask_disc_trc & mask)) 480 if (!(lpfc_debugfs_mask_disc_trc & mask))
@@ -244,7 +491,32 @@ lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt,
244 dtp->data1 = data1; 491 dtp->data1 = data1;
245 dtp->data2 = data2; 492 dtp->data2 = data2;
246 dtp->data3 = data3; 493 dtp->data3 = data3;
247 dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_disc_trc_cnt); 494 dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_seq_trc_cnt);
495 dtp->jif = jiffies;
496#endif
497 return;
498}
499
500inline void
501lpfc_debugfs_slow_ring_trc(struct lpfc_hba *phba, char *fmt,
502 uint32_t data1, uint32_t data2, uint32_t data3)
503{
504#ifdef CONFIG_LPFC_DEBUG_FS
505 struct lpfc_debugfs_trc *dtp;
506 int index;
507
508 if (!lpfc_debugfs_enable || !lpfc_debugfs_max_slow_ring_trc ||
509 !phba || !phba->slow_ring_trc)
510 return;
511
512 index = atomic_inc_return(&phba->slow_ring_trc_cnt) &
513 (lpfc_debugfs_max_slow_ring_trc - 1);
514 dtp = phba->slow_ring_trc + index;
515 dtp->fmt = fmt;
516 dtp->data1 = data1;
517 dtp->data2 = data2;
518 dtp->data3 = data3;
519 dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_seq_trc_cnt);
248 dtp->jif = jiffies; 520 dtp->jif = jiffies;
249#endif 521#endif
250 return; 522 return;
@@ -269,7 +541,7 @@ lpfc_debugfs_disc_trc_open(struct inode *inode, struct file *file)
269 goto out; 541 goto out;
270 542
271 /* Round to page boundry */ 543 /* Round to page boundry */
272 size = (lpfc_debugfs_max_disc_trc * LPFC_DISC_TRC_ENTRY_SIZE); 544 size = (lpfc_debugfs_max_disc_trc * LPFC_DEBUG_TRC_ENTRY_SIZE);
273 size = PAGE_ALIGN(size); 545 size = PAGE_ALIGN(size);
274 546
275 debug->buffer = kmalloc(size, GFP_KERNEL); 547 debug->buffer = kmalloc(size, GFP_KERNEL);
@@ -287,6 +559,95 @@ out:
287} 559}
288 560
289static int 561static int
562lpfc_debugfs_slow_ring_trc_open(struct inode *inode, struct file *file)
563{
564 struct lpfc_hba *phba = inode->i_private;
565 struct lpfc_debug *debug;
566 int size;
567 int rc = -ENOMEM;
568
569 if (!lpfc_debugfs_max_slow_ring_trc) {
570 rc = -ENOSPC;
571 goto out;
572 }
573
574 debug = kmalloc(sizeof(*debug), GFP_KERNEL);
575 if (!debug)
576 goto out;
577
578 /* Round to page boundry */
579 size = (lpfc_debugfs_max_slow_ring_trc * LPFC_DEBUG_TRC_ENTRY_SIZE);
580 size = PAGE_ALIGN(size);
581
582 debug->buffer = kmalloc(size, GFP_KERNEL);
583 if (!debug->buffer) {
584 kfree(debug);
585 goto out;
586 }
587
588 debug->len = lpfc_debugfs_slow_ring_trc_data(phba, debug->buffer, size);
589 file->private_data = debug;
590
591 rc = 0;
592out:
593 return rc;
594}
595
596static int
597lpfc_debugfs_hbqinfo_open(struct inode *inode, struct file *file)
598{
599 struct lpfc_hba *phba = inode->i_private;
600 struct lpfc_debug *debug;
601 int rc = -ENOMEM;
602
603 debug = kmalloc(sizeof(*debug), GFP_KERNEL);
604 if (!debug)
605 goto out;
606
607 /* Round to page boundry */
608 debug->buffer = kmalloc(LPFC_HBQINFO_SIZE, GFP_KERNEL);
609 if (!debug->buffer) {
610 kfree(debug);
611 goto out;
612 }
613
614 debug->len = lpfc_debugfs_hbqinfo_data(phba, debug->buffer,
615 LPFC_HBQINFO_SIZE);
616 file->private_data = debug;
617
618 rc = 0;
619out:
620 return rc;
621}
622
623static int
624lpfc_debugfs_dumpslim_open(struct inode *inode, struct file *file)
625{
626 struct lpfc_hba *phba = inode->i_private;
627 struct lpfc_debug *debug;
628 int rc = -ENOMEM;
629
630 debug = kmalloc(sizeof(*debug), GFP_KERNEL);
631 if (!debug)
632 goto out;
633
634 /* Round to page boundry */
635 debug->buffer = kmalloc(LPFC_DUMPSLIM_SIZE, GFP_KERNEL);
636 if (!debug->buffer) {
637 kfree(debug);
638 goto out;
639 }
640
641 debug->len = lpfc_debugfs_dumpslim_data(phba, debug->buffer,
642 LPFC_DUMPSLIM_SIZE);
643 file->private_data = debug;
644
645 rc = 0;
646out:
647 return rc;
648}
649
650static int
290lpfc_debugfs_nodelist_open(struct inode *inode, struct file *file) 651lpfc_debugfs_nodelist_open(struct inode *inode, struct file *file)
291{ 652{
292 struct lpfc_vport *vport = inode->i_private; 653 struct lpfc_vport *vport = inode->i_private;
@@ -372,6 +733,33 @@ static struct file_operations lpfc_debugfs_op_nodelist = {
372 .release = lpfc_debugfs_release, 733 .release = lpfc_debugfs_release,
373}; 734};
374 735
736#undef lpfc_debugfs_op_hbqinfo
737static struct file_operations lpfc_debugfs_op_hbqinfo = {
738 .owner = THIS_MODULE,
739 .open = lpfc_debugfs_hbqinfo_open,
740 .llseek = lpfc_debugfs_lseek,
741 .read = lpfc_debugfs_read,
742 .release = lpfc_debugfs_release,
743};
744
745#undef lpfc_debugfs_op_dumpslim
746static struct file_operations lpfc_debugfs_op_dumpslim = {
747 .owner = THIS_MODULE,
748 .open = lpfc_debugfs_dumpslim_open,
749 .llseek = lpfc_debugfs_lseek,
750 .read = lpfc_debugfs_read,
751 .release = lpfc_debugfs_release,
752};
753
754#undef lpfc_debugfs_op_slow_ring_trc
755static struct file_operations lpfc_debugfs_op_slow_ring_trc = {
756 .owner = THIS_MODULE,
757 .open = lpfc_debugfs_slow_ring_trc_open,
758 .llseek = lpfc_debugfs_lseek,
759 .read = lpfc_debugfs_read,
760 .release = lpfc_debugfs_release,
761};
762
375static struct dentry *lpfc_debugfs_root = NULL; 763static struct dentry *lpfc_debugfs_root = NULL;
376static atomic_t lpfc_debugfs_hba_count; 764static atomic_t lpfc_debugfs_hba_count;
377#endif 765#endif
@@ -387,60 +775,146 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
387 if (!lpfc_debugfs_enable) 775 if (!lpfc_debugfs_enable)
388 return; 776 return;
389 777
390 if (lpfc_debugfs_max_disc_trc) { 778 /* Setup lpfc root directory */
391 num = lpfc_debugfs_max_disc_trc - 1;
392 if (num & lpfc_debugfs_max_disc_trc) {
393 /* Change to be a power of 2 */
394 num = lpfc_debugfs_max_disc_trc;
395 i = 0;
396 while (num > 1) {
397 num = num >> 1;
398 i++;
399 }
400 lpfc_debugfs_max_disc_trc = (1 << i);
401 printk(KERN_ERR
402 "lpfc_debugfs_max_disc_trc changed to %d\n",
403 lpfc_debugfs_max_disc_trc);
404 }
405 }
406
407 if (!lpfc_debugfs_root) { 779 if (!lpfc_debugfs_root) {
408 lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL); 780 lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL);
409 atomic_set(&lpfc_debugfs_hba_count, 0); 781 atomic_set(&lpfc_debugfs_hba_count, 0);
410 if (!lpfc_debugfs_root) 782 if (!lpfc_debugfs_root) {
783 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
784 "0409 Cannot create debugfs root\n");
411 goto debug_failed; 785 goto debug_failed;
786 }
412 } 787 }
788 if (!lpfc_debugfs_start_time)
789 lpfc_debugfs_start_time = jiffies;
413 790
791 /* Setup lpfcX directory for specific HBA */
414 snprintf(name, sizeof(name), "lpfc%d", phba->brd_no); 792 snprintf(name, sizeof(name), "lpfc%d", phba->brd_no);
415 if (!phba->hba_debugfs_root) { 793 if (!phba->hba_debugfs_root) {
416 phba->hba_debugfs_root = 794 phba->hba_debugfs_root =
417 debugfs_create_dir(name, lpfc_debugfs_root); 795 debugfs_create_dir(name, lpfc_debugfs_root);
418 if (!phba->hba_debugfs_root) 796 if (!phba->hba_debugfs_root) {
797 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
798 "0409 Cannot create debugfs hba\n");
419 goto debug_failed; 799 goto debug_failed;
800 }
420 atomic_inc(&lpfc_debugfs_hba_count); 801 atomic_inc(&lpfc_debugfs_hba_count);
421 atomic_set(&phba->debugfs_vport_count, 0); 802 atomic_set(&phba->debugfs_vport_count, 0);
803
804 /* Setup hbqinfo */
805 snprintf(name, sizeof(name), "hbqinfo");
806 phba->debug_hbqinfo =
807 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
808 phba->hba_debugfs_root,
809 phba, &lpfc_debugfs_op_hbqinfo);
810 if (!phba->debug_hbqinfo) {
811 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
812 "0409 Cannot create debugfs hbqinfo\n");
813 goto debug_failed;
814 }
815
816 /* Setup dumpslim */
817 snprintf(name, sizeof(name), "dumpslim");
818 phba->debug_dumpslim =
819 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
820 phba->hba_debugfs_root,
821 phba, &lpfc_debugfs_op_dumpslim);
822 if (!phba->debug_dumpslim) {
823 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
824 "0409 Cannot create debugfs dumpslim\n");
825 goto debug_failed;
826 }
827
828 /* Setup slow ring trace */
829 if (lpfc_debugfs_max_slow_ring_trc) {
830 num = lpfc_debugfs_max_slow_ring_trc - 1;
831 if (num & lpfc_debugfs_max_slow_ring_trc) {
832 /* Change to be a power of 2 */
833 num = lpfc_debugfs_max_slow_ring_trc;
834 i = 0;
835 while (num > 1) {
836 num = num >> 1;
837 i++;
838 }
839 lpfc_debugfs_max_slow_ring_trc = (1 << i);
840 printk(KERN_ERR
841 "lpfc_debugfs_max_disc_trc changed to "
842 "%d\n", lpfc_debugfs_max_disc_trc);
843 }
844 }
845
846
847 snprintf(name, sizeof(name), "slow_ring_trace");
848 phba->debug_slow_ring_trc =
849 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
850 phba->hba_debugfs_root,
851 phba, &lpfc_debugfs_op_slow_ring_trc);
852 if (!phba->debug_slow_ring_trc) {
853 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
854 "0409 Cannot create debugfs "
855 "slow_ring_trace\n");
856 goto debug_failed;
857 }
858 if (!phba->slow_ring_trc) {
859 phba->slow_ring_trc = kmalloc(
860 (sizeof(struct lpfc_debugfs_trc) *
861 lpfc_debugfs_max_slow_ring_trc),
862 GFP_KERNEL);
863 if (!phba->slow_ring_trc) {
864 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
865 "0409 Cannot create debugfs "
866 "slow_ring buffer\n");
867 goto debug_failed;
868 }
869 atomic_set(&phba->slow_ring_trc_cnt, 0);
870 memset(phba->slow_ring_trc, 0,
871 (sizeof(struct lpfc_debugfs_trc) *
872 lpfc_debugfs_max_slow_ring_trc));
873 }
422 } 874 }
423 875
424 snprintf(name, sizeof(name), "vport%d", vport->vpi); 876 snprintf(name, sizeof(name), "vport%d", vport->vpi);
425 if (!vport->vport_debugfs_root) { 877 if (!vport->vport_debugfs_root) {
426 vport->vport_debugfs_root = 878 vport->vport_debugfs_root =
427 debugfs_create_dir(name, phba->hba_debugfs_root); 879 debugfs_create_dir(name, phba->hba_debugfs_root);
428 if (!vport->vport_debugfs_root) 880 if (!vport->vport_debugfs_root) {
881 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
882 "0409 Cant create debugfs");
429 goto debug_failed; 883 goto debug_failed;
884 }
430 atomic_inc(&phba->debugfs_vport_count); 885 atomic_inc(&phba->debugfs_vport_count);
431 } 886 }
432 887
433 if (!lpfc_debugfs_start_time) 888 if (lpfc_debugfs_max_disc_trc) {
434 lpfc_debugfs_start_time = jiffies; 889 num = lpfc_debugfs_max_disc_trc - 1;
890 if (num & lpfc_debugfs_max_disc_trc) {
891 /* Change to be a power of 2 */
892 num = lpfc_debugfs_max_disc_trc;
893 i = 0;
894 while (num > 1) {
895 num = num >> 1;
896 i++;
897 }
898 lpfc_debugfs_max_disc_trc = (1 << i);
899 printk(KERN_ERR
900 "lpfc_debugfs_max_disc_trc changed to %d\n",
901 lpfc_debugfs_max_disc_trc);
902 }
903 }
435 904
436 vport->disc_trc = kmalloc( 905 vport->disc_trc = kmalloc(
437 (sizeof(struct lpfc_disc_trc) * lpfc_debugfs_max_disc_trc), 906 (sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc),
438 GFP_KERNEL); 907 GFP_KERNEL);
439 908
440 if (!vport->disc_trc) 909 if (!vport->disc_trc) {
910 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
911 "0409 Cannot create debugfs disc trace "
912 "buffer\n");
441 goto debug_failed; 913 goto debug_failed;
914 }
915 atomic_set(&vport->disc_trc_cnt, 0);
442 memset(vport->disc_trc, 0, 916 memset(vport->disc_trc, 0,
443 (sizeof(struct lpfc_disc_trc) * lpfc_debugfs_max_disc_trc)); 917 (sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc));
444 918
445 snprintf(name, sizeof(name), "discovery_trace"); 919 snprintf(name, sizeof(name), "discovery_trace");
446 vport->debug_disc_trc = 920 vport->debug_disc_trc =
@@ -448,9 +922,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
448 vport->vport_debugfs_root, 922 vport->vport_debugfs_root,
449 vport, &lpfc_debugfs_op_disc_trc); 923 vport, &lpfc_debugfs_op_disc_trc);
450 if (!vport->debug_disc_trc) { 924 if (!vport->debug_disc_trc) {
451 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 925 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
452 "%d:0409 Cannot create debugfs", 926 "0409 Cannot create debugfs "
453 phba->brd_no); 927 "discovery_trace\n");
454 goto debug_failed; 928 goto debug_failed;
455 } 929 }
456 snprintf(name, sizeof(name), "nodelist"); 930 snprintf(name, sizeof(name), "nodelist");
@@ -459,9 +933,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
459 vport->vport_debugfs_root, 933 vport->vport_debugfs_root,
460 vport, &lpfc_debugfs_op_nodelist); 934 vport, &lpfc_debugfs_op_nodelist);
461 if (!vport->debug_nodelist) { 935 if (!vport->debug_nodelist) {
462 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 936 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
463 "%d:0409 Cannot create debugfs", 937 "0409 Cant create debugfs nodelist");
464 phba->brd_no);
465 goto debug_failed; 938 goto debug_failed;
466 } 939 }
467debug_failed: 940debug_failed:
@@ -488,21 +961,45 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport)
488 debugfs_remove(vport->debug_nodelist); /* nodelist */ 961 debugfs_remove(vport->debug_nodelist); /* nodelist */
489 vport->debug_nodelist = NULL; 962 vport->debug_nodelist = NULL;
490 } 963 }
964
491 if (vport->vport_debugfs_root) { 965 if (vport->vport_debugfs_root) {
492 debugfs_remove(vport->vport_debugfs_root); /* vportX */ 966 debugfs_remove(vport->vport_debugfs_root); /* vportX */
493 vport->vport_debugfs_root = NULL; 967 vport->vport_debugfs_root = NULL;
494 atomic_dec(&phba->debugfs_vport_count); 968 atomic_dec(&phba->debugfs_vport_count);
495 } 969 }
496 if (atomic_read(&phba->debugfs_vport_count) == 0) { 970 if (atomic_read(&phba->debugfs_vport_count) == 0) {
497 debugfs_remove(vport->phba->hba_debugfs_root); /* lpfcX */ 971
498 vport->phba->hba_debugfs_root = NULL; 972 if (phba->debug_hbqinfo) {
499 atomic_dec(&lpfc_debugfs_hba_count); 973 debugfs_remove(phba->debug_hbqinfo); /* hbqinfo */
974 phba->debug_hbqinfo = NULL;
975 }
976 if (phba->debug_dumpslim) {
977 debugfs_remove(phba->debug_dumpslim); /* dumpslim */
978 phba->debug_dumpslim = NULL;
979 }
980 if (phba->slow_ring_trc) {
981 kfree(phba->slow_ring_trc);
982 phba->slow_ring_trc = NULL;
983 }
984 if (phba->debug_slow_ring_trc) {
985 /* slow_ring_trace */
986 debugfs_remove(phba->debug_slow_ring_trc);
987 phba->debug_slow_ring_trc = NULL;
988 }
989
990 if (phba->hba_debugfs_root) {
991 debugfs_remove(phba->hba_debugfs_root); /* lpfcX */
992 phba->hba_debugfs_root = NULL;
993 atomic_dec(&lpfc_debugfs_hba_count);
994 }
995
500 if (atomic_read(&lpfc_debugfs_hba_count) == 0) { 996 if (atomic_read(&lpfc_debugfs_hba_count) == 0) {
501 debugfs_remove(lpfc_debugfs_root); /* lpfc */ 997 debugfs_remove(lpfc_debugfs_root); /* lpfc */
502 lpfc_debugfs_root = NULL; 998 lpfc_debugfs_root = NULL;
503 } 999 }
504 } 1000 }
505#endif 1001#endif
1002 return;
506} 1003}
507 1004
508 1005
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h
index fffb678426a4..31e86a55391d 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.h
+++ b/drivers/scsi/lpfc/lpfc_debugfs.h
@@ -22,7 +22,7 @@
22#define _H_LPFC_DEBUG_FS 22#define _H_LPFC_DEBUG_FS
23 23
24#ifdef CONFIG_LPFC_DEBUG_FS 24#ifdef CONFIG_LPFC_DEBUG_FS
25struct lpfc_disc_trc { 25struct lpfc_debugfs_trc {
26 char *fmt; 26 char *fmt;
27 uint32_t data1; 27 uint32_t data1;
28 uint32_t data2; 28 uint32_t data2;
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 33fbc1666946..8085900635d4 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -63,10 +63,10 @@ lpfc_els_chk_latt(struct lpfc_vport *vport)
63 return 0; 63 return 0;
64 64
65 /* Pending Link Event during Discovery */ 65 /* Pending Link Event during Discovery */
66 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 66 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
67 "%d (%d):0237 Pending Link Event during " 67 "0237 Pending Link Event during "
68 "Discovery: State x%x\n", 68 "Discovery: State x%x\n",
69 phba->brd_no, vport->vpi, phba->pport->port_state); 69 phba->pport->port_state);
70 70
71 /* CLEAR_LA should re-enable link attention events and 71 /* CLEAR_LA should re-enable link attention events and
72 * we should then imediately take a LATT event. The 72 * we should then imediately take a LATT event. The
@@ -196,9 +196,7 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp,
196 bpl->tus.w = le32_to_cpu(bpl->tus.w); 196 bpl->tus.w = le32_to_cpu(bpl->tus.w);
197 } 197 }
198 198
199 /* Save for completion so we can release these resources */ 199 elsiocb->context1 = lpfc_nlp_get(ndlp);
200 if (elscmd != ELS_CMD_LS_RJT)
201 elsiocb->context1 = lpfc_nlp_get(ndlp);
202 elsiocb->context2 = pcmd; 200 elsiocb->context2 = pcmd;
203 elsiocb->context3 = pbuflist; 201 elsiocb->context3 = pbuflist;
204 elsiocb->retry = retry; 202 elsiocb->retry = retry;
@@ -208,23 +206,21 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp,
208 if (prsp) { 206 if (prsp) {
209 list_add(&prsp->list, &pcmd->list); 207 list_add(&prsp->list, &pcmd->list);
210 } 208 }
211
212 if (expectRsp) { 209 if (expectRsp) {
213 /* Xmit ELS command <elsCmd> to remote NPORT <did> */ 210 /* Xmit ELS command <elsCmd> to remote NPORT <did> */
214 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 211 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
215 "%d (%d):0116 Xmit ELS command x%x to remote " 212 "0116 Xmit ELS command x%x to remote "
216 "NPORT x%x I/O tag: x%x, port state: x%x\n", 213 "NPORT x%x I/O tag: x%x, port state: x%x\n",
217 phba->brd_no, vport->vpi, elscmd, did, 214 elscmd, did, elsiocb->iotag,
218 elsiocb->iotag, vport->port_state); 215 vport->port_state);
219 } else { 216 } else {
220 /* Xmit ELS response <elsCmd> to remote NPORT <did> */ 217 /* Xmit ELS response <elsCmd> to remote NPORT <did> */
221 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 218 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
222 "%d (%d):0117 Xmit ELS response x%x to remote " 219 "0117 Xmit ELS response x%x to remote "
223 "NPORT x%x I/O tag: x%x, size: x%x\n", 220 "NPORT x%x I/O tag: x%x, size: x%x\n",
224 phba->brd_no, vport->vpi, elscmd, 221 elscmd, ndlp->nlp_DID, elsiocb->iotag,
225 ndlp->nlp_DID, elsiocb->iotag, cmdSize); 222 cmdSize);
226 } 223 }
227
228 return elsiocb; 224 return elsiocb;
229} 225}
230 226
@@ -285,9 +281,8 @@ fail_free_mbox:
285 281
286fail: 282fail:
287 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 283 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
288 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 284 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
289 "%d (%d):0249 Cannot issue Register Fabric login\n", 285 "0249 Cannot issue Register Fabric login\n");
290 phba->brd_no, vport->vpi);
291 return -ENXIO; 286 return -ENXIO;
292} 287}
293 288
@@ -340,20 +335,19 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
340 335
341 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) { 336 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) {
342 if (sp->cmn.response_multiple_NPort) { 337 if (sp->cmn.response_multiple_NPort) {
343 lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_VPORT, 338 lpfc_printf_vlog(vport, KERN_WARNING,
344 "%d:1816 FLOGI NPIV supported, " 339 LOG_ELS | LOG_VPORT,
345 "response data 0x%x\n", 340 "1816 FLOGI NPIV supported, "
346 phba->brd_no, 341 "response data 0x%x\n",
347 sp->cmn.response_multiple_NPort); 342 sp->cmn.response_multiple_NPort);
348 phba->link_flag |= LS_NPIV_FAB_SUPPORTED; 343 phba->link_flag |= LS_NPIV_FAB_SUPPORTED;
349
350 } else { 344 } else {
351 /* Because we asked f/w for NPIV it still expects us 345 /* Because we asked f/w for NPIV it still expects us
352 to call reg_vnpid atleast for the physcial host */ 346 to call reg_vnpid atleast for the physcial host */
353 lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_VPORT, 347 lpfc_printf_vlog(vport, KERN_WARNING,
354 "%d:1817 Fabric does not support NPIV " 348 LOG_ELS | LOG_VPORT,
355 "- configuring single port mode.\n", 349 "1817 Fabric does not support NPIV "
356 phba->brd_no); 350 "- configuring single port mode.\n");
357 phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED; 351 phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED;
358 } 352 }
359 } 353 }
@@ -518,16 +512,15 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
518 * alpa map would take too long otherwise. 512 * alpa map would take too long otherwise.
519 */ 513 */
520 if (phba->alpa_map[0] == 0) { 514 if (phba->alpa_map[0] == 0) {
521 phba->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; 515 vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS;
522 } 516 }
523 517
524 /* FLOGI failure */ 518 /* FLOGI failure */
525 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 519 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
526 "%d (%d):0100 FLOGI failure Data: x%x x%x " 520 "0100 FLOGI failure Data: x%x x%x "
527 "x%x\n", 521 "x%x\n",
528 phba->brd_no, vport->vpi, 522 irsp->ulpStatus, irsp->un.ulpWord[4],
529 irsp->ulpStatus, irsp->un.ulpWord[4], 523 irsp->ulpTimeout);
530 irsp->ulpTimeout);
531 goto flogifail; 524 goto flogifail;
532 } 525 }
533 526
@@ -540,12 +533,11 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
540 sp = prsp->virt + sizeof(uint32_t); 533 sp = prsp->virt + sizeof(uint32_t);
541 534
542 /* FLOGI completes successfully */ 535 /* FLOGI completes successfully */
543 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 536 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
544 "%d (%d):0101 FLOGI completes sucessfully " 537 "0101 FLOGI completes sucessfully "
545 "Data: x%x x%x x%x x%x\n", 538 "Data: x%x x%x x%x x%x\n",
546 phba->brd_no, vport->vpi, 539 irsp->un.ulpWord[4], sp->cmn.e_d_tov,
547 irsp->un.ulpWord[4], sp->cmn.e_d_tov, 540 sp->cmn.w2.r_a_tov, sp->cmn.edtovResolution);
548 sp->cmn.w2.r_a_tov, sp->cmn.edtovResolution);
549 541
550 if (vport->port_state == LPFC_FLOGI) { 542 if (vport->port_state == LPFC_FLOGI) {
551 /* 543 /*
@@ -662,8 +654,8 @@ lpfc_els_abort_flogi(struct lpfc_hba *phba)
662 654
663 /* Abort outstanding I/O on NPort <nlp_DID> */ 655 /* Abort outstanding I/O on NPort <nlp_DID> */
664 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 656 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
665 "%d:0201 Abort outstanding I/O on NPort x%x\n", 657 "0201 Abort outstanding I/O on NPort x%x\n",
666 phba->brd_no, Fabric_DID); 658 Fabric_DID);
667 659
668 pring = &phba->sli.ring[LPFC_ELS_RING]; 660 pring = &phba->sli.ring[LPFC_ELS_RING];
669 661
@@ -736,18 +728,16 @@ static void
736lpfc_more_plogi(struct lpfc_vport *vport) 728lpfc_more_plogi(struct lpfc_vport *vport)
737{ 729{
738 int sentplogi; 730 int sentplogi;
739 struct lpfc_hba *phba = vport->phba;
740 731
741 if (vport->num_disc_nodes) 732 if (vport->num_disc_nodes)
742 vport->num_disc_nodes--; 733 vport->num_disc_nodes--;
743 734
744 /* Continue discovery with <num_disc_nodes> PLOGIs to go */ 735 /* Continue discovery with <num_disc_nodes> PLOGIs to go */
745 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 736 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
746 "%d (%d):0232 Continue discovery with %d PLOGIs to go " 737 "0232 Continue discovery with %d PLOGIs to go "
747 "Data: x%x x%x x%x\n", 738 "Data: x%x x%x x%x\n",
748 phba->brd_no, vport->vpi, vport->num_disc_nodes, 739 vport->num_disc_nodes, vport->fc_plogi_cnt,
749 vport->fc_plogi_cnt, vport->fc_flag, vport->port_state); 740 vport->fc_flag, vport->port_state);
750
751 /* Check to see if there are more PLOGIs to be sent */ 741 /* Check to see if there are more PLOGIs to be sent */
752 if (vport->fc_flag & FC_NLP_MORE) 742 if (vport->fc_flag & FC_NLP_MORE)
753 /* go thru NPR nodes and issue any remaining ELS PLOGIs */ 743 /* go thru NPR nodes and issue any remaining ELS PLOGIs */
@@ -833,11 +823,12 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
833 823
834 ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID); 824 ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID);
835 if (!ndlp) { 825 if (!ndlp) {
836 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 826 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
837 "%d (%d):0136 PLOGI completes to NPort x%x " 827 "0136 PLOGI completes to NPort x%x "
838 "with no ndlp. Data: x%x x%x x%x\n", 828 "with no ndlp. Data: x%x x%x x%x\n",
839 phba->brd_no, vport->vpi, irsp->un.elsreq64.remoteID, 829 irsp->un.elsreq64.remoteID,
840 irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpIoTag); 830 irsp->ulpStatus, irsp->un.ulpWord[4],
831 irsp->ulpIoTag);
841 goto out; 832 goto out;
842 } 833 }
843 834
@@ -851,13 +842,11 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
851 rc = 0; 842 rc = 0;
852 843
853 /* PLOGI completes to NPort <nlp_DID> */ 844 /* PLOGI completes to NPort <nlp_DID> */
854 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 845 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
855 "%d (%d):0102 PLOGI completes to NPort x%x " 846 "0102 PLOGI completes to NPort x%x "
856 "Data: x%x x%x x%x x%x x%x\n", 847 "Data: x%x x%x x%x x%x x%x\n",
857 phba->brd_no, vport->vpi, ndlp->nlp_DID, 848 ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
858 irsp->ulpStatus, irsp->un.ulpWord[4], 849 irsp->ulpTimeout, disc, vport->num_disc_nodes);
859 irsp->ulpTimeout, disc, vport->num_disc_nodes);
860
861 /* Check to see if link went down during discovery */ 850 /* Check to see if link went down during discovery */
862 if (lpfc_els_chk_latt(vport)) { 851 if (lpfc_els_chk_latt(vport)) {
863 spin_lock_irq(shost->host_lock); 852 spin_lock_irq(shost->host_lock);
@@ -881,17 +870,14 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
881 } 870 }
882 goto out; 871 goto out;
883 } 872 }
884
885 /* PLOGI failed */ 873 /* PLOGI failed */
886 if (ndlp->nlp_DID == NameServer_DID) { 874 if (ndlp->nlp_DID == NameServer_DID) {
887 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 875 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
888 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 876 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
889 "%d (%d):0250 Nameserver login error: " 877 "0250 Nameserver login error: "
890 "0x%x / 0x%x\n", 878 "0x%x / 0x%x\n",
891 phba->brd_no, vport->vpi, 879 irsp->ulpStatus, irsp->un.ulpWord[4]);
892 irsp->ulpStatus, irsp->un.ulpWord[4]);
893 } 880 }
894
895 /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ 881 /* Do not call DSM for lpfc_els_abort'ed ELS cmds */
896 if (lpfc_error_lost_link(irsp)) { 882 if (lpfc_error_lost_link(irsp)) {
897 rc = NLP_STE_FREED_NODE; 883 rc = NLP_STE_FREED_NODE;
@@ -1017,14 +1003,12 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1017 "PRLI cmpl: status:x%x/x%x did:x%x", 1003 "PRLI cmpl: status:x%x/x%x did:x%x",
1018 irsp->ulpStatus, irsp->un.ulpWord[4], 1004 irsp->ulpStatus, irsp->un.ulpWord[4],
1019 ndlp->nlp_DID); 1005 ndlp->nlp_DID);
1020
1021 /* PRLI completes to NPort <nlp_DID> */ 1006 /* PRLI completes to NPort <nlp_DID> */
1022 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 1007 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
1023 "%d (%d):0103 PRLI completes to NPort x%x " 1008 "0103 PRLI completes to NPort x%x "
1024 "Data: x%x x%x x%x x%x\n", 1009 "Data: x%x x%x x%x x%x\n",
1025 phba->brd_no, vport->vpi, ndlp->nlp_DID, 1010 ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
1026 irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout, 1011 irsp->ulpTimeout, vport->num_disc_nodes);
1027 vport->num_disc_nodes);
1028 1012
1029 vport->fc_prli_sent--; 1013 vport->fc_prli_sent--;
1030 /* Check to see if link went down during discovery */ 1014 /* Check to see if link went down during discovery */
@@ -1129,18 +1113,15 @@ static void
1129lpfc_more_adisc(struct lpfc_vport *vport) 1113lpfc_more_adisc(struct lpfc_vport *vport)
1130{ 1114{
1131 int sentadisc; 1115 int sentadisc;
1132 struct lpfc_hba *phba = vport->phba;
1133 1116
1134 if (vport->num_disc_nodes) 1117 if (vport->num_disc_nodes)
1135 vport->num_disc_nodes--; 1118 vport->num_disc_nodes--;
1136
1137 /* Continue discovery with <num_disc_nodes> ADISCs to go */ 1119 /* Continue discovery with <num_disc_nodes> ADISCs to go */
1138 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 1120 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
1139 "%d (%d):0210 Continue discovery with %d ADISCs to go " 1121 "0210 Continue discovery with %d ADISCs to go "
1140 "Data: x%x x%x x%x\n", 1122 "Data: x%x x%x x%x\n",
1141 phba->brd_no, vport->vpi, vport->num_disc_nodes, 1123 vport->num_disc_nodes, vport->fc_adisc_cnt,
1142 vport->fc_adisc_cnt, vport->fc_flag, vport->port_state); 1124 vport->fc_flag, vport->port_state);
1143
1144 /* Check to see if there are more ADISCs to be sent */ 1125 /* Check to see if there are more ADISCs to be sent */
1145 if (vport->fc_flag & FC_NLP_MORE) { 1126 if (vport->fc_flag & FC_NLP_MORE) {
1146 lpfc_set_disctmo(vport); 1127 lpfc_set_disctmo(vport);
@@ -1206,15 +1187,12 @@ lpfc_cmpl_els_adisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1206 disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC); 1187 disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC);
1207 ndlp->nlp_flag &= ~(NLP_ADISC_SND | NLP_NPR_2B_DISC); 1188 ndlp->nlp_flag &= ~(NLP_ADISC_SND | NLP_NPR_2B_DISC);
1208 spin_unlock_irq(shost->host_lock); 1189 spin_unlock_irq(shost->host_lock);
1209
1210 /* ADISC completes to NPort <nlp_DID> */ 1190 /* ADISC completes to NPort <nlp_DID> */
1211 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 1191 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
1212 "%d (%d):0104 ADISC completes to NPort x%x " 1192 "0104 ADISC completes to NPort x%x "
1213 "Data: x%x x%x x%x x%x x%x\n", 1193 "Data: x%x x%x x%x x%x x%x\n",
1214 phba->brd_no, vport->vpi, ndlp->nlp_DID, 1194 ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
1215 irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout, 1195 irsp->ulpTimeout, disc, vport->num_disc_nodes);
1216 disc, vport->num_disc_nodes);
1217
1218 /* Check to see if link went down during discovery */ 1196 /* Check to see if link went down during discovery */
1219 if (lpfc_els_chk_latt(vport)) { 1197 if (lpfc_els_chk_latt(vport)) {
1220 spin_lock_irq(shost->host_lock); 1198 spin_lock_irq(shost->host_lock);
@@ -1374,15 +1352,12 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1374 "LOGO cmpl: status:x%x/x%x did:x%x", 1352 "LOGO cmpl: status:x%x/x%x did:x%x",
1375 irsp->ulpStatus, irsp->un.ulpWord[4], 1353 irsp->ulpStatus, irsp->un.ulpWord[4],
1376 ndlp->nlp_DID); 1354 ndlp->nlp_DID);
1377
1378 /* LOGO completes to NPort <nlp_DID> */ 1355 /* LOGO completes to NPort <nlp_DID> */
1379 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 1356 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
1380 "%d (%d):0105 LOGO completes to NPort x%x " 1357 "0105 LOGO completes to NPort x%x "
1381 "Data: x%x x%x x%x x%x\n", 1358 "Data: x%x x%x x%x x%x\n",
1382 phba->brd_no, vport->vpi, ndlp->nlp_DID, 1359 ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
1383 irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout, 1360 irsp->ulpTimeout, vport->num_disc_nodes);
1384 vport->num_disc_nodes);
1385
1386 /* Check to see if link went down during discovery */ 1361 /* Check to see if link went down during discovery */
1387 if (lpfc_els_chk_latt(vport)) 1362 if (lpfc_els_chk_latt(vport))
1388 goto out; 1363 goto out;
@@ -1488,15 +1463,11 @@ lpfc_cmpl_els_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1488 "ELS cmd cmpl: status:x%x/x%x did:x%x", 1463 "ELS cmd cmpl: status:x%x/x%x did:x%x",
1489 irsp->ulpStatus, irsp->un.ulpWord[4], 1464 irsp->ulpStatus, irsp->un.ulpWord[4],
1490 irsp->un.elsreq64.remoteID); 1465 irsp->un.elsreq64.remoteID);
1491
1492 /* ELS cmd tag <ulpIoTag> completes */ 1466 /* ELS cmd tag <ulpIoTag> completes */
1493 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 1467 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
1494 "%d (%d):0106 ELS cmd tag x%x completes Data: x%x x%x " 1468 "0106 ELS cmd tag x%x completes Data: x%x x%x x%x\n",
1495 "x%x\n", 1469 irsp->ulpIoTag, irsp->ulpStatus,
1496 phba->brd_no, vport->vpi, 1470 irsp->un.ulpWord[4], irsp->ulpTimeout);
1497 irsp->ulpIoTag, irsp->ulpStatus,
1498 irsp->un.ulpWord[4], irsp->ulpTimeout);
1499
1500 /* Check to see if link went down during discovery */ 1471 /* Check to see if link went down during discovery */
1501 lpfc_els_chk_latt(vport); 1472 lpfc_els_chk_latt(vport);
1502 lpfc_els_free_iocb(phba, cmdiocb); 1473 lpfc_els_free_iocb(phba, cmdiocb);
@@ -1831,13 +1802,15 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1831 case IOERR_ILLEGAL_COMMAND: 1802 case IOERR_ILLEGAL_COMMAND:
1832 if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) && 1803 if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) &&
1833 (cmd == ELS_CMD_FDISC)) { 1804 (cmd == ELS_CMD_FDISC)) {
1834 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 1805 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
1835 "%d (%d):0124 FDISC failed (3/6) retrying...\n", 1806 "0124 FDISC failed (3/6) "
1836 phba->brd_no, vport->vpi); 1807 "retrying...\n");
1837 lpfc_mbx_unreg_vpi(vport); 1808 lpfc_mbx_unreg_vpi(vport);
1838 retry = 1; 1809 retry = 1;
1839 /* Always retry for this case */ 1810 /* FDISC retry policy */
1840 cmdiocb->retry = 0; 1811 maxretry = 48;
1812 if (cmdiocb->retry >= 32)
1813 delay = 1000;
1841 } 1814 }
1842 break; 1815 break;
1843 1816
@@ -1898,10 +1871,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1898 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && 1871 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) &&
1899 (cmd == ELS_CMD_FDISC) && 1872 (cmd == ELS_CMD_FDISC) &&
1900 (stat.un.b.lsRjtRsnCodeExp == LSEXP_OUT_OF_RESOURCE)){ 1873 (stat.un.b.lsRjtRsnCodeExp == LSEXP_OUT_OF_RESOURCE)){
1901 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 1874 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
1902 "%d (%d):0125 FDISC Failed (x%x)." 1875 "0125 FDISC Failed (x%x). "
1903 " Fabric out of resources\n", 1876 "Fabric out of resources\n",
1904 phba->brd_no, vport->vpi, stat.un.lsRjtError); 1877 stat.un.lsRjtError);
1905 lpfc_vport_set_state(vport, 1878 lpfc_vport_set_state(vport,
1906 FC_VPORT_NO_FABRIC_RSCS); 1879 FC_VPORT_NO_FABRIC_RSCS);
1907 } 1880 }
@@ -1913,8 +1886,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1913 delay = 1000; 1886 delay = 1000;
1914 maxretry = 48; 1887 maxretry = 48;
1915 } else if (cmd == ELS_CMD_FDISC) { 1888 } else if (cmd == ELS_CMD_FDISC) {
1916 /* Always retry for this case */ 1889 /* FDISC retry policy */
1917 cmdiocb->retry = 0; 1890 maxretry = 48;
1891 if (cmdiocb->retry >= 32)
1892 delay = 1000;
1918 } 1893 }
1919 retry = 1; 1894 retry = 1;
1920 break; 1895 break;
@@ -1926,10 +1901,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1926 ((stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_PNAME) || 1901 ((stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_PNAME) ||
1927 (stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_NPORT_ID)) 1902 (stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_NPORT_ID))
1928 ) { 1903 ) {
1929 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 1904 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
1930 "%d (%d):0123 FDISC Failed (x%x)." 1905 "0123 FDISC Failed (x%x). "
1931 " Fabric Detected Bad WWN\n", 1906 "Fabric Detected Bad WWN\n",
1932 phba->brd_no, vport->vpi, stat.un.lsRjtError); 1907 stat.un.lsRjtError);
1933 lpfc_vport_set_state(vport, 1908 lpfc_vport_set_state(vport,
1934 FC_VPORT_FABRIC_REJ_WWN); 1909 FC_VPORT_FABRIC_REJ_WWN);
1935 } 1910 }
@@ -1959,11 +1934,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1959 if (retry) { 1934 if (retry) {
1960 1935
1961 /* Retry ELS command <elsCmd> to remote NPORT <did> */ 1936 /* Retry ELS command <elsCmd> to remote NPORT <did> */
1962 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 1937 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
1963 "%d (%d):0107 Retry ELS command x%x to remote " 1938 "0107 Retry ELS command x%x to remote "
1964 "NPORT x%x Data: x%x x%x\n", 1939 "NPORT x%x Data: x%x x%x\n",
1965 phba->brd_no, vport->vpi, 1940 cmd, did, cmdiocb->retry, delay);
1966 cmd, did, cmdiocb->retry, delay);
1967 1941
1968 if (((cmd == ELS_CMD_PLOGI) || (cmd == ELS_CMD_ADISC)) && 1942 if (((cmd == ELS_CMD_PLOGI) || (cmd == ELS_CMD_ADISC)) &&
1969 ((irsp->ulpStatus != IOSTAT_LOCAL_REJECT) || 1943 ((irsp->ulpStatus != IOSTAT_LOCAL_REJECT) ||
@@ -2031,14 +2005,12 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
2031 return 1; 2005 return 1;
2032 } 2006 }
2033 } 2007 }
2034
2035 /* No retry ELS command <elsCmd> to remote NPORT <did> */ 2008 /* No retry ELS command <elsCmd> to remote NPORT <did> */
2036 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 2009 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
2037 "%d (%d):0108 No retry ELS command x%x to remote " 2010 "0108 No retry ELS command x%x to remote "
2038 "NPORT x%x Data: x%x\n", 2011 "NPORT x%x Retried:%d Error:x%x/%x\n",
2039 phba->brd_no, vport->vpi, 2012 cmd, did, cmdiocb->retry, irsp->ulpStatus,
2040 cmd, did, cmdiocb->retry); 2013 irsp->un.ulpWord[4]);
2041
2042 return 0; 2014 return 0;
2043} 2015}
2044 2016
@@ -2087,14 +2059,12 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
2087 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 2059 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP,
2088 "ACC LOGO cmpl: status:x%x/x%x did:x%x", 2060 "ACC LOGO cmpl: status:x%x/x%x did:x%x",
2089 irsp->ulpStatus, irsp->un.ulpWord[4], ndlp->nlp_DID); 2061 irsp->ulpStatus, irsp->un.ulpWord[4], ndlp->nlp_DID);
2090
2091 /* ACC to LOGO completes to NPort <nlp_DID> */ 2062 /* ACC to LOGO completes to NPort <nlp_DID> */
2092 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 2063 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
2093 "%d (%d):0109 ACC to LOGO completes to NPort x%x " 2064 "0109 ACC to LOGO completes to NPort x%x "
2094 "Data: x%x x%x x%x\n", 2065 "Data: x%x x%x x%x\n",
2095 phba->brd_no, vport->vpi, ndlp->nlp_DID, 2066 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
2096 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); 2067 ndlp->nlp_rpi);
2097
2098 switch (ndlp->nlp_state) { 2068 switch (ndlp->nlp_state) {
2099 case NLP_STE_UNUSED_NODE: /* node is just allocated */ 2069 case NLP_STE_UNUSED_NODE: /* node is just allocated */
2100 lpfc_drop_node(vport, ndlp); 2070 lpfc_drop_node(vport, ndlp);
@@ -2153,20 +2123,17 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
2153 } 2123 }
2154 2124
2155 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 2125 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP,
2156 "ACC cmpl: status:x%x/x%x did:x%x", 2126 "ELS rsp cmpl: status:x%x/x%x did:x%x",
2157 irsp->ulpStatus, irsp->un.ulpWord[4], 2127 irsp->ulpStatus, irsp->un.ulpWord[4],
2158 irsp->un.rcvels.remoteID); 2128 cmdiocb->iocb.un.elsreq64.remoteID);
2159
2160 /* ELS response tag <ulpIoTag> completes */ 2129 /* ELS response tag <ulpIoTag> completes */
2161 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 2130 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
2162 "%d (%d):0110 ELS response tag x%x completes " 2131 "0110 ELS response tag x%x completes "
2163 "Data: x%x x%x x%x x%x x%x x%x x%x\n", 2132 "Data: x%x x%x x%x x%x x%x x%x x%x\n",
2164 phba->brd_no, vport->vpi, 2133 cmdiocb->iocb.ulpIoTag, rspiocb->iocb.ulpStatus,
2165 cmdiocb->iocb.ulpIoTag, rspiocb->iocb.ulpStatus, 2134 rspiocb->iocb.un.ulpWord[4], rspiocb->iocb.ulpTimeout,
2166 rspiocb->iocb.un.ulpWord[4], rspiocb->iocb.ulpTimeout, 2135 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
2167 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, 2136 ndlp->nlp_rpi);
2168 ndlp->nlp_rpi);
2169
2170 if (mbox) { 2137 if (mbox) {
2171 if ((rspiocb->iocb.ulpStatus == 0) 2138 if ((rspiocb->iocb.ulpStatus == 0)
2172 && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { 2139 && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) {
@@ -2219,7 +2186,7 @@ out:
2219int 2186int
2220lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag, 2187lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag,
2221 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp, 2188 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp,
2222 LPFC_MBOXQ_t *mbox, uint8_t newnode) 2189 LPFC_MBOXQ_t *mbox)
2223{ 2190{
2224 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 2191 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2225 struct lpfc_hba *phba = vport->phba; 2192 struct lpfc_hba *phba = vport->phba;
@@ -2305,20 +2272,13 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag,
2305 default: 2272 default:
2306 return 1; 2273 return 1;
2307 } 2274 }
2308
2309 if (newnode) {
2310 lpfc_nlp_put(ndlp);
2311 elsiocb->context1 = NULL;
2312 }
2313
2314 /* Xmit ELS ACC response tag <ulpIoTag> */ 2275 /* Xmit ELS ACC response tag <ulpIoTag> */
2315 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 2276 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
2316 "%d (%d):0128 Xmit ELS ACC response tag x%x, XRI: x%x, " 2277 "0128 Xmit ELS ACC response tag x%x, XRI: x%x, "
2317 "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x\n", 2278 "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x\n",
2318 phba->brd_no, vport->vpi, elsiocb->iotag, 2279 elsiocb->iotag, elsiocb->iocb.ulpContext,
2319 elsiocb->iocb.ulpContext, ndlp->nlp_DID, 2280 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
2320 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); 2281 ndlp->nlp_rpi);
2321
2322 if (ndlp->nlp_flag & NLP_LOGO_ACC) { 2282 if (ndlp->nlp_flag & NLP_LOGO_ACC) {
2323 spin_lock_irq(shost->host_lock); 2283 spin_lock_irq(shost->host_lock);
2324 ndlp->nlp_flag &= ~NLP_LOGO_ACC; 2284 ndlp->nlp_flag &= ~NLP_LOGO_ACC;
@@ -2370,20 +2330,17 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_t rejectError,
2370 pcmd += sizeof(uint32_t); 2330 pcmd += sizeof(uint32_t);
2371 *((uint32_t *) (pcmd)) = rejectError; 2331 *((uint32_t *) (pcmd)) = rejectError;
2372 2332
2373 if (mbox) { 2333 if (mbox)
2374 elsiocb->context_un.mbox = mbox; 2334 elsiocb->context_un.mbox = mbox;
2375 elsiocb->context1 = lpfc_nlp_get(ndlp);
2376 }
2377 2335
2378 /* Xmit ELS RJT <err> response tag <ulpIoTag> */ 2336 /* Xmit ELS RJT <err> response tag <ulpIoTag> */
2379 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 2337 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
2380 "%d (%d):0129 Xmit ELS RJT x%x response tag x%x " 2338 "0129 Xmit ELS RJT x%x response tag x%x "
2381 "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " 2339 "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, "
2382 "rpi x%x\n", 2340 "rpi x%x\n",
2383 phba->brd_no, vport->vpi, rejectError, elsiocb->iotag, 2341 rejectError, elsiocb->iotag,
2384 elsiocb->iocb.ulpContext, ndlp->nlp_DID, 2342 elsiocb->iocb.ulpContext, ndlp->nlp_DID,
2385 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); 2343 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
2386
2387 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 2344 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP,
2388 "Issue LS_RJT: did:x%x flg:x%x err:x%x", 2345 "Issue LS_RJT: did:x%x flg:x%x err:x%x",
2389 ndlp->nlp_DID, ndlp->nlp_flag, rejectError); 2346 ndlp->nlp_DID, ndlp->nlp_flag, rejectError);
@@ -2391,6 +2348,15 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_t rejectError,
2391 phba->fc_stat.elsXmitLSRJT++; 2348 phba->fc_stat.elsXmitLSRJT++;
2392 elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; 2349 elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;
2393 rc = lpfc_sli_issue_iocb(phba, pring, elsiocb, 0); 2350 rc = lpfc_sli_issue_iocb(phba, pring, elsiocb, 0);
2351
2352 /* If the node is in the UNUSED state, and we are sending
2353 * a reject, we are done with it. Release driver reference
2354 * count here. The outstanding els will release its reference on
2355 * completion and the node can be freed then.
2356 */
2357 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
2358 lpfc_nlp_put(ndlp);
2359
2394 if (rc == IOCB_ERROR) { 2360 if (rc == IOCB_ERROR) {
2395 lpfc_els_free_iocb(phba, elsiocb); 2361 lpfc_els_free_iocb(phba, elsiocb);
2396 return 1; 2362 return 1;
@@ -2423,13 +2389,12 @@ lpfc_els_rsp_adisc_acc(struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb,
2423 icmd->ulpContext = oldcmd->ulpContext; /* Xri */ 2389 icmd->ulpContext = oldcmd->ulpContext; /* Xri */
2424 2390
2425 /* Xmit ADISC ACC response tag <ulpIoTag> */ 2391 /* Xmit ADISC ACC response tag <ulpIoTag> */
2426 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 2392 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
2427 "%d (%d):0130 Xmit ADISC ACC response iotag x%x xri: " 2393 "0130 Xmit ADISC ACC response iotag x%x xri: "
2428 "x%x, did x%x, nlp_flag x%x, nlp_state x%x rpi x%x\n", 2394 "x%x, did x%x, nlp_flag x%x, nlp_state x%x rpi x%x\n",
2429 phba->brd_no, vport->vpi, elsiocb->iotag, 2395 elsiocb->iotag, elsiocb->iocb.ulpContext,
2430 elsiocb->iocb.ulpContext, ndlp->nlp_DID, 2396 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
2431 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); 2397 ndlp->nlp_rpi);
2432
2433 pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); 2398 pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt);
2434 2399
2435 *((uint32_t *) (pcmd)) = ELS_CMD_ACC; 2400 *((uint32_t *) (pcmd)) = ELS_CMD_ACC;
@@ -2483,15 +2448,13 @@ lpfc_els_rsp_prli_acc(struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb,
2483 icmd = &elsiocb->iocb; 2448 icmd = &elsiocb->iocb;
2484 oldcmd = &oldiocb->iocb; 2449 oldcmd = &oldiocb->iocb;
2485 icmd->ulpContext = oldcmd->ulpContext; /* Xri */ 2450 icmd->ulpContext = oldcmd->ulpContext; /* Xri */
2486
2487 /* Xmit PRLI ACC response tag <ulpIoTag> */ 2451 /* Xmit PRLI ACC response tag <ulpIoTag> */
2488 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 2452 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
2489 "%d (%d):0131 Xmit PRLI ACC response tag x%x xri x%x, " 2453 "0131 Xmit PRLI ACC response tag x%x xri x%x, "
2490 "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", 2454 "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n",
2491 phba->brd_no, vport->vpi, elsiocb->iotag, 2455 elsiocb->iotag, elsiocb->iocb.ulpContext,
2492 elsiocb->iocb.ulpContext, ndlp->nlp_DID, 2456 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
2493 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); 2457 ndlp->nlp_rpi);
2494
2495 pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); 2458 pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt);
2496 2459
2497 *((uint32_t *) (pcmd)) = (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK)); 2460 *((uint32_t *) (pcmd)) = (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK));
@@ -2565,16 +2528,11 @@ lpfc_els_rsp_rnid_acc(struct lpfc_vport *vport, uint8_t format,
2565 icmd = &elsiocb->iocb; 2528 icmd = &elsiocb->iocb;
2566 oldcmd = &oldiocb->iocb; 2529 oldcmd = &oldiocb->iocb;
2567 icmd->ulpContext = oldcmd->ulpContext; /* Xri */ 2530 icmd->ulpContext = oldcmd->ulpContext; /* Xri */
2568
2569 /* Xmit RNID ACC response tag <ulpIoTag> */ 2531 /* Xmit RNID ACC response tag <ulpIoTag> */
2570 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 2532 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
2571 "%d (%d):0132 Xmit RNID ACC response tag x%x " 2533 "0132 Xmit RNID ACC response tag x%x xri x%x\n",
2572 "xri x%x\n", 2534 elsiocb->iotag, elsiocb->iocb.ulpContext);
2573 phba->brd_no, vport->vpi, elsiocb->iotag,
2574 elsiocb->iocb.ulpContext);
2575
2576 pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); 2535 pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt);
2577
2578 *((uint32_t *) (pcmd)) = ELS_CMD_ACC; 2536 *((uint32_t *) (pcmd)) = ELS_CMD_ACC;
2579 pcmd += sizeof(uint32_t); 2537 pcmd += sizeof(uint32_t);
2580 2538
@@ -2641,7 +2599,7 @@ lpfc_els_disc_adisc(struct lpfc_vport *vport)
2641 sentadisc++; 2599 sentadisc++;
2642 vport->num_disc_nodes++; 2600 vport->num_disc_nodes++;
2643 if (vport->num_disc_nodes >= 2601 if (vport->num_disc_nodes >=
2644 vport->phba->cfg_discovery_threads) { 2602 vport->cfg_discovery_threads) {
2645 spin_lock_irq(shost->host_lock); 2603 spin_lock_irq(shost->host_lock);
2646 vport->fc_flag |= FC_NLP_MORE; 2604 vport->fc_flag |= FC_NLP_MORE;
2647 spin_unlock_irq(shost->host_lock); 2605 spin_unlock_irq(shost->host_lock);
@@ -2676,7 +2634,7 @@ lpfc_els_disc_plogi(struct lpfc_vport *vport)
2676 sentplogi++; 2634 sentplogi++;
2677 vport->num_disc_nodes++; 2635 vport->num_disc_nodes++;
2678 if (vport->num_disc_nodes >= 2636 if (vport->num_disc_nodes >=
2679 vport->phba->cfg_discovery_threads) { 2637 vport->cfg_discovery_threads) {
2680 spin_lock_irq(shost->host_lock); 2638 spin_lock_irq(shost->host_lock);
2681 vport->fc_flag |= FC_NLP_MORE; 2639 vport->fc_flag |= FC_NLP_MORE;
2682 spin_unlock_irq(shost->host_lock); 2640 spin_unlock_irq(shost->host_lock);
@@ -2717,7 +2675,6 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did)
2717 D_ID rscn_did; 2675 D_ID rscn_did;
2718 uint32_t *lp; 2676 uint32_t *lp;
2719 uint32_t payload_len, i; 2677 uint32_t payload_len, i;
2720 struct lpfc_hba *phba = vport->phba;
2721 2678
2722 ns_did.un.word = did; 2679 ns_did.un.word = did;
2723 2680
@@ -2752,12 +2709,10 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did)
2752 break; 2709 break;
2753 default: 2710 default:
2754 /* Unknown Identifier in RSCN node */ 2711 /* Unknown Identifier in RSCN node */
2755 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2712 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
2756 "%d (%d):0217 Unknown " 2713 "0217 Unknown Identifier in "
2757 "Identifier in RSCN payload " 2714 "RSCN payload Data: x%x\n",
2758 "Data: x%x\n", 2715 rscn_did.un.word);
2759 phba->brd_no, vport->vpi,
2760 rscn_did.un.word);
2761 case 3: /* Whole Fabric effected */ 2716 case 3: /* Whole Fabric effected */
2762 return did; 2717 return did;
2763 } 2718 }
@@ -2796,12 +2751,11 @@ lpfc_rscn_recovery_check(struct lpfc_vport *vport)
2796 2751
2797static int 2752static int
2798lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, 2753lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
2799 struct lpfc_nodelist *ndlp, uint8_t newnode) 2754 struct lpfc_nodelist *ndlp)
2800{ 2755{
2801 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 2756 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2802 struct lpfc_hba *phba = vport->phba; 2757 struct lpfc_hba *phba = vport->phba;
2803 struct lpfc_dmabuf *pcmd; 2758 struct lpfc_dmabuf *pcmd;
2804 struct lpfc_vport *next_vport;
2805 uint32_t *lp, *datap; 2759 uint32_t *lp, *datap;
2806 IOCB_t *icmd; 2760 IOCB_t *icmd;
2807 uint32_t payload_len, length, nportid, *cmd; 2761 uint32_t payload_len, length, nportid, *cmd;
@@ -2815,13 +2769,10 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
2815 2769
2816 payload_len = be32_to_cpu(*lp++ & ~ELS_CMD_MASK); 2770 payload_len = be32_to_cpu(*lp++ & ~ELS_CMD_MASK);
2817 payload_len -= sizeof(uint32_t); /* take off word 0 */ 2771 payload_len -= sizeof(uint32_t); /* take off word 0 */
2818
2819 /* RSCN received */ 2772 /* RSCN received */
2820 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 2773 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2821 "%d (%d):0214 RSCN received Data: x%x x%x x%x x%x\n", 2774 "0214 RSCN received Data: x%x x%x x%x x%x\n",
2822 phba->brd_no, vport->vpi, vport->fc_flag, payload_len, 2775 vport->fc_flag, payload_len, *lp, rscn_cnt);
2823 *lp, rscn_cnt);
2824
2825 for (i = 0; i < payload_len/sizeof(uint32_t); i++) 2776 for (i = 0; i < payload_len/sizeof(uint32_t); i++)
2826 fc_host_post_event(shost, fc_get_event_number(), 2777 fc_host_post_event(shost, fc_get_event_number(),
2827 FCH_EVT_RSCN, lp[i]); 2778 FCH_EVT_RSCN, lp[i]);
@@ -2834,8 +2785,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
2834 "RCV RSCN ignore: did:x%x/ste:x%x flg:x%x", 2785 "RCV RSCN ignore: did:x%x/ste:x%x flg:x%x",
2835 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag); 2786 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag);
2836 2787
2837 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 2788 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
2838 newnode);
2839 return 0; 2789 return 0;
2840 } 2790 }
2841 2791
@@ -2843,7 +2793,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
2843 * just ACC and ignore it. 2793 * just ACC and ignore it.
2844 */ 2794 */
2845 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && 2795 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) &&
2846 !(phba->cfg_peer_port_login)) { 2796 !(vport->cfg_peer_port_login)) {
2847 i = payload_len; 2797 i = payload_len;
2848 datap = lp; 2798 datap = lp;
2849 while (i > 0) { 2799 while (i > 0) {
@@ -2851,28 +2801,23 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
2851 nportid = ((be32_to_cpu(nportid)) & Mask_DID); 2801 nportid = ((be32_to_cpu(nportid)) & Mask_DID);
2852 i -= sizeof(uint32_t); 2802 i -= sizeof(uint32_t);
2853 rscn_id++; 2803 rscn_id++;
2854 list_for_each_entry(next_vport, &phba->port_list, 2804 if (lpfc_find_vport_by_did(phba, nportid))
2855 listentry) { 2805 hba_id++;
2856 if (nportid == next_vport->fc_myDID) {
2857 hba_id++;
2858 break;
2859 }
2860 }
2861 } 2806 }
2862 if (rscn_id == hba_id) { 2807 if (rscn_id == hba_id) {
2863 /* ALL NPortIDs in RSCN are on HBA */ 2808 /* ALL NPortIDs in RSCN are on HBA */
2864 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 2809 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2865 "%d (%d):0214 Ignore RSCN Data: x%x x%x x%x x%x\n", 2810 "0214 Ignore RSCN "
2866 phba->brd_no, vport->vpi, vport->fc_flag, payload_len, 2811 "Data: x%x x%x x%x x%x\n",
2867 *lp, rscn_cnt); 2812 vport->fc_flag, payload_len,
2868 2813 *lp, rscn_cnt);
2869 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 2814 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
2870 "RCV RSCN vport: did:x%x/ste:x%x flg:x%x", 2815 "RCV RSCN vport: did:x%x/ste:x%x flg:x%x",
2871 ndlp->nlp_DID, vport->port_state, 2816 ndlp->nlp_DID, vport->port_state,
2872 ndlp->nlp_flag); 2817 ndlp->nlp_flag);
2873 2818
2874 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, 2819 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb,
2875 ndlp, NULL, newnode); 2820 ndlp, NULL);
2876 return 0; 2821 return 0;
2877 } 2822 }
2878 } 2823 }
@@ -2911,27 +2856,24 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
2911 } 2856 }
2912 2857
2913 /* Deferred RSCN */ 2858 /* Deferred RSCN */
2914 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 2859 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2915 "%d (%d):0235 Deferred RSCN " 2860 "0235 Deferred RSCN "
2916 "Data: x%x x%x x%x\n", 2861 "Data: x%x x%x x%x\n",
2917 phba->brd_no, vport->vpi, 2862 vport->fc_rscn_id_cnt, vport->fc_flag,
2918 vport->fc_rscn_id_cnt, vport->fc_flag, 2863 vport->port_state);
2919 vport->port_state);
2920 } else { 2864 } else {
2921 spin_lock_irq(shost->host_lock); 2865 spin_lock_irq(shost->host_lock);
2922 vport->fc_flag |= FC_RSCN_DISCOVERY; 2866 vport->fc_flag |= FC_RSCN_DISCOVERY;
2923 spin_unlock_irq(shost->host_lock); 2867 spin_unlock_irq(shost->host_lock);
2924 /* ReDiscovery RSCN */ 2868 /* ReDiscovery RSCN */
2925 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 2869 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2926 "%d (%d):0234 ReDiscovery RSCN " 2870 "0234 ReDiscovery RSCN "
2927 "Data: x%x x%x x%x\n", 2871 "Data: x%x x%x x%x\n",
2928 phba->brd_no, vport->vpi, 2872 vport->fc_rscn_id_cnt, vport->fc_flag,
2929 vport->fc_rscn_id_cnt, vport->fc_flag, 2873 vport->port_state);
2930 vport->port_state);
2931 } 2874 }
2932 /* Send back ACC */ 2875 /* Send back ACC */
2933 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 2876 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
2934 newnode);
2935 2877
2936 /* send RECOVERY event for ALL nodes that match RSCN payload */ 2878 /* send RECOVERY event for ALL nodes that match RSCN payload */
2937 lpfc_rscn_recovery_check(vport); 2879 lpfc_rscn_recovery_check(vport);
@@ -2956,7 +2898,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
2956 lpfc_set_disctmo(vport); 2898 lpfc_set_disctmo(vport);
2957 2899
2958 /* Send back ACC */ 2900 /* Send back ACC */
2959 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, newnode); 2901 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
2960 2902
2961 /* send RECOVERY event for ALL nodes that match RSCN payload */ 2903 /* send RECOVERY event for ALL nodes that match RSCN payload */
2962 lpfc_rscn_recovery_check(vport); 2904 lpfc_rscn_recovery_check(vport);
@@ -2980,11 +2922,10 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport)
2980 lpfc_set_disctmo(vport); 2922 lpfc_set_disctmo(vport);
2981 2923
2982 /* RSCN processed */ 2924 /* RSCN processed */
2983 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 2925 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2984 "%d (%d):0215 RSCN processed Data: x%x x%x x%x x%x\n", 2926 "0215 RSCN processed Data: x%x x%x x%x x%x\n",
2985 phba->brd_no, vport->vpi, 2927 vport->fc_flag, 0, vport->fc_rscn_id_cnt,
2986 vport->fc_flag, 0, vport->fc_rscn_id_cnt, 2928 vport->port_state);
2987 vport->port_state);
2988 2929
2989 /* To process RSCN, first compare RSCN data with NameServer */ 2930 /* To process RSCN, first compare RSCN data with NameServer */
2990 vport->fc_ns_retry = 0; 2931 vport->fc_ns_retry = 0;
@@ -3026,7 +2967,7 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport)
3026 2967
3027static int 2968static int
3028lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, 2969lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3029 struct lpfc_nodelist *ndlp, uint8_t newnode) 2970 struct lpfc_nodelist *ndlp)
3030{ 2971{
3031 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 2972 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
3032 struct lpfc_hba *phba = vport->phba; 2973 struct lpfc_hba *phba = vport->phba;
@@ -3052,10 +2993,10 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3052 2993
3053 /* An FLOGI ELS command <elsCmd> was received from DID <did> in 2994 /* An FLOGI ELS command <elsCmd> was received from DID <did> in
3054 Loop Mode */ 2995 Loop Mode */
3055 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 2996 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
3056 "%d (%d):0113 An FLOGI ELS command x%x was " 2997 "0113 An FLOGI ELS command x%x was "
3057 "received from DID x%x in Loop Mode\n", 2998 "received from DID x%x in Loop Mode\n",
3058 phba->brd_no, vport->vpi, cmd, did); 2999 cmd, did);
3059 return 1; 3000 return 1;
3060 } 3001 }
3061 3002
@@ -3109,7 +3050,7 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3109 } 3050 }
3110 3051
3111 /* Send back ACC */ 3052 /* Send back ACC */
3112 lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, newnode); 3053 lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL);
3113 3054
3114 return 0; 3055 return 0;
3115} 3056}
@@ -3226,16 +3167,13 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
3226 rps_rsp->primSeqErrCnt = be32_to_cpu(mb->un.varRdLnk.primSeqErrCnt); 3167 rps_rsp->primSeqErrCnt = be32_to_cpu(mb->un.varRdLnk.primSeqErrCnt);
3227 rps_rsp->invalidXmitWord = be32_to_cpu(mb->un.varRdLnk.invalidXmitWord); 3168 rps_rsp->invalidXmitWord = be32_to_cpu(mb->un.varRdLnk.invalidXmitWord);
3228 rps_rsp->crcCnt = be32_to_cpu(mb->un.varRdLnk.crcCnt); 3169 rps_rsp->crcCnt = be32_to_cpu(mb->un.varRdLnk.crcCnt);
3229
3230 /* Xmit ELS RPS ACC response tag <ulpIoTag> */ 3170 /* Xmit ELS RPS ACC response tag <ulpIoTag> */
3231 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 3171 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_ELS,
3232 "%d (%d):0118 Xmit ELS RPS ACC response tag x%x " 3172 "0118 Xmit ELS RPS ACC response tag x%x xri x%x, "
3233 "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " 3173 "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n",
3234 "rpi x%x\n", 3174 elsiocb->iotag, elsiocb->iocb.ulpContext,
3235 phba->brd_no, ndlp->vport->vpi, elsiocb->iotag, 3175 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
3236 elsiocb->iocb.ulpContext, ndlp->nlp_DID, 3176 ndlp->nlp_rpi);
3237 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
3238
3239 elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; 3177 elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;
3240 phba->fc_stat.elsXmitACC++; 3178 phba->fc_stat.elsXmitACC++;
3241 if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) 3179 if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR)
@@ -3337,21 +3275,16 @@ lpfc_els_rsp_rpl_acc(struct lpfc_vport *vport, uint16_t cmdsize,
3337 rpl_rsp.port_num_blk.portID = be32_to_cpu(vport->fc_myDID); 3275 rpl_rsp.port_num_blk.portID = be32_to_cpu(vport->fc_myDID);
3338 memcpy(&rpl_rsp.port_num_blk.portName, &vport->fc_portname, 3276 memcpy(&rpl_rsp.port_num_blk.portName, &vport->fc_portname,
3339 sizeof(struct lpfc_name)); 3277 sizeof(struct lpfc_name));
3340
3341 memcpy(pcmd, &rpl_rsp, cmdsize - sizeof(uint32_t)); 3278 memcpy(pcmd, &rpl_rsp, cmdsize - sizeof(uint32_t));
3342
3343
3344 /* Xmit ELS RPL ACC response tag <ulpIoTag> */ 3279 /* Xmit ELS RPL ACC response tag <ulpIoTag> */
3345 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 3280 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
3346 "%d (%d):0120 Xmit ELS RPL ACC response tag x%x " 3281 "0120 Xmit ELS RPL ACC response tag x%x "
3347 "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " 3282 "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, "
3348 "rpi x%x\n", 3283 "rpi x%x\n",
3349 phba->brd_no, vport->vpi, elsiocb->iotag, 3284 elsiocb->iotag, elsiocb->iocb.ulpContext,
3350 elsiocb->iocb.ulpContext, ndlp->nlp_DID, 3285 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
3351 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); 3286 ndlp->nlp_rpi);
3352
3353 elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; 3287 elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;
3354
3355 phba->fc_stat.elsXmitACC++; 3288 phba->fc_stat.elsXmitACC++;
3356 if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { 3289 if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) {
3357 lpfc_els_free_iocb(phba, elsiocb); 3290 lpfc_els_free_iocb(phba, elsiocb);
@@ -3404,7 +3337,6 @@ static int
3404lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, 3337lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3405 struct lpfc_nodelist *ndlp) 3338 struct lpfc_nodelist *ndlp)
3406{ 3339{
3407 struct lpfc_hba *phba = vport->phba;
3408 struct lpfc_dmabuf *pcmd; 3340 struct lpfc_dmabuf *pcmd;
3409 uint32_t *lp; 3341 uint32_t *lp;
3410 IOCB_t *icmd; 3342 IOCB_t *icmd;
@@ -3418,12 +3350,9 @@ lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3418 3350
3419 cmd = *lp++; 3351 cmd = *lp++;
3420 fp = (FARP *) lp; 3352 fp = (FARP *) lp;
3421
3422 /* FARP-REQ received from DID <did> */ 3353 /* FARP-REQ received from DID <did> */
3423 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 3354 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
3424 "%d (%d):0601 FARP-REQ received from DID x%x\n", 3355 "0601 FARP-REQ received from DID x%x\n", did);
3425 phba->brd_no, vport->vpi, did);
3426
3427 /* We will only support match on WWPN or WWNN */ 3356 /* We will only support match on WWPN or WWNN */
3428 if (fp->Mflags & ~(FARP_MATCH_NODE | FARP_MATCH_PORT)) { 3357 if (fp->Mflags & ~(FARP_MATCH_NODE | FARP_MATCH_PORT)) {
3429 return 0; 3358 return 0;
@@ -3471,7 +3400,6 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3471 uint32_t *lp; 3400 uint32_t *lp;
3472 IOCB_t *icmd; 3401 IOCB_t *icmd;
3473 uint32_t cmd, did; 3402 uint32_t cmd, did;
3474 struct lpfc_hba *phba = vport->phba;
3475 3403
3476 icmd = &cmdiocb->iocb; 3404 icmd = &cmdiocb->iocb;
3477 did = icmd->un.elsreq64.remoteID; 3405 did = icmd->un.elsreq64.remoteID;
@@ -3480,11 +3408,10 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3480 3408
3481 cmd = *lp++; 3409 cmd = *lp++;
3482 /* FARP-RSP received from DID <did> */ 3410 /* FARP-RSP received from DID <did> */
3483 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 3411 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
3484 "%d (%d):0600 FARP-RSP received from DID x%x\n", 3412 "0600 FARP-RSP received from DID x%x\n", did);
3485 phba->brd_no, vport->vpi, did);
3486 /* ACCEPT the Farp resp request */ 3413 /* ACCEPT the Farp resp request */
3487 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 3414 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
3488 3415
3489 return 0; 3416 return 0;
3490} 3417}
@@ -3502,10 +3429,8 @@ lpfc_els_rcv_fan(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3502 struct lpfc_hba *phba = vport->phba; 3429 struct lpfc_hba *phba = vport->phba;
3503 3430
3504 /* FAN received */ 3431 /* FAN received */
3505 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 3432 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
3506 "%d (%d):0265 FAN received\n", 3433 "0265 FAN received\n");
3507 phba->brd_no, vport->vpi);
3508
3509 icmd = &cmdiocb->iocb; 3434 icmd = &cmdiocb->iocb;
3510 did = icmd->un.elsreq64.remoteID; 3435 did = icmd->un.elsreq64.remoteID;
3511 pcmd = (struct lpfc_dmabuf *)cmdiocb->context2; 3436 pcmd = (struct lpfc_dmabuf *)cmdiocb->context2;
@@ -3664,13 +3589,10 @@ lpfc_els_timeout_handler(struct lpfc_vport *vport)
3664 if (ndlp) 3589 if (ndlp)
3665 remote_ID = ndlp->nlp_DID; 3590 remote_ID = ndlp->nlp_DID;
3666 } 3591 }
3667 3592 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
3668 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 3593 "0127 ELS timeout Data: x%x x%x x%x "
3669 "%d (%d):0127 ELS timeout Data: x%x x%x x%x " 3594 "x%x\n", els_command,
3670 "x%x\n", 3595 remote_ID, cmd->ulpCommand, cmd->ulpIoTag);
3671 phba->brd_no, vport->vpi, els_command,
3672 remote_ID, cmd->ulpCommand, cmd->ulpIoTag);
3673
3674 lpfc_sli_issue_abort_iotag(phba, pring, piocb); 3596 lpfc_sli_issue_abort_iotag(phba, pring, piocb);
3675 } 3597 }
3676 spin_unlock_irq(&phba->hbalock); 3598 spin_unlock_irq(&phba->hbalock);
@@ -3741,6 +3663,50 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport)
3741 return; 3663 return;
3742} 3664}
3743 3665
3666void
3667lpfc_els_flush_all_cmd(struct lpfc_hba *phba)
3668{
3669 LIST_HEAD(completions);
3670 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
3671 struct lpfc_iocbq *tmp_iocb, *piocb;
3672 IOCB_t *cmd = NULL;
3673
3674 lpfc_fabric_abort_hba(phba);
3675 spin_lock_irq(&phba->hbalock);
3676 list_for_each_entry_safe(piocb, tmp_iocb, &pring->txq, list) {
3677 cmd = &piocb->iocb;
3678 if (piocb->iocb_flag & LPFC_IO_LIBDFC)
3679 continue;
3680 /* Do not flush out the QUE_RING and ABORT/CLOSE iocbs */
3681 if (cmd->ulpCommand == CMD_QUE_RING_BUF_CN ||
3682 cmd->ulpCommand == CMD_QUE_RING_BUF64_CN ||
3683 cmd->ulpCommand == CMD_CLOSE_XRI_CN ||
3684 cmd->ulpCommand == CMD_ABORT_XRI_CN)
3685 continue;
3686 list_move_tail(&piocb->list, &completions);
3687 pring->txq_cnt--;
3688 }
3689 list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) {
3690 if (piocb->iocb_flag & LPFC_IO_LIBDFC)
3691 continue;
3692 lpfc_sli_issue_abort_iotag(phba, pring, piocb);
3693 }
3694 spin_unlock_irq(&phba->hbalock);
3695 while (!list_empty(&completions)) {
3696 piocb = list_get_first(&completions, struct lpfc_iocbq, list);
3697 cmd = &piocb->iocb;
3698 list_del_init(&piocb->list);
3699 if (!piocb->iocb_cmpl)
3700 lpfc_sli_release_iocbq(phba, piocb);
3701 else {
3702 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
3703 cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
3704 (piocb->iocb_cmpl) (phba, piocb, piocb);
3705 }
3706 }
3707 return;
3708}
3709
3744static void 3710static void
3745lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, 3711lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3746 struct lpfc_vport *vport, struct lpfc_iocbq *elsiocb) 3712 struct lpfc_vport *vport, struct lpfc_iocbq *elsiocb)
@@ -3801,11 +3767,9 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3801 cmd &= ELS_CMD_MASK; 3767 cmd &= ELS_CMD_MASK;
3802 } 3768 }
3803 /* ELS command <elsCmd> received from NPORT <did> */ 3769 /* ELS command <elsCmd> received from NPORT <did> */
3804 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 3770 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
3805 "%d (%d):0112 ELS command x%x received from NPORT x%x " 3771 "0112 ELS command x%x received from NPORT x%x "
3806 "Data: x%x\n", phba->brd_no, vport->vpi, cmd, did, 3772 "Data: x%x\n", cmd, did, vport->port_state);
3807 vport->port_state);
3808
3809 switch (cmd) { 3773 switch (cmd) {
3810 case ELS_CMD_PLOGI: 3774 case ELS_CMD_PLOGI:
3811 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 3775 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
@@ -3829,7 +3793,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3829 did, vport->port_state, ndlp->nlp_flag); 3793 did, vport->port_state, ndlp->nlp_flag);
3830 3794
3831 phba->fc_stat.elsRcvFLOGI++; 3795 phba->fc_stat.elsRcvFLOGI++;
3832 lpfc_els_rcv_flogi(vport, elsiocb, ndlp, newnode); 3796 lpfc_els_rcv_flogi(vport, elsiocb, ndlp);
3833 if (newnode) 3797 if (newnode)
3834 lpfc_drop_node(vport, ndlp); 3798 lpfc_drop_node(vport, ndlp);
3835 break; 3799 break;
@@ -3859,7 +3823,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3859 break; 3823 break;
3860 case ELS_CMD_RSCN: 3824 case ELS_CMD_RSCN:
3861 phba->fc_stat.elsRcvRSCN++; 3825 phba->fc_stat.elsRcvRSCN++;
3862 lpfc_els_rcv_rscn(vport, elsiocb, ndlp, newnode); 3826 lpfc_els_rcv_rscn(vport, elsiocb, ndlp);
3863 if (newnode) 3827 if (newnode)
3864 lpfc_drop_node(vport, ndlp); 3828 lpfc_drop_node(vport, ndlp);
3865 break; 3829 break;
@@ -3974,10 +3938,9 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3974 rjt_err = LSRJT_INVALID_CMD; 3938 rjt_err = LSRJT_INVALID_CMD;
3975 3939
3976 /* Unknown ELS command <elsCmd> received from NPORT <did> */ 3940 /* Unknown ELS command <elsCmd> received from NPORT <did> */
3977 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 3941 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
3978 "%d (%d):0115 Unknown ELS command x%x " 3942 "0115 Unknown ELS command x%x "
3979 "received from NPORT x%x\n", 3943 "received from NPORT x%x\n", cmd, did);
3980 phba->brd_no, vport->vpi, cmd, did);
3981 if (newnode) 3944 if (newnode)
3982 lpfc_drop_node(vport, ndlp); 3945 lpfc_drop_node(vport, ndlp);
3983 break; 3946 break;
@@ -3990,19 +3953,16 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3990 stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE; 3953 stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE;
3991 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, elsiocb, ndlp, 3954 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, elsiocb, ndlp,
3992 NULL); 3955 NULL);
3993 if (newnode)
3994 lpfc_drop_node(vport, ndlp);
3995 } 3956 }
3996 3957
3997 return; 3958 return;
3998 3959
3999dropit: 3960dropit:
4000 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 3961 lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
4001 "%d (%d):0111 Dropping received ELS cmd " 3962 "(%d):0111 Dropping received ELS cmd "
4002 "Data: x%x x%x x%x\n", 3963 "Data: x%x x%x x%x\n",
4003 phba->brd_no, vport ? vport->vpi : 0xffff, 3964 vport ? vport->vpi : 0xffff, icmd->ulpStatus,
4004 icmd->ulpStatus, icmd->un.ulpWord[4], 3965 icmd->un.ulpWord[4], icmd->ulpTimeout);
4005 icmd->ulpTimeout);
4006 phba->fc_stat.elsRcvDrop++; 3966 phba->fc_stat.elsRcvDrop++;
4007} 3967}
4008 3968
@@ -4010,11 +3970,16 @@ static struct lpfc_vport *
4010lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi) 3970lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi)
4011{ 3971{
4012 struct lpfc_vport *vport; 3972 struct lpfc_vport *vport;
3973 unsigned long flags;
4013 3974
3975 spin_lock_irqsave(&phba->hbalock, flags);
4014 list_for_each_entry(vport, &phba->port_list, listentry) { 3976 list_for_each_entry(vport, &phba->port_list, listentry) {
4015 if (vport->vpi == vpi) 3977 if (vport->vpi == vpi) {
3978 spin_unlock_irqrestore(&phba->hbalock, flags);
4016 return vport; 3979 return vport;
3980 }
4017 } 3981 }
3982 spin_unlock_irqrestore(&phba->hbalock, flags);
4018 return NULL; 3983 return NULL;
4019} 3984}
4020 3985
@@ -4109,9 +4074,8 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
4109 return; 4074 return;
4110 } 4075 }
4111 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 4076 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
4112 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 4077 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
4113 "%d (%d):0251 NameServer login: no memory\n", 4078 "0251 NameServer login: no memory\n");
4114 phba->brd_no, vport->vpi);
4115 return; 4079 return;
4116 } 4080 }
4117 lpfc_nlp_init(vport, ndlp, NameServer_DID); 4081 lpfc_nlp_init(vport, ndlp, NameServer_DID);
@@ -4122,13 +4086,12 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
4122 4086
4123 if (lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0)) { 4087 if (lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0)) {
4124 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 4088 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
4125 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 4089 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
4126 "%d (%d):0252 Cannot issue NameServer login\n", 4090 "0252 Cannot issue NameServer login\n");
4127 phba->brd_no, vport->vpi);
4128 return; 4091 return;
4129 } 4092 }
4130 4093
4131 if (phba->cfg_fdmi_on) { 4094 if (vport->cfg_fdmi_on) {
4132 ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool, 4095 ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool,
4133 GFP_KERNEL); 4096 GFP_KERNEL);
4134 if (ndlp_fdmi) { 4097 if (ndlp_fdmi) {
@@ -4155,9 +4118,9 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
4155 lpfc_nlp_put(ndlp); 4118 lpfc_nlp_put(ndlp);
4156 4119
4157 if (mb->mbxStatus) { 4120 if (mb->mbxStatus) {
4158 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, 4121 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
4159 "%d (%d):0915 Register VPI failed: 0x%x\n", 4122 "0915 Register VPI failed: 0x%x\n",
4160 phba->brd_no, vport->vpi, mb->mbxStatus); 4123 mb->mbxStatus);
4161 4124
4162 switch (mb->mbxStatus) { 4125 switch (mb->mbxStatus) {
4163 case 0x11: /* unsupported feature */ 4126 case 0x11: /* unsupported feature */
@@ -4206,17 +4169,14 @@ lpfc_register_new_vport(struct lpfc_hba *phba, struct lpfc_vport *vport,
4206 vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI; 4169 vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI;
4207 4170
4208 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 4171 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
4209 4172 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
4210 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, 4173 "0253 Register VPI: Can't send mbox\n");
4211 "%d (%d):0253 Register VPI: Cannot send mbox\n",
4212 phba->brd_no, vport->vpi);
4213 } 4174 }
4214 } else { 4175 } else {
4215 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 4176 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
4216 4177
4217 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, 4178 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
4218 "%d (%d):0254 Register VPI: no memory\n", 4179 "0254 Register VPI: no memory\n");
4219 phba->brd_no, vport->vpi);
4220 4180
4221 vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI; 4181 vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI;
4222 lpfc_nlp_put(ndlp); 4182 lpfc_nlp_put(ndlp);
@@ -4235,11 +4195,10 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
4235 IOCB_t *irsp = &rspiocb->iocb; 4195 IOCB_t *irsp = &rspiocb->iocb;
4236 struct lpfc_iocbq *piocb; 4196 struct lpfc_iocbq *piocb;
4237 4197
4238 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 4198 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
4239 "%d (%d):0123 FDISC completes. x%x/x%x prevDID: x%x\n", 4199 "0123 FDISC completes. x%x/x%x prevDID: x%x\n",
4240 phba->brd_no, vport->vpi, 4200 irsp->ulpStatus, irsp->un.ulpWord[4],
4241 irsp->ulpStatus, irsp->un.ulpWord[4], vport->fc_prevDID); 4201 vport->fc_prevDID);
4242
4243 /* Since all FDISCs are being single threaded, we 4202 /* Since all FDISCs are being single threaded, we
4244 * must reset the discovery timer for ALL vports 4203 * must reset the discovery timer for ALL vports
4245 * waiting to send FDISC when one completes. 4204 * waiting to send FDISC when one completes.
@@ -4256,13 +4215,10 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
4256 /* Check for retry */ 4215 /* Check for retry */
4257 if (lpfc_els_retry(phba, cmdiocb, rspiocb)) 4216 if (lpfc_els_retry(phba, cmdiocb, rspiocb))
4258 goto out; 4217 goto out;
4259
4260 /* FDISC failed */ 4218 /* FDISC failed */
4261 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 4219 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
4262 "%d (%d):0124 FDISC failed. (%d/%d)\n", 4220 "0124 FDISC failed. (%d/%d)\n",
4263 phba->brd_no, vport->vpi, 4221 irsp->ulpStatus, irsp->un.ulpWord[4]);
4264 irsp->ulpStatus, irsp->un.ulpWord[4]);
4265
4266 if (vport->fc_vport->vport_state == FC_VPORT_INITIALIZING) 4222 if (vport->fc_vport->vport_state == FC_VPORT_INITIALIZING)
4267 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 4223 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
4268 4224
@@ -4328,10 +4284,8 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
4328 ELS_CMD_FDISC); 4284 ELS_CMD_FDISC);
4329 if (!elsiocb) { 4285 if (!elsiocb) {
4330 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 4286 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
4331 4287 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
4332 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 4288 "0255 Issue FDISC: no IOCB\n");
4333 "%d (%d):0255 Issue FDISC: no IOCB\n",
4334 phba->brd_no, vport->vpi);
4335 return 1; 4289 return 1;
4336 } 4290 }
4337 4291
@@ -4377,11 +4331,8 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
4377 if (rc == IOCB_ERROR) { 4331 if (rc == IOCB_ERROR) {
4378 lpfc_els_free_iocb(phba, elsiocb); 4332 lpfc_els_free_iocb(phba, elsiocb);
4379 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 4333 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
4380 4334 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
4381 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 4335 "0256 Issue FDISC: Cannot send IOCB\n");
4382 "%d (%d):0256 Issue FDISC: Cannot send IOCB\n",
4383 phba->brd_no, vport->vpi);
4384
4385 return 1; 4336 return 1;
4386 } 4337 }
4387 lpfc_vport_set_state(vport, FC_VPORT_INITIALIZING); 4338 lpfc_vport_set_state(vport, FC_VPORT_INITIALIZING);
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index f2f4639eab59..c81c2b3228d6 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -83,10 +83,17 @@ lpfc_terminate_rport_io(struct fc_rport *rport)
83 ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); 83 ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag);
84 84
85 if (ndlp->nlp_sid != NLP_NO_SID) { 85 if (ndlp->nlp_sid != NLP_NO_SID) {
86 lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], 86 lpfc_sli_abort_iocb(ndlp->vport,
87 ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT); 87 &phba->sli.ring[phba->sli.fcp_ring],
88 ndlp->nlp_sid, 0, LPFC_CTX_TGT);
88 } 89 }
89 90
91 /*
92 * A device is normally blocked for rediscovery and unblocked when
93 * devloss timeout happens. In case a vport is removed or driver
94 * unloaded before devloss timeout happens, we need to unblock here.
95 */
96 scsi_target_unblock(&rport->dev);
90 return; 97 return;
91} 98}
92 99
@@ -194,32 +201,30 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
194 if (ndlp->nlp_sid != NLP_NO_SID) { 201 if (ndlp->nlp_sid != NLP_NO_SID) {
195 warn_on = 1; 202 warn_on = 1;
196 /* flush the target */ 203 /* flush the target */
197 lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], 204 lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring],
198 ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT); 205 ndlp->nlp_sid, 0, LPFC_CTX_TGT);
199 } 206 }
200 if (vport->load_flag & FC_UNLOADING) 207 if (vport->load_flag & FC_UNLOADING)
201 warn_on = 0; 208 warn_on = 0;
202 209
203 if (warn_on) { 210 if (warn_on) {
204 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 211 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
205 "%d (%d):0203 Devloss timeout on " 212 "0203 Devloss timeout on "
206 "WWPN %x:%x:%x:%x:%x:%x:%x:%x " 213 "WWPN %x:%x:%x:%x:%x:%x:%x:%x "
207 "NPort x%x Data: x%x x%x x%x\n", 214 "NPort x%x Data: x%x x%x x%x\n",
208 phba->brd_no, vport->vpi, 215 *name, *(name+1), *(name+2), *(name+3),
209 *name, *(name+1), *(name+2), *(name+3), 216 *(name+4), *(name+5), *(name+6), *(name+7),
210 *(name+4), *(name+5), *(name+6), *(name+7), 217 ndlp->nlp_DID, ndlp->nlp_flag,
211 ndlp->nlp_DID, ndlp->nlp_flag, 218 ndlp->nlp_state, ndlp->nlp_rpi);
212 ndlp->nlp_state, ndlp->nlp_rpi);
213 } else { 219 } else {
214 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 220 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
215 "%d (%d):0204 Devloss timeout on " 221 "0204 Devloss timeout on "
216 "WWPN %x:%x:%x:%x:%x:%x:%x:%x " 222 "WWPN %x:%x:%x:%x:%x:%x:%x:%x "
217 "NPort x%x Data: x%x x%x x%x\n", 223 "NPort x%x Data: x%x x%x x%x\n",
218 phba->brd_no, vport->vpi, 224 *name, *(name+1), *(name+2), *(name+3),
219 *name, *(name+1), *(name+2), *(name+3), 225 *(name+4), *(name+5), *(name+6), *(name+7),
220 *(name+4), *(name+5), *(name+6), *(name+7), 226 ndlp->nlp_DID, ndlp->nlp_flag,
221 ndlp->nlp_DID, ndlp->nlp_flag, 227 ndlp->nlp_state, ndlp->nlp_rpi);
222 ndlp->nlp_state, ndlp->nlp_rpi);
223 } 228 }
224 229
225 if (!(vport->load_flag & FC_UNLOADING) && 230 if (!(vport->load_flag & FC_UNLOADING) &&
@@ -344,12 +349,14 @@ lpfc_work_list_done(struct lpfc_hba *phba)
344 349
345} 350}
346 351
347void 352static void
348lpfc_work_done(struct lpfc_hba *phba) 353lpfc_work_done(struct lpfc_hba *phba)
349{ 354{
350 struct lpfc_sli_ring *pring; 355 struct lpfc_sli_ring *pring;
351 uint32_t ha_copy, status, control, work_port_events; 356 uint32_t ha_copy, status, control, work_port_events;
357 struct lpfc_vport **vports;
352 struct lpfc_vport *vport; 358 struct lpfc_vport *vport;
359 int i;
353 360
354 spin_lock_irq(&phba->hbalock); 361 spin_lock_irq(&phba->hbalock);
355 ha_copy = phba->work_ha; 362 ha_copy = phba->work_ha;
@@ -364,48 +371,41 @@ lpfc_work_done(struct lpfc_hba *phba)
364 371
365 if (ha_copy & HA_LATT) 372 if (ha_copy & HA_LATT)
366 lpfc_handle_latt(phba); 373 lpfc_handle_latt(phba);
367 374 vports = lpfc_create_vport_work_array(phba);
368 spin_lock_irq(&phba->hbalock); 375 if (vports != NULL)
369 list_for_each_entry(vport, &phba->port_list, listentry) { 376 for(i = 0; i < LPFC_MAX_VPORTS; i++) {
370 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 377 /*
371 378 * We could have no vports in array if unloading, so if
372 if (!scsi_host_get(shost)) { 379 * this happens then just use the pport
373 continue; 380 */
381 if (vports[i] == NULL && i == 0)
382 vport = phba->pport;
383 else
384 vport = vports[i];
385 if (vport == NULL)
386 break;
387 work_port_events = vport->work_port_events;
388 if (work_port_events & WORKER_DISC_TMO)
389 lpfc_disc_timeout_handler(vport);
390 if (work_port_events & WORKER_ELS_TMO)
391 lpfc_els_timeout_handler(vport);
392 if (work_port_events & WORKER_HB_TMO)
393 lpfc_hb_timeout_handler(phba);
394 if (work_port_events & WORKER_MBOX_TMO)
395 lpfc_mbox_timeout_handler(phba);
396 if (work_port_events & WORKER_FABRIC_BLOCK_TMO)
397 lpfc_unblock_fabric_iocbs(phba);
398 if (work_port_events & WORKER_FDMI_TMO)
399 lpfc_fdmi_timeout_handler(vport);
400 if (work_port_events & WORKER_RAMP_DOWN_QUEUE)
401 lpfc_ramp_down_queue_handler(phba);
402 if (work_port_events & WORKER_RAMP_UP_QUEUE)
403 lpfc_ramp_up_queue_handler(phba);
404 spin_lock_irq(&vport->work_port_lock);
405 vport->work_port_events &= ~work_port_events;
406 spin_unlock_irq(&vport->work_port_lock);
374 } 407 }
375 spin_unlock_irq(&phba->hbalock); 408 lpfc_destroy_vport_work_array(vports);
376 work_port_events = vport->work_port_events;
377
378 if (work_port_events & WORKER_DISC_TMO)
379 lpfc_disc_timeout_handler(vport);
380
381 if (work_port_events & WORKER_ELS_TMO)
382 lpfc_els_timeout_handler(vport);
383
384 if (work_port_events & WORKER_HB_TMO)
385 lpfc_hb_timeout_handler(phba);
386
387 if (work_port_events & WORKER_MBOX_TMO)
388 lpfc_mbox_timeout_handler(phba);
389
390 if (work_port_events & WORKER_FABRIC_BLOCK_TMO)
391 lpfc_unblock_fabric_iocbs(phba);
392
393 if (work_port_events & WORKER_FDMI_TMO)
394 lpfc_fdmi_timeout_handler(vport);
395
396 if (work_port_events & WORKER_RAMP_DOWN_QUEUE)
397 lpfc_ramp_down_queue_handler(phba);
398
399 if (work_port_events & WORKER_RAMP_UP_QUEUE)
400 lpfc_ramp_up_queue_handler(phba);
401
402 spin_lock_irq(&vport->work_port_lock);
403 vport->work_port_events &= ~work_port_events;
404 spin_unlock_irq(&vport->work_port_lock);
405 scsi_host_put(shost);
406 spin_lock_irq(&phba->hbalock);
407 }
408 spin_unlock_irq(&phba->hbalock);
409 409
410 pring = &phba->sli.ring[LPFC_ELS_RING]; 410 pring = &phba->sli.ring[LPFC_ELS_RING];
411 status = (ha_copy & (HA_RXMASK << (4*LPFC_ELS_RING))); 411 status = (ha_copy & (HA_RXMASK << (4*LPFC_ELS_RING)));
@@ -426,10 +426,19 @@ lpfc_work_done(struct lpfc_hba *phba)
426 spin_lock_irq(&phba->hbalock); 426 spin_lock_irq(&phba->hbalock);
427 control = readl(phba->HCregaddr); 427 control = readl(phba->HCregaddr);
428 if (!(control & (HC_R0INT_ENA << LPFC_ELS_RING))) { 428 if (!(control & (HC_R0INT_ENA << LPFC_ELS_RING))) {
429 lpfc_debugfs_slow_ring_trc(phba,
430 "WRK Enable ring: cntl:x%x hacopy:x%x",
431 control, ha_copy, 0);
432
429 control |= (HC_R0INT_ENA << LPFC_ELS_RING); 433 control |= (HC_R0INT_ENA << LPFC_ELS_RING);
430 writel(control, phba->HCregaddr); 434 writel(control, phba->HCregaddr);
431 readl(phba->HCregaddr); /* flush */ 435 readl(phba->HCregaddr); /* flush */
432 } 436 }
437 else {
438 lpfc_debugfs_slow_ring_trc(phba,
439 "WRK Ring ok: cntl:x%x hacopy:x%x",
440 control, ha_copy, 0);
441 }
433 spin_unlock_irq(&phba->hbalock); 442 spin_unlock_irq(&phba->hbalock);
434 } 443 }
435 lpfc_work_list_done(phba); 444 lpfc_work_list_done(phba);
@@ -439,32 +448,22 @@ static int
439check_work_wait_done(struct lpfc_hba *phba) 448check_work_wait_done(struct lpfc_hba *phba)
440{ 449{
441 struct lpfc_vport *vport; 450 struct lpfc_vport *vport;
442 struct lpfc_sli_ring *pring; 451 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
443 int rc = 0; 452 int rc = 0;
444 453
445 spin_lock_irq(&phba->hbalock); 454 spin_lock_irq(&phba->hbalock);
446 list_for_each_entry(vport, &phba->port_list, listentry) { 455 list_for_each_entry(vport, &phba->port_list, listentry) {
447 if (vport->work_port_events) { 456 if (vport->work_port_events) {
448 rc = 1; 457 rc = 1;
449 goto exit; 458 break;
450 } 459 }
451 } 460 }
452 461 if (rc || phba->work_ha || (!list_empty(&phba->work_list)) ||
453 if (phba->work_ha || (!list_empty(&phba->work_list)) || 462 kthread_should_stop() || pring->flag & LPFC_DEFERRED_RING_EVENT) {
454 kthread_should_stop()) {
455 rc = 1;
456 goto exit;
457 }
458
459 pring = &phba->sli.ring[LPFC_ELS_RING];
460 if (pring->flag & LPFC_DEFERRED_RING_EVENT)
461 rc = 1; 463 rc = 1;
462exit:
463 if (rc)
464 phba->work_found++; 464 phba->work_found++;
465 else 465 } else
466 phba->work_found = 0; 466 phba->work_found = 0;
467
468 spin_unlock_irq(&phba->hbalock); 467 spin_unlock_irq(&phba->hbalock);
469 return rc; 468 return rc;
470} 469}
@@ -592,7 +591,6 @@ lpfc_linkdown_port(struct lpfc_vport *vport)
592 591
593 /* free any ndlp's on unused list */ 592 /* free any ndlp's on unused list */
594 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) 593 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp)
595 /* free any ndlp's in unused state */
596 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) 594 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
597 lpfc_drop_node(vport, ndlp); 595 lpfc_drop_node(vport, ndlp);
598 596
@@ -605,8 +603,9 @@ lpfc_linkdown(struct lpfc_hba *phba)
605{ 603{
606 struct lpfc_vport *vport = phba->pport; 604 struct lpfc_vport *vport = phba->pport;
607 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 605 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
608 struct lpfc_vport *port_iterator; 606 struct lpfc_vport **vports;
609 LPFC_MBOXQ_t *mb; 607 LPFC_MBOXQ_t *mb;
608 int i;
610 609
611 if (phba->link_state == LPFC_LINK_DOWN) { 610 if (phba->link_state == LPFC_LINK_DOWN) {
612 return 0; 611 return 0;
@@ -617,13 +616,13 @@ lpfc_linkdown(struct lpfc_hba *phba)
617 phba->pport->fc_flag &= ~FC_LBIT; 616 phba->pport->fc_flag &= ~FC_LBIT;
618 } 617 }
619 spin_unlock_irq(&phba->hbalock); 618 spin_unlock_irq(&phba->hbalock);
620 619 vports = lpfc_create_vport_work_array(phba);
621 list_for_each_entry(port_iterator, &phba->port_list, listentry) { 620 if (vports != NULL)
622 621 for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
623 /* Issue a LINK DOWN event to all nodes */ 622 /* Issue a LINK DOWN event to all nodes */
624 lpfc_linkdown_port(port_iterator); 623 lpfc_linkdown_port(vports[i]);
625 } 624 }
626 625 lpfc_destroy_vport_work_array(vports);
627 /* Clean up any firmware default rpi's */ 626 /* Clean up any firmware default rpi's */
628 mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 627 mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
629 if (mb) { 628 if (mb) {
@@ -724,7 +723,8 @@ lpfc_linkup_port(struct lpfc_vport *vport)
724static int 723static int
725lpfc_linkup(struct lpfc_hba *phba) 724lpfc_linkup(struct lpfc_hba *phba)
726{ 725{
727 struct lpfc_vport *vport; 726 struct lpfc_vport **vports;
727 int i;
728 728
729 phba->link_state = LPFC_LINK_UP; 729 phba->link_state = LPFC_LINK_UP;
730 730
@@ -732,9 +732,11 @@ lpfc_linkup(struct lpfc_hba *phba)
732 clear_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags); 732 clear_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags);
733 del_timer_sync(&phba->fabric_block_timer); 733 del_timer_sync(&phba->fabric_block_timer);
734 734
735 list_for_each_entry(vport, &phba->port_list, listentry) { 735 vports = lpfc_create_vport_work_array(phba);
736 lpfc_linkup_port(vport); 736 if (vports != NULL)
737 } 737 for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++)
738 lpfc_linkup_port(vports[i]);
739 lpfc_destroy_vport_work_array(vports);
738 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) 740 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)
739 lpfc_issue_clear_la(phba, phba->pport); 741 lpfc_issue_clear_la(phba, phba->pport);
740 742
@@ -764,12 +766,10 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
764 /* Check for error */ 766 /* Check for error */
765 if ((mb->mbxStatus) && (mb->mbxStatus != 0x1601)) { 767 if ((mb->mbxStatus) && (mb->mbxStatus != 0x1601)) {
766 /* CLEAR_LA mbox error <mbxStatus> state <hba_state> */ 768 /* CLEAR_LA mbox error <mbxStatus> state <hba_state> */
767 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, 769 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
768 "%d (%d):0320 CLEAR_LA mbxStatus error x%x hba " 770 "0320 CLEAR_LA mbxStatus error x%x hba "
769 "state x%x\n", 771 "state x%x\n",
770 phba->brd_no, vport->vpi, mb->mbxStatus, 772 mb->mbxStatus, vport->port_state);
771 vport->port_state);
772
773 phba->link_state = LPFC_HBA_ERROR; 773 phba->link_state = LPFC_HBA_ERROR;
774 goto out; 774 goto out;
775 } 775 }
@@ -801,10 +801,8 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
801 801
802out: 802out:
803 /* Device Discovery completes */ 803 /* Device Discovery completes */
804 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 804 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
805 "%d (%d):0225 Device Discovery completes\n", 805 "0225 Device Discovery completes\n");
806 phba->brd_no, vport->vpi);
807
808 mempool_free(pmb, phba->mbox_mem_pool); 806 mempool_free(pmb, phba->mbox_mem_pool);
809 807
810 spin_lock_irq(shost->host_lock); 808 spin_lock_irq(shost->host_lock);
@@ -861,19 +859,17 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
861 return; 859 return;
862 860
863out: 861out:
864 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, 862 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
865 "%d (%d):0306 CONFIG_LINK mbxStatus error x%x " 863 "0306 CONFIG_LINK mbxStatus error x%x "
866 "HBA state x%x\n", 864 "HBA state x%x\n",
867 phba->brd_no, vport->vpi, pmb->mb.mbxStatus, 865 pmb->mb.mbxStatus, vport->port_state);
868 vport->port_state);
869
870 mempool_free(pmb, phba->mbox_mem_pool); 866 mempool_free(pmb, phba->mbox_mem_pool);
871 867
872 lpfc_linkdown(phba); 868 lpfc_linkdown(phba);
873 869
874 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 870 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
875 "%d (%d):0200 CONFIG_LINK bad hba state x%x\n", 871 "0200 CONFIG_LINK bad hba state x%x\n",
876 phba->brd_no, vport->vpi, vport->port_state); 872 vport->port_state);
877 873
878 lpfc_issue_clear_la(phba, vport); 874 lpfc_issue_clear_la(phba, vport);
879 return; 875 return;
@@ -890,12 +886,10 @@ lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
890 /* Check for error */ 886 /* Check for error */
891 if (mb->mbxStatus) { 887 if (mb->mbxStatus) {
892 /* READ_SPARAM mbox error <mbxStatus> state <hba_state> */ 888 /* READ_SPARAM mbox error <mbxStatus> state <hba_state> */
893 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, 889 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
894 "%d (%d):0319 READ_SPARAM mbxStatus error x%x " 890 "0319 READ_SPARAM mbxStatus error x%x "
895 "hba state x%x>\n", 891 "hba state x%x>\n",
896 phba->brd_no, vport->vpi, mb->mbxStatus, 892 mb->mbxStatus, vport->port_state);
897 vport->port_state);
898
899 lpfc_linkdown(phba); 893 lpfc_linkdown(phba);
900 goto out; 894 goto out;
901 } 895 }
@@ -978,7 +972,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
978 if (i == 0) { 972 if (i == 0) {
979 phba->alpa_map[0] = 0; 973 phba->alpa_map[0] = 0;
980 } else { 974 } else {
981 if (phba->cfg_log_verbose & LOG_LINK_EVENT) { 975 if (vport->cfg_log_verbose & LOG_LINK_EVENT) {
982 int numalpa, j, k; 976 int numalpa, j, k;
983 union { 977 union {
984 uint8_t pamap[16]; 978 uint8_t pamap[16];
@@ -1004,10 +998,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
1004 lpfc_printf_log(phba, 998 lpfc_printf_log(phba,
1005 KERN_WARNING, 999 KERN_WARNING,
1006 LOG_LINK_EVENT, 1000 LOG_LINK_EVENT,
1007 "%d:1304 Link Up Event " 1001 "1304 Link Up Event "
1008 "ALPA map Data: x%x " 1002 "ALPA map Data: x%x "
1009 "x%x x%x x%x\n", 1003 "x%x x%x x%x\n",
1010 phba->brd_no,
1011 un.pa.wd1, un.pa.wd2, 1004 un.pa.wd1, un.pa.wd2,
1012 un.pa.wd3, un.pa.wd4); 1005 un.pa.wd3, un.pa.wd4);
1013 } 1006 }
@@ -1015,7 +1008,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
1015 } 1008 }
1016 } else { 1009 } else {
1017 if (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { 1010 if (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) {
1018 if (phba->max_vpi && phba->cfg_npiv_enable && 1011 if (phba->max_vpi && phba->cfg_enable_npiv &&
1019 (phba->sli_rev == 3)) 1012 (phba->sli_rev == 3))
1020 phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED; 1013 phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED;
1021 } 1014 }
@@ -1055,11 +1048,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
1055 } 1048 }
1056out: 1049out:
1057 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 1050 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
1058 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, 1051 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
1059 "%d (%d):0263 Discovery Mailbox error: state: 0x%x : %p %p\n", 1052 "0263 Discovery Mailbox error: state: 0x%x : %p %p\n",
1060 phba->brd_no, vport->vpi, 1053 vport->port_state, sparam_mbox, cfglink_mbox);
1061 vport->port_state, sparam_mbox, cfglink_mbox);
1062
1063 lpfc_issue_clear_la(phba, vport); 1054 lpfc_issue_clear_la(phba, vport);
1064 return; 1055 return;
1065} 1056}
@@ -1100,8 +1091,8 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1100 /* Check for error */ 1091 /* Check for error */
1101 if (mb->mbxStatus) { 1092 if (mb->mbxStatus) {
1102 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, 1093 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
1103 "%d:1307 READ_LA mbox error x%x state x%x\n", 1094 "1307 READ_LA mbox error x%x state x%x\n",
1104 phba->brd_no, mb->mbxStatus, vport->port_state); 1095 mb->mbxStatus, vport->port_state);
1105 lpfc_mbx_issue_link_down(phba); 1096 lpfc_mbx_issue_link_down(phba);
1106 phba->link_state = LPFC_HBA_ERROR; 1097 phba->link_state = LPFC_HBA_ERROR;
1107 goto lpfc_mbx_cmpl_read_la_free_mbuf; 1098 goto lpfc_mbx_cmpl_read_la_free_mbuf;
@@ -1132,26 +1123,26 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1132 phba->fc_stat.LinkUp++; 1123 phba->fc_stat.LinkUp++;
1133 if (phba->link_flag & LS_LOOPBACK_MODE) { 1124 if (phba->link_flag & LS_LOOPBACK_MODE) {
1134 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, 1125 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
1135 "%d:1306 Link Up Event in loop back mode " 1126 "1306 Link Up Event in loop back mode "
1136 "x%x received Data: x%x x%x x%x x%x\n", 1127 "x%x received Data: x%x x%x x%x x%x\n",
1137 phba->brd_no, la->eventTag, phba->fc_eventTag, 1128 la->eventTag, phba->fc_eventTag,
1138 la->granted_AL_PA, la->UlnkSpeed, 1129 la->granted_AL_PA, la->UlnkSpeed,
1139 phba->alpa_map[0]); 1130 phba->alpa_map[0]);
1140 } else { 1131 } else {
1141 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, 1132 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
1142 "%d:1303 Link Up Event x%x received " 1133 "1303 Link Up Event x%x received "
1143 "Data: x%x x%x x%x x%x\n", 1134 "Data: x%x x%x x%x x%x\n",
1144 phba->brd_no, la->eventTag, phba->fc_eventTag, 1135 la->eventTag, phba->fc_eventTag,
1145 la->granted_AL_PA, la->UlnkSpeed, 1136 la->granted_AL_PA, la->UlnkSpeed,
1146 phba->alpa_map[0]); 1137 phba->alpa_map[0]);
1147 } 1138 }
1148 lpfc_mbx_process_link_up(phba, la); 1139 lpfc_mbx_process_link_up(phba, la);
1149 } else { 1140 } else {
1150 phba->fc_stat.LinkDown++; 1141 phba->fc_stat.LinkDown++;
1151 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, 1142 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
1152 "%d:1305 Link Down Event x%x received " 1143 "1305 Link Down Event x%x received "
1153 "Data: x%x x%x x%x\n", 1144 "Data: x%x x%x x%x\n",
1154 phba->brd_no, la->eventTag, phba->fc_eventTag, 1145 la->eventTag, phba->fc_eventTag,
1155 phba->pport->port_state, vport->fc_flag); 1146 phba->pport->port_state, vport->fc_flag);
1156 lpfc_mbx_issue_link_down(phba); 1147 lpfc_mbx_issue_link_down(phba);
1157 } 1148 }
@@ -1199,10 +1190,9 @@ lpfc_mbx_cmpl_unreg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1199 case 0x0011: 1190 case 0x0011:
1200 case 0x0020: 1191 case 0x0020:
1201 case 0x9700: 1192 case 0x9700:
1202 lpfc_printf_log(phba, KERN_INFO, LOG_NODE, 1193 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
1203 "%d (%d):0911 cmpl_unreg_vpi, " 1194 "0911 cmpl_unreg_vpi, mb status = 0x%x\n",
1204 "mb status = 0x%x\n", 1195 mb->mbxStatus);
1205 phba->brd_no, vport->vpi, mb->mbxStatus);
1206 break; 1196 break;
1207 } 1197 }
1208 vport->unreg_vpi_cmpl = VPORT_OK; 1198 vport->unreg_vpi_cmpl = VPORT_OK;
@@ -1231,9 +1221,8 @@ lpfc_mbx_unreg_vpi(struct lpfc_vport *vport)
1231 mbox->mbox_cmpl = lpfc_mbx_cmpl_unreg_vpi; 1221 mbox->mbox_cmpl = lpfc_mbx_cmpl_unreg_vpi;
1232 rc = lpfc_sli_issue_mbox(phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); 1222 rc = lpfc_sli_issue_mbox(phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB));
1233 if (rc == MBX_NOT_FINISHED) { 1223 if (rc == MBX_NOT_FINISHED) {
1234 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_VPORT, 1224 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT,
1235 "%d (%d):1800 Could not issue unreg_vpi\n", 1225 "1800 Could not issue unreg_vpi\n");
1236 phba->brd_no, vport->vpi);
1237 mempool_free(mbox, phba->mbox_mem_pool); 1226 mempool_free(mbox, phba->mbox_mem_pool);
1238 vport->unreg_vpi_cmpl = VPORT_ERROR; 1227 vport->unreg_vpi_cmpl = VPORT_ERROR;
1239 } 1228 }
@@ -1250,9 +1239,9 @@ lpfc_mbx_cmpl_reg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1250 case 0x0011: 1239 case 0x0011:
1251 case 0x9601: 1240 case 0x9601:
1252 case 0x9602: 1241 case 0x9602:
1253 lpfc_printf_log(phba, KERN_INFO, LOG_NODE, 1242 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
1254 "%d (%d):0912 cmpl_reg_vpi, mb status = 0x%x\n", 1243 "0912 cmpl_reg_vpi, mb status = 0x%x\n",
1255 phba->brd_no, vport->vpi, mb->mbxStatus); 1244 mb->mbxStatus);
1256 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 1245 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
1257 spin_lock_irq(shost->host_lock); 1246 spin_lock_irq(shost->host_lock);
1258 vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); 1247 vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
@@ -1289,15 +1278,15 @@ void
1289lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 1278lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1290{ 1279{
1291 struct lpfc_vport *vport = pmb->vport; 1280 struct lpfc_vport *vport = pmb->vport;
1292 struct lpfc_vport *next_vport;
1293 MAILBOX_t *mb = &pmb->mb; 1281 MAILBOX_t *mb = &pmb->mb;
1294 struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1); 1282 struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1);
1295 struct lpfc_nodelist *ndlp; 1283 struct lpfc_nodelist *ndlp;
1296 ndlp = (struct lpfc_nodelist *) pmb->context2; 1284 struct lpfc_vport **vports;
1285 int i;
1297 1286
1287 ndlp = (struct lpfc_nodelist *) pmb->context2;
1298 pmb->context1 = NULL; 1288 pmb->context1 = NULL;
1299 pmb->context2 = NULL; 1289 pmb->context2 = NULL;
1300
1301 if (mb->mbxStatus) { 1290 if (mb->mbxStatus) {
1302 lpfc_mbuf_free(phba, mp->virt, mp->phys); 1291 lpfc_mbuf_free(phba, mp->virt, mp->phys);
1303 kfree(mp); 1292 kfree(mp);
@@ -1314,10 +1303,9 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1314 } 1303 }
1315 1304
1316 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 1305 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
1317 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, 1306 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
1318 "%d (%d):0258 Register Fabric login error: 0x%x\n", 1307 "0258 Register Fabric login error: 0x%x\n",
1319 phba->brd_no, vport->vpi, mb->mbxStatus); 1308 mb->mbxStatus);
1320
1321 return; 1309 return;
1322 } 1310 }
1323 1311
@@ -1328,21 +1316,26 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1328 lpfc_nlp_put(ndlp); /* Drop the reference from the mbox */ 1316 lpfc_nlp_put(ndlp); /* Drop the reference from the mbox */
1329 1317
1330 if (vport->port_state == LPFC_FABRIC_CFG_LINK) { 1318 if (vport->port_state == LPFC_FABRIC_CFG_LINK) {
1331 list_for_each_entry(next_vport, &phba->port_list, listentry) { 1319 vports = lpfc_create_vport_work_array(phba);
1332 if (next_vport->port_type == LPFC_PHYSICAL_PORT) 1320 if (vports != NULL)
1333 continue; 1321 for(i = 0;
1334 1322 i < LPFC_MAX_VPORTS && vports[i] != NULL;
1335 if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) 1323 i++) {
1336 lpfc_initial_fdisc(next_vport); 1324 if (vports[i]->port_type == LPFC_PHYSICAL_PORT)
1337 else if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) { 1325 continue;
1338 lpfc_vport_set_state(vport, 1326 if (phba->link_flag & LS_NPIV_FAB_SUPPORTED)
1339 FC_VPORT_NO_FABRIC_SUPP); 1327 lpfc_initial_fdisc(vports[i]);
1340 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 1328 else if (phba->sli3_options &
1341 "%d (%d):0259 No NPIV Fabric " 1329 LPFC_SLI3_NPIV_ENABLED) {
1342 "support\n", 1330 lpfc_vport_set_state(vports[i],
1343 phba->brd_no, vport->vpi); 1331 FC_VPORT_NO_FABRIC_SUPP);
1332 lpfc_printf_vlog(vport, KERN_ERR,
1333 LOG_ELS,
1334 "0259 No NPIV "
1335 "Fabric support\n");
1336 }
1344 } 1337 }
1345 } 1338 lpfc_destroy_vport_work_array(vports);
1346 lpfc_do_scr_ns_plogi(phba, vport); 1339 lpfc_do_scr_ns_plogi(phba, vport);
1347 } 1340 }
1348 1341
@@ -1386,9 +1379,9 @@ out:
1386 return; 1379 return;
1387 } 1380 }
1388 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 1381 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
1389 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 1382 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
1390 "%d (%d):0260 Register NameServer error: 0x%x\n", 1383 "0260 Register NameServer error: 0x%x\n",
1391 phba->brd_no, vport->vpi, mb->mbxStatus); 1384 mb->mbxStatus);
1392 return; 1385 return;
1393 } 1386 }
1394 1387
@@ -1598,7 +1591,7 @@ lpfc_nlp_state_name(char *buffer, size_t size, int state)
1598 [NLP_STE_NPR_NODE] = "NPR", 1591 [NLP_STE_NPR_NODE] = "NPR",
1599 }; 1592 };
1600 1593
1601 if (state < ARRAY_SIZE(states) && states[state]) 1594 if (state < NLP_STE_MAX_STATE && states[state])
1602 strlcpy(buffer, states[state], size); 1595 strlcpy(buffer, states[state], size);
1603 else 1596 else
1604 snprintf(buffer, size, "unknown (%d)", state); 1597 snprintf(buffer, size, "unknown (%d)", state);
@@ -1613,12 +1606,11 @@ lpfc_nlp_set_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1613 int old_state = ndlp->nlp_state; 1606 int old_state = ndlp->nlp_state;
1614 char name1[16], name2[16]; 1607 char name1[16], name2[16];
1615 1608
1616 lpfc_printf_log(vport->phba, KERN_INFO, LOG_NODE, 1609 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
1617 "%d (%d):0904 NPort state transition x%06x, %s -> %s\n", 1610 "0904 NPort state transition x%06x, %s -> %s\n",
1618 vport->phba->brd_no, vport->vpi, 1611 ndlp->nlp_DID,
1619 ndlp->nlp_DID, 1612 lpfc_nlp_state_name(name1, sizeof(name1), old_state),
1620 lpfc_nlp_state_name(name1, sizeof(name1), old_state), 1613 lpfc_nlp_state_name(name2, sizeof(name2), state));
1621 lpfc_nlp_state_name(name2, sizeof(name2), state));
1622 1614
1623 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE, 1615 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE,
1624 "node statechg did:x%x old:%d ste:%d", 1616 "node statechg did:x%x old:%d ste:%d",
@@ -1664,16 +1656,7 @@ lpfc_dequeue_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1664void 1656void
1665lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) 1657lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1666{ 1658{
1667 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 1659 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE);
1668
1669 if ((ndlp->nlp_flag & NLP_DELAY_TMO) != 0)
1670 lpfc_cancel_retry_delay_tmo(vport, ndlp);
1671 if (ndlp->nlp_state && !list_empty(&ndlp->nlp_listp))
1672 lpfc_nlp_counters(vport, ndlp->nlp_state, -1);
1673 spin_lock_irq(shost->host_lock);
1674 list_del_init(&ndlp->nlp_listp);
1675 ndlp->nlp_flag &= ~NLP_TARGET_REMOVE;
1676 spin_unlock_irq(shost->host_lock);
1677 lpfc_nlp_put(ndlp); 1660 lpfc_nlp_put(ndlp);
1678} 1661}
1679 1662
@@ -1710,12 +1693,12 @@ lpfc_set_disctmo(struct lpfc_vport *vport)
1710 spin_unlock_irq(shost->host_lock); 1693 spin_unlock_irq(shost->host_lock);
1711 1694
1712 /* Start Discovery Timer state <hba_state> */ 1695 /* Start Discovery Timer state <hba_state> */
1713 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 1696 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
1714 "%d (%d):0247 Start Discovery Timer state x%x " 1697 "0247 Start Discovery Timer state x%x "
1715 "Data: x%x x%lx x%x x%x\n", 1698 "Data: x%x x%lx x%x x%x\n",
1716 phba->brd_no, vport->vpi, vport->port_state, tmo, 1699 vport->port_state, tmo,
1717 (unsigned long)&vport->fc_disctmo, vport->fc_plogi_cnt, 1700 (unsigned long)&vport->fc_disctmo, vport->fc_plogi_cnt,
1718 vport->fc_adisc_cnt); 1701 vport->fc_adisc_cnt);
1719 1702
1720 return; 1703 return;
1721} 1704}
@@ -1727,7 +1710,6 @@ int
1727lpfc_can_disctmo(struct lpfc_vport *vport) 1710lpfc_can_disctmo(struct lpfc_vport *vport)
1728{ 1711{
1729 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 1712 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1730 struct lpfc_hba *phba = vport->phba;
1731 unsigned long iflags; 1713 unsigned long iflags;
1732 1714
1733 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, 1715 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
@@ -1746,13 +1728,11 @@ lpfc_can_disctmo(struct lpfc_vport *vport)
1746 } 1728 }
1747 1729
1748 /* Cancel Discovery Timer state <hba_state> */ 1730 /* Cancel Discovery Timer state <hba_state> */
1749 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 1731 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
1750 "%d (%d):0248 Cancel Discovery Timer state x%x " 1732 "0248 Cancel Discovery Timer state x%x "
1751 "Data: x%x x%x x%x\n", 1733 "Data: x%x x%x x%x\n",
1752 phba->brd_no, vport->vpi, vport->port_state, 1734 vport->port_state, vport->fc_flag,
1753 vport->fc_flag, vport->fc_plogi_cnt, 1735 vport->fc_plogi_cnt, vport->fc_adisc_cnt);
1754 vport->fc_adisc_cnt);
1755
1756 return 0; 1736 return 0;
1757} 1737}
1758 1738
@@ -1935,10 +1915,9 @@ lpfc_unreg_default_rpis(struct lpfc_vport *vport)
1935 rc = lpfc_sli_issue_mbox(phba, mbox, 1915 rc = lpfc_sli_issue_mbox(phba, mbox,
1936 (MBX_NOWAIT | MBX_STOP_IOCB)); 1916 (MBX_NOWAIT | MBX_STOP_IOCB));
1937 if (rc == MBX_NOT_FINISHED) { 1917 if (rc == MBX_NOT_FINISHED) {
1938 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_VPORT, 1918 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT,
1939 "%d (%d):1815 Could not issue " 1919 "1815 Could not issue "
1940 "unreg_did (default rpis)\n", 1920 "unreg_did (default rpis)\n");
1941 phba->brd_no, vport->vpi);
1942 mempool_free(mbox, phba->mbox_mem_pool); 1921 mempool_free(mbox, phba->mbox_mem_pool);
1943 } 1922 }
1944 } 1923 }
@@ -1957,12 +1936,11 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1957 struct lpfc_dmabuf *mp; 1936 struct lpfc_dmabuf *mp;
1958 1937
1959 /* Cleanup node for NPort <nlp_DID> */ 1938 /* Cleanup node for NPort <nlp_DID> */
1960 lpfc_printf_log(phba, KERN_INFO, LOG_NODE, 1939 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
1961 "%d (%d):0900 Cleanup node for NPort x%x " 1940 "0900 Cleanup node for NPort x%x "
1962 "Data: x%x x%x x%x\n", 1941 "Data: x%x x%x x%x\n",
1963 phba->brd_no, vport->vpi, ndlp->nlp_DID, ndlp->nlp_flag, 1942 ndlp->nlp_DID, ndlp->nlp_flag,
1964 ndlp->nlp_state, ndlp->nlp_rpi); 1943 ndlp->nlp_state, ndlp->nlp_rpi);
1965
1966 lpfc_dequeue_node(vport, ndlp); 1944 lpfc_dequeue_node(vport, ndlp);
1967 1945
1968 /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ 1946 /* cleanup any ndlp on mbox q waiting for reglogin cmpl */
@@ -2094,7 +2072,6 @@ lpfc_matchdid(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2094static struct lpfc_nodelist * 2072static struct lpfc_nodelist *
2095__lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) 2073__lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
2096{ 2074{
2097 struct lpfc_hba *phba = vport->phba;
2098 struct lpfc_nodelist *ndlp; 2075 struct lpfc_nodelist *ndlp;
2099 uint32_t data1; 2076 uint32_t data1;
2100 2077
@@ -2104,20 +2081,18 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
2104 ((uint32_t) ndlp->nlp_xri << 16) | 2081 ((uint32_t) ndlp->nlp_xri << 16) |
2105 ((uint32_t) ndlp->nlp_type << 8) | 2082 ((uint32_t) ndlp->nlp_type << 8) |
2106 ((uint32_t) ndlp->nlp_rpi & 0xff)); 2083 ((uint32_t) ndlp->nlp_rpi & 0xff));
2107 lpfc_printf_log(phba, KERN_INFO, LOG_NODE, 2084 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
2108 "%d (%d):0929 FIND node DID " 2085 "0929 FIND node DID "
2109 " Data: x%p x%x x%x x%x\n", 2086 "Data: x%p x%x x%x x%x\n",
2110 phba->brd_no, vport->vpi, 2087 ndlp, ndlp->nlp_DID,
2111 ndlp, ndlp->nlp_DID, 2088 ndlp->nlp_flag, data1);
2112 ndlp->nlp_flag, data1);
2113 return ndlp; 2089 return ndlp;
2114 } 2090 }
2115 } 2091 }
2116 2092
2117 /* FIND node did <did> NOT FOUND */ 2093 /* FIND node did <did> NOT FOUND */
2118 lpfc_printf_log(phba, KERN_INFO, LOG_NODE, 2094 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
2119 "%d (%d):0932 FIND node did x%x NOT FOUND.\n", 2095 "0932 FIND node did x%x NOT FOUND.\n", did);
2120 phba->brd_no, vport->vpi, did);
2121 return NULL; 2096 return NULL;
2122} 2097}
2123 2098
@@ -2208,7 +2183,7 @@ lpfc_disc_list_loopmap(struct lpfc_vport *vport)
2208 /* If cfg_scan_down is set, start from highest 2183 /* If cfg_scan_down is set, start from highest
2209 * ALPA (0xef) to lowest (0x1). 2184 * ALPA (0xef) to lowest (0x1).
2210 */ 2185 */
2211 if (phba->cfg_scan_down) 2186 if (vport->cfg_scan_down)
2212 index = j; 2187 index = j;
2213 else 2188 else
2214 index = FC_MAXLOOP - j - 1; 2189 index = FC_MAXLOOP - j - 1;
@@ -2309,12 +2284,11 @@ lpfc_disc_start(struct lpfc_vport *vport)
2309 vport->num_disc_nodes = 0; 2284 vport->num_disc_nodes = 0;
2310 2285
2311 /* Start Discovery state <hba_state> */ 2286 /* Start Discovery state <hba_state> */
2312 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 2287 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2313 "%d (%d):0202 Start Discovery hba state x%x " 2288 "0202 Start Discovery hba state x%x "
2314 "Data: x%x x%x x%x\n", 2289 "Data: x%x x%x x%x\n",
2315 phba->brd_no, vport->vpi, vport->port_state, 2290 vport->port_state, vport->fc_flag, vport->fc_plogi_cnt,
2316 vport->fc_flag, vport->fc_plogi_cnt, 2291 vport->fc_adisc_cnt);
2317 vport->fc_adisc_cnt);
2318 2292
2319 /* First do ADISCs - if any */ 2293 /* First do ADISCs - if any */
2320 num_sent = lpfc_els_disc_adisc(vport); 2294 num_sent = lpfc_els_disc_adisc(vport);
@@ -2532,10 +2506,8 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2532 * FAN 2506 * FAN
2533 */ 2507 */
2534 /* FAN timeout */ 2508 /* FAN timeout */
2535 lpfc_printf_log(phba, KERN_WARNING, LOG_DISCOVERY, 2509 lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY,
2536 "%d (%d):0221 FAN timeout\n", 2510 "0221 FAN timeout\n");
2537 phba->brd_no, vport->vpi);
2538
2539 /* Start discovery by sending FLOGI, clean up old rpis */ 2511 /* Start discovery by sending FLOGI, clean up old rpis */
2540 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, 2512 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes,
2541 nlp_listp) { 2513 nlp_listp) {
@@ -2562,10 +2534,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2562 case LPFC_FLOGI: 2534 case LPFC_FLOGI:
2563 /* port_state is identically LPFC_FLOGI while waiting for FLOGI cmpl */ 2535 /* port_state is identically LPFC_FLOGI while waiting for FLOGI cmpl */
2564 /* Initial FLOGI timeout */ 2536 /* Initial FLOGI timeout */
2565 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2537 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
2566 "%d (%d):0222 Initial %s timeout\n", 2538 "0222 Initial %s timeout\n",
2567 phba->brd_no, vport->vpi, 2539 vport->vpi ? "FLOGI" : "FDISC");
2568 vport->vpi ? "FLOGI" : "FDISC");
2569 2540
2570 /* Assume no Fabric and go on with discovery. 2541 /* Assume no Fabric and go on with discovery.
2571 * Check for outstanding ELS FLOGI to abort. 2542 * Check for outstanding ELS FLOGI to abort.
@@ -2581,11 +2552,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2581 case LPFC_FABRIC_CFG_LINK: 2552 case LPFC_FABRIC_CFG_LINK:
2582 /* hba_state is identically LPFC_FABRIC_CFG_LINK while waiting for 2553 /* hba_state is identically LPFC_FABRIC_CFG_LINK while waiting for
2583 NameServer login */ 2554 NameServer login */
2584 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2555 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
2585 "%d (%d):0223 Timeout while waiting for " 2556 "0223 Timeout while waiting for "
2586 "NameServer login\n", 2557 "NameServer login\n");
2587 phba->brd_no, vport->vpi);
2588
2589 /* Next look for NameServer ndlp */ 2558 /* Next look for NameServer ndlp */
2590 ndlp = lpfc_findnode_did(vport, NameServer_DID); 2559 ndlp = lpfc_findnode_did(vport, NameServer_DID);
2591 if (ndlp) 2560 if (ndlp)
@@ -2596,11 +2565,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2596 2565
2597 case LPFC_NS_QRY: 2566 case LPFC_NS_QRY:
2598 /* Check for wait for NameServer Rsp timeout */ 2567 /* Check for wait for NameServer Rsp timeout */
2599 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2568 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
2600 "%d (%d):0224 NameServer Query timeout " 2569 "0224 NameServer Query timeout "
2601 "Data: x%x x%x\n", 2570 "Data: x%x x%x\n",
2602 phba->brd_no, vport->vpi, 2571 vport->fc_ns_retry, LPFC_MAX_NS_RETRY);
2603 vport->fc_ns_retry, LPFC_MAX_NS_RETRY);
2604 2572
2605 if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { 2573 if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) {
2606 /* Try it one more time */ 2574 /* Try it one more time */
@@ -2627,10 +2595,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2627 /* Setup and issue mailbox INITIALIZE LINK command */ 2595 /* Setup and issue mailbox INITIALIZE LINK command */
2628 initlinkmbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 2596 initlinkmbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
2629 if (!initlinkmbox) { 2597 if (!initlinkmbox) {
2630 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2598 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
2631 "%d (%d):0206 Device Discovery " 2599 "0206 Device Discovery "
2632 "completion error\n", 2600 "completion error\n");
2633 phba->brd_no, vport->vpi);
2634 phba->link_state = LPFC_HBA_ERROR; 2601 phba->link_state = LPFC_HBA_ERROR;
2635 break; 2602 break;
2636 } 2603 }
@@ -2651,9 +2618,8 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2651 2618
2652 case LPFC_DISC_AUTH: 2619 case LPFC_DISC_AUTH:
2653 /* Node Authentication timeout */ 2620 /* Node Authentication timeout */
2654 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2621 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
2655 "%d (%d):0227 Node Authentication timeout\n", 2622 "0227 Node Authentication timeout\n");
2656 phba->brd_no, vport->vpi);
2657 lpfc_disc_flush_list(vport); 2623 lpfc_disc_flush_list(vport);
2658 2624
2659 /* 2625 /*
@@ -2670,11 +2636,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2670 2636
2671 case LPFC_VPORT_READY: 2637 case LPFC_VPORT_READY:
2672 if (vport->fc_flag & FC_RSCN_MODE) { 2638 if (vport->fc_flag & FC_RSCN_MODE) {
2673 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2639 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
2674 "%d (%d):0231 RSCN timeout Data: x%x " 2640 "0231 RSCN timeout Data: x%x "
2675 "x%x\n", 2641 "x%x\n",
2676 phba->brd_no, vport->vpi, 2642 vport->fc_ns_retry, LPFC_MAX_NS_RETRY);
2677 vport->fc_ns_retry, LPFC_MAX_NS_RETRY);
2678 2643
2679 /* Cleanup any outstanding ELS commands */ 2644 /* Cleanup any outstanding ELS commands */
2680 lpfc_els_flush_cmd(vport); 2645 lpfc_els_flush_cmd(vport);
@@ -2685,20 +2650,17 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2685 break; 2650 break;
2686 2651
2687 default: 2652 default:
2688 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2653 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
2689 "%d (%d):0229 Unexpected discovery timeout, " 2654 "0229 Unexpected discovery timeout, "
2690 "vport State x%x\n", 2655 "vport State x%x\n", vport->port_state);
2691 phba->brd_no, vport->vpi, vport->port_state);
2692
2693 break; 2656 break;
2694 } 2657 }
2695 2658
2696 switch (phba->link_state) { 2659 switch (phba->link_state) {
2697 case LPFC_CLEAR_LA: 2660 case LPFC_CLEAR_LA:
2698 /* CLEAR LA timeout */ 2661 /* CLEAR LA timeout */
2699 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2662 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
2700 "%d (%d):0228 CLEAR LA timeout\n", 2663 "0228 CLEAR LA timeout\n");
2701 phba->brd_no, vport->vpi);
2702 clrlaerr = 1; 2664 clrlaerr = 1;
2703 break; 2665 break;
2704 2666
@@ -2709,10 +2671,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2709 case LPFC_LINK_DOWN: 2671 case LPFC_LINK_DOWN:
2710 case LPFC_LINK_UP: 2672 case LPFC_LINK_UP:
2711 case LPFC_HBA_ERROR: 2673 case LPFC_HBA_ERROR:
2712 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2674 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
2713 "%d (%d):0230 Unexpected timeout, hba link " 2675 "0230 Unexpected timeout, hba link "
2714 "state x%x\n", 2676 "state x%x\n", phba->link_state);
2715 phba->brd_no, vport->vpi, phba->link_state);
2716 clrlaerr = 1; 2677 clrlaerr = 1;
2717 break; 2678 break;
2718 2679
@@ -2757,7 +2718,7 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
2757 * fdmi-on=2 (supporting RPA/hostnmae) 2718 * fdmi-on=2 (supporting RPA/hostnmae)
2758 */ 2719 */
2759 2720
2760 if (phba->cfg_fdmi_on == 1) 2721 if (vport->cfg_fdmi_on == 1)
2761 lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA); 2722 lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA);
2762 else 2723 else
2763 mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60); 2724 mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60);
@@ -2854,32 +2815,6 @@ lpfc_findnode_wwpn(struct lpfc_vport *vport, struct lpfc_name *wwpn)
2854} 2815}
2855 2816
2856void 2817void
2857lpfc_dev_loss_delay(unsigned long ptr)
2858{
2859 struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) ptr;
2860 struct lpfc_vport *vport = ndlp->vport;
2861 struct lpfc_hba *phba = vport->phba;
2862 struct lpfc_work_evt *evtp = &ndlp->dev_loss_evt;
2863 unsigned long flags;
2864
2865 evtp = &ndlp->dev_loss_evt;
2866
2867 spin_lock_irqsave(&phba->hbalock, flags);
2868 if (!list_empty(&evtp->evt_listp)) {
2869 spin_unlock_irqrestore(&phba->hbalock, flags);
2870 return;
2871 }
2872
2873 evtp->evt_arg1 = ndlp;
2874 evtp->evt = LPFC_EVT_DEV_LOSS_DELAY;
2875 list_add_tail(&evtp->evt_listp, &phba->work_list);
2876 if (phba->work_wait)
2877 lpfc_worker_wake_up(phba);
2878 spin_unlock_irqrestore(&phba->hbalock, flags);
2879 return;
2880}
2881
2882void
2883lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, 2818lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2884 uint32_t did) 2819 uint32_t did)
2885{ 2820{
@@ -2902,7 +2837,7 @@ lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2902 return; 2837 return;
2903} 2838}
2904 2839
2905void 2840static void
2906lpfc_nlp_release(struct kref *kref) 2841lpfc_nlp_release(struct kref *kref)
2907{ 2842{
2908 struct lpfc_nodelist *ndlp = container_of(kref, struct lpfc_nodelist, 2843 struct lpfc_nodelist *ndlp = container_of(kref, struct lpfc_nodelist,
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index c2fb59f595f3..451accd5564b 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -150,7 +150,11 @@ struct lpfc_sli_ct_request {
150 struct gff_acc { 150 struct gff_acc {
151 uint8_t fbits[128]; 151 uint8_t fbits[128];
152 } gff_acc; 152 } gff_acc;
153#ifdef __BIG_ENDIAN_BITFIELD
154#define FCP_TYPE_FEATURE_OFFSET 7
155#else /* __LITTLE_ENDIAN_BITFIELD */
153#define FCP_TYPE_FEATURE_OFFSET 4 156#define FCP_TYPE_FEATURE_OFFSET 4
157#endif
154 struct rff { 158 struct rff {
155 uint32_t PortId; 159 uint32_t PortId;
156 uint8_t reserved[2]; 160 uint8_t reserved[2];
@@ -805,7 +809,7 @@ typedef struct _RNID { /* Structure is in Big Endian format */
805 } un; 809 } un;
806} RNID; 810} RNID;
807 811
808typedef struct _RPS { /* Structure is in Big Endian format */ 812typedef struct _RPS { /* Structure is in Big Endian format */
809 union { 813 union {
810 uint32_t portNum; 814 uint32_t portNum;
811 struct lpfc_name portName; 815 struct lpfc_name portName;
@@ -823,7 +827,7 @@ typedef struct _RPS_RSP { /* Structure is in Big Endian format */
823 uint32_t crcCnt; 827 uint32_t crcCnt;
824} RPS_RSP; 828} RPS_RSP;
825 829
826typedef struct _RPL { /* Structure is in Big Endian format */ 830typedef struct _RPL { /* Structure is in Big Endian format */
827 uint32_t maxsize; 831 uint32_t maxsize;
828 uint32_t index; 832 uint32_t index;
829} RPL; 833} RPL;
@@ -834,7 +838,7 @@ typedef struct _PORT_NUM_BLK {
834 struct lpfc_name portName; 838 struct lpfc_name portName;
835} PORT_NUM_BLK; 839} PORT_NUM_BLK;
836 840
837typedef struct _RPL_RSP { /* Structure is in Big Endian format */ 841typedef struct _RPL_RSP { /* Structure is in Big Endian format */
838 uint32_t listLen; 842 uint32_t listLen;
839 uint32_t index; 843 uint32_t index;
840 PORT_NUM_BLK port_num_blk; 844 PORT_NUM_BLK port_num_blk;
@@ -2613,8 +2617,8 @@ typedef union {
2613 LOAD_SM_VAR varLdSM; /* cmd = 1 (LOAD_SM) */ 2617 LOAD_SM_VAR varLdSM; /* cmd = 1 (LOAD_SM) */
2614 READ_NV_VAR varRDnvp; /* cmd = 2 (READ_NVPARMS) */ 2618 READ_NV_VAR varRDnvp; /* cmd = 2 (READ_NVPARMS) */
2615 WRITE_NV_VAR varWTnvp; /* cmd = 3 (WRITE_NVPARMS) */ 2619 WRITE_NV_VAR varWTnvp; /* cmd = 3 (WRITE_NVPARMS) */
2616 BIU_DIAG_VAR varBIUdiag; /* cmd = 4 (RUN_BIU_DIAG) */ 2620 BIU_DIAG_VAR varBIUdiag; /* cmd = 4 (RUN_BIU_DIAG) */
2617 INIT_LINK_VAR varInitLnk; /* cmd = 5 (INIT_LINK) */ 2621 INIT_LINK_VAR varInitLnk; /* cmd = 5 (INIT_LINK) */
2618 DOWN_LINK_VAR varDwnLnk; /* cmd = 6 (DOWN_LINK) */ 2622 DOWN_LINK_VAR varDwnLnk; /* cmd = 6 (DOWN_LINK) */
2619 CONFIG_LINK varCfgLnk; /* cmd = 7 (CONFIG_LINK) */ 2623 CONFIG_LINK varCfgLnk; /* cmd = 7 (CONFIG_LINK) */
2620 PART_SLIM_VAR varSlim; /* cmd = 8 (PART_SLIM) */ 2624 PART_SLIM_VAR varSlim; /* cmd = 8 (PART_SLIM) */
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 07bd0dcdf0d6..414350ab584e 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -53,8 +53,6 @@ static struct scsi_transport_template *lpfc_transport_template = NULL;
53static struct scsi_transport_template *lpfc_vport_transport_template = NULL; 53static struct scsi_transport_template *lpfc_vport_transport_template = NULL;
54static DEFINE_IDR(lpfc_hba_index); 54static DEFINE_IDR(lpfc_hba_index);
55 55
56
57
58/************************************************************************/ 56/************************************************************************/
59/* */ 57/* */
60/* lpfc_config_port_prep */ 58/* lpfc_config_port_prep */
@@ -107,10 +105,9 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
107 105
108 if (rc != MBX_SUCCESS) { 106 if (rc != MBX_SUCCESS) {
109 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, 107 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
110 "%d:0324 Config Port initialization " 108 "0324 Config Port initialization "
111 "error, mbxCmd x%x READ_NVPARM, " 109 "error, mbxCmd x%x READ_NVPARM, "
112 "mbxStatus x%x\n", 110 "mbxStatus x%x\n",
113 phba->brd_no,
114 mb->mbxCommand, mb->mbxStatus); 111 mb->mbxCommand, mb->mbxStatus);
115 mempool_free(pmb, phba->mbox_mem_pool); 112 mempool_free(pmb, phba->mbox_mem_pool);
116 return -ERESTART; 113 return -ERESTART;
@@ -128,9 +125,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
128 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); 125 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
129 if (rc != MBX_SUCCESS) { 126 if (rc != MBX_SUCCESS) {
130 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 127 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
131 "%d:0439 Adapter failed to init, mbxCmd x%x " 128 "0439 Adapter failed to init, mbxCmd x%x "
132 "READ_REV, mbxStatus x%x\n", 129 "READ_REV, mbxStatus x%x\n",
133 phba->brd_no,
134 mb->mbxCommand, mb->mbxStatus); 130 mb->mbxCommand, mb->mbxStatus);
135 mempool_free( pmb, phba->mbox_mem_pool); 131 mempool_free( pmb, phba->mbox_mem_pool);
136 return -ERESTART; 132 return -ERESTART;
@@ -144,9 +140,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
144 if (mb->un.varRdRev.rr == 0) { 140 if (mb->un.varRdRev.rr == 0) {
145 vp->rev.rBit = 0; 141 vp->rev.rBit = 0;
146 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 142 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
147 "%d:0440 Adapter failed to init, READ_REV has " 143 "0440 Adapter failed to init, READ_REV has "
148 "missing revision information.\n", 144 "missing revision information.\n");
149 phba->brd_no);
150 mempool_free(pmb, phba->mbox_mem_pool); 145 mempool_free(pmb, phba->mbox_mem_pool);
151 return -ERESTART; 146 return -ERESTART;
152 } 147 }
@@ -197,9 +192,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
197 192
198 if (rc != MBX_SUCCESS) { 193 if (rc != MBX_SUCCESS) {
199 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 194 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
200 "%d:0441 VPD not present on adapter, " 195 "0441 VPD not present on adapter, "
201 "mbxCmd x%x DUMP VPD, mbxStatus x%x\n", 196 "mbxCmd x%x DUMP VPD, mbxStatus x%x\n",
202 phba->brd_no,
203 mb->mbxCommand, mb->mbxStatus); 197 mb->mbxCommand, mb->mbxStatus);
204 mb->un.varDmp.word_cnt = 0; 198 mb->un.varDmp.word_cnt = 0;
205 } 199 }
@@ -253,9 +247,8 @@ lpfc_config_port_post(struct lpfc_hba *phba)
253 pmb->vport = vport; 247 pmb->vport = vport;
254 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { 248 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
255 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 249 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
256 "%d:0448 Adapter failed init, mbxCmd x%x " 250 "0448 Adapter failed init, mbxCmd x%x "
257 "READ_SPARM mbxStatus x%x\n", 251 "READ_SPARM mbxStatus x%x\n",
258 phba->brd_no,
259 mb->mbxCommand, mb->mbxStatus); 252 mb->mbxCommand, mb->mbxStatus);
260 phba->link_state = LPFC_HBA_ERROR; 253 phba->link_state = LPFC_HBA_ERROR;
261 mp = (struct lpfc_dmabuf *) pmb->context1; 254 mp = (struct lpfc_dmabuf *) pmb->context1;
@@ -312,9 +305,8 @@ lpfc_config_port_post(struct lpfc_hba *phba)
312 pmb->vport = vport; 305 pmb->vport = vport;
313 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { 306 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
314 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 307 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
315 "%d:0453 Adapter failed to init, mbxCmd x%x " 308 "0453 Adapter failed to init, mbxCmd x%x "
316 "READ_CONFIG, mbxStatus x%x\n", 309 "READ_CONFIG, mbxStatus x%x\n",
317 phba->brd_no,
318 mb->mbxCommand, mb->mbxStatus); 310 mb->mbxCommand, mb->mbxStatus);
319 phba->link_state = LPFC_HBA_ERROR; 311 phba->link_state = LPFC_HBA_ERROR;
320 mempool_free( pmb, phba->mbox_mem_pool); 312 mempool_free( pmb, phba->mbox_mem_pool);
@@ -344,9 +336,8 @@ lpfc_config_port_post(struct lpfc_hba *phba)
344 && !(phba->lmt & LMT_10Gb))) { 336 && !(phba->lmt & LMT_10Gb))) {
345 /* Reset link speed to auto */ 337 /* Reset link speed to auto */
346 lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT, 338 lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT,
347 "%d:1302 Invalid speed for this board: " 339 "1302 Invalid speed for this board: "
348 "Reset link speed to auto: x%x\n", 340 "Reset link speed to auto: x%x\n",
349 phba->brd_no,
350 phba->cfg_link_speed); 341 phba->cfg_link_speed);
351 phba->cfg_link_speed = LINK_SPEED_AUTO; 342 phba->cfg_link_speed = LINK_SPEED_AUTO;
352 } 343 }
@@ -402,9 +393,8 @@ lpfc_config_port_post(struct lpfc_hba *phba)
402 lpfc_set_loopback_flag(phba); 393 lpfc_set_loopback_flag(phba);
403 if (rc != MBX_SUCCESS) { 394 if (rc != MBX_SUCCESS) {
404 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 395 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
405 "%d:0454 Adapter failed to init, mbxCmd x%x " 396 "0454 Adapter failed to init, mbxCmd x%x "
406 "INIT_LINK, mbxStatus x%x\n", 397 "INIT_LINK, mbxStatus x%x\n",
407 phba->brd_no,
408 mb->mbxCommand, mb->mbxStatus); 398 mb->mbxCommand, mb->mbxStatus);
409 399
410 /* Clear all interrupt enable conditions */ 400 /* Clear all interrupt enable conditions */
@@ -437,16 +427,11 @@ lpfc_config_port_post(struct lpfc_hba *phba)
437int 427int
438lpfc_hba_down_prep(struct lpfc_hba *phba) 428lpfc_hba_down_prep(struct lpfc_hba *phba)
439{ 429{
440 struct lpfc_vport *vport = phba->pport;
441
442 /* Disable interrupts */ 430 /* Disable interrupts */
443 writel(0, phba->HCregaddr); 431 writel(0, phba->HCregaddr);
444 readl(phba->HCregaddr); /* flush */ 432 readl(phba->HCregaddr); /* flush */
445 433
446 list_for_each_entry(vport, &phba->port_list, listentry) { 434 lpfc_cleanup_discovery_resources(phba->pport);
447 lpfc_cleanup_discovery_resources(vport);
448 }
449
450 return 0; 435 return 0;
451} 436}
452 437
@@ -518,7 +503,7 @@ lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq)
518 mempool_free(pmboxq, phba->mbox_mem_pool); 503 mempool_free(pmboxq, phba->mbox_mem_pool);
519 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && 504 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) &&
520 !(phba->link_state == LPFC_HBA_ERROR) && 505 !(phba->link_state == LPFC_HBA_ERROR) &&
521 !(phba->pport->fc_flag & FC_UNLOADING)) 506 !(phba->pport->load_flag & FC_UNLOADING))
522 mod_timer(&phba->hb_tmofunc, 507 mod_timer(&phba->hb_tmofunc,
523 jiffies + HZ * LPFC_HB_MBOX_INTERVAL); 508 jiffies + HZ * LPFC_HB_MBOX_INTERVAL);
524 return; 509 return;
@@ -532,7 +517,7 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)
532 struct lpfc_sli *psli = &phba->sli; 517 struct lpfc_sli *psli = &phba->sli;
533 518
534 if ((phba->link_state == LPFC_HBA_ERROR) || 519 if ((phba->link_state == LPFC_HBA_ERROR) ||
535 (phba->pport->fc_flag & FC_UNLOADING) || 520 (phba->pport->load_flag & FC_UNLOADING) ||
536 (phba->pport->fc_flag & FC_OFFLINE_MODE)) 521 (phba->pport->fc_flag & FC_OFFLINE_MODE))
537 return; 522 return;
538 523
@@ -586,8 +571,8 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)
586 * need to take the HBA offline. 571 * need to take the HBA offline.
587 */ 572 */
588 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 573 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
589 "%d:0459 Adapter heartbeat failure, taking " 574 "0459 Adapter heartbeat failure, taking "
590 "this port offline.\n", phba->brd_no); 575 "this port offline.\n");
591 576
592 spin_lock_irq(&phba->hbalock); 577 spin_lock_irq(&phba->hbalock);
593 psli->sli_flag &= ~LPFC_SLI2_ACTIVE; 578 psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
@@ -615,9 +600,10 @@ lpfc_handle_eratt(struct lpfc_hba *phba)
615 struct lpfc_vport *vport = phba->pport; 600 struct lpfc_vport *vport = phba->pport;
616 struct lpfc_sli *psli = &phba->sli; 601 struct lpfc_sli *psli = &phba->sli;
617 struct lpfc_sli_ring *pring; 602 struct lpfc_sli_ring *pring;
618 struct lpfc_vport *port_iterator; 603 struct lpfc_vport **vports;
619 uint32_t event_data; 604 uint32_t event_data;
620 struct Scsi_Host *shost; 605 struct Scsi_Host *shost;
606 int i;
621 607
622 /* If the pci channel is offline, ignore possible errors, 608 /* If the pci channel is offline, ignore possible errors,
623 * since we cannot communicate with the pci card anyway. */ 609 * since we cannot communicate with the pci card anyway. */
@@ -628,18 +614,21 @@ lpfc_handle_eratt(struct lpfc_hba *phba)
628 phba->work_hs & HS_FFER5) { 614 phba->work_hs & HS_FFER5) {
629 /* Re-establishing Link */ 615 /* Re-establishing Link */
630 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, 616 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
631 "%d:1301 Re-establishing Link " 617 "1301 Re-establishing Link "
632 "Data: x%x x%x x%x\n", 618 "Data: x%x x%x x%x\n",
633 phba->brd_no, phba->work_hs, 619 phba->work_hs,
634 phba->work_status[0], phba->work_status[1]); 620 phba->work_status[0], phba->work_status[1]);
635 list_for_each_entry(port_iterator, &phba->port_list, 621 vports = lpfc_create_vport_work_array(phba);
636 listentry) { 622 if (vports != NULL)
637 shost = lpfc_shost_from_vport(port_iterator); 623 for(i = 0;
638 624 i < LPFC_MAX_VPORTS && vports[i] != NULL;
639 spin_lock_irq(shost->host_lock); 625 i++){
640 port_iterator->fc_flag |= FC_ESTABLISH_LINK; 626 shost = lpfc_shost_from_vport(vports[i]);
641 spin_unlock_irq(shost->host_lock); 627 spin_lock_irq(shost->host_lock);
642 } 628 vports[i]->fc_flag |= FC_ESTABLISH_LINK;
629 spin_unlock_irq(shost->host_lock);
630 }
631 lpfc_destroy_vport_work_array(vports);
643 spin_lock_irq(&phba->hbalock); 632 spin_lock_irq(&phba->hbalock);
644 psli->sli_flag &= ~LPFC_SLI2_ACTIVE; 633 psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
645 spin_unlock_irq(&phba->hbalock); 634 spin_unlock_irq(&phba->hbalock);
@@ -673,9 +662,9 @@ lpfc_handle_eratt(struct lpfc_hba *phba)
673 * twice. This is the adapter hardware error path. 662 * twice. This is the adapter hardware error path.
674 */ 663 */
675 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 664 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
676 "%d:0457 Adapter Hardware Error " 665 "0457 Adapter Hardware Error "
677 "Data: x%x x%x x%x\n", 666 "Data: x%x x%x x%x\n",
678 phba->brd_no, phba->work_hs, 667 phba->work_hs,
679 phba->work_status[0], phba->work_status[1]); 668 phba->work_status[0], phba->work_status[1]);
680 669
681 event_data = FC_REG_DUMP_EVENT; 670 event_data = FC_REG_DUMP_EVENT;
@@ -708,7 +697,6 @@ lpfc_handle_latt(struct lpfc_hba *phba)
708{ 697{
709 struct lpfc_vport *vport = phba->pport; 698 struct lpfc_vport *vport = phba->pport;
710 struct lpfc_sli *psli = &phba->sli; 699 struct lpfc_sli *psli = &phba->sli;
711 struct lpfc_vport *port_iterator;
712 LPFC_MBOXQ_t *pmb; 700 LPFC_MBOXQ_t *pmb;
713 volatile uint32_t control; 701 volatile uint32_t control;
714 struct lpfc_dmabuf *mp; 702 struct lpfc_dmabuf *mp;
@@ -729,8 +717,7 @@ lpfc_handle_latt(struct lpfc_hba *phba)
729 rc = -EIO; 717 rc = -EIO;
730 718
731 /* Cleanup any outstanding ELS commands */ 719 /* Cleanup any outstanding ELS commands */
732 list_for_each_entry(port_iterator, &phba->port_list, listentry) 720 lpfc_els_flush_all_cmd(phba);
733 lpfc_els_flush_cmd(port_iterator);
734 721
735 psli->slistat.link_event++; 722 psli->slistat.link_event++;
736 lpfc_read_la(phba, pmb, mp); 723 lpfc_read_la(phba, pmb, mp);
@@ -773,8 +760,7 @@ lpfc_handle_latt_err_exit:
773 /* The other case is an error from issue_mbox */ 760 /* The other case is an error from issue_mbox */
774 if (rc == -ENOMEM) 761 if (rc == -ENOMEM)
775 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, 762 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX,
776 "%d:0300 READ_LA: no buffers\n", 763 "0300 READ_LA: no buffers\n");
777 phba->brd_no);
778 764
779 return; 765 return;
780} 766}
@@ -799,8 +785,7 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len)
799 785
800 /* Vital Product */ 786 /* Vital Product */
801 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 787 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
802 "%d:0455 Vital Product Data: x%x x%x x%x x%x\n", 788 "0455 Vital Product Data: x%x x%x x%x x%x\n",
803 phba->brd_no,
804 (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], 789 (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2],
805 (uint32_t) vpd[3]); 790 (uint32_t) vpd[3]);
806 while (!finished && (index < (len - 4))) { 791 while (!finished && (index < (len - 4))) {
@@ -1313,22 +1298,25 @@ static void
1313lpfc_establish_link_tmo(unsigned long ptr) 1298lpfc_establish_link_tmo(unsigned long ptr)
1314{ 1299{
1315 struct lpfc_hba *phba = (struct lpfc_hba *) ptr; 1300 struct lpfc_hba *phba = (struct lpfc_hba *) ptr;
1316 struct lpfc_vport *vport = phba->pport; 1301 struct lpfc_vport **vports;
1317 unsigned long iflag; 1302 unsigned long iflag;
1303 int i;
1318 1304
1319 /* Re-establishing Link, timer expired */ 1305 /* Re-establishing Link, timer expired */
1320 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, 1306 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
1321 "%d:1300 Re-establishing Link, timer expired " 1307 "1300 Re-establishing Link, timer expired "
1322 "Data: x%x x%x\n", 1308 "Data: x%x x%x\n",
1323 phba->brd_no, vport->fc_flag, 1309 phba->pport->fc_flag, phba->pport->port_state);
1324 vport->port_state); 1310 vports = lpfc_create_vport_work_array(phba);
1325 list_for_each_entry(vport, &phba->port_list, listentry) { 1311 if (vports != NULL)
1326 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 1312 for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
1327 1313 struct Scsi_Host *shost;
1328 spin_lock_irqsave(shost->host_lock, iflag); 1314 shost = lpfc_shost_from_vport(vports[i]);
1329 vport->fc_flag &= ~FC_ESTABLISH_LINK; 1315 spin_lock_irqsave(shost->host_lock, iflag);
1330 spin_unlock_irqrestore(shost->host_lock, iflag); 1316 vports[i]->fc_flag &= ~FC_ESTABLISH_LINK;
1331 } 1317 spin_unlock_irqrestore(shost->host_lock, iflag);
1318 }
1319 lpfc_destroy_vport_work_array(vports);
1332} 1320}
1333 1321
1334void 1322void
@@ -1343,12 +1331,9 @@ lpfc_stop_vport_timers(struct lpfc_vport *vport)
1343static void 1331static void
1344lpfc_stop_phba_timers(struct lpfc_hba *phba) 1332lpfc_stop_phba_timers(struct lpfc_hba *phba)
1345{ 1333{
1346 struct lpfc_vport *vport;
1347
1348 del_timer_sync(&phba->fcp_poll_timer); 1334 del_timer_sync(&phba->fcp_poll_timer);
1349 del_timer_sync(&phba->fc_estabtmo); 1335 del_timer_sync(&phba->fc_estabtmo);
1350 list_for_each_entry(vport, &phba->port_list, listentry) 1336 lpfc_stop_vport_timers(phba->pport);
1351 lpfc_stop_vport_timers(vport);
1352 del_timer_sync(&phba->sli.mbox_tmo); 1337 del_timer_sync(&phba->sli.mbox_tmo);
1353 del_timer_sync(&phba->fabric_block_timer); 1338 del_timer_sync(&phba->fabric_block_timer);
1354 phba->hb_outstanding = 0; 1339 phba->hb_outstanding = 0;
@@ -1360,6 +1345,8 @@ int
1360lpfc_online(struct lpfc_hba *phba) 1345lpfc_online(struct lpfc_hba *phba)
1361{ 1346{
1362 struct lpfc_vport *vport = phba->pport; 1347 struct lpfc_vport *vport = phba->pport;
1348 struct lpfc_vport **vports;
1349 int i;
1363 1350
1364 if (!phba) 1351 if (!phba)
1365 return 0; 1352 return 0;
@@ -1368,8 +1355,7 @@ lpfc_online(struct lpfc_hba *phba)
1368 return 0; 1355 return 0;
1369 1356
1370 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, 1357 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
1371 "%d:0458 Bring Adapter online\n", 1358 "0458 Bring Adapter online\n");
1372 phba->brd_no);
1373 1359
1374 lpfc_block_mgmt_io(phba); 1360 lpfc_block_mgmt_io(phba);
1375 1361
@@ -1383,14 +1369,18 @@ lpfc_online(struct lpfc_hba *phba)
1383 return 1; 1369 return 1;
1384 } 1370 }
1385 1371
1386 list_for_each_entry(vport, &phba->port_list, listentry) { 1372 vports = lpfc_create_vport_work_array(phba);
1387 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 1373 if (vports != NULL)
1388 spin_lock_irq(shost->host_lock); 1374 for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
1389 vport->fc_flag &= ~FC_OFFLINE_MODE; 1375 struct Scsi_Host *shost;
1390 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) 1376 shost = lpfc_shost_from_vport(vports[i]);
1391 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; 1377 spin_lock_irq(shost->host_lock);
1392 spin_unlock_irq(shost->host_lock); 1378 vports[i]->fc_flag &= ~FC_OFFLINE_MODE;
1393 } 1379 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)
1380 vports[i]->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
1381 spin_unlock_irq(shost->host_lock);
1382 }
1383 lpfc_destroy_vport_work_array(vports);
1394 1384
1395 lpfc_unblock_mgmt_io(phba); 1385 lpfc_unblock_mgmt_io(phba);
1396 return 0; 1386 return 0;
@@ -1440,39 +1430,39 @@ lpfc_offline_prep(struct lpfc_hba * phba)
1440void 1430void
1441lpfc_offline(struct lpfc_hba *phba) 1431lpfc_offline(struct lpfc_hba *phba)
1442{ 1432{
1443 struct lpfc_vport *vport = phba->pport; 1433 struct Scsi_Host *shost;
1444 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 1434 struct lpfc_vport **vports;
1445 struct lpfc_vport *port_iterator; 1435 int i;
1446 1436
1447 if (vport->fc_flag & FC_OFFLINE_MODE) 1437 if (phba->pport->fc_flag & FC_OFFLINE_MODE)
1448 return; 1438 return;
1449 1439
1450 /* stop all timers associated with this hba */ 1440 /* stop all timers associated with this hba */
1451 lpfc_stop_phba_timers(phba); 1441 lpfc_stop_phba_timers(phba);
1452 list_for_each_entry(port_iterator, &phba->port_list, listentry) { 1442 vports = lpfc_create_vport_work_array(phba);
1453 port_iterator->work_port_events = 0; 1443 if (vports != NULL)
1454 } 1444 for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++)
1455 1445 lpfc_stop_vport_timers(vports[i]);
1446 lpfc_destroy_vport_work_array(vports);
1456 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, 1447 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
1457 "%d:0460 Bring Adapter offline\n", 1448 "0460 Bring Adapter offline\n");
1458 phba->brd_no);
1459
1460 /* Bring down the SLI Layer and cleanup. The HBA is offline 1449 /* Bring down the SLI Layer and cleanup. The HBA is offline
1461 now. */ 1450 now. */
1462 lpfc_sli_hba_down(phba); 1451 lpfc_sli_hba_down(phba);
1463 spin_lock_irq(&phba->hbalock); 1452 spin_lock_irq(&phba->hbalock);
1464 phba->work_ha = 0; 1453 phba->work_ha = 0;
1465 vport->fc_flag |= FC_OFFLINE_MODE;
1466 spin_unlock_irq(&phba->hbalock); 1454 spin_unlock_irq(&phba->hbalock);
1467 list_for_each_entry(port_iterator, &phba->port_list, listentry) { 1455 vports = lpfc_create_vport_work_array(phba);
1468 shost = lpfc_shost_from_vport(port_iterator); 1456 if (vports != NULL)
1469 1457 for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
1470 lpfc_cleanup(port_iterator); 1458 shost = lpfc_shost_from_vport(vports[i]);
1471 spin_lock_irq(shost->host_lock); 1459 lpfc_cleanup(vports[i]);
1472 vport->work_port_events = 0; 1460 spin_lock_irq(shost->host_lock);
1473 vport->fc_flag |= FC_OFFLINE_MODE; 1461 vports[i]->work_port_events = 0;
1474 spin_unlock_irq(shost->host_lock); 1462 vports[i]->fc_flag |= FC_OFFLINE_MODE;
1475 } 1463 spin_unlock_irq(shost->host_lock);
1464 }
1465 lpfc_destroy_vport_work_array(vports);
1476} 1466}
1477 1467
1478/****************************************************************************** 1468/******************************************************************************
@@ -1509,15 +1499,19 @@ lpfc_scsi_free(struct lpfc_hba *phba)
1509 return 0; 1499 return 0;
1510} 1500}
1511 1501
1512
1513struct lpfc_vport * 1502struct lpfc_vport *
1514lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) 1503lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
1515{ 1504{
1516 struct lpfc_vport *vport; 1505 struct lpfc_vport *vport;
1517 struct Scsi_Host *shost; 1506 struct Scsi_Host *shost;
1518 int error = 0; 1507 int error = 0;
1519 1508
1520 shost = scsi_host_alloc(&lpfc_template, sizeof(struct lpfc_vport)); 1509 if (dev != &phba->pcidev->dev)
1510 shost = scsi_host_alloc(&lpfc_vport_template,
1511 sizeof(struct lpfc_vport));
1512 else
1513 shost = scsi_host_alloc(&lpfc_template,
1514 sizeof(struct lpfc_vport));
1521 if (!shost) 1515 if (!shost)
1522 goto out; 1516 goto out;
1523 1517
@@ -1527,9 +1521,10 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport)
1527 vport->load_flag |= FC_LOADING; 1521 vport->load_flag |= FC_LOADING;
1528 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; 1522 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
1529 1523
1524 lpfc_get_vport_cfgparam(vport);
1530 shost->unique_id = instance; 1525 shost->unique_id = instance;
1531 shost->max_id = LPFC_MAX_TARGET; 1526 shost->max_id = LPFC_MAX_TARGET;
1532 shost->max_lun = phba->cfg_max_luns; 1527 shost->max_lun = vport->cfg_max_luns;
1533 shost->this_id = -1; 1528 shost->this_id = -1;
1534 shost->max_cmd_len = 16; 1529 shost->max_cmd_len = 16;
1535 /* 1530 /*
@@ -1538,7 +1533,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport)
1538 * max xri value determined in hba setup. 1533 * max xri value determined in hba setup.
1539 */ 1534 */
1540 shost->can_queue = phba->cfg_hba_queue_depth - 10; 1535 shost->can_queue = phba->cfg_hba_queue_depth - 10;
1541 if (fc_vport != NULL) { 1536 if (dev != &phba->pcidev->dev) {
1542 shost->transportt = lpfc_vport_transport_template; 1537 shost->transportt = lpfc_vport_transport_template;
1543 vport->port_type = LPFC_NPIV_PORT; 1538 vport->port_type = LPFC_NPIV_PORT;
1544 } else { 1539 } else {
@@ -1562,15 +1557,13 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport)
1562 vport->els_tmofunc.function = lpfc_els_timeout; 1557 vport->els_tmofunc.function = lpfc_els_timeout;
1563 vport->els_tmofunc.data = (unsigned long)vport; 1558 vport->els_tmofunc.data = (unsigned long)vport;
1564 1559
1565 if (fc_vport != NULL) { 1560 error = scsi_add_host(shost, dev);
1566 error = scsi_add_host(shost, &fc_vport->dev);
1567 } else {
1568 error = scsi_add_host(shost, &phba->pcidev->dev);
1569 }
1570 if (error) 1561 if (error)
1571 goto out_put_shost; 1562 goto out_put_shost;
1572 1563
1564 spin_lock_irq(&phba->hbalock);
1573 list_add_tail(&vport->listentry, &phba->port_list); 1565 list_add_tail(&vport->listentry, &phba->port_list);
1566 spin_unlock_irq(&phba->hbalock);
1574 return vport; 1567 return vport;
1575 1568
1576out_put_shost: 1569out_put_shost:
@@ -1625,23 +1618,21 @@ int lpfc_scan_finished(struct Scsi_Host *shost, unsigned long time)
1625 1618
1626 spin_lock_irq(shost->host_lock); 1619 spin_lock_irq(shost->host_lock);
1627 1620
1628 if (vport->fc_flag & FC_UNLOADING) { 1621 if (vport->load_flag & FC_UNLOADING) {
1629 stat = 1; 1622 stat = 1;
1630 goto finished; 1623 goto finished;
1631 } 1624 }
1632 if (time >= 30 * HZ) { 1625 if (time >= 30 * HZ) {
1633 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 1626 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
1634 "%d:0461 Scanning longer than 30 " 1627 "0461 Scanning longer than 30 "
1635 "seconds. Continuing initialization\n", 1628 "seconds. Continuing initialization\n");
1636 phba->brd_no);
1637 stat = 1; 1629 stat = 1;
1638 goto finished; 1630 goto finished;
1639 } 1631 }
1640 if (time >= 15 * HZ && phba->link_state <= LPFC_LINK_DOWN) { 1632 if (time >= 15 * HZ && phba->link_state <= LPFC_LINK_DOWN) {
1641 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 1633 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
1642 "%d:0465 Link down longer than 15 " 1634 "0465 Link down longer than 15 "
1643 "seconds. Continuing initialization\n", 1635 "seconds. Continuing initialization\n");
1644 phba->brd_no);
1645 stat = 1; 1636 stat = 1;
1646 goto finished; 1637 goto finished;
1647 } 1638 }
@@ -1704,7 +1695,7 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost)
1704 1695
1705 fc_host_max_npiv_vports(shost) = phba->max_vpi; 1696 fc_host_max_npiv_vports(shost) = phba->max_vpi;
1706 spin_lock_irq(shost->host_lock); 1697 spin_lock_irq(shost->host_lock);
1707 vport->fc_flag &= ~FC_LOADING; 1698 vport->load_flag &= ~FC_LOADING;
1708 spin_unlock_irq(shost->host_lock); 1699 spin_unlock_irq(shost->host_lock);
1709} 1700}
1710 1701
@@ -1716,9 +1707,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1716 struct lpfc_sli *psli; 1707 struct lpfc_sli *psli;
1717 struct lpfc_iocbq *iocbq_entry = NULL, *iocbq_next = NULL; 1708 struct lpfc_iocbq *iocbq_entry = NULL, *iocbq_next = NULL;
1718 struct Scsi_Host *shost = NULL; 1709 struct Scsi_Host *shost = NULL;
1710 void *ptr;
1719 unsigned long bar0map_len, bar2map_len; 1711 unsigned long bar0map_len, bar2map_len;
1720 int error = -ENODEV; 1712 int error = -ENODEV;
1721 int i; 1713 int i, hbq_count;
1722 uint16_t iotag; 1714 uint16_t iotag;
1723 1715
1724 if (pci_enable_device(pdev)) 1716 if (pci_enable_device(pdev))
@@ -1739,7 +1731,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1739 goto out_free_phba; 1731 goto out_free_phba;
1740 1732
1741 INIT_LIST_HEAD(&phba->port_list); 1733 INIT_LIST_HEAD(&phba->port_list);
1742 INIT_LIST_HEAD(&phba->hbq_buffer_list);
1743 /* 1734 /*
1744 * Get all the module params for configuring this host and then 1735 * Get all the module params for configuring this host and then
1745 * establish the host. 1736 * establish the host.
@@ -1817,6 +1808,17 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1817 if (!phba->hbqslimp.virt) 1808 if (!phba->hbqslimp.virt)
1818 goto out_free_slim; 1809 goto out_free_slim;
1819 1810
1811 hbq_count = lpfc_sli_hbq_count();
1812 ptr = phba->hbqslimp.virt;
1813 for (i = 0; i < hbq_count; ++i) {
1814 phba->hbqs[i].hbq_virt = ptr;
1815 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list);
1816 ptr += (lpfc_hbq_defs[i]->entry_count *
1817 sizeof(struct lpfc_hbq_entry));
1818 }
1819 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc;
1820 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free;
1821
1820 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); 1822 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size());
1821 1823
1822 /* Initialize the SLI Layer to run with lpfc HBAs. */ 1824 /* Initialize the SLI Layer to run with lpfc HBAs. */
@@ -1880,7 +1882,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1880 /* Initialize list of fabric iocbs */ 1882 /* Initialize list of fabric iocbs */
1881 INIT_LIST_HEAD(&phba->fabric_iocb_list); 1883 INIT_LIST_HEAD(&phba->fabric_iocb_list);
1882 1884
1883 vport = lpfc_create_port(phba, phba->brd_no, NULL); 1885 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev);
1884 if (!vport) 1886 if (!vport)
1885 goto out_kthread_stop; 1887 goto out_kthread_stop;
1886 1888
@@ -1892,18 +1894,19 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1892 1894
1893 if (phba->cfg_use_msi) { 1895 if (phba->cfg_use_msi) {
1894 error = pci_enable_msi(phba->pcidev); 1896 error = pci_enable_msi(phba->pcidev);
1895 if (error) 1897 if (!error)
1896 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "%d:0452 " 1898 phba->using_msi = 1;
1897 "Enable MSI failed, continuing with " 1899 else
1898 "IRQ\n", phba->brd_no); 1900 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
1901 "0452 Enable MSI failed, continuing "
1902 "with IRQ\n");
1899 } 1903 }
1900 1904
1901 error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED, 1905 error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED,
1902 LPFC_DRIVER_NAME, phba); 1906 LPFC_DRIVER_NAME, phba);
1903 if (error) { 1907 if (error) {
1904 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1908 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1905 "%d:0451 Enable interrupt handler failed\n", 1909 "0451 Enable interrupt handler failed\n");
1906 phba->brd_no);
1907 goto out_disable_msi; 1910 goto out_disable_msi;
1908 } 1911 }
1909 1912
@@ -1940,14 +1943,15 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1940out_remove_device: 1943out_remove_device:
1941 lpfc_free_sysfs_attr(vport); 1944 lpfc_free_sysfs_attr(vport);
1942 spin_lock_irq(shost->host_lock); 1945 spin_lock_irq(shost->host_lock);
1943 vport->fc_flag |= FC_UNLOADING; 1946 vport->load_flag |= FC_UNLOADING;
1944 spin_unlock_irq(shost->host_lock); 1947 spin_unlock_irq(shost->host_lock);
1945out_free_irq: 1948out_free_irq:
1946 lpfc_stop_phba_timers(phba); 1949 lpfc_stop_phba_timers(phba);
1947 phba->pport->work_port_events = 0; 1950 phba->pport->work_port_events = 0;
1948 free_irq(phba->pcidev->irq, phba); 1951 free_irq(phba->pcidev->irq, phba);
1949out_disable_msi: 1952out_disable_msi:
1950 pci_disable_msi(phba->pcidev); 1953 if (phba->using_msi)
1954 pci_disable_msi(phba->pcidev);
1951 destroy_port(vport); 1955 destroy_port(vport);
1952out_kthread_stop: 1956out_kthread_stop:
1953 kthread_stop(phba->worker_thread); 1957 kthread_stop(phba->worker_thread);
@@ -1989,16 +1993,15 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
1989 struct Scsi_Host *shost = pci_get_drvdata(pdev); 1993 struct Scsi_Host *shost = pci_get_drvdata(pdev);
1990 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1994 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
1991 struct lpfc_hba *phba = vport->phba; 1995 struct lpfc_hba *phba = vport->phba;
1992 struct lpfc_vport *port_iterator; 1996 spin_lock_irq(&phba->hbalock);
1993 list_for_each_entry(port_iterator, &phba->port_list, listentry) 1997 vport->load_flag |= FC_UNLOADING;
1994 port_iterator->load_flag |= FC_UNLOADING; 1998 spin_unlock_irq(&phba->hbalock);
1995 1999
1996 kfree(vport->vname); 2000 kfree(vport->vname);
1997 lpfc_free_sysfs_attr(vport); 2001 lpfc_free_sysfs_attr(vport);
1998 2002
1999 fc_remove_host(shost); 2003 fc_remove_host(shost);
2000 scsi_remove_host(shost); 2004 scsi_remove_host(shost);
2001
2002 /* 2005 /*
2003 * Bring down the SLI Layer. This step disable all interrupts, 2006 * Bring down the SLI Layer. This step disable all interrupts,
2004 * clears the rings, discards all mailbox commands, and resets 2007 * clears the rings, discards all mailbox commands, and resets
@@ -2012,7 +2015,6 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
2012 list_del_init(&vport->listentry); 2015 list_del_init(&vport->listentry);
2013 spin_unlock_irq(&phba->hbalock); 2016 spin_unlock_irq(&phba->hbalock);
2014 2017
2015
2016 lpfc_debugfs_terminate(vport); 2018 lpfc_debugfs_terminate(vport);
2017 lpfc_cleanup(vport); 2019 lpfc_cleanup(vport);
2018 2020
@@ -2020,7 +2022,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
2020 2022
2021 /* Release the irq reservation */ 2023 /* Release the irq reservation */
2022 free_irq(phba->pcidev->irq, phba); 2024 free_irq(phba->pcidev->irq, phba);
2023 pci_disable_msi(phba->pcidev); 2025 if (phba->using_msi)
2026 pci_disable_msi(phba->pcidev);
2024 2027
2025 pci_set_drvdata(pdev, NULL); 2028 pci_set_drvdata(pdev, NULL);
2026 scsi_host_put(shost); 2029 scsi_host_put(shost);
@@ -2062,8 +2065,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
2062static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, 2065static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
2063 pci_channel_state_t state) 2066 pci_channel_state_t state)
2064{ 2067{
2065 struct Scsi_Host *host = pci_get_drvdata(pdev); 2068 struct Scsi_Host *shost = pci_get_drvdata(pdev);
2066 struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; 2069 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
2067 struct lpfc_sli *psli = &phba->sli; 2070 struct lpfc_sli *psli = &phba->sli;
2068 struct lpfc_sli_ring *pring; 2071 struct lpfc_sli_ring *pring;
2069 2072
@@ -2079,6 +2082,11 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
2079 pring = &psli->ring[psli->fcp_ring]; 2082 pring = &psli->ring[psli->fcp_ring];
2080 lpfc_sli_abort_iocb_ring(phba, pring); 2083 lpfc_sli_abort_iocb_ring(phba, pring);
2081 2084
2085 /* Release the irq reservation */
2086 free_irq(phba->pcidev->irq, phba);
2087 if (phba->using_msi)
2088 pci_disable_msi(phba->pcidev);
2089
2082 /* Request a slot reset. */ 2090 /* Request a slot reset. */
2083 return PCI_ERS_RESULT_NEED_RESET; 2091 return PCI_ERS_RESULT_NEED_RESET;
2084} 2092}
@@ -2091,8 +2099,8 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
2091 */ 2099 */
2092static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) 2100static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev)
2093{ 2101{
2094 struct Scsi_Host *host = pci_get_drvdata(pdev); 2102 struct Scsi_Host *shost = pci_get_drvdata(pdev);
2095 struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; 2103 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
2096 struct lpfc_sli *psli = &phba->sli; 2104 struct lpfc_sli *psli = &phba->sli;
2097 int bars = pci_select_bars(pdev, IORESOURCE_MEM); 2105 int bars = pci_select_bars(pdev, IORESOURCE_MEM);
2098 2106
@@ -2106,9 +2114,9 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev)
2106 pci_set_master(pdev); 2114 pci_set_master(pdev);
2107 2115
2108 /* Re-establishing Link */ 2116 /* Re-establishing Link */
2109 spin_lock_irq(host->host_lock); 2117 spin_lock_irq(shost->host_lock);
2110 phba->pport->fc_flag |= FC_ESTABLISH_LINK; 2118 phba->pport->fc_flag |= FC_ESTABLISH_LINK;
2111 spin_unlock_irq(host->host_lock); 2119 spin_unlock_irq(shost->host_lock);
2112 2120
2113 spin_lock_irq(&phba->hbalock); 2121 spin_lock_irq(&phba->hbalock);
2114 psli->sli_flag &= ~LPFC_SLI2_ACTIVE; 2122 psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
@@ -2131,8 +2139,8 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev)
2131 */ 2139 */
2132static void lpfc_io_resume(struct pci_dev *pdev) 2140static void lpfc_io_resume(struct pci_dev *pdev)
2133{ 2141{
2134 struct Scsi_Host *host = pci_get_drvdata(pdev); 2142 struct Scsi_Host *shost = pci_get_drvdata(pdev);
2135 struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; 2143 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
2136 2144
2137 if (lpfc_online(phba) == 0) { 2145 if (lpfc_online(phba) == 0) {
2138 mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); 2146 mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60);
diff --git a/drivers/scsi/lpfc/lpfc_logmsg.h b/drivers/scsi/lpfc/lpfc_logmsg.h
index 8a6ceffeabcf..626e4d878725 100644
--- a/drivers/scsi/lpfc/lpfc_logmsg.h
+++ b/drivers/scsi/lpfc/lpfc_logmsg.h
@@ -33,6 +33,12 @@
33#define LOG_VPORT 0x4000 /* NPIV events */ 33#define LOG_VPORT 0x4000 /* NPIV events */
34#define LOG_ALL_MSG 0xffff /* LOG all messages */ 34#define LOG_ALL_MSG 0xffff /* LOG all messages */
35 35
36#define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \
37 { if (((mask) &(vport)->cfg_log_verbose) || (level[1] <= '3')) \
38 dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
39 fmt, (vport)->phba->brd_no, vport->vpi, ##arg); }
40
36#define lpfc_printf_log(phba, level, mask, fmt, arg...) \ 41#define lpfc_printf_log(phba, level, mask, fmt, arg...) \
37 { if (((mask) &(phba)->cfg_log_verbose) || (level[1] <= '3')) \ 42 { if (((mask) &(phba)->pport->cfg_log_verbose) || (level[1] <= '3')) \
38 dev_printk(level, &((phba)->pcidev)->dev, fmt, ##arg); } 43 dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
44 fmt, phba->brd_no, ##arg); }
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 8f42fbfdd29e..a592733664e9 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -275,11 +275,8 @@ lpfc_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, int vpi)
275 kfree(mp); 275 kfree(mp);
276 mb->mbxCommand = MBX_READ_SPARM64; 276 mb->mbxCommand = MBX_READ_SPARM64;
277 /* READ_SPARAM: no buffers */ 277 /* READ_SPARAM: no buffers */
278 lpfc_printf_log(phba, 278 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX,
279 KERN_WARNING, 279 "0301 READ_SPARAM: no buffers\n");
280 LOG_MBOX,
281 "%d:0301 READ_SPARAM: no buffers\n",
282 phba->brd_no);
283 return (1); 280 return (1);
284 } 281 }
285 INIT_LIST_HEAD(&mp->list); 282 INIT_LIST_HEAD(&mp->list);
@@ -378,9 +375,8 @@ lpfc_reg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t did,
378 mb->mbxCommand = MBX_REG_LOGIN64; 375 mb->mbxCommand = MBX_REG_LOGIN64;
379 /* REG_LOGIN: no buffers */ 376 /* REG_LOGIN: no buffers */
380 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, 377 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX,
381 "%d (%d):0302 REG_LOGIN: no buffers, DID x%x, " 378 "0302 REG_LOGIN: no buffers, VPI:%d DID:x%x, "
382 "flag x%x\n", 379 "flag x%x\n", vpi, did, flag);
383 phba->brd_no, vpi, did, flag);
384 return (1); 380 return (1);
385 } 381 }
386 INIT_LIST_HEAD(&mp->list); 382 INIT_LIST_HEAD(&mp->list);
@@ -564,7 +560,8 @@ lpfc_build_hbq_profile5(struct config_hbq_var *hbqmb,
564} 560}
565 561
566void 562void
567lpfc_config_hbq(struct lpfc_hba *phba, struct lpfc_hbq_init *hbq_desc, 563lpfc_config_hbq(struct lpfc_hba *phba, uint32_t id,
564 struct lpfc_hbq_init *hbq_desc,
568 uint32_t hbq_entry_index, LPFC_MBOXQ_t *pmb) 565 uint32_t hbq_entry_index, LPFC_MBOXQ_t *pmb)
569{ 566{
570 int i; 567 int i;
@@ -572,6 +569,7 @@ lpfc_config_hbq(struct lpfc_hba *phba, struct lpfc_hbq_init *hbq_desc,
572 struct config_hbq_var *hbqmb = &mb->un.varCfgHbq; 569 struct config_hbq_var *hbqmb = &mb->un.varCfgHbq;
573 570
574 memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); 571 memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
572 hbqmb->hbqId = id;
575 hbqmb->entry_count = hbq_desc->entry_count; /* # entries in HBQ */ 573 hbqmb->entry_count = hbq_desc->entry_count; /* # entries in HBQ */
576 hbqmb->recvNotify = hbq_desc->rn; /* Receive 574 hbqmb->recvNotify = hbq_desc->rn; /* Receive
577 * Notification */ 575 * Notification */
@@ -691,8 +689,8 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
691 689
692 if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) { 690 if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) {
693 mb->un.varCfgPort.cerbm = 1; /* Request HBQs */ 691 mb->un.varCfgPort.cerbm = 1; /* Request HBQs */
694 mb->un.varCfgPort.max_hbq = 1; /* Requesting 2 HBQs */ 692 mb->un.varCfgPort.max_hbq = lpfc_sli_hbq_count();
695 if (phba->max_vpi && phba->cfg_npiv_enable && 693 if (phba->max_vpi && phba->cfg_enable_npiv &&
696 phba->vpd.sli3Feat.cmv) { 694 phba->vpd.sli3Feat.cmv) {
697 mb->un.varCfgPort.max_vpi = phba->max_vpi; 695 mb->un.varCfgPort.max_vpi = phba->max_vpi;
698 mb->un.varCfgPort.cmv = 1; 696 mb->un.varCfgPort.cmv = 1;
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index 3594c469494f..43c3b8a0d76a 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -231,21 +231,34 @@ lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
231 return; 231 return;
232} 232}
233 233
234void * 234struct hbq_dmabuf *
235lpfc_hbq_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle) 235lpfc_els_hbq_alloc(struct lpfc_hba *phba)
236{ 236{
237 void *ret; 237 struct hbq_dmabuf *hbqbp;
238 ret = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_ATOMIC, handle); 238
239 return ret; 239 hbqbp = kmalloc(sizeof(struct hbq_dmabuf), GFP_KERNEL);
240 if (!hbqbp)
241 return NULL;
242
243 hbqbp->dbuf.virt = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL,
244 &hbqbp->dbuf.phys);
245 if (!hbqbp->dbuf.virt) {
246 kfree(hbqbp);
247 return NULL;
248 }
249 hbqbp->size = LPFC_BPL_SIZE;
250 return hbqbp;
240} 251}
241 252
242void 253void
243lpfc_hbq_free(struct lpfc_hba *phba, void *virt, dma_addr_t dma) 254lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp)
244{ 255{
245 pci_pool_free(phba->lpfc_hbq_pool, virt, dma); 256 pci_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys);
257 kfree(hbqbp);
246 return; 258 return;
247} 259}
248 260
261/* This is ONLY called for the LPFC_ELS_HBQ */
249void 262void
250lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) 263lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp)
251{ 264{
@@ -254,9 +267,8 @@ lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp)
254 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { 267 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
255 hbq_entry = container_of(mp, struct hbq_dmabuf, dbuf); 268 hbq_entry = container_of(mp, struct hbq_dmabuf, dbuf);
256 if (hbq_entry->tag == -1) { 269 if (hbq_entry->tag == -1) {
257 lpfc_hbq_free(phba, hbq_entry->dbuf.virt, 270 (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer)
258 hbq_entry->dbuf.phys); 271 (phba, hbq_entry);
259 kfree(hbq_entry);
260 } else { 272 } else {
261 lpfc_sli_free_hbq(phba, hbq_entry); 273 lpfc_sli_free_hbq(phba, hbq_entry);
262 } 274 }
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index bca2f5c9b4ba..880af0cd463d 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -133,15 +133,15 @@ lpfc_check_sparm(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
133 memcpy(&ndlp->nlp_portname, &sp->portName, sizeof (struct lpfc_name)); 133 memcpy(&ndlp->nlp_portname, &sp->portName, sizeof (struct lpfc_name));
134 return 1; 134 return 1;
135bad_service_param: 135bad_service_param:
136 lpfc_printf_log(vport->phba, KERN_ERR, LOG_DISCOVERY, 136 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
137 "%d (%d):0207 Device %x " 137 "0207 Device %x "
138 "(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x) sent " 138 "(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x) sent "
139 "invalid service parameters. Ignoring device.\n", 139 "invalid service parameters. Ignoring device.\n",
140 vport->phba->brd_no, ndlp->vport->vpi, ndlp->nlp_DID, 140 ndlp->nlp_DID,
141 sp->nodeName.u.wwn[0], sp->nodeName.u.wwn[1], 141 sp->nodeName.u.wwn[0], sp->nodeName.u.wwn[1],
142 sp->nodeName.u.wwn[2], sp->nodeName.u.wwn[3], 142 sp->nodeName.u.wwn[2], sp->nodeName.u.wwn[3],
143 sp->nodeName.u.wwn[4], sp->nodeName.u.wwn[5], 143 sp->nodeName.u.wwn[4], sp->nodeName.u.wwn[5],
144 sp->nodeName.u.wwn[6], sp->nodeName.u.wwn[7]); 144 sp->nodeName.u.wwn[6], sp->nodeName.u.wwn[7]);
145 return 0; 145 return 0;
146} 146}
147 147
@@ -194,11 +194,11 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
194 IOCB_t *cmd; 194 IOCB_t *cmd;
195 195
196 /* Abort outstanding I/O on NPort <nlp_DID> */ 196 /* Abort outstanding I/O on NPort <nlp_DID> */
197 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 197 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_DISCOVERY,
198 "%d (%d):0205 Abort outstanding I/O on NPort x%x " 198 "0205 Abort outstanding I/O on NPort x%x "
199 "Data: x%x x%x x%x\n", 199 "Data: x%x x%x x%x\n",
200 phba->brd_no, ndlp->vport->vpi, ndlp->nlp_DID, 200 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
201 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); 201 ndlp->nlp_rpi);
202 202
203 lpfc_fabric_abort_nport(ndlp); 203 lpfc_fabric_abort_nport(ndlp);
204 204
@@ -298,13 +298,12 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
298 icmd = &cmdiocb->iocb; 298 icmd = &cmdiocb->iocb;
299 299
300 /* PLOGI chkparm OK */ 300 /* PLOGI chkparm OK */
301 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 301 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
302 "%d (%d):0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", 302 "0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n",
303 phba->brd_no, vport->vpi, 303 ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag,
304 ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, 304 ndlp->nlp_rpi);
305 ndlp->nlp_rpi);
306 305
307 if (phba->cfg_fcp_class == 2 && sp->cls2.classValid) 306 if (vport->cfg_fcp_class == 2 && sp->cls2.classValid)
308 ndlp->nlp_fcp_info |= CLASS2; 307 ndlp->nlp_fcp_info |= CLASS2;
309 else 308 else
310 ndlp->nlp_fcp_info |= CLASS3; 309 ndlp->nlp_fcp_info |= CLASS3;
@@ -330,7 +329,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
330 case NLP_STE_PRLI_ISSUE: 329 case NLP_STE_PRLI_ISSUE:
331 case NLP_STE_UNMAPPED_NODE: 330 case NLP_STE_UNMAPPED_NODE:
332 case NLP_STE_MAPPED_NODE: 331 case NLP_STE_MAPPED_NODE:
333 lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, 0); 332 lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL);
334 return 1; 333 return 1;
335 } 334 }
336 335
@@ -392,7 +391,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
392 } 391 }
393 392
394 if ((vport->port_type == LPFC_NPIV_PORT && 393 if ((vport->port_type == LPFC_NPIV_PORT &&
395 phba->cfg_vport_restrict_login)) { 394 vport->cfg_restrict_login)) {
396 395
397 /* In order to preserve RPIs, we want to cleanup 396 /* In order to preserve RPIs, we want to cleanup
398 * the default RPI the firmware created to rcv 397 * the default RPI the firmware created to rcv
@@ -408,7 +407,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
408 ndlp, mbox); 407 ndlp, mbox);
409 return 1; 408 return 1;
410 } 409 }
411 lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0); 410 lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox);
412 return 1; 411 return 1;
413 412
414out: 413out:
@@ -452,7 +451,7 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
452 lpfc_els_rsp_adisc_acc(vport, cmdiocb, ndlp); 451 lpfc_els_rsp_adisc_acc(vport, cmdiocb, ndlp);
453 } else { 452 } else {
454 lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, 453 lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp,
455 NULL, 0); 454 NULL);
456 } 455 }
457 return 1; 456 return 1;
458 } 457 }
@@ -489,9 +488,9 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
489 ndlp->nlp_flag |= NLP_LOGO_ACC; 488 ndlp->nlp_flag |= NLP_LOGO_ACC;
490 spin_unlock_irq(shost->host_lock); 489 spin_unlock_irq(shost->host_lock);
491 if (els_cmd == ELS_CMD_PRLO) 490 if (els_cmd == ELS_CMD_PRLO)
492 lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); 491 lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL);
493 else 492 else
494 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 493 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
495 494
496 if (!(ndlp->nlp_type & NLP_FABRIC) || 495 if (!(ndlp->nlp_type & NLP_FABRIC) ||
497 (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) { 496 (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) {
@@ -564,10 +563,14 @@ static uint32_t
564lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) 563lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
565{ 564{
566 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 565 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
567 struct lpfc_hba *phba = vport->phba; 566
567 if (!ndlp->nlp_rpi) {
568 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
569 return 0;
570 }
568 571
569 /* Check config parameter use-adisc or FCP-2 */ 572 /* Check config parameter use-adisc or FCP-2 */
570 if ((phba->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) || 573 if ((vport->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) ||
571 ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) { 574 ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) {
572 spin_lock_irq(shost->host_lock); 575 spin_lock_irq(shost->host_lock);
573 ndlp->nlp_flag |= NLP_NPR_ADISC; 576 ndlp->nlp_flag |= NLP_NPR_ADISC;
@@ -583,12 +586,11 @@ static uint32_t
583lpfc_disc_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, 586lpfc_disc_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
584 void *arg, uint32_t evt) 587 void *arg, uint32_t evt)
585{ 588{
586 lpfc_printf_log(vport->phba, KERN_ERR, LOG_DISCOVERY, 589 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
587 "%d (%d):0253 Illegal State Transition: node x%x " 590 "0253 Illegal State Transition: node x%x "
588 "event x%x, state x%x Data: x%x x%x\n", 591 "event x%x, state x%x Data: x%x x%x\n",
589 vport->phba->brd_no, vport->vpi, 592 ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi,
590 ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi, 593 ndlp->nlp_flag);
591 ndlp->nlp_flag);
592 return ndlp->nlp_state; 594 return ndlp->nlp_state;
593} 595}
594 596
@@ -630,7 +632,7 @@ lpfc_rcv_logo_unused_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
630 spin_lock_irq(shost->host_lock); 632 spin_lock_irq(shost->host_lock);
631 ndlp->nlp_flag |= NLP_LOGO_ACC; 633 ndlp->nlp_flag |= NLP_LOGO_ACC;
632 spin_unlock_irq(shost->host_lock); 634 spin_unlock_irq(shost->host_lock);
633 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 635 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
634 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE); 636 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE);
635 637
636 return ndlp->nlp_state; 638 return ndlp->nlp_state;
@@ -726,7 +728,7 @@ lpfc_rcv_els_plogi_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
726 lpfc_els_abort(phba, ndlp); 728 lpfc_els_abort(phba, ndlp);
727 729
728 if (evt == NLP_EVT_RCV_LOGO) { 730 if (evt == NLP_EVT_RCV_LOGO) {
729 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 731 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
730 } else { 732 } else {
731 lpfc_issue_els_logo(vport, ndlp, 0); 733 lpfc_issue_els_logo(vport, ndlp, 0);
732 } 734 }
@@ -778,16 +780,12 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
778 sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); 780 sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t));
779 if (!lpfc_check_sparm(vport, ndlp, sp, CLASS3)) 781 if (!lpfc_check_sparm(vport, ndlp, sp, CLASS3))
780 goto out; 782 goto out;
781
782 /* PLOGI chkparm OK */ 783 /* PLOGI chkparm OK */
783 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 784 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
784 "%d (%d):0121 PLOGI chkparm OK " 785 "0121 PLOGI chkparm OK Data: x%x x%x x%x x%x\n",
785 "Data: x%x x%x x%x x%x\n", 786 ndlp->nlp_DID, ndlp->nlp_state,
786 phba->brd_no, vport->vpi, 787 ndlp->nlp_flag, ndlp->nlp_rpi);
787 ndlp->nlp_DID, ndlp->nlp_state, 788 if (vport->cfg_fcp_class == 2 && (sp->cls2.classValid))
788 ndlp->nlp_flag, ndlp->nlp_rpi);
789
790 if (phba->cfg_fcp_class == 2 && (sp->cls2.classValid))
791 ndlp->nlp_fcp_info |= CLASS2; 789 ndlp->nlp_fcp_info |= CLASS2;
792 else 790 else
793 ndlp->nlp_fcp_info |= CLASS3; 791 ndlp->nlp_fcp_info |= CLASS3;
@@ -806,10 +804,9 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
806 804
807 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 805 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
808 if (!mbox) { 806 if (!mbox) {
809 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 807 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
810 "%d (%d):0133 PLOGI: no memory for reg_login " 808 "0133 PLOGI: no memory for reg_login "
811 "Data: x%x x%x x%x x%x\n", 809 "Data: x%x x%x x%x x%x\n",
812 phba->brd_no, vport->vpi,
813 ndlp->nlp_DID, ndlp->nlp_state, 810 ndlp->nlp_DID, ndlp->nlp_state,
814 ndlp->nlp_flag, ndlp->nlp_rpi); 811 ndlp->nlp_flag, ndlp->nlp_rpi);
815 goto out; 812 goto out;
@@ -844,30 +841,27 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
844 kfree(mp); 841 kfree(mp);
845 mempool_free(mbox, phba->mbox_mem_pool); 842 mempool_free(mbox, phba->mbox_mem_pool);
846 843
847 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 844 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
848 "%d (%d):0134 PLOGI: cannot issue reg_login " 845 "0134 PLOGI: cannot issue reg_login "
849 "Data: x%x x%x x%x x%x\n", 846 "Data: x%x x%x x%x x%x\n",
850 phba->brd_no, vport->vpi, 847 ndlp->nlp_DID, ndlp->nlp_state,
851 ndlp->nlp_DID, ndlp->nlp_state, 848 ndlp->nlp_flag, ndlp->nlp_rpi);
852 ndlp->nlp_flag, ndlp->nlp_rpi);
853 } else { 849 } else {
854 mempool_free(mbox, phba->mbox_mem_pool); 850 mempool_free(mbox, phba->mbox_mem_pool);
855 851
856 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 852 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
857 "%d (%d):0135 PLOGI: cannot format reg_login " 853 "0135 PLOGI: cannot format reg_login "
858 "Data: x%x x%x x%x x%x\n", 854 "Data: x%x x%x x%x x%x\n",
859 phba->brd_no, vport->vpi, 855 ndlp->nlp_DID, ndlp->nlp_state,
860 ndlp->nlp_DID, ndlp->nlp_state, 856 ndlp->nlp_flag, ndlp->nlp_rpi);
861 ndlp->nlp_flag, ndlp->nlp_rpi);
862 } 857 }
863 858
864 859
865out: 860out:
866 if (ndlp->nlp_DID == NameServer_DID) { 861 if (ndlp->nlp_DID == NameServer_DID) {
867 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 862 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
868 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 863 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
869 "%d (%d):0261 Cannot Register NameServer login\n", 864 "0261 Cannot Register NameServer login\n");
870 phba->brd_no, vport->vpi);
871 } 865 }
872 866
873 /* Free this node since the driver cannot login or has the wrong 867 /* Free this node since the driver cannot login or has the wrong
@@ -1178,7 +1172,7 @@ lpfc_rcv_prlo_reglogin_issue(struct lpfc_vport *vport,
1178 struct lpfc_iocbq *cmdiocb; 1172 struct lpfc_iocbq *cmdiocb;
1179 1173
1180 cmdiocb = (struct lpfc_iocbq *) arg; 1174 cmdiocb = (struct lpfc_iocbq *) arg;
1181 lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); 1175 lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL);
1182 return ndlp->nlp_state; 1176 return ndlp->nlp_state;
1183} 1177}
1184 1178
@@ -1189,19 +1183,15 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport,
1189 uint32_t evt) 1183 uint32_t evt)
1190{ 1184{
1191 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 1185 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1192 struct lpfc_hba *phba = vport->phba;
1193 LPFC_MBOXQ_t *pmb = (LPFC_MBOXQ_t *) arg; 1186 LPFC_MBOXQ_t *pmb = (LPFC_MBOXQ_t *) arg;
1194 MAILBOX_t *mb = &pmb->mb; 1187 MAILBOX_t *mb = &pmb->mb;
1195 uint32_t did = mb->un.varWords[1]; 1188 uint32_t did = mb->un.varWords[1];
1196 1189
1197 if (mb->mbxStatus) { 1190 if (mb->mbxStatus) {
1198 /* RegLogin failed */ 1191 /* RegLogin failed */
1199 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 1192 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
1200 "%d (%d):0246 RegLogin failed Data: x%x x%x " 1193 "0246 RegLogin failed Data: x%x x%x x%x\n",
1201 "x%x\n",
1202 phba->brd_no, vport->vpi,
1203 did, mb->mbxStatus, vport->port_state); 1194 did, mb->mbxStatus, vport->port_state);
1204
1205 /* 1195 /*
1206 * If RegLogin failed due to lack of HBA resources do not 1196 * If RegLogin failed due to lack of HBA resources do not
1207 * retry discovery. 1197 * retry discovery.
@@ -1337,7 +1327,7 @@ lpfc_rcv_prlo_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1337{ 1327{
1338 struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; 1328 struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg;
1339 1329
1340 lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); 1330 lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL);
1341 return ndlp->nlp_state; 1331 return ndlp->nlp_state;
1342} 1332}
1343 1333
@@ -1358,7 +1348,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1358 irsp = &rspiocb->iocb; 1348 irsp = &rspiocb->iocb;
1359 if (irsp->ulpStatus) { 1349 if (irsp->ulpStatus) {
1360 if ((vport->port_type == LPFC_NPIV_PORT) && 1350 if ((vport->port_type == LPFC_NPIV_PORT) &&
1361 phba->cfg_vport_restrict_login) { 1351 vport->cfg_restrict_login) {
1362 goto out; 1352 goto out;
1363 } 1353 }
1364 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; 1354 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE;
@@ -1380,7 +1370,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1380 } 1370 }
1381 if (!(ndlp->nlp_type & NLP_FCP_TARGET) && 1371 if (!(ndlp->nlp_type & NLP_FCP_TARGET) &&
1382 (vport->port_type == LPFC_NPIV_PORT) && 1372 (vport->port_type == LPFC_NPIV_PORT) &&
1383 phba->cfg_vport_restrict_login) { 1373 vport->cfg_restrict_login) {
1384out: 1374out:
1385 spin_lock_irq(shost->host_lock); 1375 spin_lock_irq(shost->host_lock);
1386 ndlp->nlp_flag |= NLP_TARGET_REMOVE; 1376 ndlp->nlp_flag |= NLP_TARGET_REMOVE;
@@ -1529,7 +1519,7 @@ lpfc_rcv_prlo_unmap_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1529{ 1519{
1530 struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; 1520 struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg;
1531 1521
1532 lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); 1522 lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL);
1533 return ndlp->nlp_state; 1523 return ndlp->nlp_state;
1534} 1524}
1535 1525
@@ -1600,8 +1590,8 @@ lpfc_rcv_prlo_mapped_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1600 struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; 1590 struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg;
1601 1591
1602 /* flush the target */ 1592 /* flush the target */
1603 lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], 1593 lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring],
1604 ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT); 1594 ndlp->nlp_sid, 0, LPFC_CTX_TGT);
1605 1595
1606 /* Treat like rcv logo */ 1596 /* Treat like rcv logo */
1607 lpfc_rcv_logo(vport, ndlp, cmdiocb, ELS_CMD_PRLO); 1597 lpfc_rcv_logo(vport, ndlp, cmdiocb, ELS_CMD_PRLO);
@@ -1734,7 +1724,7 @@ lpfc_rcv_prlo_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1734 ndlp->nlp_flag |= NLP_LOGO_ACC; 1724 ndlp->nlp_flag |= NLP_LOGO_ACC;
1735 spin_unlock_irq(shost->host_lock); 1725 spin_unlock_irq(shost->host_lock);
1736 1726
1737 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 1727 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
1738 1728
1739 if ((ndlp->nlp_flag & NLP_DELAY_TMO) == 0) { 1729 if ((ndlp->nlp_flag & NLP_DELAY_TMO) == 0) {
1740 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1); 1730 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1);
@@ -2047,7 +2037,6 @@ int
2047lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, 2037lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2048 void *arg, uint32_t evt) 2038 void *arg, uint32_t evt)
2049{ 2039{
2050 struct lpfc_hba *phba = vport->phba;
2051 uint32_t cur_state, rc; 2040 uint32_t cur_state, rc;
2052 uint32_t(*func) (struct lpfc_vport *, struct lpfc_nodelist *, void *, 2041 uint32_t(*func) (struct lpfc_vport *, struct lpfc_nodelist *, void *,
2053 uint32_t); 2042 uint32_t);
@@ -2056,11 +2045,10 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2056 cur_state = ndlp->nlp_state; 2045 cur_state = ndlp->nlp_state;
2057 2046
2058 /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ 2047 /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */
2059 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 2048 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2060 "%d (%d):0211 DSM in event x%x on NPort x%x in " 2049 "0211 DSM in event x%x on NPort x%x in "
2061 "state %d Data: x%x\n", 2050 "state %d Data: x%x\n",
2062 phba->brd_no, vport->vpi, 2051 evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag);
2063 evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag);
2064 2052
2065 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, 2053 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM,
2066 "DSM in: evt:%d ste:%d did:x%x", 2054 "DSM in: evt:%d ste:%d did:x%x",
@@ -2070,11 +2058,9 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2070 rc = (func) (vport, ndlp, arg, evt); 2058 rc = (func) (vport, ndlp, arg, evt);
2071 2059
2072 /* DSM out state <rc> on NPort <nlp_DID> */ 2060 /* DSM out state <rc> on NPort <nlp_DID> */
2073 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 2061 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2074 "%d (%d):0212 DSM out state %d on NPort x%x " 2062 "0212 DSM out state %d on NPort x%x Data: x%x\n",
2075 "Data: x%x\n", 2063 rc, ndlp->nlp_DID, ndlp->nlp_flag);
2076 phba->brd_no, vport->vpi,
2077 rc, ndlp->nlp_DID, ndlp->nlp_flag);
2078 2064
2079 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, 2065 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM,
2080 "DSM out: ste:%d did:x%x flg:x%x", 2066 "DSM out: ste:%d did:x%x flg:x%x",
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 8f45bbc42126..17d7dc05149b 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -84,22 +84,21 @@ lpfc_adjust_queue_depth(struct lpfc_hba *phba)
84 * SCSI command completion. 84 * SCSI command completion.
85 */ 85 */
86static inline void 86static inline void
87lpfc_rampup_queue_depth(struct lpfc_hba *phba, 87lpfc_rampup_queue_depth(struct lpfc_vport *vport,
88 struct scsi_device *sdev) 88 struct scsi_device *sdev)
89{ 89{
90 unsigned long flags; 90 unsigned long flags;
91 struct lpfc_hba *phba = vport->phba;
91 atomic_inc(&phba->num_cmd_success); 92 atomic_inc(&phba->num_cmd_success);
92 93
93 if (phba->cfg_lun_queue_depth <= sdev->queue_depth) 94 if (vport->cfg_lun_queue_depth <= sdev->queue_depth)
94 return; 95 return;
95
96 spin_lock_irqsave(&phba->hbalock, flags); 96 spin_lock_irqsave(&phba->hbalock, flags);
97 if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) || 97 if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) ||
98 ((phba->last_rsrc_error_time + QUEUE_RAMP_UP_INTERVAL ) > jiffies)) { 98 ((phba->last_rsrc_error_time + QUEUE_RAMP_UP_INTERVAL ) > jiffies)) {
99 spin_unlock_irqrestore(&phba->hbalock, flags); 99 spin_unlock_irqrestore(&phba->hbalock, flags);
100 return; 100 return;
101 } 101 }
102
103 phba->last_ramp_up_time = jiffies; 102 phba->last_ramp_up_time = jiffies;
104 spin_unlock_irqrestore(&phba->hbalock, flags); 103 spin_unlock_irqrestore(&phba->hbalock, flags);
105 104
@@ -119,43 +118,40 @@ lpfc_rampup_queue_depth(struct lpfc_hba *phba,
119void 118void
120lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) 119lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
121{ 120{
122 struct lpfc_vport *vport; 121 struct lpfc_vport **vports;
123 struct Scsi_Host *host; 122 struct Scsi_Host *shost;
124 struct scsi_device *sdev; 123 struct scsi_device *sdev;
125 unsigned long new_queue_depth; 124 unsigned long new_queue_depth;
126 unsigned long num_rsrc_err, num_cmd_success; 125 unsigned long num_rsrc_err, num_cmd_success;
126 int i;
127 127
128 num_rsrc_err = atomic_read(&phba->num_rsrc_err); 128 num_rsrc_err = atomic_read(&phba->num_rsrc_err);
129 num_cmd_success = atomic_read(&phba->num_cmd_success); 129 num_cmd_success = atomic_read(&phba->num_cmd_success);
130 130
131 spin_lock_irq(&phba->hbalock); 131 vports = lpfc_create_vport_work_array(phba);
132 list_for_each_entry(vport, &phba->port_list, listentry) { 132 if (vports != NULL)
133 host = lpfc_shost_from_vport(vport); 133 for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
134 if (!scsi_host_get(host)) 134 shost = lpfc_shost_from_vport(vports[i]);
135 continue; 135 shost_for_each_device(sdev, shost) {
136
137 spin_unlock_irq(&phba->hbalock);
138
139 shost_for_each_device(sdev, host) {
140 new_queue_depth = sdev->queue_depth * num_rsrc_err /
141 (num_rsrc_err + num_cmd_success);
142 if (!new_queue_depth)
143 new_queue_depth = sdev->queue_depth - 1;
144 else
145 new_queue_depth = 136 new_queue_depth =
146 sdev->queue_depth - new_queue_depth; 137 sdev->queue_depth * num_rsrc_err /
147 138 (num_rsrc_err + num_cmd_success);
148 if (sdev->ordered_tags) 139 if (!new_queue_depth)
149 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, 140 new_queue_depth = sdev->queue_depth - 1;
150 new_queue_depth); 141 else
151 else 142 new_queue_depth = sdev->queue_depth -
152 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, 143 new_queue_depth;
153 new_queue_depth); 144 if (sdev->ordered_tags)
145 scsi_adjust_queue_depth(sdev,
146 MSG_ORDERED_TAG,
147 new_queue_depth);
148 else
149 scsi_adjust_queue_depth(sdev,
150 MSG_SIMPLE_TAG,
151 new_queue_depth);
152 }
154 } 153 }
155 spin_lock_irq(&phba->hbalock); 154 lpfc_destroy_vport_work_array(vports);
156 scsi_host_put(host);
157 }
158 spin_unlock_irq(&phba->hbalock);
159 atomic_set(&phba->num_rsrc_err, 0); 155 atomic_set(&phba->num_rsrc_err, 0);
160 atomic_set(&phba->num_cmd_success, 0); 156 atomic_set(&phba->num_cmd_success, 0);
161} 157}
@@ -163,29 +159,27 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
163void 159void
164lpfc_ramp_up_queue_handler(struct lpfc_hba *phba) 160lpfc_ramp_up_queue_handler(struct lpfc_hba *phba)
165{ 161{
166 struct lpfc_vport *vport; 162 struct lpfc_vport **vports;
167 struct Scsi_Host *host; 163 struct Scsi_Host *shost;
168 struct scsi_device *sdev; 164 struct scsi_device *sdev;
169 165 int i;
170 spin_lock_irq(&phba->hbalock); 166
171 list_for_each_entry(vport, &phba->port_list, listentry) { 167 vports = lpfc_create_vport_work_array(phba);
172 host = lpfc_shost_from_vport(vport); 168 if (vports != NULL)
173 if (!scsi_host_get(host)) 169 for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
174 continue; 170 shost = lpfc_shost_from_vport(vports[i]);
175 171 shost_for_each_device(sdev, shost) {
176 spin_unlock_irq(&phba->hbalock); 172 if (sdev->ordered_tags)
177 shost_for_each_device(sdev, host) { 173 scsi_adjust_queue_depth(sdev,
178 if (sdev->ordered_tags) 174 MSG_ORDERED_TAG,
179 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, 175 sdev->queue_depth+1);
180 sdev->queue_depth+1); 176 else
181 else 177 scsi_adjust_queue_depth(sdev,
182 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, 178 MSG_SIMPLE_TAG,
183 sdev->queue_depth+1); 179 sdev->queue_depth+1);
180 }
184 } 181 }
185 spin_lock_irq(&phba->hbalock); 182 lpfc_destroy_vport_work_array(vports);
186 scsi_host_put(host);
187 }
188 spin_unlock_irq(&phba->hbalock);
189 atomic_set(&phba->num_rsrc_err, 0); 183 atomic_set(&phba->num_rsrc_err, 0);
190 atomic_set(&phba->num_cmd_success, 0); 184 atomic_set(&phba->num_cmd_success, 0);
191} 185}
@@ -411,9 +405,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
411 struct scsi_cmnd *cmnd = lpfc_cmd->pCmd; 405 struct scsi_cmnd *cmnd = lpfc_cmd->pCmd;
412 struct fcp_cmnd *fcpcmd = lpfc_cmd->fcp_cmnd; 406 struct fcp_cmnd *fcpcmd = lpfc_cmd->fcp_cmnd;
413 struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp; 407 struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp;
414 struct lpfc_hba *phba = vport->phba;
415 uint32_t fcpi_parm = rsp_iocb->iocb.un.fcpi.fcpi_parm; 408 uint32_t fcpi_parm = rsp_iocb->iocb.un.fcpi.fcpi_parm;
416 uint32_t vpi = vport->vpi;
417 uint32_t resp_info = fcprsp->rspStatus2; 409 uint32_t resp_info = fcprsp->rspStatus2;
418 uint32_t scsi_status = fcprsp->rspStatus3; 410 uint32_t scsi_status = fcprsp->rspStatus3;
419 uint32_t *lp; 411 uint32_t *lp;
@@ -445,15 +437,15 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
445 if (!scsi_status && (resp_info & RESID_UNDER)) 437 if (!scsi_status && (resp_info & RESID_UNDER))
446 logit = LOG_FCP; 438 logit = LOG_FCP;
447 439
448 lpfc_printf_log(phba, KERN_WARNING, logit, 440 lpfc_printf_vlog(vport, KERN_WARNING, logit,
449 "%d (%d):0730 FCP command x%x failed: x%x SNS x%x x%x " 441 "0730 FCP command x%x failed: x%x SNS x%x x%x "
450 "Data: x%x x%x x%x x%x x%x\n", 442 "Data: x%x x%x x%x x%x x%x\n",
451 phba->brd_no, vpi, cmnd->cmnd[0], scsi_status, 443 cmnd->cmnd[0], scsi_status,
452 be32_to_cpu(*lp), be32_to_cpu(*(lp + 3)), resp_info, 444 be32_to_cpu(*lp), be32_to_cpu(*(lp + 3)), resp_info,
453 be32_to_cpu(fcprsp->rspResId), 445 be32_to_cpu(fcprsp->rspResId),
454 be32_to_cpu(fcprsp->rspSnsLen), 446 be32_to_cpu(fcprsp->rspSnsLen),
455 be32_to_cpu(fcprsp->rspRspLen), 447 be32_to_cpu(fcprsp->rspRspLen),
456 fcprsp->rspInfo3); 448 fcprsp->rspInfo3);
457 449
458 if (resp_info & RSP_LEN_VALID) { 450 if (resp_info & RSP_LEN_VALID) {
459 rsplen = be32_to_cpu(fcprsp->rspRspLen); 451 rsplen = be32_to_cpu(fcprsp->rspRspLen);
@@ -468,12 +460,12 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
468 if (resp_info & RESID_UNDER) { 460 if (resp_info & RESID_UNDER) {
469 scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId)); 461 scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId));
470 462
471 lpfc_printf_log(phba, KERN_INFO, LOG_FCP, 463 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
472 "%d (%d):0716 FCP Read Underrun, expected %d, " 464 "0716 FCP Read Underrun, expected %d, "
473 "residual %d Data: x%x x%x x%x\n", 465 "residual %d Data: x%x x%x x%x\n",
474 phba->brd_no, vpi, be32_to_cpu(fcpcmd->fcpDl), 466 be32_to_cpu(fcpcmd->fcpDl),
475 scsi_get_resid(cmnd), fcpi_parm, cmnd->cmnd[0], 467 scsi_get_resid(cmnd), fcpi_parm, cmnd->cmnd[0],
476 cmnd->underflow); 468 cmnd->underflow);
477 469
478 /* 470 /*
479 * If there is an under run check if under run reported by 471 * If there is an under run check if under run reported by
@@ -483,14 +475,13 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
483 if ((cmnd->sc_data_direction == DMA_FROM_DEVICE) && 475 if ((cmnd->sc_data_direction == DMA_FROM_DEVICE) &&
484 fcpi_parm && 476 fcpi_parm &&
485 (scsi_get_resid(cmnd) != fcpi_parm)) { 477 (scsi_get_resid(cmnd) != fcpi_parm)) {
486 lpfc_printf_log(phba, KERN_WARNING, 478 lpfc_printf_vlog(vport, KERN_WARNING,
487 LOG_FCP | LOG_FCP_ERROR, 479 LOG_FCP | LOG_FCP_ERROR,
488 "%d (%d):0735 FCP Read Check Error " 480 "0735 FCP Read Check Error "
489 "and Underrun Data: x%x x%x x%x x%x\n", 481 "and Underrun Data: x%x x%x x%x x%x\n",
490 phba->brd_no, vpi, 482 be32_to_cpu(fcpcmd->fcpDl),
491 be32_to_cpu(fcpcmd->fcpDl), 483 scsi_get_resid(cmnd), fcpi_parm,
492 scsi_get_resid(cmnd), fcpi_parm, 484 cmnd->cmnd[0]);
493 cmnd->cmnd[0]);
494 scsi_set_resid(cmnd, scsi_bufflen(cmnd)); 485 scsi_set_resid(cmnd, scsi_bufflen(cmnd));
495 host_status = DID_ERROR; 486 host_status = DID_ERROR;
496 } 487 }
@@ -504,21 +495,19 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
504 (scsi_status == SAM_STAT_GOOD) && 495 (scsi_status == SAM_STAT_GOOD) &&
505 (scsi_bufflen(cmnd) - scsi_get_resid(cmnd) 496 (scsi_bufflen(cmnd) - scsi_get_resid(cmnd)
506 < cmnd->underflow)) { 497 < cmnd->underflow)) {
507 lpfc_printf_log(phba, KERN_INFO, LOG_FCP, 498 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
508 "%d (%d):0717 FCP command x%x residual " 499 "0717 FCP command x%x residual "
509 "underrun converted to error " 500 "underrun converted to error "
510 "Data: x%x x%x x%x\n", 501 "Data: x%x x%x x%x\n",
511 phba->brd_no, vpi, cmnd->cmnd[0], 502 cmnd->cmnd[0], scsi_bufflen(cmnd),
512 scsi_bufflen(cmnd), 503 scsi_get_resid(cmnd), cmnd->underflow);
513 scsi_get_resid(cmnd), cmnd->underflow);
514 host_status = DID_ERROR; 504 host_status = DID_ERROR;
515 } 505 }
516 } else if (resp_info & RESID_OVER) { 506 } else if (resp_info & RESID_OVER) {
517 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, 507 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
518 "%d (%d):0720 FCP command x%x residual " 508 "0720 FCP command x%x residual overrun error. "
519 "overrun error. Data: x%x x%x \n", 509 "Data: x%x x%x \n", cmnd->cmnd[0],
520 phba->brd_no, vpi, cmnd->cmnd[0], 510 scsi_bufflen(cmnd), scsi_get_resid(cmnd));
521 scsi_bufflen(cmnd), scsi_get_resid(cmnd));
522 host_status = DID_ERROR; 511 host_status = DID_ERROR;
523 512
524 /* 513 /*
@@ -527,13 +516,12 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
527 */ 516 */
528 } else if ((scsi_status == SAM_STAT_GOOD) && fcpi_parm && 517 } else if ((scsi_status == SAM_STAT_GOOD) && fcpi_parm &&
529 (cmnd->sc_data_direction == DMA_FROM_DEVICE)) { 518 (cmnd->sc_data_direction == DMA_FROM_DEVICE)) {
530 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR, 519 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR,
531 "%d (%d):0734 FCP Read Check Error Data: " 520 "0734 FCP Read Check Error Data: "
532 "x%x x%x x%x x%x\n", 521 "x%x x%x x%x x%x\n",
533 phba->brd_no, vpi, 522 be32_to_cpu(fcpcmd->fcpDl),
534 be32_to_cpu(fcpcmd->fcpDl), 523 be32_to_cpu(fcprsp->rspResId),
535 be32_to_cpu(fcprsp->rspResId), 524 fcpi_parm, cmnd->cmnd[0]);
536 fcpi_parm, cmnd->cmnd[0]);
537 host_status = DID_ERROR; 525 host_status = DID_ERROR;
538 scsi_set_resid(cmnd, scsi_bufflen(cmnd)); 526 scsi_set_resid(cmnd, scsi_bufflen(cmnd));
539 } 527 }
@@ -552,9 +540,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
552 struct lpfc_rport_data *rdata = lpfc_cmd->rdata; 540 struct lpfc_rport_data *rdata = lpfc_cmd->rdata;
553 struct lpfc_nodelist *pnode = rdata->pnode; 541 struct lpfc_nodelist *pnode = rdata->pnode;
554 struct scsi_cmnd *cmd = lpfc_cmd->pCmd; 542 struct scsi_cmnd *cmd = lpfc_cmd->pCmd;
555 uint32_t vpi = (lpfc_cmd->cur_iocbq.vport
556 ? lpfc_cmd->cur_iocbq.vport->vpi
557 : 0);
558 int result; 543 int result;
559 struct scsi_device *sdev, *tmp_sdev; 544 struct scsi_device *sdev, *tmp_sdev;
560 int depth = 0; 545 int depth = 0;
@@ -569,15 +554,15 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
569 else if (lpfc_cmd->status >= IOSTAT_CNT) 554 else if (lpfc_cmd->status >= IOSTAT_CNT)
570 lpfc_cmd->status = IOSTAT_DEFAULT; 555 lpfc_cmd->status = IOSTAT_DEFAULT;
571 556
572 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, 557 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
573 "%d (%d):0729 FCP cmd x%x failed <%d/%d> " 558 "0729 FCP cmd x%x failed <%d/%d> "
574 "status: x%x result: x%x Data: x%x x%x\n", 559 "status: x%x result: x%x Data: x%x x%x\n",
575 phba->brd_no, vpi, cmd->cmnd[0], 560 cmd->cmnd[0],
576 cmd->device ? cmd->device->id : 0xffff, 561 cmd->device ? cmd->device->id : 0xffff,
577 cmd->device ? cmd->device->lun : 0xffff, 562 cmd->device ? cmd->device->lun : 0xffff,
578 lpfc_cmd->status, lpfc_cmd->result, 563 lpfc_cmd->status, lpfc_cmd->result,
579 pIocbOut->iocb.ulpContext, 564 pIocbOut->iocb.ulpContext,
580 lpfc_cmd->cur_iocbq.iocb.ulpIoTag); 565 lpfc_cmd->cur_iocbq.iocb.ulpIoTag);
581 566
582 switch (lpfc_cmd->status) { 567 switch (lpfc_cmd->status) {
583 case IOSTAT_FCP_RSP_ERROR: 568 case IOSTAT_FCP_RSP_ERROR:
@@ -610,13 +595,12 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
610 if (cmd->result || lpfc_cmd->fcp_rsp->rspSnsLen) { 595 if (cmd->result || lpfc_cmd->fcp_rsp->rspSnsLen) {
611 uint32_t *lp = (uint32_t *)cmd->sense_buffer; 596 uint32_t *lp = (uint32_t *)cmd->sense_buffer;
612 597
613 lpfc_printf_log(phba, KERN_INFO, LOG_FCP, 598 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
614 "%d (%d):0710 Iodone <%d/%d> cmd %p, error " 599 "0710 Iodone <%d/%d> cmd %p, error "
615 "x%x SNS x%x x%x Data: x%x x%x\n", 600 "x%x SNS x%x x%x Data: x%x x%x\n",
616 phba->brd_no, vpi, cmd->device->id, 601 cmd->device->id, cmd->device->lun, cmd,
617 cmd->device->lun, cmd, cmd->result, 602 cmd->result, *lp, *(lp + 3), cmd->retries,
618 *lp, *(lp + 3), cmd->retries, 603 scsi_get_resid(cmd));
619 scsi_get_resid(cmd));
620 } 604 }
621 605
622 result = cmd->result; 606 result = cmd->result;
@@ -631,16 +615,16 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
631 615
632 616
633 if (!result) 617 if (!result)
634 lpfc_rampup_queue_depth(phba, sdev); 618 lpfc_rampup_queue_depth(vport, sdev);
635 619
636 if (!result && pnode != NULL && 620 if (!result && pnode != NULL &&
637 ((jiffies - pnode->last_ramp_up_time) > 621 ((jiffies - pnode->last_ramp_up_time) >
638 LPFC_Q_RAMP_UP_INTERVAL * HZ) && 622 LPFC_Q_RAMP_UP_INTERVAL * HZ) &&
639 ((jiffies - pnode->last_q_full_time) > 623 ((jiffies - pnode->last_q_full_time) >
640 LPFC_Q_RAMP_UP_INTERVAL * HZ) && 624 LPFC_Q_RAMP_UP_INTERVAL * HZ) &&
641 (phba->cfg_lun_queue_depth > sdev->queue_depth)) { 625 (vport->cfg_lun_queue_depth > sdev->queue_depth)) {
642 shost_for_each_device(tmp_sdev, sdev->host) { 626 shost_for_each_device(tmp_sdev, sdev->host) {
643 if (phba->cfg_lun_queue_depth > tmp_sdev->queue_depth) { 627 if (vport->cfg_lun_queue_depth > tmp_sdev->queue_depth){
644 if (tmp_sdev->id != sdev->id) 628 if (tmp_sdev->id != sdev->id)
645 continue; 629 continue;
646 if (tmp_sdev->ordered_tags) 630 if (tmp_sdev->ordered_tags)
@@ -680,10 +664,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
680 depth = sdev->host->cmd_per_lun; 664 depth = sdev->host->cmd_per_lun;
681 665
682 if (depth) { 666 if (depth) {
683 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, 667 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
684 "%d (%d):0711 detected queue full - " 668 "0711 detected queue full - lun queue "
685 "lun queue depth adjusted to %d.\n", 669 "depth adjusted to %d.\n", depth);
686 phba->brd_no, vpi, depth);
687 } 670 }
688 } 671 }
689 672
@@ -853,12 +836,9 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_vport *vport,
853 return FAILED; 836 return FAILED;
854 837
855 /* Issue Target Reset to TGT <num> */ 838 /* Issue Target Reset to TGT <num> */
856 lpfc_printf_log(phba, KERN_INFO, LOG_FCP, 839 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
857 "%d (%d):0702 Issue Target Reset to TGT %d " 840 "0702 Issue Target Reset to TGT %d Data: x%x x%x\n",
858 "Data: x%x x%x\n", 841 tgt_id, rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag);
859 phba->brd_no, vport->vpi, tgt_id,
860 rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag);
861
862 ret = lpfc_sli_issue_iocb_wait(phba, 842 ret = lpfc_sli_issue_iocb_wait(phba,
863 &phba->sli.ring[phba->sli.fcp_ring], 843 &phba->sli.ring[phba->sli.fcp_ring],
864 iocbq, iocbqrsp, lpfc_cmd->timeout); 844 iocbq, iocbqrsp, lpfc_cmd->timeout);
@@ -965,10 +945,9 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
965 if (lpfc_cmd == NULL) { 945 if (lpfc_cmd == NULL) {
966 lpfc_adjust_queue_depth(phba); 946 lpfc_adjust_queue_depth(phba);
967 947
968 lpfc_printf_log(phba, KERN_INFO, LOG_FCP, 948 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
969 "%d (%d):0707 driver's buffer pool is empty, " 949 "0707 driver's buffer pool is empty, "
970 "IO busied\n", 950 "IO busied\n");
971 phba->brd_no, vport->vpi);
972 goto out_host_busy; 951 goto out_host_busy;
973 } 952 }
974 953
@@ -1103,28 +1082,25 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
1103 1082
1104 schedule_timeout_uninterruptible(LPFC_ABORT_WAIT * HZ); 1083 schedule_timeout_uninterruptible(LPFC_ABORT_WAIT * HZ);
1105 if (++loop_count 1084 if (++loop_count
1106 > (2 * phba->cfg_devloss_tmo)/LPFC_ABORT_WAIT) 1085 > (2 * vport->cfg_devloss_tmo)/LPFC_ABORT_WAIT)
1107 break; 1086 break;
1108 } 1087 }
1109 1088
1110 if (lpfc_cmd->pCmd == cmnd) { 1089 if (lpfc_cmd->pCmd == cmnd) {
1111 ret = FAILED; 1090 ret = FAILED;
1112 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1091 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1113 "%d (%d):0748 abort handler timed out waiting " 1092 "0748 abort handler timed out waiting "
1114 "for abort to complete: ret %#x, ID %d, " 1093 "for abort to complete: ret %#x, ID %d, "
1115 "LUN %d, snum %#lx\n", 1094 "LUN %d, snum %#lx\n",
1116 phba->brd_no, vport->vpi, ret, 1095 ret, cmnd->device->id, cmnd->device->lun,
1117 cmnd->device->id, cmnd->device->lun, 1096 cmnd->serial_number);
1118 cmnd->serial_number);
1119 } 1097 }
1120 1098
1121 out: 1099 out:
1122 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, 1100 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
1123 "%d (%d):0749 SCSI Layer I/O Abort Request " 1101 "0749 SCSI Layer I/O Abort Request Status x%x ID %d "
1124 "Status x%x ID %d LUN %d snum %#lx\n", 1102 "LUN %d snum %#lx\n", ret, cmnd->device->id,
1125 phba->brd_no, vport->vpi, ret, cmnd->device->id, 1103 cmnd->device->lun, cmnd->serial_number);
1126 cmnd->device->lun, cmnd->serial_number);
1127
1128 return ret; 1104 return ret;
1129} 1105}
1130 1106
@@ -1158,12 +1134,11 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
1158 loopcnt++; 1134 loopcnt++;
1159 rdata = cmnd->device->hostdata; 1135 rdata = cmnd->device->hostdata;
1160 if (!rdata || 1136 if (!rdata ||
1161 (loopcnt > ((phba->cfg_devloss_tmo * 2) + 1))) { 1137 (loopcnt > ((vport->cfg_devloss_tmo * 2) + 1))){
1162 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1138 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1163 "%d (%d):0721 LUN Reset rport " 1139 "0721 LUN Reset rport "
1164 "failure: cnt x%x rdata x%p\n", 1140 "failure: cnt x%x rdata x%p\n",
1165 phba->brd_no, vport->vpi, 1141 loopcnt, rdata);
1166 loopcnt, rdata);
1167 goto out; 1142 goto out;
1168 } 1143 }
1169 pnode = rdata->pnode; 1144 pnode = rdata->pnode;
@@ -1193,12 +1168,10 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
1193 if (iocbqrsp == NULL) 1168 if (iocbqrsp == NULL)
1194 goto out_free_scsi_buf; 1169 goto out_free_scsi_buf;
1195 1170
1196 lpfc_printf_log(phba, KERN_INFO, LOG_FCP, 1171 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
1197 "%d (%d):0703 Issue target reset to TGT %d LUN %d " 1172 "0703 Issue target reset to TGT %d LUN %d "
1198 "rpi x%x nlp_flag x%x\n", 1173 "rpi x%x nlp_flag x%x\n", cmnd->device->id,
1199 phba->brd_no, vport->vpi, cmnd->device->id, 1174 cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag);
1200 cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag);
1201
1202 iocb_status = lpfc_sli_issue_iocb_wait(phba, 1175 iocb_status = lpfc_sli_issue_iocb_wait(phba,
1203 &phba->sli.ring[phba->sli.fcp_ring], 1176 &phba->sli.ring[phba->sli.fcp_ring],
1204 iocbq, iocbqrsp, lpfc_cmd->timeout); 1177 iocbq, iocbqrsp, lpfc_cmd->timeout);
@@ -1221,33 +1194,28 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
1221 * Unfortunately, some targets do not abide by this forcing the driver 1194 * Unfortunately, some targets do not abide by this forcing the driver
1222 * to double check. 1195 * to double check.
1223 */ 1196 */
1224 cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], 1197 cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id, cmnd->device->lun,
1225 cmnd->device->id, cmnd->device->lun,
1226 LPFC_CTX_LUN); 1198 LPFC_CTX_LUN);
1227 if (cnt) 1199 if (cnt)
1228 lpfc_sli_abort_iocb(phba, 1200 lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring],
1229 &phba->sli.ring[phba->sli.fcp_ring],
1230 cmnd->device->id, cmnd->device->lun, 1201 cmnd->device->id, cmnd->device->lun,
1231 0, LPFC_CTX_LUN); 1202 LPFC_CTX_LUN);
1232 loopcnt = 0; 1203 loopcnt = 0;
1233 while(cnt) { 1204 while(cnt) {
1234 schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); 1205 schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ);
1235 1206
1236 if (++loopcnt 1207 if (++loopcnt
1237 > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT) 1208 > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT)
1238 break; 1209 break;
1239 1210
1240 cnt = lpfc_sli_sum_iocb(phba, 1211 cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id,
1241 &phba->sli.ring[phba->sli.fcp_ring], 1212 cmnd->device->lun, LPFC_CTX_LUN);
1242 cmnd->device->id, cmnd->device->lun,
1243 LPFC_CTX_LUN);
1244 } 1213 }
1245 1214
1246 if (cnt) { 1215 if (cnt) {
1247 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1216 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1248 "%d (%d):0719 device reset I/O flush failure: " 1217 "0719 device reset I/O flush failure: "
1249 "cnt x%x\n", 1218 "cnt x%x\n", cnt);
1250 phba->brd_no, vport->vpi, cnt);
1251 ret = FAILED; 1219 ret = FAILED;
1252 } 1220 }
1253 1221
@@ -1255,12 +1223,11 @@ out_free_scsi_buf:
1255 if (iocb_status != IOCB_TIMEDOUT) { 1223 if (iocb_status != IOCB_TIMEDOUT) {
1256 lpfc_release_scsi_buf(phba, lpfc_cmd); 1224 lpfc_release_scsi_buf(phba, lpfc_cmd);
1257 } 1225 }
1258 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1226 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1259 "%d (%d):0713 SCSI layer issued device reset (%d, %d) " 1227 "0713 SCSI layer issued device reset (%d, %d) "
1260 "return x%x status x%x result x%x\n", 1228 "return x%x status x%x result x%x\n",
1261 phba->brd_no, vport->vpi, cmnd->device->id, 1229 cmnd->device->id, cmnd->device->lun, ret,
1262 cmnd->device->lun, ret, cmd_status, cmd_result); 1230 cmd_status, cmd_result);
1263
1264out: 1231out:
1265 return ret; 1232 return ret;
1266} 1233}
@@ -1311,10 +1278,9 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
1311 cmnd->device->lun, 1278 cmnd->device->lun,
1312 ndlp->rport->dd_data); 1279 ndlp->rport->dd_data);
1313 if (ret != SUCCESS) { 1280 if (ret != SUCCESS) {
1314 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1281 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1315 "%d (%d):0700 Bus Reset on target %d " 1282 "0700 Bus Reset on target %d failed\n",
1316 "failed\n", 1283 i);
1317 phba->brd_no, vport->vpi, i);
1318 err_count++; 1284 err_count++;
1319 break; 1285 break;
1320 } 1286 }
@@ -1333,35 +1299,30 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
1333 * the targets. Unfortunately, some targets do not abide by 1299 * the targets. Unfortunately, some targets do not abide by
1334 * this forcing the driver to double check. 1300 * this forcing the driver to double check.
1335 */ 1301 */
1336 cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], 1302 cnt = lpfc_sli_sum_iocb(vport, 0, 0, LPFC_CTX_HOST);
1337 0, 0, LPFC_CTX_HOST);
1338 if (cnt) 1303 if (cnt)
1339 lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], 1304 lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring],
1340 0, 0, 0, LPFC_CTX_HOST); 1305 0, 0, LPFC_CTX_HOST);
1341 loopcnt = 0; 1306 loopcnt = 0;
1342 while(cnt) { 1307 while(cnt) {
1343 schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); 1308 schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ);
1344 1309
1345 if (++loopcnt 1310 if (++loopcnt
1346 > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT) 1311 > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT)
1347 break; 1312 break;
1348 1313
1349 cnt = lpfc_sli_sum_iocb(phba, 1314 cnt = lpfc_sli_sum_iocb(vport, 0, 0, LPFC_CTX_HOST);
1350 &phba->sli.ring[phba->sli.fcp_ring],
1351 0, 0, LPFC_CTX_HOST);
1352 } 1315 }
1353 1316
1354 if (cnt) { 1317 if (cnt) {
1355 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1318 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1356 "%d (%d):0715 Bus Reset I/O flush failure: " 1319 "0715 Bus Reset I/O flush failure: "
1357 "cnt x%x left x%x\n", 1320 "cnt x%x left x%x\n", cnt, i);
1358 phba->brd_no, vport->vpi, cnt, i);
1359 ret = FAILED; 1321 ret = FAILED;
1360 } 1322 }
1361 1323
1362 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1324 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1363 "%d (%d):0714 SCSI layer issued Bus Reset Data: x%x\n", 1325 "0714 SCSI layer issued Bus Reset Data: x%x\n", ret);
1364 phba->brd_no, vport->vpi, ret);
1365out: 1326out:
1366 return ret; 1327 return ret;
1367} 1328}
@@ -1390,36 +1351,32 @@ lpfc_slave_alloc(struct scsi_device *sdev)
1390 * extra. This list of scsi bufs exists for the lifetime of the driver. 1351 * extra. This list of scsi bufs exists for the lifetime of the driver.
1391 */ 1352 */
1392 total = phba->total_scsi_bufs; 1353 total = phba->total_scsi_bufs;
1393 num_to_alloc = phba->cfg_lun_queue_depth + 2; 1354 num_to_alloc = vport->cfg_lun_queue_depth + 2;
1394 1355
1395 /* Allow some exchanges to be available always to complete discovery */ 1356 /* Allow some exchanges to be available always to complete discovery */
1396 if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { 1357 if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) {
1397 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, 1358 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
1398 "%d (%d):0704 At limitation of %d " 1359 "0704 At limitation of %d preallocated "
1399 "preallocated command buffers\n", 1360 "command buffers\n", total);
1400 phba->brd_no, vport->vpi, total);
1401 return 0; 1361 return 0;
1402
1403 /* Allow some exchanges to be available always to complete discovery */ 1362 /* Allow some exchanges to be available always to complete discovery */
1404 } else if (total + num_to_alloc > 1363 } else if (total + num_to_alloc >
1405 phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { 1364 phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) {
1406 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, 1365 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
1407 "%d (%d):0705 Allocation request of %d " 1366 "0705 Allocation request of %d "
1408 "command buffers will exceed max of %d. " 1367 "command buffers will exceed max of %d. "
1409 "Reducing allocation request to %d.\n", 1368 "Reducing allocation request to %d.\n",
1410 phba->brd_no, vport->vpi, num_to_alloc, 1369 num_to_alloc, phba->cfg_hba_queue_depth,
1411 phba->cfg_hba_queue_depth, 1370 (phba->cfg_hba_queue_depth - total));
1412 (phba->cfg_hba_queue_depth - total));
1413 num_to_alloc = phba->cfg_hba_queue_depth - total; 1371 num_to_alloc = phba->cfg_hba_queue_depth - total;
1414 } 1372 }
1415 1373
1416 for (i = 0; i < num_to_alloc; i++) { 1374 for (i = 0; i < num_to_alloc; i++) {
1417 scsi_buf = lpfc_new_scsi_buf(vport); 1375 scsi_buf = lpfc_new_scsi_buf(vport);
1418 if (!scsi_buf) { 1376 if (!scsi_buf) {
1419 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1377 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
1420 "%d (%d):0706 Failed to allocate " 1378 "0706 Failed to allocate "
1421 "command buffer\n", 1379 "command buffer\n");
1422 phba->brd_no, vport->vpi);
1423 break; 1380 break;
1424 } 1381 }
1425 1382
@@ -1439,9 +1396,9 @@ lpfc_slave_configure(struct scsi_device *sdev)
1439 struct fc_rport *rport = starget_to_rport(sdev->sdev_target); 1396 struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
1440 1397
1441 if (sdev->tagged_supported) 1398 if (sdev->tagged_supported)
1442 scsi_activate_tcq(sdev, phba->cfg_lun_queue_depth); 1399 scsi_activate_tcq(sdev, vport->cfg_lun_queue_depth);
1443 else 1400 else
1444 scsi_deactivate_tcq(sdev, phba->cfg_lun_queue_depth); 1401 scsi_deactivate_tcq(sdev, vport->cfg_lun_queue_depth);
1445 1402
1446 /* 1403 /*
1447 * Initialize the fc transport attributes for the target 1404 * Initialize the fc transport attributes for the target
@@ -1449,7 +1406,7 @@ lpfc_slave_configure(struct scsi_device *sdev)
1449 * target pointer is stored in the starget_data for the 1406 * target pointer is stored in the starget_data for the
1450 * driver's sysfs entry point functions. 1407 * driver's sysfs entry point functions.
1451 */ 1408 */
1452 rport->dev_loss_tmo = phba->cfg_devloss_tmo; 1409 rport->dev_loss_tmo = vport->cfg_devloss_tmo;
1453 1410
1454 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { 1411 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
1455 lpfc_sli_poll_fcp_ring(phba); 1412 lpfc_sli_poll_fcp_ring(phba);
@@ -1487,3 +1444,23 @@ struct scsi_host_template lpfc_template = {
1487 .shost_attrs = lpfc_hba_attrs, 1444 .shost_attrs = lpfc_hba_attrs,
1488 .max_sectors = 0xFFFF, 1445 .max_sectors = 0xFFFF,
1489}; 1446};
1447
1448struct scsi_host_template lpfc_vport_template = {
1449 .module = THIS_MODULE,
1450 .name = LPFC_DRIVER_NAME,
1451 .info = lpfc_info,
1452 .queuecommand = lpfc_queuecommand,
1453 .eh_abort_handler = lpfc_abort_handler,
1454 .eh_device_reset_handler= lpfc_device_reset_handler,
1455 .eh_bus_reset_handler = lpfc_bus_reset_handler,
1456 .slave_alloc = lpfc_slave_alloc,
1457 .slave_configure = lpfc_slave_configure,
1458 .slave_destroy = lpfc_slave_destroy,
1459 .scan_finished = lpfc_scan_finished,
1460 .this_id = -1,
1461 .sg_tablesize = LPFC_SG_SEG_CNT,
1462 .cmd_per_lun = LPFC_CMD_PER_LUN,
1463 .use_clustering = ENABLE_CLUSTERING,
1464 .shost_attrs = lpfc_vport_attrs,
1465 .max_sectors = 0xFFFF,
1466};
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index f4d5a6b00fde..ce5ff2bccba6 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -49,9 +49,8 @@
49 lpfc_printf_log(phba, \ 49 lpfc_printf_log(phba, \
50 KERN_INFO, \ 50 KERN_INFO, \
51 LOG_MBOX | LOG_SLI, \ 51 LOG_MBOX | LOG_SLI, \
52 "%d (%d):0311 Mailbox command x%x cannot " \ 52 "(%d):0311 Mailbox command x%x cannot " \
53 "issue Data: x%x x%x x%x\n", \ 53 "issue Data: x%x x%x x%x\n", \
54 phba->brd_no, \
55 pmbox->vport ? pmbox->vport->vpi : 0, \ 54 pmbox->vport ? pmbox->vport->vpi : 0, \
56 pmbox->mb.mbxCommand, \ 55 pmbox->mb.mbxCommand, \
57 phba->pport->port_state, \ 56 phba->pport->port_state, \
@@ -231,13 +230,11 @@ lpfc_sli_ring_map(struct lpfc_hba *phba)
231 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); 230 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
232 if (rc != MBX_SUCCESS) { 231 if (rc != MBX_SUCCESS) {
233 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 232 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
234 "%d:0446 Adapter failed to init (%d), " 233 "0446 Adapter failed to init (%d), "
235 "mbxCmd x%x CFG_RING, mbxStatus x%x, " 234 "mbxCmd x%x CFG_RING, mbxStatus x%x, "
236 "ring %d\n", 235 "ring %d\n",
237 phba->brd_no, rc, 236 rc, pmbox->mbxCommand,
238 pmbox->mbxCommand, 237 pmbox->mbxStatus, i);
239 pmbox->mbxStatus,
240 i);
241 phba->link_state = LPFC_HBA_ERROR; 238 phba->link_state = LPFC_HBA_ERROR;
242 ret = -ENXIO; 239 ret = -ENXIO;
243 break; 240 break;
@@ -296,9 +293,9 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
296 293
297 if (unlikely(pring->local_getidx >= max_cmd_idx)) { 294 if (unlikely(pring->local_getidx >= max_cmd_idx)) {
298 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 295 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
299 "%d:0315 Ring %d issue: portCmdGet %d " 296 "0315 Ring %d issue: portCmdGet %d "
300 "is bigger then cmd ring %d\n", 297 "is bigger then cmd ring %d\n",
301 phba->brd_no, pring->ringno, 298 pring->ringno,
302 pring->local_getidx, max_cmd_idx); 299 pring->local_getidx, max_cmd_idx);
303 300
304 phba->link_state = LPFC_HBA_ERROR; 301 phba->link_state = LPFC_HBA_ERROR;
@@ -366,7 +363,7 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
366 if (psli->iocbq_lookup) 363 if (psli->iocbq_lookup)
367 memcpy(new_arr, old_arr, 364 memcpy(new_arr, old_arr,
368 ((psli->last_iotag + 1) * 365 ((psli->last_iotag + 1) *
369 sizeof (struct lpfc_iocbq *))); 366 sizeof (struct lpfc_iocbq *)));
370 psli->iocbq_lookup = new_arr; 367 psli->iocbq_lookup = new_arr;
371 psli->iocbq_lookup_len = new_len; 368 psli->iocbq_lookup_len = new_len;
372 psli->last_iotag = iotag; 369 psli->last_iotag = iotag;
@@ -380,8 +377,8 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
380 spin_unlock_irq(&phba->hbalock); 377 spin_unlock_irq(&phba->hbalock);
381 378
382 lpfc_printf_log(phba, KERN_ERR,LOG_SLI, 379 lpfc_printf_log(phba, KERN_ERR,LOG_SLI,
383 "%d:0318 Failed to allocate IOTAG.last IOTAG is %d\n", 380 "0318 Failed to allocate IOTAG.last IOTAG is %d\n",
384 phba->brd_no, psli->last_iotag); 381 psli->last_iotag);
385 382
386 return 0; 383 return 0;
387} 384}
@@ -395,6 +392,14 @@ lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
395 */ 392 */
396 nextiocb->iocb.ulpIoTag = (nextiocb->iocb_cmpl) ? nextiocb->iotag : 0; 393 nextiocb->iocb.ulpIoTag = (nextiocb->iocb_cmpl) ? nextiocb->iotag : 0;
397 394
395 if (pring->ringno == LPFC_ELS_RING) {
396 lpfc_debugfs_slow_ring_trc(phba,
397 "IOCB cmd ring: wd4:x%08x wd6:x%08x wd7:x%08x",
398 *(((uint32_t *) &nextiocb->iocb) + 4),
399 *(((uint32_t *) &nextiocb->iocb) + 6),
400 *(((uint32_t *) &nextiocb->iocb) + 7));
401 }
402
398 /* 403 /*
399 * Issue iocb command to adapter 404 * Issue iocb command to adapter
400 */ 405 */
@@ -527,10 +532,9 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno)
527 if (unlikely(hbqp->local_hbqGetIdx >= hbqp->entry_count)) { 532 if (unlikely(hbqp->local_hbqGetIdx >= hbqp->entry_count)) {
528 lpfc_printf_log(phba, KERN_ERR, 533 lpfc_printf_log(phba, KERN_ERR,
529 LOG_SLI | LOG_VPORT, 534 LOG_SLI | LOG_VPORT,
530 "%d:1802 HBQ %d: local_hbqGetIdx " 535 "1802 HBQ %d: local_hbqGetIdx "
531 "%u is > than hbqp->entry_count %u\n", 536 "%u is > than hbqp->entry_count %u\n",
532 phba->brd_no, hbqno, 537 hbqno, hbqp->local_hbqGetIdx,
533 hbqp->local_hbqGetIdx,
534 hbqp->entry_count); 538 hbqp->entry_count);
535 539
536 phba->link_state = LPFC_HBA_ERROR; 540 phba->link_state = LPFC_HBA_ERROR;
@@ -541,7 +545,8 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno)
541 return NULL; 545 return NULL;
542 } 546 }
543 547
544 return (struct lpfc_hbq_entry *) phba->hbqslimp.virt + hbqp->hbqPutIdx; 548 return (struct lpfc_hbq_entry *) phba->hbqs[hbqno].hbq_virt +
549 hbqp->hbqPutIdx;
545} 550}
546 551
547void 552void
@@ -549,18 +554,21 @@ lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba)
549{ 554{
550 struct lpfc_dmabuf *dmabuf, *next_dmabuf; 555 struct lpfc_dmabuf *dmabuf, *next_dmabuf;
551 struct hbq_dmabuf *hbq_buf; 556 struct hbq_dmabuf *hbq_buf;
557 int i, hbq_count;
552 558
559 hbq_count = lpfc_sli_hbq_count();
553 /* Return all memory used by all HBQs */ 560 /* Return all memory used by all HBQs */
554 list_for_each_entry_safe(dmabuf, next_dmabuf, 561 for (i = 0; i < hbq_count; ++i) {
555 &phba->hbq_buffer_list, list) { 562 list_for_each_entry_safe(dmabuf, next_dmabuf,
556 hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf); 563 &phba->hbqs[i].hbq_buffer_list, list) {
557 list_del(&hbq_buf->dbuf.list); 564 hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf);
558 lpfc_hbq_free(phba, hbq_buf->dbuf.virt, hbq_buf->dbuf.phys); 565 list_del(&hbq_buf->dbuf.list);
559 kfree(hbq_buf); 566 (phba->hbqs[i].hbq_free_buffer)(phba, hbq_buf);
567 }
560 } 568 }
561} 569}
562 570
563static void 571static struct lpfc_hbq_entry *
564lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, 572lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno,
565 struct hbq_dmabuf *hbq_buf) 573 struct hbq_dmabuf *hbq_buf)
566{ 574{
@@ -574,7 +582,7 @@ lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno,
574 582
575 hbqe->bde.addrHigh = le32_to_cpu(putPaddrHigh(physaddr)); 583 hbqe->bde.addrHigh = le32_to_cpu(putPaddrHigh(physaddr));
576 hbqe->bde.addrLow = le32_to_cpu(putPaddrLow(physaddr)); 584 hbqe->bde.addrLow = le32_to_cpu(putPaddrLow(physaddr));
577 hbqe->bde.tus.f.bdeSize = FCELSSIZE; 585 hbqe->bde.tus.f.bdeSize = hbq_buf->size;
578 hbqe->bde.tus.f.bdeFlags = 0; 586 hbqe->bde.tus.f.bdeFlags = 0;
579 hbqe->bde.tus.w = le32_to_cpu(hbqe->bde.tus.w); 587 hbqe->bde.tus.w = le32_to_cpu(hbqe->bde.tus.w);
580 hbqe->buffer_tag = le32_to_cpu(hbq_buf->tag); 588 hbqe->buffer_tag = le32_to_cpu(hbq_buf->tag);
@@ -583,8 +591,9 @@ lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno,
583 writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno); 591 writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno);
584 /* flush */ 592 /* flush */
585 readl(phba->hbq_put + hbqno); 593 readl(phba->hbq_put + hbqno);
586 list_add_tail(&hbq_buf->dbuf.list, &phba->hbq_buffer_list); 594 list_add_tail(&hbq_buf->dbuf.list, &hbqp->hbq_buffer_list);
587 } 595 }
596 return hbqe;
588} 597}
589 598
590static struct lpfc_hbq_init lpfc_els_hbq = { 599static struct lpfc_hbq_init lpfc_els_hbq = {
@@ -592,22 +601,38 @@ static struct lpfc_hbq_init lpfc_els_hbq = {
592 .entry_count = 200, 601 .entry_count = 200,
593 .mask_count = 0, 602 .mask_count = 0,
594 .profile = 0, 603 .profile = 0,
595 .ring_mask = 1 << LPFC_ELS_RING, 604 .ring_mask = (1 << LPFC_ELS_RING),
596 .buffer_count = 0, 605 .buffer_count = 0,
597 .init_count = 20, 606 .init_count = 20,
598 .add_count = 5, 607 .add_count = 5,
599}; 608};
600 609
601static struct lpfc_hbq_init *lpfc_hbq_defs[] = { 610static struct lpfc_hbq_init lpfc_extra_hbq = {
611 .rn = 1,
612 .entry_count = 200,
613 .mask_count = 0,
614 .profile = 0,
615 .ring_mask = (1 << LPFC_EXTRA_RING),
616 .buffer_count = 0,
617 .init_count = 0,
618 .add_count = 5,
619};
620
621struct lpfc_hbq_init *lpfc_hbq_defs[] = {
602 &lpfc_els_hbq, 622 &lpfc_els_hbq,
623 &lpfc_extra_hbq,
603}; 624};
604 625
605int 626static int
606lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) 627lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
607{ 628{
608 uint32_t i, start, end; 629 uint32_t i, start, end;
609 struct hbq_dmabuf *hbq_buffer; 630 struct hbq_dmabuf *hbq_buffer;
610 631
632 if (!phba->hbqs[hbqno].hbq_alloc_buffer) {
633 return 0;
634 }
635
611 start = lpfc_hbq_defs[hbqno]->buffer_count; 636 start = lpfc_hbq_defs[hbqno]->buffer_count;
612 end = count + lpfc_hbq_defs[hbqno]->buffer_count; 637 end = count + lpfc_hbq_defs[hbqno]->buffer_count;
613 if (end > lpfc_hbq_defs[hbqno]->entry_count) { 638 if (end > lpfc_hbq_defs[hbqno]->entry_count) {
@@ -616,17 +641,14 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
616 641
617 /* Populate HBQ entries */ 642 /* Populate HBQ entries */
618 for (i = start; i < end; i++) { 643 for (i = start; i < end; i++) {
619 hbq_buffer = kmalloc(sizeof(struct hbq_dmabuf), 644 hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
620 GFP_KERNEL);
621 if (!hbq_buffer) 645 if (!hbq_buffer)
622 return 1; 646 return 1;
623 hbq_buffer->dbuf.virt = lpfc_hbq_alloc(phba, MEM_PRI,
624 &hbq_buffer->dbuf.phys);
625 if (hbq_buffer->dbuf.virt == NULL)
626 return 1;
627 hbq_buffer->tag = (i | (hbqno << 16)); 647 hbq_buffer->tag = (i | (hbqno << 16));
628 lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer); 648 if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer))
629 lpfc_hbq_defs[hbqno]->buffer_count++; 649 lpfc_hbq_defs[hbqno]->buffer_count++;
650 else
651 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
630 } 652 }
631 return 0; 653 return 0;
632} 654}
@@ -650,28 +672,34 @@ lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag)
650{ 672{
651 struct lpfc_dmabuf *d_buf; 673 struct lpfc_dmabuf *d_buf;
652 struct hbq_dmabuf *hbq_buf; 674 struct hbq_dmabuf *hbq_buf;
675 uint32_t hbqno;
676
677 hbqno = tag >> 16;
678 if (hbqno > LPFC_MAX_HBQS)
679 return NULL;
653 680
654 list_for_each_entry(d_buf, &phba->hbq_buffer_list, list) { 681 list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) {
655 hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); 682 hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
656 if ((hbq_buf->tag & 0xffff) == tag) { 683 if (hbq_buf->tag == tag) {
657 return hbq_buf; 684 return hbq_buf;
658 } 685 }
659 } 686 }
660 lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT, 687 lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT,
661 "%d:1803 Bad hbq tag. Data: x%x x%x\n", 688 "1803 Bad hbq tag. Data: x%x x%x\n",
662 phba->brd_no, tag, 689 tag, lpfc_hbq_defs[tag >> 16]->buffer_count);
663 lpfc_hbq_defs[tag >> 16]->buffer_count);
664 return NULL; 690 return NULL;
665} 691}
666 692
667void 693void
668lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *sp) 694lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer)
669{ 695{
670 uint32_t hbqno; 696 uint32_t hbqno;
671 697
672 if (sp) { 698 if (hbq_buffer) {
673 hbqno = sp->tag >> 16; 699 hbqno = hbq_buffer->tag >> 16;
674 lpfc_sli_hbq_to_firmware(phba, hbqno, sp); 700 if (!lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) {
701 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
702 }
675 } 703 }
676} 704}
677 705
@@ -837,12 +865,10 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
837 */ 865 */
838 if (lpfc_sli_chk_mbx_command(pmbox->mbxCommand) == 866 if (lpfc_sli_chk_mbx_command(pmbox->mbxCommand) ==
839 MBX_SHUTDOWN) { 867 MBX_SHUTDOWN) {
840
841 /* Unknow mailbox command compl */ 868 /* Unknow mailbox command compl */
842 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, 869 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
843 "%d (%d):0323 Unknown Mailbox command " 870 "(%d):0323 Unknown Mailbox command "
844 "%x Cmpl\n", 871 "%x Cmpl\n",
845 phba->brd_no,
846 pmb->vport ? pmb->vport->vpi : 0, 872 pmb->vport ? pmb->vport->vpi : 0,
847 pmbox->mbxCommand); 873 pmbox->mbxCommand);
848 phba->link_state = LPFC_HBA_ERROR; 874 phba->link_state = LPFC_HBA_ERROR;
@@ -857,10 +883,9 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
857 /* Mbox cmd cmpl error - RETRYing */ 883 /* Mbox cmd cmpl error - RETRYing */
858 lpfc_printf_log(phba, KERN_INFO, 884 lpfc_printf_log(phba, KERN_INFO,
859 LOG_MBOX | LOG_SLI, 885 LOG_MBOX | LOG_SLI,
860 "%d (%d):0305 Mbox cmd cmpl " 886 "(%d):0305 Mbox cmd cmpl "
861 "error - RETRYing Data: x%x " 887 "error - RETRYing Data: x%x "
862 "x%x x%x x%x\n", 888 "x%x x%x x%x\n",
863 phba->brd_no,
864 pmb->vport ? pmb->vport->vpi :0, 889 pmb->vport ? pmb->vport->vpi :0,
865 pmbox->mbxCommand, 890 pmbox->mbxCommand,
866 pmbox->mbxStatus, 891 pmbox->mbxStatus,
@@ -879,9 +904,8 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
879 904
880 /* Mailbox cmd <cmd> Cmpl <cmpl> */ 905 /* Mailbox cmd <cmd> Cmpl <cmpl> */
881 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, 906 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
882 "%d (%d):0307 Mailbox cmd x%x Cmpl x%p " 907 "(%d):0307 Mailbox cmd x%x Cmpl x%p "
883 "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n", 908 "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n",
884 phba->brd_no,
885 pmb->vport ? pmb->vport->vpi : 0, 909 pmb->vport ? pmb->vport->vpi : 0,
886 pmbox->mbxCommand, 910 pmbox->mbxCommand,
887 pmb->mbox_cmpl, 911 pmb->mbox_cmpl,
@@ -905,21 +929,26 @@ static struct lpfc_dmabuf *
905lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag) 929lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag)
906{ 930{
907 struct hbq_dmabuf *hbq_entry, *new_hbq_entry; 931 struct hbq_dmabuf *hbq_entry, *new_hbq_entry;
932 uint32_t hbqno;
933 void *virt; /* virtual address ptr */
934 dma_addr_t phys; /* mapped address */
908 935
909 hbq_entry = lpfc_sli_hbqbuf_find(phba, tag); 936 hbq_entry = lpfc_sli_hbqbuf_find(phba, tag);
910 if (hbq_entry == NULL) 937 if (hbq_entry == NULL)
911 return NULL; 938 return NULL;
912 list_del(&hbq_entry->dbuf.list); 939 list_del(&hbq_entry->dbuf.list);
913 new_hbq_entry = kmalloc(sizeof(struct hbq_dmabuf), GFP_ATOMIC); 940
941 hbqno = tag >> 16;
942 new_hbq_entry = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
914 if (new_hbq_entry == NULL) 943 if (new_hbq_entry == NULL)
915 return &hbq_entry->dbuf; 944 return &hbq_entry->dbuf;
916 new_hbq_entry->dbuf = hbq_entry->dbuf;
917 new_hbq_entry->tag = -1; 945 new_hbq_entry->tag = -1;
918 hbq_entry->dbuf.virt = lpfc_hbq_alloc(phba, 0, &hbq_entry->dbuf.phys); 946 phys = new_hbq_entry->dbuf.phys;
919 if (hbq_entry->dbuf.virt == NULL) { 947 virt = new_hbq_entry->dbuf.virt;
920 kfree(new_hbq_entry); 948 new_hbq_entry->dbuf.phys = hbq_entry->dbuf.phys;
921 return &hbq_entry->dbuf; 949 new_hbq_entry->dbuf.virt = hbq_entry->dbuf.virt;
922 } 950 hbq_entry->dbuf.phys = phys;
951 hbq_entry->dbuf.virt = virt;
923 lpfc_sli_free_hbq(phba, hbq_entry); 952 lpfc_sli_free_hbq(phba, hbq_entry);
924 return &new_hbq_entry->dbuf; 953 return &new_hbq_entry->dbuf;
925} 954}
@@ -965,7 +994,7 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
965 irsp->un.ulpWord[3]); 994 irsp->un.ulpWord[3]);
966 if (irsp->ulpBdeCount == 2) 995 if (irsp->ulpBdeCount == 2)
967 saveq->context3 = lpfc_sli_replace_hbqbuff(phba, 996 saveq->context3 = lpfc_sli_replace_hbqbuff(phba,
968 irsp->un.ulpWord[15]); 997 irsp->unsli3.sli3Words[7]);
969 } 998 }
970 999
971 /* unSolicited Responses */ 1000 /* unSolicited Responses */
@@ -996,12 +1025,9 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
996 /* Ring <ringno> handler: unexpected 1025 /* Ring <ringno> handler: unexpected
997 Rctl <Rctl> Type <Type> received */ 1026 Rctl <Rctl> Type <Type> received */
998 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, 1027 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
999 "%d:0313 Ring %d handler: unexpected Rctl x%x " 1028 "0313 Ring %d handler: unexpected Rctl x%x "
1000 "Type x%x received\n", 1029 "Type x%x received\n",
1001 phba->brd_no, 1030 pring->ringno, Rctl, Type);
1002 pring->ringno,
1003 Rctl,
1004 Type);
1005 } 1031 }
1006 return 1; 1032 return 1;
1007} 1033}
@@ -1024,10 +1050,9 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba,
1024 } 1050 }
1025 1051
1026 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 1052 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
1027 "%d:0317 iotag x%x is out off " 1053 "0317 iotag x%x is out off "
1028 "range: max iotag x%x wd0 x%x\n", 1054 "range: max iotag x%x wd0 x%x\n",
1029 phba->brd_no, iotag, 1055 iotag, phba->sli.last_iotag,
1030 phba->sli.last_iotag,
1031 *(((uint32_t *) &prspiocb->iocb) + 7)); 1056 *(((uint32_t *) &prspiocb->iocb) + 7));
1032 return NULL; 1057 return NULL;
1033} 1058}
@@ -1075,18 +1100,16 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1075 * Ring <ringno> handler: unexpected completion IoTag 1100 * Ring <ringno> handler: unexpected completion IoTag
1076 * <IoTag> 1101 * <IoTag>
1077 */ 1102 */
1078 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, 1103 lpfc_printf_vlog(cmdiocbp->vport, KERN_WARNING, LOG_SLI,
1079 "%d (%d):0322 Ring %d handler: " 1104 "0322 Ring %d handler: "
1080 "unexpected completion IoTag x%x " 1105 "unexpected completion IoTag x%x "
1081 "Data: x%x x%x x%x x%x\n", 1106 "Data: x%x x%x x%x x%x\n",
1082 phba->brd_no, 1107 pring->ringno,
1083 cmdiocbp->vport->vpi, 1108 saveq->iocb.ulpIoTag,
1084 pring->ringno, 1109 saveq->iocb.ulpStatus,
1085 saveq->iocb.ulpIoTag, 1110 saveq->iocb.un.ulpWord[4],
1086 saveq->iocb.ulpStatus, 1111 saveq->iocb.ulpCommand,
1087 saveq->iocb.un.ulpWord[4], 1112 saveq->iocb.ulpContext);
1088 saveq->iocb.ulpCommand,
1089 saveq->iocb.ulpContext);
1090 } 1113 }
1091 } 1114 }
1092 1115
@@ -1104,10 +1127,9 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
1104 * rsp ring <portRspMax> 1127 * rsp ring <portRspMax>
1105 */ 1128 */
1106 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 1129 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
1107 "%d:0312 Ring %d handler: portRspPut %d " 1130 "0312 Ring %d handler: portRspPut %d "
1108 "is bigger then rsp ring %d\n", 1131 "is bigger then rsp ring %d\n",
1109 phba->brd_no, pring->ringno, 1132 pring->ringno, le32_to_cpu(pgp->rspPutInx),
1110 le32_to_cpu(pgp->rspPutInx),
1111 pring->numRiocb); 1133 pring->numRiocb);
1112 1134
1113 phba->link_state = LPFC_HBA_ERROR; 1135 phba->link_state = LPFC_HBA_ERROR;
@@ -1177,9 +1199,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba)
1177 if (unlikely(irsp->ulpStatus)) { 1199 if (unlikely(irsp->ulpStatus)) {
1178 /* Rsp ring <ringno> error: IOCB */ 1200 /* Rsp ring <ringno> error: IOCB */
1179 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, 1201 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
1180 "%d:0326 Rsp Ring %d error: IOCB Data: " 1202 "0326 Rsp Ring %d error: IOCB Data: "
1181 "x%x x%x x%x x%x x%x x%x x%x x%x\n", 1203 "x%x x%x x%x x%x x%x x%x x%x x%x\n",
1182 phba->brd_no, pring->ringno, 1204 pring->ringno,
1183 irsp->un.ulpWord[0], 1205 irsp->un.ulpWord[0],
1184 irsp->un.ulpWord[1], 1206 irsp->un.ulpWord[1],
1185 irsp->un.ulpWord[2], 1207 irsp->un.ulpWord[2],
@@ -1199,9 +1221,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba)
1199 */ 1221 */
1200 if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { 1222 if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) {
1201 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 1223 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
1202 "%d:0314 IOCB cmd 0x%x" 1224 "0314 IOCB cmd 0x%x "
1203 " processed. Skipping" 1225 "processed. Skipping "
1204 " completion", phba->brd_no, 1226 "completion",
1205 irsp->ulpCommand); 1227 irsp->ulpCommand);
1206 break; 1228 break;
1207 } 1229 }
@@ -1226,10 +1248,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba)
1226 } else { 1248 } else {
1227 /* Unknown IOCB command */ 1249 /* Unknown IOCB command */
1228 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 1250 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
1229 "%d:0321 Unknown IOCB command " 1251 "0321 Unknown IOCB command "
1230 "Data: x%x, x%x x%x x%x x%x\n", 1252 "Data: x%x, x%x x%x x%x x%x\n",
1231 phba->brd_no, type, 1253 type, irsp->ulpCommand,
1232 irsp->ulpCommand,
1233 irsp->ulpStatus, 1254 irsp->ulpStatus,
1234 irsp->ulpIoTag, 1255 irsp->ulpIoTag,
1235 irsp->ulpContext); 1256 irsp->ulpContext);
@@ -1353,9 +1374,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
1353 1374
1354 /* Rsp ring <ringno> error: IOCB */ 1375 /* Rsp ring <ringno> error: IOCB */
1355 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, 1376 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
1356 "%d:0336 Rsp Ring %d error: IOCB Data: " 1377 "0336 Rsp Ring %d error: IOCB Data: "
1357 "x%x x%x x%x x%x x%x x%x x%x x%x\n", 1378 "x%x x%x x%x x%x x%x x%x x%x x%x\n",
1358 phba->brd_no, pring->ringno, 1379 pring->ringno,
1359 irsp->un.ulpWord[0], 1380 irsp->un.ulpWord[0],
1360 irsp->un.ulpWord[1], 1381 irsp->un.ulpWord[1],
1361 irsp->un.ulpWord[2], 1382 irsp->un.ulpWord[2],
@@ -1375,10 +1396,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
1375 */ 1396 */
1376 if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { 1397 if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) {
1377 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 1398 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
1378 "%d:0333 IOCB cmd 0x%x" 1399 "0333 IOCB cmd 0x%x"
1379 " processed. Skipping" 1400 " processed. Skipping"
1380 " completion\n", 1401 " completion\n",
1381 phba->brd_no,
1382 irsp->ulpCommand); 1402 irsp->ulpCommand);
1383 break; 1403 break;
1384 } 1404 }
@@ -1415,10 +1435,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
1415 } else { 1435 } else {
1416 /* Unknown IOCB command */ 1436 /* Unknown IOCB command */
1417 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 1437 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
1418 "%d:0334 Unknown IOCB command " 1438 "0334 Unknown IOCB command "
1419 "Data: x%x, x%x x%x x%x x%x\n", 1439 "Data: x%x, x%x x%x x%x x%x\n",
1420 phba->brd_no, type, 1440 type, irsp->ulpCommand,
1421 irsp->ulpCommand,
1422 irsp->ulpStatus, 1441 irsp->ulpStatus,
1423 irsp->ulpIoTag, 1442 irsp->ulpIoTag,
1424 irsp->ulpContext); 1443 irsp->ulpContext);
@@ -1496,10 +1515,9 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
1496 * rsp ring <portRspMax> 1515 * rsp ring <portRspMax>
1497 */ 1516 */
1498 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 1517 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
1499 "%d:0303 Ring %d handler: portRspPut %d " 1518 "0303 Ring %d handler: portRspPut %d "
1500 "is bigger then rsp ring %d\n", 1519 "is bigger then rsp ring %d\n",
1501 phba->brd_no, pring->ringno, portRspPut, 1520 pring->ringno, portRspPut, portRspMax);
1502 portRspMax);
1503 1521
1504 phba->link_state = LPFC_HBA_ERROR; 1522 phba->link_state = LPFC_HBA_ERROR;
1505 spin_unlock_irqrestore(&phba->hbalock, iflag); 1523 spin_unlock_irqrestore(&phba->hbalock, iflag);
@@ -1542,6 +1560,14 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
1542 if (++pring->rspidx >= portRspMax) 1560 if (++pring->rspidx >= portRspMax)
1543 pring->rspidx = 0; 1561 pring->rspidx = 0;
1544 1562
1563 if (pring->ringno == LPFC_ELS_RING) {
1564 lpfc_debugfs_slow_ring_trc(phba,
1565 "IOCB rsp ring: wd4:x%08x wd6:x%08x wd7:x%08x",
1566 *(((uint32_t *) irsp) + 4),
1567 *(((uint32_t *) irsp) + 6),
1568 *(((uint32_t *) irsp) + 7));
1569 }
1570
1545 writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); 1571 writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx);
1546 1572
1547 if (list_empty(&(pring->iocb_continueq))) { 1573 if (list_empty(&(pring->iocb_continueq))) {
@@ -1580,13 +1606,12 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
1580 if (irsp->ulpStatus) { 1606 if (irsp->ulpStatus) {
1581 /* Rsp ring <ringno> error: IOCB */ 1607 /* Rsp ring <ringno> error: IOCB */
1582 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, 1608 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
1583 "%d:0328 Rsp Ring %d error: " 1609 "0328 Rsp Ring %d error: "
1584 "IOCB Data: " 1610 "IOCB Data: "
1585 "x%x x%x x%x x%x " 1611 "x%x x%x x%x x%x "
1586 "x%x x%x x%x x%x " 1612 "x%x x%x x%x x%x "
1587 "x%x x%x x%x x%x " 1613 "x%x x%x x%x x%x "
1588 "x%x x%x x%x x%x\n", 1614 "x%x x%x x%x x%x\n",
1589 phba->brd_no,
1590 pring->ringno, 1615 pring->ringno,
1591 irsp->un.ulpWord[0], 1616 irsp->un.ulpWord[0],
1592 irsp->un.ulpWord[1], 1617 irsp->un.ulpWord[1],
@@ -1661,10 +1686,9 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
1661 } else { 1686 } else {
1662 /* Unknown IOCB command */ 1687 /* Unknown IOCB command */
1663 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 1688 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
1664 "%d:0335 Unknown IOCB " 1689 "0335 Unknown IOCB "
1665 "command Data: x%x " 1690 "command Data: x%x "
1666 "x%x x%x x%x\n", 1691 "x%x x%x x%x\n",
1667 phba->brd_no,
1668 irsp->ulpCommand, 1692 irsp->ulpCommand,
1669 irsp->ulpStatus, 1693 irsp->ulpStatus,
1670 irsp->ulpIoTag, 1694 irsp->ulpIoTag,
@@ -1892,8 +1916,8 @@ lpfc_sli_brdkill(struct lpfc_hba *phba)
1892 1916
1893 /* Kill HBA */ 1917 /* Kill HBA */
1894 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 1918 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
1895 "%d:0329 Kill HBA Data: x%x x%x\n", 1919 "0329 Kill HBA Data: x%x x%x\n",
1896 phba->brd_no, phba->pport->port_state, psli->sli_flag); 1920 phba->pport->port_state, psli->sli_flag);
1897 1921
1898 if ((pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, 1922 if ((pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool,
1899 GFP_KERNEL)) == 0) 1923 GFP_KERNEL)) == 0)
@@ -1966,7 +1990,7 @@ lpfc_sli_brdreset(struct lpfc_hba *phba)
1966 1990
1967 /* Reset HBA */ 1991 /* Reset HBA */
1968 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 1992 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
1969 "%d:0325 Reset HBA Data: x%x x%x\n", phba->brd_no, 1993 "0325 Reset HBA Data: x%x x%x\n",
1970 phba->pport->port_state, psli->sli_flag); 1994 phba->pport->port_state, psli->sli_flag);
1971 1995
1972 /* perform board reset */ 1996 /* perform board reset */
@@ -2021,7 +2045,7 @@ lpfc_sli_brdrestart(struct lpfc_hba *phba)
2021 2045
2022 /* Restart HBA */ 2046 /* Restart HBA */
2023 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 2047 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
2024 "%d:0337 Restart HBA Data: x%x x%x\n", phba->brd_no, 2048 "0337 Restart HBA Data: x%x x%x\n",
2025 phba->pport->port_state, psli->sli_flag); 2049 phba->pport->port_state, psli->sli_flag);
2026 2050
2027 word0 = 0; 2051 word0 = 0;
@@ -2086,9 +2110,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba)
2086 /* Adapter failed to init, timeout, status reg 2110 /* Adapter failed to init, timeout, status reg
2087 <status> */ 2111 <status> */
2088 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 2112 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
2089 "%d:0436 Adapter failed to init, " 2113 "0436 Adapter failed to init, "
2090 "timeout, status reg x%x\n", 2114 "timeout, status reg x%x\n", status);
2091 phba->brd_no, status);
2092 phba->link_state = LPFC_HBA_ERROR; 2115 phba->link_state = LPFC_HBA_ERROR;
2093 return -ETIMEDOUT; 2116 return -ETIMEDOUT;
2094 } 2117 }
@@ -2099,10 +2122,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba)
2099 /* Adapter failed to init, chipset, status reg 2122 /* Adapter failed to init, chipset, status reg
2100 <status> */ 2123 <status> */
2101 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 2124 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
2102 "%d:0437 Adapter failed to init, " 2125 "0437 Adapter failed to init, "
2103 "chipset, status reg x%x\n", 2126 "chipset, status reg x%x\n", status);
2104 phba->brd_no,
2105 status);
2106 phba->link_state = LPFC_HBA_ERROR; 2127 phba->link_state = LPFC_HBA_ERROR;
2107 return -EIO; 2128 return -EIO;
2108 } 2129 }
@@ -2129,10 +2150,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba)
2129 /* ERROR: During chipset initialization */ 2150 /* ERROR: During chipset initialization */
2130 /* Adapter failed to init, chipset, status reg <status> */ 2151 /* Adapter failed to init, chipset, status reg <status> */
2131 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 2152 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
2132 "%d:0438 Adapter failed to init, chipset, " 2153 "0438 Adapter failed to init, chipset, "
2133 "status reg x%x\n", 2154 "status reg x%x\n", status);
2134 phba->brd_no,
2135 status);
2136 phba->link_state = LPFC_HBA_ERROR; 2155 phba->link_state = LPFC_HBA_ERROR;
2137 return -EIO; 2156 return -EIO;
2138 } 2157 }
@@ -2147,7 +2166,7 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba)
2147 return 0; 2166 return 0;
2148} 2167}
2149 2168
2150static int 2169int
2151lpfc_sli_hbq_count(void) 2170lpfc_sli_hbq_count(void)
2152{ 2171{
2153 return ARRAY_SIZE(lpfc_hbq_defs); 2172 return ARRAY_SIZE(lpfc_hbq_defs);
@@ -2200,8 +2219,8 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba)
2200 phba->hbqs[hbqno].local_hbqGetIdx = 0; 2219 phba->hbqs[hbqno].local_hbqGetIdx = 0;
2201 phba->hbqs[hbqno].entry_count = 2220 phba->hbqs[hbqno].entry_count =
2202 lpfc_hbq_defs[hbqno]->entry_count; 2221 lpfc_hbq_defs[hbqno]->entry_count;
2203 lpfc_config_hbq(phba, lpfc_hbq_defs[hbqno], hbq_entry_index, 2222 lpfc_config_hbq(phba, hbqno, lpfc_hbq_defs[hbqno],
2204 pmb); 2223 hbq_entry_index, pmb);
2205 hbq_entry_index += phba->hbqs[hbqno].entry_count; 2224 hbq_entry_index += phba->hbqs[hbqno].entry_count;
2206 2225
2207 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { 2226 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
@@ -2210,9 +2229,9 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba)
2210 2229
2211 lpfc_printf_log(phba, KERN_ERR, 2230 lpfc_printf_log(phba, KERN_ERR,
2212 LOG_SLI | LOG_VPORT, 2231 LOG_SLI | LOG_VPORT,
2213 "%d:1805 Adapter failed to init. " 2232 "1805 Adapter failed to init. "
2214 "Data: x%x x%x x%x\n", 2233 "Data: x%x x%x x%x\n",
2215 phba->brd_no, pmbox->mbxCommand, 2234 pmbox->mbxCommand,
2216 pmbox->mbxStatus, hbqno); 2235 pmbox->mbxStatus, hbqno);
2217 2236
2218 phba->link_state = LPFC_HBA_ERROR; 2237 phba->link_state = LPFC_HBA_ERROR;
@@ -2279,10 +2298,9 @@ lpfc_do_config_port(struct lpfc_hba *phba, int sli_mode)
2279 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); 2298 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
2280 if (rc != MBX_SUCCESS) { 2299 if (rc != MBX_SUCCESS) {
2281 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 2300 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
2282 "%d:0442 Adapter failed to init, mbxCmd x%x " 2301 "0442 Adapter failed to init, mbxCmd x%x "
2283 "CONFIG_PORT, mbxStatus x%x Data: x%x\n", 2302 "CONFIG_PORT, mbxStatus x%x Data: x%x\n",
2284 phba->brd_no, pmb->mb.mbxCommand, 2303 pmb->mb.mbxCommand, pmb->mb.mbxStatus, 0);
2285 pmb->mb.mbxStatus, 0);
2286 spin_lock_irq(&phba->hbalock); 2304 spin_lock_irq(&phba->hbalock);
2287 phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE; 2305 phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE;
2288 spin_unlock_irq(&phba->hbalock); 2306 spin_unlock_irq(&phba->hbalock);
@@ -2321,11 +2339,11 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
2321 2339
2322 switch (lpfc_sli_mode) { 2340 switch (lpfc_sli_mode) {
2323 case 2: 2341 case 2:
2324 if (phba->cfg_npiv_enable) { 2342 if (phba->cfg_enable_npiv) {
2325 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, 2343 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
2326 "%d:1824 NPIV enabled: Override lpfc_sli_mode " 2344 "1824 NPIV enabled: Override lpfc_sli_mode "
2327 "parameter (%d) to auto (0).\n", 2345 "parameter (%d) to auto (0).\n",
2328 phba->brd_no, lpfc_sli_mode); 2346 lpfc_sli_mode);
2329 break; 2347 break;
2330 } 2348 }
2331 mode = 2; 2349 mode = 2;
@@ -2335,9 +2353,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
2335 break; 2353 break;
2336 default: 2354 default:
2337 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, 2355 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
2338 "%d:1819 Unrecognized lpfc_sli_mode " 2356 "1819 Unrecognized lpfc_sli_mode "
2339 "parameter: %d.\n", 2357 "parameter: %d.\n", lpfc_sli_mode);
2340 phba->brd_no, lpfc_sli_mode);
2341 2358
2342 break; 2359 break;
2343 } 2360 }
@@ -2345,9 +2362,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
2345 rc = lpfc_do_config_port(phba, mode); 2362 rc = lpfc_do_config_port(phba, mode);
2346 if (rc && lpfc_sli_mode == 3) 2363 if (rc && lpfc_sli_mode == 3)
2347 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, 2364 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
2348 "%d:1820 Unable to select SLI-3. " 2365 "1820 Unable to select SLI-3. "
2349 "Not supported by adapter.\n", 2366 "Not supported by adapter.\n");
2350 phba->brd_no);
2351 if (rc && mode != 2) 2367 if (rc && mode != 2)
2352 rc = lpfc_do_config_port(phba, 2); 2368 rc = lpfc_do_config_port(phba, 2);
2353 if (rc) 2369 if (rc)
@@ -2366,8 +2382,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
2366 } 2382 }
2367 2383
2368 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 2384 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
2369 "%d:0444 Firmware in SLI %x mode. Max_vpi %d\n", 2385 "0444 Firmware in SLI %x mode. Max_vpi %d\n",
2370 phba->brd_no, phba->sli_rev, phba->max_vpi); 2386 phba->sli_rev, phba->max_vpi);
2371 rc = lpfc_sli_ring_map(phba); 2387 rc = lpfc_sli_ring_map(phba);
2372 2388
2373 if (rc) 2389 if (rc)
@@ -2392,8 +2408,7 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
2392lpfc_sli_hba_setup_error: 2408lpfc_sli_hba_setup_error:
2393 phba->link_state = LPFC_HBA_ERROR; 2409 phba->link_state = LPFC_HBA_ERROR;
2394 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 2410 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
2395 "%d:0445 Firmware initialization failed\n", 2411 "0445 Firmware initialization failed\n");
2396 phba->brd_no);
2397 return rc; 2412 return rc;
2398} 2413}
2399 2414
@@ -2445,9 +2460,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
2445 2460
2446 /* Mbox cmd <mbxCommand> timeout */ 2461 /* Mbox cmd <mbxCommand> timeout */
2447 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, 2462 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
2448 "%d:0310 Mailbox command x%x timeout Data: x%x x%x " 2463 "0310 Mailbox command x%x timeout Data: x%x x%x x%p\n",
2449 "x%p\n",
2450 phba->brd_no,
2451 mb->mbxCommand, 2464 mb->mbxCommand,
2452 phba->pport->port_state, 2465 phba->pport->port_state,
2453 phba->sli.sli_flag, 2466 phba->sli.sli_flag,
@@ -2470,8 +2483,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
2470 lpfc_sli_abort_iocb_ring(phba, pring); 2483 lpfc_sli_abort_iocb_ring(phba, pring);
2471 2484
2472 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, 2485 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
2473 "%d:0316 Resetting board due to mailbox timeout\n", 2486 "0316 Resetting board due to mailbox timeout\n");
2474 phba->brd_no);
2475 /* 2487 /*
2476 * lpfc_offline calls lpfc_sli_hba_down which will clean up 2488 * lpfc_offline calls lpfc_sli_hba_down which will clean up
2477 * on oustanding mailbox commands. 2489 * on oustanding mailbox commands.
@@ -2502,8 +2514,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
2502 if(!pmbox->vport) { 2514 if(!pmbox->vport) {
2503 lpfc_printf_log(phba, KERN_ERR, 2515 lpfc_printf_log(phba, KERN_ERR,
2504 LOG_MBOX | LOG_VPORT, 2516 LOG_MBOX | LOG_VPORT,
2505 "%d:1806 Mbox x%x failed. No vport\n", 2517 "1806 Mbox x%x failed. No vport\n",
2506 phba->brd_no,
2507 pmbox->mb.mbxCommand); 2518 pmbox->mb.mbxCommand);
2508 dump_stack(); 2519 dump_stack();
2509 return MBXERR_ERROR; 2520 return MBXERR_ERROR;
@@ -2580,9 +2591,8 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
2580 2591
2581 /* Mbox cmd issue - BUSY */ 2592 /* Mbox cmd issue - BUSY */
2582 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, 2593 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
2583 "%d (%d):0308 Mbox cmd issue - BUSY Data: " 2594 "(%d):0308 Mbox cmd issue - BUSY Data: "
2584 "x%x x%x x%x x%x\n", 2595 "x%x x%x x%x x%x\n",
2585 phba->brd_no,
2586 pmbox->vport ? pmbox->vport->vpi : 0xffffff, 2596 pmbox->vport ? pmbox->vport->vpi : 0xffffff,
2587 mb->mbxCommand, phba->pport->port_state, 2597 mb->mbxCommand, phba->pport->port_state,
2588 psli->sli_flag, flag); 2598 psli->sli_flag, flag);
@@ -2644,9 +2654,9 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
2644 2654
2645 /* Mailbox cmd <cmd> issue */ 2655 /* Mailbox cmd <cmd> issue */
2646 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, 2656 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
2647 "%d (%d):0309 Mailbox cmd x%x issue Data: x%x x%x " 2657 "(%d):0309 Mailbox cmd x%x issue Data: x%x x%x "
2648 "x%x\n", 2658 "x%x\n",
2649 phba->brd_no, pmbox->vport ? pmbox->vport->vpi : 0, 2659 pmbox->vport ? pmbox->vport->vpi : 0,
2650 mb->mbxCommand, phba->pport->port_state, 2660 mb->mbxCommand, phba->pport->port_state,
2651 psli->sli_flag, flag); 2661 psli->sli_flag, flag);
2652 2662
@@ -2848,8 +2858,7 @@ __lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
2848 (piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN)) { 2858 (piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN)) {
2849 lpfc_printf_log(phba, KERN_ERR, 2859 lpfc_printf_log(phba, KERN_ERR,
2850 LOG_SLI | LOG_VPORT, 2860 LOG_SLI | LOG_VPORT,
2851 "%d:1807 IOCB x%x failed. No vport\n", 2861 "1807 IOCB x%x failed. No vport\n",
2852 phba->brd_no,
2853 piocb->iocb.ulpCommand); 2862 piocb->iocb.ulpCommand);
2854 dump_stack(); 2863 dump_stack();
2855 return IOCB_ERROR; 2864 return IOCB_ERROR;
@@ -3080,11 +3089,10 @@ lpfc_sli_setup(struct lpfc_hba *phba)
3080 } 3089 }
3081 if (totiocbsize > MAX_SLIM_IOCB_SIZE) { 3090 if (totiocbsize > MAX_SLIM_IOCB_SIZE) {
3082 /* Too many cmd / rsp ring entries in SLI2 SLIM */ 3091 /* Too many cmd / rsp ring entries in SLI2 SLIM */
3083 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 3092 printk(KERN_ERR "%d:0462 Too many cmd / rsp ring entries in "
3084 "%d:0462 Too many cmd / rsp ring entries in " 3093 "SLI2 SLIM Data: x%x x%lx\n",
3085 "SLI2 SLIM Data: x%x x%lx\n", 3094 phba->brd_no, totiocbsize,
3086 phba->brd_no, totiocbsize, 3095 (unsigned long) MAX_SLIM_IOCB_SIZE);
3087 (unsigned long) MAX_SLIM_IOCB_SIZE);
3088 } 3096 }
3089 if (phba->cfg_multi_ring_support == 2) 3097 if (phba->cfg_multi_ring_support == 2)
3090 lpfc_extra_ring_setup(phba); 3098 lpfc_extra_ring_setup(phba);
@@ -3305,9 +3313,9 @@ lpfc_sli_ringpostbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3305 3313
3306 spin_unlock_irq(&phba->hbalock); 3314 spin_unlock_irq(&phba->hbalock);
3307 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 3315 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
3308 "%d:0410 Cannot find virtual addr for mapped buf on " 3316 "0410 Cannot find virtual addr for mapped buf on "
3309 "ring %d Data x%llx x%p x%p x%x\n", 3317 "ring %d Data x%llx x%p x%p x%x\n",
3310 phba->brd_no, pring->ringno, (unsigned long long)phys, 3318 pring->ringno, (unsigned long long)phys,
3311 slp->next, slp->prev, pring->postbufq_cnt); 3319 slp->next, slp->prev, pring->postbufq_cnt);
3312 return NULL; 3320 return NULL;
3313} 3321}
@@ -3332,12 +3340,11 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
3332 abort_iocb = phba->sli.iocbq_lookup[abort_iotag]; 3340 abort_iocb = phba->sli.iocbq_lookup[abort_iotag];
3333 3341
3334 lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_SLI, 3342 lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_SLI,
3335 "%d:0327 Cannot abort els iocb %p " 3343 "0327 Cannot abort els iocb %p "
3336 "with tag %x context %x, abort status %x, " 3344 "with tag %x context %x, abort status %x, "
3337 "abort code %x\n", 3345 "abort code %x\n",
3338 phba->brd_no, abort_iocb, abort_iotag, 3346 abort_iocb, abort_iotag, abort_context,
3339 abort_context, irsp->ulpStatus, 3347 irsp->ulpStatus, irsp->un.ulpWord[4]);
3340 irsp->un.ulpWord[4]);
3341 3348
3342 /* 3349 /*
3343 * make sure we have the right iocbq before taking it 3350 * make sure we have the right iocbq before taking it
@@ -3371,9 +3378,9 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
3371 3378
3372 /* ELS cmd tag <ulpIoTag> completes */ 3379 /* ELS cmd tag <ulpIoTag> completes */
3373 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 3380 lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
3374 "%d (X):0133 Ignoring ELS cmd tag x%x completion Data: " 3381 "0133 Ignoring ELS cmd tag x%x completion Data: "
3375 "x%x x%x x%x\n", 3382 "x%x x%x x%x\n",
3376 phba->brd_no, irsp->ulpIoTag, irsp->ulpStatus, 3383 irsp->ulpIoTag, irsp->ulpStatus,
3377 irsp->un.ulpWord[4], irsp->ulpTimeout); 3384 irsp->un.ulpWord[4], irsp->ulpTimeout);
3378 if (cmdiocb->iocb.ulpCommand == CMD_GEN_REQUEST64_CR) 3385 if (cmdiocb->iocb.ulpCommand == CMD_GEN_REQUEST64_CR)
3379 lpfc_ct_free_iocb(phba, cmdiocb); 3386 lpfc_ct_free_iocb(phba, cmdiocb);
@@ -3439,12 +3446,11 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3439 3446
3440 abtsiocbp->iocb_cmpl = lpfc_sli_abort_els_cmpl; 3447 abtsiocbp->iocb_cmpl = lpfc_sli_abort_els_cmpl;
3441 3448
3442 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 3449 lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
3443 "%d (%d):0339 Abort xri x%x, original iotag x%x, " 3450 "0339 Abort xri x%x, original iotag x%x, "
3444 "abort cmd iotag x%x\n", 3451 "abort cmd iotag x%x\n",
3445 phba->brd_no, vport->vpi, 3452 iabt->un.acxri.abortContextTag,
3446 iabt->un.acxri.abortContextTag, 3453 iabt->un.acxri.abortIoTag, abtsiocbp->iotag);
3447 iabt->un.acxri.abortIoTag, abtsiocbp->iotag);
3448 retval = __lpfc_sli_issue_iocb(phba, pring, abtsiocbp, 0); 3454 retval = __lpfc_sli_issue_iocb(phba, pring, abtsiocbp, 0);
3449 3455
3450abort_iotag_exit: 3456abort_iotag_exit:
@@ -3457,8 +3463,8 @@ abort_iotag_exit:
3457} 3463}
3458 3464
3459static int 3465static int
3460lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, 3466lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport,
3461 uint64_t lun_id, uint32_t ctx, 3467 uint16_t tgt_id, uint64_t lun_id,
3462 lpfc_ctx_cmd ctx_cmd) 3468 lpfc_ctx_cmd ctx_cmd)
3463{ 3469{
3464 struct lpfc_scsi_buf *lpfc_cmd; 3470 struct lpfc_scsi_buf *lpfc_cmd;
@@ -3468,6 +3474,9 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id,
3468 if (!(iocbq->iocb_flag & LPFC_IO_FCP)) 3474 if (!(iocbq->iocb_flag & LPFC_IO_FCP))
3469 return rc; 3475 return rc;
3470 3476
3477 if (iocbq->vport != vport)
3478 return rc;
3479
3471 lpfc_cmd = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq); 3480 lpfc_cmd = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq);
3472 cmnd = lpfc_cmd->pCmd; 3481 cmnd = lpfc_cmd->pCmd;
3473 3482
@@ -3484,10 +3493,6 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id,
3484 if (cmnd->device->id == tgt_id) 3493 if (cmnd->device->id == tgt_id)
3485 rc = 0; 3494 rc = 0;
3486 break; 3495 break;
3487 case LPFC_CTX_CTX:
3488 if (iocbq->iocb.ulpContext == ctx)
3489 rc = 0;
3490 break;
3491 case LPFC_CTX_HOST: 3496 case LPFC_CTX_HOST:
3492 rc = 0; 3497 rc = 0;
3493 break; 3498 break;
@@ -3501,17 +3506,18 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id,
3501} 3506}
3502 3507
3503int 3508int
3504lpfc_sli_sum_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, 3509lpfc_sli_sum_iocb(struct lpfc_vport *vport, uint16_t tgt_id, uint64_t lun_id,
3505 uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd ctx_cmd) 3510 lpfc_ctx_cmd ctx_cmd)
3506{ 3511{
3512 struct lpfc_hba *phba = vport->phba;
3507 struct lpfc_iocbq *iocbq; 3513 struct lpfc_iocbq *iocbq;
3508 int sum, i; 3514 int sum, i;
3509 3515
3510 for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) { 3516 for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) {
3511 iocbq = phba->sli.iocbq_lookup[i]; 3517 iocbq = phba->sli.iocbq_lookup[i];
3512 3518
3513 if (lpfc_sli_validate_fcp_iocb (iocbq, tgt_id, lun_id, 3519 if (lpfc_sli_validate_fcp_iocb (iocbq, vport, tgt_id, lun_id,
3514 0, ctx_cmd) == 0) 3520 ctx_cmd) == 0)
3515 sum++; 3521 sum++;
3516 } 3522 }
3517 3523
@@ -3527,10 +3533,10 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
3527} 3533}
3528 3534
3529int 3535int
3530lpfc_sli_abort_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, 3536lpfc_sli_abort_iocb(struct lpfc_vport *vport, struct lpfc_sli_ring *pring,
3531 uint16_t tgt_id, uint64_t lun_id, uint32_t ctx, 3537 uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd abort_cmd)
3532 lpfc_ctx_cmd abort_cmd)
3533{ 3538{
3539 struct lpfc_hba *phba = vport->phba;
3534 struct lpfc_iocbq *iocbq; 3540 struct lpfc_iocbq *iocbq;
3535 struct lpfc_iocbq *abtsiocb; 3541 struct lpfc_iocbq *abtsiocb;
3536 IOCB_t *cmd = NULL; 3542 IOCB_t *cmd = NULL;
@@ -3540,7 +3546,7 @@ lpfc_sli_abort_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3540 for (i = 1; i <= phba->sli.last_iotag; i++) { 3546 for (i = 1; i <= phba->sli.last_iotag; i++) {
3541 iocbq = phba->sli.iocbq_lookup[i]; 3547 iocbq = phba->sli.iocbq_lookup[i];
3542 3548
3543 if (lpfc_sli_validate_fcp_iocb(iocbq, tgt_id, lun_id, 0, 3549 if (lpfc_sli_validate_fcp_iocb(iocbq, vport, tgt_id, lun_id,
3544 abort_cmd) != 0) 3550 abort_cmd) != 0)
3545 continue; 3551 continue;
3546 3552
@@ -3647,25 +3653,23 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba,
3647 3653
3648 if (piocb->iocb_flag & LPFC_IO_WAKE) { 3654 if (piocb->iocb_flag & LPFC_IO_WAKE) {
3649 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 3655 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
3650 "%d:0331 IOCB wake signaled\n", 3656 "0331 IOCB wake signaled\n");
3651 phba->brd_no);
3652 } else if (timeleft == 0) { 3657 } else if (timeleft == 0) {
3653 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 3658 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3654 "%d:0338 IOCB wait timeout error - no " 3659 "0338 IOCB wait timeout error - no "
3655 "wake response Data x%x\n", 3660 "wake response Data x%x\n", timeout);
3656 phba->brd_no, timeout);
3657 retval = IOCB_TIMEDOUT; 3661 retval = IOCB_TIMEDOUT;
3658 } else { 3662 } else {
3659 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 3663 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3660 "%d:0330 IOCB wake NOT set, " 3664 "0330 IOCB wake NOT set, "
3661 "Data x%x x%lx\n", phba->brd_no, 3665 "Data x%x x%lx\n",
3662 timeout, (timeleft / jiffies)); 3666 timeout, (timeleft / jiffies));
3663 retval = IOCB_TIMEDOUT; 3667 retval = IOCB_TIMEDOUT;
3664 } 3668 }
3665 } else { 3669 } else {
3666 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 3670 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
3667 "%d:0332 IOCB wait issue failed, Data x%x\n", 3671 ":0332 IOCB wait issue failed, Data x%x\n",
3668 phba->brd_no, retval); 3672 retval);
3669 retval = IOCB_ERROR; 3673 retval = IOCB_ERROR;
3670 } 3674 }
3671 3675
@@ -3850,12 +3854,33 @@ lpfc_intr_handler(int irq, void *dev_id)
3850 if (status & HA_RXMASK) { 3854 if (status & HA_RXMASK) {
3851 spin_lock(&phba->hbalock); 3855 spin_lock(&phba->hbalock);
3852 control = readl(phba->HCregaddr); 3856 control = readl(phba->HCregaddr);
3857
3858 lpfc_debugfs_slow_ring_trc(phba,
3859 "ISR slow ring: ctl:x%x stat:x%x isrcnt:x%x",
3860 control, status,
3861 (uint32_t)phba->sli.slistat.sli_intr);
3862
3853 if (control & (HC_R0INT_ENA << LPFC_ELS_RING)) { 3863 if (control & (HC_R0INT_ENA << LPFC_ELS_RING)) {
3864 lpfc_debugfs_slow_ring_trc(phba,
3865 "ISR Disable ring:"
3866 "pwork:x%x hawork:x%x wait:x%x",
3867 phba->work_ha, work_ha_copy,
3868 (uint32_t)((unsigned long)
3869 phba->work_wait));
3870
3854 control &= 3871 control &=
3855 ~(HC_R0INT_ENA << LPFC_ELS_RING); 3872 ~(HC_R0INT_ENA << LPFC_ELS_RING);
3856 writel(control, phba->HCregaddr); 3873 writel(control, phba->HCregaddr);
3857 readl(phba->HCregaddr); /* flush */ 3874 readl(phba->HCregaddr); /* flush */
3858 } 3875 }
3876 else {
3877 lpfc_debugfs_slow_ring_trc(phba,
3878 "ISR slow ring: pwork:"
3879 "x%x hawork:x%x wait:x%x",
3880 phba->work_ha, work_ha_copy,
3881 (uint32_t)((unsigned long)
3882 phba->work_wait));
3883 }
3859 spin_unlock(&phba->hbalock); 3884 spin_unlock(&phba->hbalock);
3860 } 3885 }
3861 } 3886 }
@@ -3895,12 +3920,10 @@ lpfc_intr_handler(int irq, void *dev_id)
3895 */ 3920 */
3896 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | 3921 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX |
3897 LOG_SLI, 3922 LOG_SLI,
3898 "%d (%d):0304 Stray Mailbox " 3923 "(%d):0304 Stray Mailbox "
3899 "Interrupt mbxCommand x%x " 3924 "Interrupt mbxCommand x%x "
3900 "mbxStatus x%x\n", 3925 "mbxStatus x%x\n",
3901 phba->brd_no, 3926 (vport ? vport->vpi : 0),
3902 (vport
3903 ? vport->vpi : 0),
3904 pmbox->mbxCommand, 3927 pmbox->mbxCommand,
3905 pmbox->mbxStatus); 3928 pmbox->mbxStatus);
3906 } 3929 }
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h
index 76058505795e..51b2b6b949be 100644
--- a/drivers/scsi/lpfc/lpfc_sli.h
+++ b/drivers/scsi/lpfc/lpfc_sli.h
@@ -26,7 +26,6 @@ struct lpfc_vport;
26typedef enum _lpfc_ctx_cmd { 26typedef enum _lpfc_ctx_cmd {
27 LPFC_CTX_LUN, 27 LPFC_CTX_LUN,
28 LPFC_CTX_TGT, 28 LPFC_CTX_TGT,
29 LPFC_CTX_CTX,
30 LPFC_CTX_HOST 29 LPFC_CTX_HOST
31} lpfc_ctx_cmd; 30} lpfc_ctx_cmd;
32 31
@@ -54,9 +53,10 @@ struct lpfc_iocbq {
54 void *context2; /* caller context information */ 53 void *context2; /* caller context information */
55 void *context3; /* caller context information */ 54 void *context3; /* caller context information */
56 union { 55 union {
57 wait_queue_head_t *wait_queue; 56 wait_queue_head_t *wait_queue;
58 struct lpfc_iocbq *rsp_iocb; 57 struct lpfc_iocbq *rsp_iocb;
59 struct lpfcMboxq *mbox; 58 struct lpfcMboxq *mbox;
59 struct lpfc_nodelist *ndlp;
60 } context_un; 60 } context_un;
61 61
62 void (*fabric_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *, 62 void (*fabric_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *,
@@ -143,7 +143,7 @@ struct lpfc_sli_ring {
143 uint16_t numCiocb; /* number of command iocb's per ring */ 143 uint16_t numCiocb; /* number of command iocb's per ring */
144 uint16_t numRiocb; /* number of rsp iocb's per ring */ 144 uint16_t numRiocb; /* number of rsp iocb's per ring */
145 uint16_t sizeCiocb; /* Size of command iocb's in this ring */ 145 uint16_t sizeCiocb; /* Size of command iocb's in this ring */
146 uint16_t sizeRiocb; /* Size of response iocb's in this ring */ 146 uint16_t sizeRiocb; /* Size of response iocb's in this ring */
147 147
148 uint32_t fast_iotag; /* max fastlookup based iotag */ 148 uint32_t fast_iotag; /* max fastlookup based iotag */
149 uint32_t iotag_ctr; /* keeps track of the next iotag to use */ 149 uint32_t iotag_ctr; /* keeps track of the next iotag to use */
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index a5bc79eef052..0081f49286bc 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -18,12 +18,10 @@
18 * included with this package. * 18 * included with this package. *
19 *******************************************************************/ 19 *******************************************************************/
20 20
21#define LPFC_DRIVER_VERSION "8.2.1" 21#define LPFC_DRIVER_VERSION "8.2.2"
22 22
23#define LPFC_DRIVER_NAME "lpfc" 23#define LPFC_DRIVER_NAME "lpfc"
24 24
25#define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ 25#define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \
26 LPFC_DRIVER_VERSION 26 LPFC_DRIVER_VERSION
27#define LPFC_COPYRIGHT "Copyright(c) 2004-2007 Emulex. All rights reserved." 27#define LPFC_COPYRIGHT "Copyright(c) 2004-2007 Emulex. All rights reserved."
28
29#define DFC_API_VERSION "0.0.0"
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 85797dbf5478..dcb415e717c3 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -125,11 +125,10 @@ lpfc_vport_sparm(struct lpfc_hba *phba, struct lpfc_vport *vport)
125 pmb->vport = vport; 125 pmb->vport = vport;
126 rc = lpfc_sli_issue_mbox_wait(phba, pmb, phba->fc_ratov * 2); 126 rc = lpfc_sli_issue_mbox_wait(phba, pmb, phba->fc_ratov * 2);
127 if (rc != MBX_SUCCESS) { 127 if (rc != MBX_SUCCESS) {
128 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, 128 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT | LOG_VPORT,
129 "%d (%d):1818 VPort failed init, mbxCmd x%x " 129 "1818 VPort failed init, mbxCmd x%x "
130 "READ_SPARM mbxStatus x%x, rc = x%x\n", 130 "READ_SPARM mbxStatus x%x, rc = x%x\n",
131 phba->brd_no, vport->vpi, 131 mb->mbxCommand, mb->mbxStatus, rc);
132 mb->mbxCommand, mb->mbxStatus, rc);
133 lpfc_mbuf_free(phba, mp->virt, mp->phys); 132 lpfc_mbuf_free(phba, mp->virt, mp->phys);
134 kfree(mp); 133 kfree(mp);
135 if (rc != MBX_TIMEOUT) 134 if (rc != MBX_TIMEOUT)
@@ -162,9 +161,9 @@ lpfc_valid_wwn_format(struct lpfc_hba *phba, struct lpfc_name *wwn,
162 return 1; 161 return 1;
163 162
164 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, 163 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
165 "%d:1822 Invalid %s: %02x:%02x:%02x:%02x:" 164 "1822 Invalid %s: %02x:%02x:%02x:%02x:"
166 "%02x:%02x:%02x:%02x\n", 165 "%02x:%02x:%02x:%02x\n",
167 phba->brd_no, name_type, 166 name_type,
168 wwn->u.wwn[0], wwn->u.wwn[1], 167 wwn->u.wwn[0], wwn->u.wwn[1],
169 wwn->u.wwn[2], wwn->u.wwn[3], 168 wwn->u.wwn[2], wwn->u.wwn[3],
170 wwn->u.wwn[4], wwn->u.wwn[5], 169 wwn->u.wwn[4], wwn->u.wwn[5],
@@ -176,16 +175,21 @@ static int
176lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport) 175lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport)
177{ 176{
178 struct lpfc_vport *vport; 177 struct lpfc_vport *vport;
178 unsigned long flags;
179 179
180 spin_lock_irqsave(&phba->hbalock, flags);
180 list_for_each_entry(vport, &phba->port_list, listentry) { 181 list_for_each_entry(vport, &phba->port_list, listentry) {
181 if (vport == new_vport) 182 if (vport == new_vport)
182 continue; 183 continue;
183 /* If they match, return not unique */ 184 /* If they match, return not unique */
184 if (memcmp(&vport->fc_sparam.portName, 185 if (memcmp(&vport->fc_sparam.portName,
185 &new_vport->fc_sparam.portName, 186 &new_vport->fc_sparam.portName,
186 sizeof(struct lpfc_name)) == 0) 187 sizeof(struct lpfc_name)) == 0) {
188 spin_unlock_irqrestore(&phba->hbalock, flags);
187 return 0; 189 return 0;
190 }
188 } 191 }
192 spin_unlock_irqrestore(&phba->hbalock, flags);
189 return 1; 193 return 1;
190} 194}
191 195
@@ -193,8 +197,8 @@ int
193lpfc_vport_create(struct fc_vport *fc_vport, bool disable) 197lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
194{ 198{
195 struct lpfc_nodelist *ndlp; 199 struct lpfc_nodelist *ndlp;
196 struct lpfc_vport *pport = 200 struct Scsi_Host *shost = fc_vport->shost;
197 (struct lpfc_vport *) fc_vport->shost->hostdata; 201 struct lpfc_vport *pport = (struct lpfc_vport *) shost->hostdata;
198 struct lpfc_hba *phba = pport->phba; 202 struct lpfc_hba *phba = pport->phba;
199 struct lpfc_vport *vport = NULL; 203 struct lpfc_vport *vport = NULL;
200 int instance; 204 int instance;
@@ -204,9 +208,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
204 if ((phba->sli_rev < 3) || 208 if ((phba->sli_rev < 3) ||
205 !(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { 209 !(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) {
206 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, 210 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
207 "%d:1808 Create VPORT failed: " 211 "1808 Create VPORT failed: "
208 "NPIV is not enabled: SLImode:%d\n", 212 "NPIV is not enabled: SLImode:%d\n",
209 phba->brd_no, phba->sli_rev); 213 phba->sli_rev);
210 rc = VPORT_INVAL; 214 rc = VPORT_INVAL;
211 goto error_out; 215 goto error_out;
212 } 216 }
@@ -214,9 +218,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
214 vpi = lpfc_alloc_vpi(phba); 218 vpi = lpfc_alloc_vpi(phba);
215 if (vpi == 0) { 219 if (vpi == 0) {
216 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, 220 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
217 "%d:1809 Create VPORT failed: " 221 "1809 Create VPORT failed: "
218 "Max VPORTs (%d) exceeded\n", 222 "Max VPORTs (%d) exceeded\n",
219 phba->brd_no, phba->max_vpi); 223 phba->max_vpi);
220 rc = VPORT_NORESOURCES; 224 rc = VPORT_NORESOURCES;
221 goto error_out; 225 goto error_out;
222 } 226 }
@@ -225,18 +229,17 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
225 /* Assign an unused board number */ 229 /* Assign an unused board number */
226 if ((instance = lpfc_get_instance()) < 0) { 230 if ((instance = lpfc_get_instance()) < 0) {
227 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, 231 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
228 "%d:1810 Create VPORT failed: Cannot get " 232 "1810 Create VPORT failed: Cannot get "
229 "instance number\n", phba->brd_no); 233 "instance number\n");
230 lpfc_free_vpi(phba, vpi); 234 lpfc_free_vpi(phba, vpi);
231 rc = VPORT_NORESOURCES; 235 rc = VPORT_NORESOURCES;
232 goto error_out; 236 goto error_out;
233 } 237 }
234 238
235 vport = lpfc_create_port(phba, instance, fc_vport); 239 vport = lpfc_create_port(phba, instance, &fc_vport->dev);
236 if (!vport) { 240 if (!vport) {
237 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, 241 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
238 "%d:1811 Create VPORT failed: vpi x%x\n", 242 "1811 Create VPORT failed: vpi x%x\n", vpi);
239 phba->brd_no, vpi);
240 lpfc_free_vpi(phba, vpi); 243 lpfc_free_vpi(phba, vpi);
241 rc = VPORT_NORESOURCES; 244 rc = VPORT_NORESOURCES;
242 goto error_out; 245 goto error_out;
@@ -246,10 +249,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
246 lpfc_debugfs_initialize(vport); 249 lpfc_debugfs_initialize(vport);
247 250
248 if (lpfc_vport_sparm(phba, vport)) { 251 if (lpfc_vport_sparm(phba, vport)) {
249 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, 252 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
250 "%d:1813 Create VPORT failed: vpi:%d " 253 "1813 Create VPORT failed. "
251 "Cannot get sparam\n", 254 "Cannot get sparam\n");
252 phba->brd_no, vpi);
253 lpfc_free_vpi(phba, vpi); 255 lpfc_free_vpi(phba, vpi);
254 destroy_port(vport); 256 destroy_port(vport);
255 rc = VPORT_NORESOURCES; 257 rc = VPORT_NORESOURCES;
@@ -269,10 +271,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
269 271
270 if (!lpfc_valid_wwn_format(phba, &vport->fc_sparam.nodeName, "WWNN") || 272 if (!lpfc_valid_wwn_format(phba, &vport->fc_sparam.nodeName, "WWNN") ||
271 !lpfc_valid_wwn_format(phba, &vport->fc_sparam.portName, "WWPN")) { 273 !lpfc_valid_wwn_format(phba, &vport->fc_sparam.portName, "WWPN")) {
272 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, 274 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
273 "%d:1821 Create VPORT failed: vpi:%d " 275 "1821 Create VPORT failed. "
274 "Invalid WWN format\n", 276 "Invalid WWN format\n");
275 phba->brd_no, vpi);
276 lpfc_free_vpi(phba, vpi); 277 lpfc_free_vpi(phba, vpi);
277 destroy_port(vport); 278 destroy_port(vport);
278 rc = VPORT_INVAL; 279 rc = VPORT_INVAL;
@@ -280,10 +281,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
280 } 281 }
281 282
282 if (!lpfc_unique_wwpn(phba, vport)) { 283 if (!lpfc_unique_wwpn(phba, vport)) {
283 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, 284 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
284 "%d:1823 Create VPORT failed: vpi:%d " 285 "1823 Create VPORT failed. "
285 "Duplicate WWN on HBA\n", 286 "Duplicate WWN on HBA\n");
286 phba->brd_no, vpi);
287 lpfc_free_vpi(phba, vpi); 287 lpfc_free_vpi(phba, vpi);
288 destroy_port(vport); 288 destroy_port(vport);
289 rc = VPORT_INVAL; 289 rc = VPORT_INVAL;
@@ -315,10 +315,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
315 lpfc_initial_fdisc(vport); 315 lpfc_initial_fdisc(vport);
316 } else { 316 } else {
317 lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); 317 lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP);
318 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 318 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
319 "%d (%d):0262 No NPIV Fabric " 319 "0262 No NPIV Fabric support\n");
320 "support\n",
321 phba->brd_no, vport->vpi);
322 } 320 }
323 } else { 321 } else {
324 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 322 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
@@ -326,12 +324,14 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
326 rc = VPORT_OK; 324 rc = VPORT_OK;
327 325
328out: 326out:
327 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
328 "1825 Vport Created.\n");
329 lpfc_host_attrib_init(lpfc_shost_from_vport(vport)); 329 lpfc_host_attrib_init(lpfc_shost_from_vport(vport));
330error_out: 330error_out:
331 return rc; 331 return rc;
332} 332}
333 333
334int 334static int
335disable_vport(struct fc_vport *fc_vport) 335disable_vport(struct fc_vport *fc_vport)
336{ 336{
337 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; 337 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data;
@@ -371,10 +371,12 @@ disable_vport(struct fc_vport *fc_vport)
371 lpfc_mbx_unreg_vpi(vport); 371 lpfc_mbx_unreg_vpi(vport);
372 372
373 lpfc_vport_set_state(vport, FC_VPORT_DISABLED); 373 lpfc_vport_set_state(vport, FC_VPORT_DISABLED);
374 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
375 "1826 Vport Disabled.\n");
374 return VPORT_OK; 376 return VPORT_OK;
375} 377}
376 378
377int 379static int
378enable_vport(struct fc_vport *fc_vport) 380enable_vport(struct fc_vport *fc_vport)
379{ 381{
380 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; 382 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data;
@@ -400,15 +402,14 @@ enable_vport(struct fc_vport *fc_vport)
400 lpfc_initial_fdisc(vport); 402 lpfc_initial_fdisc(vport);
401 } else { 403 } else {
402 lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); 404 lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP);
403 lpfc_printf_log(phba, KERN_ERR, LOG_ELS, 405 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
404 "%d (%d):0264 No NPIV Fabric " 406 "0264 No NPIV Fabric support\n");
405 "support\n",
406 phba->brd_no, vport->vpi);
407 } 407 }
408 } else { 408 } else {
409 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 409 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
410 } 410 }
411 411 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
412 "1827 Vport Enabled.\n");
412 return VPORT_OK; 413 return VPORT_OK;
413} 414}
414 415
@@ -431,8 +432,29 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
431 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; 432 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data;
432 struct lpfc_hba *phba = vport->phba; 433 struct lpfc_hba *phba = vport->phba;
433 long timeout; 434 long timeout;
434 int rc = VPORT_ERROR;
435 435
436 if (vport->port_type == LPFC_PHYSICAL_PORT) {
437 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
438 "1812 vport_delete failed: Cannot delete "
439 "physical host\n");
440 return VPORT_ERROR;
441 }
442 /*
443 * If we are not unloading the driver then prevent the vport_delete
444 * from happening until after this vport's discovery is finished.
445 */
446 if (!(phba->pport->load_flag & FC_UNLOADING)) {
447 int check_count = 0;
448 while (check_count < ((phba->fc_ratov * 3) + 3) &&
449 vport->port_state > LPFC_VPORT_FAILED &&
450 vport->port_state < LPFC_VPORT_READY) {
451 check_count++;
452 msleep(1000);
453 }
454 if (vport->port_state > LPFC_VPORT_FAILED &&
455 vport->port_state < LPFC_VPORT_READY)
456 return -EAGAIN;
457 }
436 /* 458 /*
437 * This is a bit of a mess. We want to ensure the shost doesn't get 459 * This is a bit of a mess. We want to ensure the shost doesn't get
438 * torn down until we're done with the embedded lpfc_vport structure. 460 * torn down until we're done with the embedded lpfc_vport structure.
@@ -450,16 +472,9 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
450 */ 472 */
451 if (!scsi_host_get(shost) || !scsi_host_get(shost)) 473 if (!scsi_host_get(shost) || !scsi_host_get(shost))
452 return VPORT_INVAL; 474 return VPORT_INVAL;
453 475 spin_lock_irq(&phba->hbalock);
454 if (vport->port_type == LPFC_PHYSICAL_PORT) {
455 lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
456 "%d:1812 vport_delete failed: Cannot delete "
457 "physical host\n", phba->brd_no);
458 goto out;
459 }
460
461 vport->load_flag |= FC_UNLOADING; 476 vport->load_flag |= FC_UNLOADING;
462 477 spin_unlock_irq(&phba->hbalock);
463 kfree(vport->vname); 478 kfree(vport->vname);
464 lpfc_debugfs_terminate(vport); 479 lpfc_debugfs_terminate(vport);
465 fc_remove_host(lpfc_shost_from_vport(vport)); 480 fc_remove_host(lpfc_shost_from_vport(vport));
@@ -511,13 +526,46 @@ skip_logo:
511 spin_lock_irq(&phba->hbalock); 526 spin_lock_irq(&phba->hbalock);
512 list_del_init(&vport->listentry); 527 list_del_init(&vport->listentry);
513 spin_unlock_irq(&phba->hbalock); 528 spin_unlock_irq(&phba->hbalock);
514 529 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
515 rc = VPORT_OK; 530 "1828 Vport Deleted.\n");
516out:
517 scsi_host_put(shost); 531 scsi_host_put(shost);
518 return rc; 532 return VPORT_OK;
519} 533}
520 534
521
522EXPORT_SYMBOL(lpfc_vport_create); 535EXPORT_SYMBOL(lpfc_vport_create);
523EXPORT_SYMBOL(lpfc_vport_delete); 536EXPORT_SYMBOL(lpfc_vport_delete);
537
538struct lpfc_vport **
539lpfc_create_vport_work_array(struct lpfc_hba *phba)
540{
541 struct lpfc_vport *port_iterator;
542 struct lpfc_vport **vports;
543 int index = 0;
544 vports = kzalloc(LPFC_MAX_VPORTS * sizeof(struct lpfc_vport *),
545 GFP_KERNEL);
546 if (vports == NULL)
547 return NULL;
548 spin_lock_irq(&phba->hbalock);
549 list_for_each_entry(port_iterator, &phba->port_list, listentry) {
550 if (!scsi_host_get(lpfc_shost_from_vport(port_iterator))) {
551 lpfc_printf_vlog(port_iterator, KERN_WARNING, LOG_VPORT,
552 "1801 Create vport work array FAILED: "
553 "cannot do scsi_host_get\n");
554 continue;
555 }
556 vports[index++] = port_iterator;
557 }
558 spin_unlock_irq(&phba->hbalock);
559 return vports;
560}
561
562void
563lpfc_destroy_vport_work_array(struct lpfc_vport **vports)
564{
565 int i;
566 if (vports == NULL)
567 return;
568 for (i=0; vports[i] != NULL && i < LPFC_MAX_VPORTS; i++)
569 scsi_host_put(lpfc_shost_from_vport(vports[i]));
570 kfree(vports);
571}
diff --git a/drivers/scsi/lpfc/lpfc_vport.h b/drivers/scsi/lpfc/lpfc_vport.h
index f223550f8cba..91da17751a37 100644
--- a/drivers/scsi/lpfc/lpfc_vport.h
+++ b/drivers/scsi/lpfc/lpfc_vport.h
@@ -88,6 +88,8 @@ int lpfc_vport_create(struct fc_vport *, bool);
88int lpfc_vport_delete(struct fc_vport *); 88int lpfc_vport_delete(struct fc_vport *);
89int lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *); 89int lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *);
90int lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint); 90int lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint);
91struct lpfc_vport **lpfc_create_vport_work_array(struct lpfc_hba *);
92void lpfc_destroy_vport_work_array(struct lpfc_vport **);
91 93
92/* 94/*
93 * queuecommand VPORT-specific return codes. Specified in the host byte code. 95 * queuecommand VPORT-specific return codes. Specified in the host byte code.
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index c488996cb958..93c0c7e4f08f 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2154,6 +2154,19 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
2154 } 2154 }
2155 } 2155 }
2156 2156
2157 /* Get memory for cached NVRAM */
2158 ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL);
2159 if (ha->nvram == NULL) {
2160 /* error */
2161 qla_printk(KERN_WARNING, ha,
2162 "Memory Allocation failed - nvram cache\n");
2163
2164 qla2x00_mem_free(ha);
2165 msleep(100);
2166
2167 continue;
2168 }
2169
2157 /* Done all allocations without any error. */ 2170 /* Done all allocations without any error. */
2158 status = 0; 2171 status = 0;
2159 2172
@@ -2266,6 +2279,7 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
2266 ha->fw_dump_reading = 0; 2279 ha->fw_dump_reading = 0;
2267 2280
2268 vfree(ha->optrom_buffer); 2281 vfree(ha->optrom_buffer);
2282 kfree(ha->nvram);
2269} 2283}
2270 2284
2271/* 2285/*
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index c4195ea869e9..594887205b0f 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -193,7 +193,8 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
193 cpu_relax(); 193 cpu_relax();
194 } 194 }
195 if (!loop_count) 195 if (!loop_count)
196 printk(KERN_EMERG "qlogicpti: mbox_command loop timeout #1\n"); 196 printk(KERN_EMERG "qlogicpti%d: mbox_command loop timeout #1\n",
197 qpti->qpti_id);
197 198
198 /* Write mailbox command registers. */ 199 /* Write mailbox command registers. */
199 switch (mbox_param[param[0]] >> 4) { 200 switch (mbox_param[param[0]] >> 4) {
@@ -224,8 +225,8 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
224 (sbus_readw(qpti->qregs + HCCTRL) & HCCTRL_CRIRQ)) 225 (sbus_readw(qpti->qregs + HCCTRL) & HCCTRL_CRIRQ))
225 udelay(20); 226 udelay(20);
226 if (!loop_count) 227 if (!loop_count)
227 printk(KERN_EMERG "qlogicpti: mbox_command[%04x] loop timeout #2\n", 228 printk(KERN_EMERG "qlogicpti%d: mbox_command[%04x] loop timeout #2\n",
228 param[0]); 229 qpti->qpti_id, param[0]);
229 230
230 /* Wait for SBUS semaphore to get set. */ 231 /* Wait for SBUS semaphore to get set. */
231 loop_count = DEFAULT_LOOP_COUNT; 232 loop_count = DEFAULT_LOOP_COUNT;
@@ -238,16 +239,16 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
238 break; 239 break;
239 } 240 }
240 if (!loop_count) 241 if (!loop_count)
241 printk(KERN_EMERG "qlogicpti: mbox_command[%04x] loop timeout #3\n", 242 printk(KERN_EMERG "qlogicpti%d: mbox_command[%04x] loop timeout #3\n",
242 param[0]); 243 qpti->qpti_id, param[0]);
243 244
244 /* Wait for MBOX busy condition to go away. */ 245 /* Wait for MBOX busy condition to go away. */
245 loop_count = DEFAULT_LOOP_COUNT; 246 loop_count = DEFAULT_LOOP_COUNT;
246 while (--loop_count && (sbus_readw(qpti->qregs + MBOX0) == 0x04)) 247 while (--loop_count && (sbus_readw(qpti->qregs + MBOX0) == 0x04))
247 udelay(20); 248 udelay(20);
248 if (!loop_count) 249 if (!loop_count)
249 printk(KERN_EMERG "qlogicpti: mbox_command[%04x] loop timeout #4\n", 250 printk(KERN_EMERG "qlogicpti%d: mbox_command[%04x] loop timeout #4\n",
250 param[0]); 251 qpti->qpti_id, param[0]);
251 252
252 /* Read back output parameters. */ 253 /* Read back output parameters. */
253 switch (mbox_param[param[0]] & 0xf) { 254 switch (mbox_param[param[0]] & 0xf) {
@@ -342,7 +343,8 @@ static int qlogicpti_reset_hardware(struct Scsi_Host *host)
342 while (--loop_count && ((sbus_readw(qpti->qregs + MBOX0) & 0xff) == 0x04)) 343 while (--loop_count && ((sbus_readw(qpti->qregs + MBOX0) & 0xff) == 0x04))
343 udelay(20); 344 udelay(20);
344 if (!loop_count) 345 if (!loop_count)
345 printk(KERN_EMERG "qlogicpti: reset_hardware loop timeout\n"); 346 printk(KERN_EMERG "qlogicpti%d: reset_hardware loop timeout\n",
347 qpti->qpti_id);
346 348
347 sbus_writew(HCCTRL_PAUSE, qpti->qregs + HCCTRL); 349 sbus_writew(HCCTRL_PAUSE, qpti->qregs + HCCTRL);
348 set_sbus_cfg1(qpti); 350 set_sbus_cfg1(qpti);
@@ -721,12 +723,12 @@ static int __init qpti_register_irq(struct qlogicpti *qpti)
721 IRQF_SHARED, "Qlogic/PTI", qpti)) 723 IRQF_SHARED, "Qlogic/PTI", qpti))
722 goto fail; 724 goto fail;
723 725
724 printk("qpti%d: IRQ %d ", qpti->qpti_id, qpti->irq); 726 printk("qlogicpti%d: IRQ %d ", qpti->qpti_id, qpti->irq);
725 727
726 return 0; 728 return 0;
727 729
728fail: 730fail:
729 printk("qpti%d: Cannot acquire irq line\n", qpti->qpti_id); 731 printk("qlogicpti%d: Cannot acquire irq line\n", qpti->qpti_id);
730 return -1; 732 return -1;
731} 733}
732 734
@@ -1210,7 +1212,7 @@ static int qlogicpti_return_status(struct Status_Entry *sts, int id)
1210 host_status = DID_OK; 1212 host_status = DID_OK;
1211 break; 1213 break;
1212 default: 1214 default:
1213 printk(KERN_EMERG "qpti%d: unknown completion status 0x%04x\n", 1215 printk(KERN_EMERG "qlogicpti%d: unknown completion status 0x%04x\n",
1214 id, sts->completion_status); 1216 id, sts->completion_status);
1215 host_status = DID_ERROR; 1217 host_status = DID_ERROR;
1216 break; 1218 break;
@@ -1329,8 +1331,8 @@ static int qlogicpti_abort(struct scsi_cmnd *Cmnd)
1329 u32 cmd_cookie; 1331 u32 cmd_cookie;
1330 int i; 1332 int i;
1331 1333
1332 printk(KERN_WARNING "qlogicpti : Aborting cmd for tgt[%d] lun[%d]\n", 1334 printk(KERN_WARNING "qlogicpti%d: Aborting cmd for tgt[%d] lun[%d]\n",
1333 (int)Cmnd->device->id, (int)Cmnd->device->lun); 1335 qpti->qpti_id, (int)Cmnd->device->id, (int)Cmnd->device->lun);
1334 1336
1335 qlogicpti_disable_irqs(qpti); 1337 qlogicpti_disable_irqs(qpti);
1336 1338
@@ -1348,7 +1350,8 @@ static int qlogicpti_abort(struct scsi_cmnd *Cmnd)
1348 param[3] = cmd_cookie & 0xffff; 1350 param[3] = cmd_cookie & 0xffff;
1349 if (qlogicpti_mbox_command(qpti, param, 0) || 1351 if (qlogicpti_mbox_command(qpti, param, 0) ||
1350 (param[0] != MBOX_COMMAND_COMPLETE)) { 1352 (param[0] != MBOX_COMMAND_COMPLETE)) {
1351 printk(KERN_EMERG "qlogicpti : scsi abort failure: %x\n", param[0]); 1353 printk(KERN_EMERG "qlogicpti%d: scsi abort failure: %x\n",
1354 qpti->qpti_id, param[0]);
1352 return_status = FAILED; 1355 return_status = FAILED;
1353 } 1356 }
1354 1357
@@ -1364,7 +1367,8 @@ static int qlogicpti_reset(struct scsi_cmnd *Cmnd)
1364 struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata; 1367 struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata;
1365 int return_status = SUCCESS; 1368 int return_status = SUCCESS;
1366 1369
1367 printk(KERN_WARNING "qlogicpti : Resetting SCSI bus!\n"); 1370 printk(KERN_WARNING "qlogicpti%d: Resetting SCSI bus!\n",
1371 qpti->qpti_id);
1368 1372
1369 qlogicpti_disable_irqs(qpti); 1373 qlogicpti_disable_irqs(qpti);
1370 1374
@@ -1372,7 +1376,8 @@ static int qlogicpti_reset(struct scsi_cmnd *Cmnd)
1372 param[1] = qpti->host_param.bus_reset_delay; 1376 param[1] = qpti->host_param.bus_reset_delay;
1373 if (qlogicpti_mbox_command(qpti, param, 0) || 1377 if (qlogicpti_mbox_command(qpti, param, 0) ||
1374 (param[0] != MBOX_COMMAND_COMPLETE)) { 1378 (param[0] != MBOX_COMMAND_COMPLETE)) {
1375 printk(KERN_EMERG "qlogicisp : scsi bus reset failure: %x\n", param[0]); 1379 printk(KERN_EMERG "qlogicisp%d: scsi bus reset failure: %x\n",
1380 qpti->qpti_id, param[0]);
1376 return_status = FAILED; 1381 return_status = FAILED;
1377 } 1382 }
1378 1383
@@ -1454,22 +1459,25 @@ static int __devinit qpti_sbus_probe(struct of_device *dev, const struct of_devi
1454 if (qlogicpti_reset_hardware(host)) 1459 if (qlogicpti_reset_hardware(host))
1455 goto fail_unmap_queues; 1460 goto fail_unmap_queues;
1456 1461
1457 if (scsi_add_host(host, &dev->dev))
1458 goto fail_unmap_queues;
1459
1460 printk("(Firmware v%d.%d.%d)", qpti->fware_majrev, 1462 printk("(Firmware v%d.%d.%d)", qpti->fware_majrev,
1461 qpti->fware_minrev, qpti->fware_micrev); 1463 qpti->fware_minrev, qpti->fware_micrev);
1462 1464
1463 fcode = of_get_property(dp, "isp-fcode", NULL); 1465 fcode = of_get_property(dp, "isp-fcode", NULL);
1464 if (fcode && fcode[0]) 1466 if (fcode && fcode[0])
1465 printk("(Firmware %s)", fcode); 1467 printk("(FCode %s)", fcode);
1466 if (of_find_property(dp, "differential", NULL) != NULL) 1468 if (of_find_property(dp, "differential", NULL) != NULL)
1467 qpti->differential = 1; 1469 qpti->differential = 1;
1468 1470
1469 printk (" [%s Wide, using %s interface]\n", 1471 printk("\nqlogicpti%d: [%s Wide, using %s interface]\n",
1472 qpti->qpti_id,
1470 (qpti->ultra ? "Ultra" : "Fast"), 1473 (qpti->ultra ? "Ultra" : "Fast"),
1471 (qpti->differential ? "differential" : "single ended")); 1474 (qpti->differential ? "differential" : "single ended"));
1472 1475
1476 if (scsi_add_host(host, &dev->dev)) {
1477 printk("qlogicpti%d: Failed scsi_add_host\n", qpti->qpti_id);
1478 goto fail_unmap_queues;
1479 }
1480
1473 dev_set_drvdata(&sdev->ofdev.dev, qpti); 1481 dev_set_drvdata(&sdev->ofdev.dev, qpti);
1474 1482
1475 qpti_chain_add(qpti); 1483 qpti_chain_add(qpti);
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 21c075d44db1..a417a6ff9f97 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1038,22 +1038,6 @@ static int scsi_init_io(struct scsi_cmnd *cmd)
1038 return BLKPREP_KILL; 1038 return BLKPREP_KILL;
1039} 1039}
1040 1040
1041static int scsi_issue_flush_fn(struct request_queue *q, struct gendisk *disk,
1042 sector_t *error_sector)
1043{
1044 struct scsi_device *sdev = q->queuedata;
1045 struct scsi_driver *drv;
1046
1047 if (sdev->sdev_state != SDEV_RUNNING)
1048 return -ENXIO;
1049
1050 drv = *(struct scsi_driver **) disk->private_data;
1051 if (drv->issue_flush)
1052 return drv->issue_flush(&sdev->sdev_gendev, error_sector);
1053
1054 return -EOPNOTSUPP;
1055}
1056
1057static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev, 1041static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev,
1058 struct request *req) 1042 struct request *req)
1059{ 1043{
@@ -1596,7 +1580,6 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev)
1596 return NULL; 1580 return NULL;
1597 1581
1598 blk_queue_prep_rq(q, scsi_prep_fn); 1582 blk_queue_prep_rq(q, scsi_prep_fn);
1599 blk_queue_issue_flush_fn(q, scsi_issue_flush_fn);
1600 blk_queue_softirq_done(q, scsi_softirq_done); 1583 blk_queue_softirq_done(q, scsi_softirq_done);
1601 return q; 1584 return q;
1602} 1585}
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e21c7142a3ea..2c6116fd4578 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -241,7 +241,6 @@ static struct scsi_driver sd_template = {
241 }, 241 },
242 .rescan = sd_rescan, 242 .rescan = sd_rescan,
243 .init_command = sd_init_command, 243 .init_command = sd_init_command,
244 .issue_flush = sd_issue_flush,
245}; 244};
246 245
247/* 246/*
@@ -800,10 +799,17 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
800 return 0; 799 return 0;
801} 800}
802 801
803static int sd_issue_flush(struct device *dev, sector_t *error_sector) 802static int sd_issue_flush(struct request_queue *q, struct gendisk *disk,
803 sector_t *error_sector)
804{ 804{
805 int ret = 0; 805 int ret = 0;
806 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); 806 struct scsi_device *sdp = q->queuedata;
807 struct scsi_disk *sdkp;
808
809 if (sdp->sdev_state != SDEV_RUNNING)
810 return -ENXIO;
811
812 sdkp = scsi_disk_get_from_dev(&sdp->sdev_gendev);
807 813
808 if (!sdkp) 814 if (!sdkp)
809 return -ENODEV; 815 return -ENODEV;
@@ -1663,6 +1669,8 @@ static int sd_probe(struct device *dev)
1663 1669
1664 sd_revalidate_disk(gd); 1670 sd_revalidate_disk(gd);
1665 1671
1672 blk_queue_issue_flush_fn(sdp->request_queue, sd_issue_flush);
1673
1666 gd->driverfs_dev = &sdp->sdev_gendev; 1674 gd->driverfs_dev = &sdp->sdev_gendev;
1667 gd->flags = GENHD_FL_DRIVERFS; 1675 gd->flags = GENHD_FL_DRIVERFS;
1668 if (sdp->removable) 1676 if (sdp->removable)
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index a4f7b8465773..73c44cbdea47 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -1485,7 +1485,7 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
1485 struct st_buffer *STbp; 1485 struct st_buffer *STbp;
1486 char *name = tape_name(STp); 1486 char *name = tape_name(STp);
1487 1487
1488 if (down_interruptible(&STp->lock)) 1488 if (mutex_lock_interruptible(&STp->lock))
1489 return -ERESTARTSYS; 1489 return -ERESTARTSYS;
1490 1490
1491 retval = rw_checks(STp, filp, count); 1491 retval = rw_checks(STp, filp, count);
@@ -1736,7 +1736,7 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
1736 if (SRpnt != NULL) 1736 if (SRpnt != NULL)
1737 st_release_request(SRpnt); 1737 st_release_request(SRpnt);
1738 release_buffering(STp, 0); 1738 release_buffering(STp, 0);
1739 up(&STp->lock); 1739 mutex_unlock(&STp->lock);
1740 1740
1741 return retval; 1741 return retval;
1742} 1742}
@@ -1942,7 +1942,7 @@ st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
1942 struct st_buffer *STbp = STp->buffer; 1942 struct st_buffer *STbp = STp->buffer;
1943 DEB( char *name = tape_name(STp); ) 1943 DEB( char *name = tape_name(STp); )
1944 1944
1945 if (down_interruptible(&STp->lock)) 1945 if (mutex_lock_interruptible(&STp->lock))
1946 return -ERESTARTSYS; 1946 return -ERESTARTSYS;
1947 1947
1948 retval = rw_checks(STp, filp, count); 1948 retval = rw_checks(STp, filp, count);
@@ -2069,7 +2069,7 @@ st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
2069 release_buffering(STp, 1); 2069 release_buffering(STp, 1);
2070 STbp->buffer_bytes = 0; 2070 STbp->buffer_bytes = 0;
2071 } 2071 }
2072 up(&STp->lock); 2072 mutex_unlock(&STp->lock);
2073 2073
2074 return retval; 2074 return retval;
2075} 2075}
@@ -3226,7 +3226,7 @@ static int st_ioctl(struct inode *inode, struct file *file,
3226 char *name = tape_name(STp); 3226 char *name = tape_name(STp);
3227 void __user *p = (void __user *)arg; 3227 void __user *p = (void __user *)arg;
3228 3228
3229 if (down_interruptible(&STp->lock)) 3229 if (mutex_lock_interruptible(&STp->lock))
3230 return -ERESTARTSYS; 3230 return -ERESTARTSYS;
3231 3231
3232 DEB( 3232 DEB(
@@ -3537,7 +3537,7 @@ static int st_ioctl(struct inode *inode, struct file *file,
3537 retval = (-EFAULT); 3537 retval = (-EFAULT);
3538 goto out; 3538 goto out;
3539 } 3539 }
3540 up(&STp->lock); 3540 mutex_unlock(&STp->lock);
3541 switch (cmd_in) { 3541 switch (cmd_in) {
3542 case SCSI_IOCTL_GET_IDLUN: 3542 case SCSI_IOCTL_GET_IDLUN:
3543 case SCSI_IOCTL_GET_BUS_NUMBER: 3543 case SCSI_IOCTL_GET_BUS_NUMBER:
@@ -3563,7 +3563,7 @@ static int st_ioctl(struct inode *inode, struct file *file,
3563 return retval; 3563 return retval;
3564 3564
3565 out: 3565 out:
3566 up(&STp->lock); 3566 mutex_unlock(&STp->lock);
3567 return retval; 3567 return retval;
3568} 3568}
3569 3569
@@ -4029,7 +4029,7 @@ static int st_probe(struct device *dev)
4029 4029
4030 tpnt->density_changed = tpnt->compression_changed = 4030 tpnt->density_changed = tpnt->compression_changed =
4031 tpnt->blksize_changed = 0; 4031 tpnt->blksize_changed = 0;
4032 init_MUTEX(&tpnt->lock); 4032 mutex_init(&tpnt->lock);
4033 4033
4034 st_nr_dev++; 4034 st_nr_dev++;
4035 write_unlock(&st_dev_arr_lock); 4035 write_unlock(&st_dev_arr_lock);
diff --git a/drivers/scsi/st.h b/drivers/scsi/st.h
index 50f3deb1f9ed..6c8075712974 100644
--- a/drivers/scsi/st.h
+++ b/drivers/scsi/st.h
@@ -3,6 +3,7 @@
3#define _ST_H 3#define _ST_H
4 4
5#include <linux/completion.h> 5#include <linux/completion.h>
6#include <linux/mutex.h>
6#include <linux/kref.h> 7#include <linux/kref.h>
7#include <scsi/scsi_cmnd.h> 8#include <scsi/scsi_cmnd.h>
8 9
@@ -98,7 +99,7 @@ struct st_partstat {
98struct scsi_tape { 99struct scsi_tape {
99 struct scsi_driver *driver; 100 struct scsi_driver *driver;
100 struct scsi_device *device; 101 struct scsi_device *device;
101 struct semaphore lock; /* For serialization */ 102 struct mutex lock; /* For serialization */
102 struct completion wait; /* For SCSI commands */ 103 struct completion wait; /* For SCSI commands */
103 struct st_buffer *buffer; 104 struct st_buffer *buffer;
104 105
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 2f5a5ac1b271..301313002f6b 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2514,7 +2514,7 @@ static int __init serial8250_console_setup(struct console *co, char *options)
2514 return uart_set_options(port, co, baud, parity, bits, flow); 2514 return uart_set_options(port, co, baud, parity, bits, flow);
2515} 2515}
2516 2516
2517static int __init serial8250_console_early_setup(void) 2517static int serial8250_console_early_setup(void)
2518{ 2518{
2519 return serial8250_find_port_for_earlycon(); 2519 return serial8250_find_port_for_earlycon();
2520} 2520}
diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c
index 150cad5c2eba..4d4c9f01be8d 100644
--- a/drivers/serial/8250_early.c
+++ b/drivers/serial/8250_early.c
@@ -227,7 +227,7 @@ int __init setup_early_serial8250_console(char *cmdline)
227 return 0; 227 return 0;
228} 228}
229 229
230int __init serial8250_find_port_for_earlycon(void) 230int serial8250_find_port_for_earlycon(void)
231{ 231{
232 struct early_serial8250_device *device = &early_device; 232 struct early_serial8250_device *device = &early_device;
233 struct uart_port *port = &device->port; 233 struct uart_port *port = &device->port;
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 0c16a2b39b41..2adf856e44c2 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -86,7 +86,7 @@ struct mpc83xx_spi {
86 86
87 unsigned nsecs; /* (clock cycle time)/2 */ 87 unsigned nsecs; /* (clock cycle time)/2 */
88 88
89 u32 sysclk; 89 u32 spibrg; /* SPIBRG input clock */
90 u32 rx_shift; /* RX data reg shift when in qe mode */ 90 u32 rx_shift; /* RX data reg shift when in qe mode */
91 u32 tx_shift; /* TX data reg shift when in qe mode */ 91 u32 tx_shift; /* TX data reg shift when in qe mode */
92 92
@@ -148,6 +148,8 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
148 if (value == BITBANG_CS_ACTIVE) { 148 if (value == BITBANG_CS_ACTIVE) {
149 u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); 149 u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
150 u32 len = spi->bits_per_word; 150 u32 len = spi->bits_per_word;
151 u8 pm;
152
151 if (len == 32) 153 if (len == 32)
152 len = 0; 154 len = 0;
153 else 155 else
@@ -169,17 +171,20 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
169 171
170 regval |= SPMODE_LEN(len); 172 regval |= SPMODE_LEN(len);
171 173
172 if ((mpc83xx_spi->sysclk / spi->max_speed_hz) >= 64) { 174 if ((mpc83xx_spi->spibrg / spi->max_speed_hz) >= 64) {
173 u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 64); 175 pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 64) - 1;
174 if (pm > 0x0f) { 176 if (pm > 0x0f) {
175 printk(KERN_WARNING "MPC83xx SPI: SPICLK can't be less then a SYSCLK/1024!\n" 177 dev_err(&spi->dev, "Requested speed is too "
176 "Requested SPICLK is %d Hz. Will use %d Hz instead.\n", 178 "low: %d Hz. Will use %d Hz instead.\n",
177 spi->max_speed_hz, mpc83xx_spi->sysclk / 1024); 179 spi->max_speed_hz,
180 mpc83xx_spi->spibrg / 1024);
178 pm = 0x0f; 181 pm = 0x0f;
179 } 182 }
180 regval |= SPMODE_PM(pm) | SPMODE_DIV16; 183 regval |= SPMODE_PM(pm) | SPMODE_DIV16;
181 } else { 184 } else {
182 u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 4); 185 pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 4);
186 if (pm)
187 pm--;
183 regval |= SPMODE_PM(pm); 188 regval |= SPMODE_PM(pm);
184 } 189 }
185 190
@@ -429,13 +434,17 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
429 mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect; 434 mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect;
430 mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer; 435 mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer;
431 mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs; 436 mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs;
432 mpc83xx_spi->sysclk = pdata->sysclk;
433 mpc83xx_spi->activate_cs = pdata->activate_cs; 437 mpc83xx_spi->activate_cs = pdata->activate_cs;
434 mpc83xx_spi->deactivate_cs = pdata->deactivate_cs; 438 mpc83xx_spi->deactivate_cs = pdata->deactivate_cs;
435 mpc83xx_spi->qe_mode = pdata->qe_mode; 439 mpc83xx_spi->qe_mode = pdata->qe_mode;
436 mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; 440 mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;
437 mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; 441 mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;
438 442
443 if (mpc83xx_spi->qe_mode)
444 mpc83xx_spi->spibrg = pdata->sysclk / 2;
445 else
446 mpc83xx_spi->spibrg = pdata->sysclk;
447
439 mpc83xx_spi->rx_shift = 0; 448 mpc83xx_spi->rx_shift = 0;
440 mpc83xx_spi->tx_shift = 0; 449 mpc83xx_spi->tx_shift = 0;
441 if (mpc83xx_spi->qe_mode) { 450 if (mpc83xx_spi->qe_mode) {
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 630f781aeb19..c55459c592b8 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -183,7 +183,9 @@ static int spidev_message(struct spidev_data *spidev,
183 183
184 if (u_tmp->rx_buf) { 184 if (u_tmp->rx_buf) {
185 k_tmp->rx_buf = buf; 185 k_tmp->rx_buf = buf;
186 if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) 186 if (!access_ok(VERIFY_WRITE, (u8 __user *)
187 (ptrdiff_t) u_tmp->rx_buf,
188 u_tmp->len))
187 goto done; 189 goto done;
188 } 190 }
189 if (u_tmp->tx_buf) { 191 if (u_tmp->tx_buf) {
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c
index 87c747123538..ee9046db9c7d 100644
--- a/drivers/video/cg6.c
+++ b/drivers/video/cg6.c
@@ -677,6 +677,7 @@ static int __devinit cg6_probe(struct of_device *op, const struct of_device_id *
677 struct fb_info *info; 677 struct fb_info *info;
678 struct cg6_par *par; 678 struct cg6_par *par;
679 int linebytes, err; 679 int linebytes, err;
680 int dblbuf;
680 681
681 info = framebuffer_alloc(sizeof(struct cg6_par), &op->dev); 682 info = framebuffer_alloc(sizeof(struct cg6_par), &op->dev);
682 683
@@ -698,7 +699,9 @@ static int __devinit cg6_probe(struct of_device *op, const struct of_device_id *
698 linebytes = of_getintprop_default(dp, "linebytes", 699 linebytes = of_getintprop_default(dp, "linebytes",
699 info->var.xres); 700 info->var.xres);
700 par->fbsize = PAGE_ALIGN(linebytes * info->var.yres); 701 par->fbsize = PAGE_ALIGN(linebytes * info->var.yres);
701 if (of_find_property(dp, "dblbuf", NULL)) 702
703 dblbuf = of_getintprop_default(dp, "dblbuf", 0);
704 if (dblbuf)
702 par->fbsize *= 4; 705 par->fbsize *= 4;
703 706
704 par->fbc = of_ioremap(&op->resource[0], CG6_FBC_OFFSET, 707 par->fbc = of_ioremap(&op->resource[0], CG6_FBC_OFFSET,
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index decfdc8eb9cc..e58c87b3e3a0 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -127,8 +127,20 @@ static int last_fb_vc = MAX_NR_CONSOLES - 1;
127static int fbcon_is_default = 1; 127static int fbcon_is_default = 1;
128static int fbcon_has_exited; 128static int fbcon_has_exited;
129static int primary_device = -1; 129static int primary_device = -1;
130
131#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
130static int map_override; 132static int map_override;
131 133
134static inline void fbcon_map_override(void)
135{
136 map_override = 1;
137}
138#else
139static inline void fbcon_map_override(void)
140{
141}
142#endif /* CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY */
143
132/* font data */ 144/* font data */
133static char fontname[40]; 145static char fontname[40];
134 146
@@ -506,7 +518,7 @@ static int __init fb_console_setup(char *this_opt)
506 (options[j++]-'0') % FB_MAX; 518 (options[j++]-'0') % FB_MAX;
507 } 519 }
508 520
509 map_override = 1; 521 fbcon_map_override();
510 } 522 }
511 523
512 return 1; 524 return 1;
diff --git a/drivers/video/matrox/g450_pll.c b/drivers/video/matrox/g450_pll.c
index 7c76e079ca7d..d42346e7fdda 100644
--- a/drivers/video/matrox/g450_pll.c
+++ b/drivers/video/matrox/g450_pll.c
@@ -331,16 +331,19 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll,
331 tmp |= M1064_XPIXCLKCTRL_PLL_UP; 331 tmp |= M1064_XPIXCLKCTRL_PLL_UP;
332 } 332 }
333 matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp); 333 matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp);
334#ifdef __powerpc__ 334 /* DVI PLL preferred for frequencies up to
335 /* This is necessary to avoid jitter on PowerPC 335 panel link max, standard PLL otherwise */
336 * (OpenFirmware) systems, but apparently 336 if (fout >= MINFO->max_pixel_clock_panellink)
337 * introduces jitter, at least on a x86-64 337 tmp = 0;
338 * using DVI. 338 else tmp =
339 * A simple workaround is disable for non-PPC. 339 M1064_XDVICLKCTRL_DVIDATAPATHSEL |
340 */ 340 M1064_XDVICLKCTRL_C1DVICLKSEL |
341 matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL, 0); 341 M1064_XDVICLKCTRL_C1DVICLKEN |
342#endif /* __powerpc__ */ 342 M1064_XDVICLKCTRL_DVILOOPCTL |
343 matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl); 343 M1064_XDVICLKCTRL_P1LOOPBWDTCTL;
344 matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL,tmp);
345 matroxfb_DAC_out(PMINFO M1064_XPWRCTRL,
346 xpwrctrl);
344 347
345 matroxfb_DAC_unlock_irqrestore(flags); 348 matroxfb_DAC_unlock_irqrestore(flags);
346 } 349 }
diff --git a/drivers/video/matrox/matroxfb_DAC1064.h b/drivers/video/matrox/matroxfb_DAC1064.h
index df39c3193735..7a98ce8043d7 100644
--- a/drivers/video/matrox/matroxfb_DAC1064.h
+++ b/drivers/video/matrox/matroxfb_DAC1064.h
@@ -33,6 +33,21 @@ void DAC1064_global_restore(WPMINFO2);
33#define M1064_XCURCTRL_3COLOR 0x01 /* transparent, 0, 1, 2 */ 33#define M1064_XCURCTRL_3COLOR 0x01 /* transparent, 0, 1, 2 */
34#define M1064_XCURCTRL_XGA 0x02 /* 0, 1, transparent, complement */ 34#define M1064_XCURCTRL_XGA 0x02 /* 0, 1, transparent, complement */
35#define M1064_XCURCTRL_XWIN 0x03 /* transparent, transparent, 0, 1 */ 35#define M1064_XCURCTRL_XWIN 0x03 /* transparent, transparent, 0, 1 */
36 /* drive DVI by standard(0)/DVI(1) PLL */
37 /* if set(1), C?DVICLKEN and C?DVICLKSEL must be set(1) */
38#define M1064_XDVICLKCTRL_DVIDATAPATHSEL 0x01
39 /* drive CRTC1 by standard(0)/DVI(1) PLL */
40#define M1064_XDVICLKCTRL_C1DVICLKSEL 0x02
41 /* drive CRTC2 by standard(0)/DVI(1) PLL */
42#define M1064_XDVICLKCTRL_C2DVICLKSEL 0x04
43 /* pixel clock allowed to(0)/blocked from(1) driving CRTC1 */
44#define M1064_XDVICLKCTRL_C1DVICLKEN 0x08
45 /* DVI PLL loop filter bandwidth selection bits */
46#define M1064_XDVICLKCTRL_DVILOOPCTL 0x30
47 /* CRTC2 pixel clock allowed to(0)/blocked from(1) driving CRTC2 */
48#define M1064_XDVICLKCTRL_C2DVICLKEN 0x40
49 /* P1PLL loop filter bandwith selection */
50#define M1064_XDVICLKCTRL_P1LOOPBWDTCTL 0x80
36#define M1064_XCURCOL0RED 0x08 51#define M1064_XCURCOL0RED 0x08
37#define M1064_XCURCOL0GREEN 0x09 52#define M1064_XCURCOL0GREEN 0x09
38#define M1064_XCURCOL0BLUE 0x0A 53#define M1064_XCURCOL0BLUE 0x0A
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h
index d59577c8de86..f3107ad7e545 100644
--- a/drivers/video/matrox/matroxfb_base.h
+++ b/drivers/video/matrox/matroxfb_base.h
@@ -424,6 +424,7 @@ struct matrox_fb_info {
424 } mmio; 424 } mmio;
425 425
426 unsigned int max_pixel_clock; 426 unsigned int max_pixel_clock;
427 unsigned int max_pixel_clock_panellink;
427 428
428 struct matrox_switch* hw_switch; 429 struct matrox_switch* hw_switch;
429 430
diff --git a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c
index 5948e54b9ef9..ab7fb50bc1de 100644
--- a/drivers/video/matrox/matroxfb_misc.c
+++ b/drivers/video/matrox/matroxfb_misc.c
@@ -658,6 +658,7 @@ static int parse_pins5(WPMINFO const struct matrox_bios* bd) {
658 MINFO->values.reg.mctlwtst_core = (MINFO->values.reg.mctlwtst & ~7) | 658 MINFO->values.reg.mctlwtst_core = (MINFO->values.reg.mctlwtst & ~7) |
659 wtst_xlat[MINFO->values.reg.mctlwtst & 7]; 659 wtst_xlat[MINFO->values.reg.mctlwtst & 7];
660 } 660 }
661 MINFO->max_pixel_clock_panellink = bd->pins[47] * 4000;
661 return 0; 662 return 0;
662} 663}
663 664
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c
index f9300266044d..7d6c29800d14 100644
--- a/drivers/video/pvr2fb.c
+++ b/drivers/video/pvr2fb.c
@@ -94,6 +94,7 @@
94#define DISP_DIWCONF (DISP_BASE + 0xe8) 94#define DISP_DIWCONF (DISP_BASE + 0xe8)
95#define DISP_DIWHSTRT (DISP_BASE + 0xec) 95#define DISP_DIWHSTRT (DISP_BASE + 0xec)
96#define DISP_DIWVSTRT (DISP_BASE + 0xf0) 96#define DISP_DIWVSTRT (DISP_BASE + 0xf0)
97#define DISP_PIXDEPTH (DISP_BASE + 0x108)
97 98
98/* Pixel clocks, one for TV output, doubled for VGA output */ 99/* Pixel clocks, one for TV output, doubled for VGA output */
99#define TV_CLK 74239 100#define TV_CLK 74239
@@ -143,6 +144,7 @@ static struct pvr2fb_par {
143 unsigned char is_lowres; /* Is horizontal pixel-doubling enabled? */ 144 unsigned char is_lowres; /* Is horizontal pixel-doubling enabled? */
144 145
145 unsigned long mmio_base; /* MMIO base */ 146 unsigned long mmio_base; /* MMIO base */
147 u32 palette[16];
146} *currentpar; 148} *currentpar;
147 149
148static struct fb_info *fb_info; 150static struct fb_info *fb_info;
@@ -599,6 +601,7 @@ static void pvr2_init_display(struct fb_info *info)
599 601
600 /* bits per pixel */ 602 /* bits per pixel */
601 fb_writel(fb_readl(DISP_DIWMODE) | (--bytesperpixel << 2), DISP_DIWMODE); 603 fb_writel(fb_readl(DISP_DIWMODE) | (--bytesperpixel << 2), DISP_DIWMODE);
604 fb_writel(bytesperpixel << 2, DISP_PIXDEPTH);
602 605
603 /* video enable, color sync, interlace, 606 /* video enable, color sync, interlace,
604 * hsync and vsync polarity (currently unused) */ 607 * hsync and vsync polarity (currently unused) */
@@ -790,7 +793,7 @@ static int __devinit pvr2fb_common_init(void)
790 fb_info->fbops = &pvr2fb_ops; 793 fb_info->fbops = &pvr2fb_ops;
791 fb_info->fix = pvr2_fix; 794 fb_info->fix = pvr2_fix;
792 fb_info->par = currentpar; 795 fb_info->par = currentpar;
793 fb_info->pseudo_palette = (void *)(fb_info->par + 1); 796 fb_info->pseudo_palette = currentpar->palette;
794 fb_info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; 797 fb_info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
795 798
796 if (video_output == VO_VGA) 799 if (video_output == VO_VGA)
@@ -807,6 +810,8 @@ static int __devinit pvr2fb_common_init(void)
807 810
808 if (register_framebuffer(fb_info) < 0) 811 if (register_framebuffer(fb_info) < 0)
809 goto out_err; 812 goto out_err;
813 /*Must write PIXDEPTH to register before anything is displayed - so force init */
814 pvr2_init_display(fb_info);
810 815
811 modememused = get_line_length(fb_info->var.xres_virtual, 816 modememused = get_line_length(fb_info->var.xres_virtual,
812 fb_info->var.bits_per_pixel); 817 fb_info->var.bits_per_pixel);
@@ -1082,14 +1087,15 @@ static int __init pvr2fb_init(void)
1082#endif 1087#endif
1083 size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32); 1088 size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32);
1084 1089
1085 fb_info = kzalloc(size, GFP_KERNEL); 1090 fb_info = framebuffer_alloc(sizeof(struct pvr2fb_par), NULL);
1091
1086 if (!fb_info) { 1092 if (!fb_info) {
1087 printk(KERN_ERR "Failed to allocate memory for fb_info\n"); 1093 printk(KERN_ERR "Failed to allocate memory for fb_info\n");
1088 return -ENOMEM; 1094 return -ENOMEM;
1089 } 1095 }
1090 1096
1091 1097
1092 currentpar = (struct pvr2fb_par *)(fb_info + 1); 1098 currentpar = fb_info->par;
1093 1099
1094 for (i = 0; i < ARRAY_SIZE(board_driver); i++) { 1100 for (i = 0; i < ARRAY_SIZE(board_driver); i++) {
1095 struct pvr2_board *pvr_board = board_driver + i; 1101 struct pvr2_board *pvr_board = board_driver + i;
@@ -1102,7 +1108,7 @@ static int __init pvr2fb_init(void)
1102 if (ret != 0) { 1108 if (ret != 0) {
1103 printk(KERN_ERR "pvr2fb: Failed init of %s device\n", 1109 printk(KERN_ERR "pvr2fb: Failed init of %s device\n",
1104 pvr_board->name); 1110 pvr_board->name);
1105 kfree(fb_info); 1111 framebuffer_release(fb_info);
1106 break; 1112 break;
1107 } 1113 }
1108 } 1114 }
@@ -1126,7 +1132,7 @@ static void __exit pvr2fb_exit(void)
1126#endif 1132#endif
1127 1133
1128 unregister_framebuffer(fb_info); 1134 unregister_framebuffer(fb_info);
1129 kfree(fb_info); 1135 framebuffer_release(fb_info);
1130} 1136}
1131 1137
1132module_init(pvr2fb_init); 1138module_init(pvr2fb_init);
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c
index c97709ecbad0..e7c8db2eb49b 100644
--- a/drivers/video/stifb.c
+++ b/drivers/video/stifb.c
@@ -1100,13 +1100,18 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref)
1100 /* only supported cards are allowed */ 1100 /* only supported cards are allowed */
1101 switch (fb->id) { 1101 switch (fb->id) {
1102 case CRT_ID_VISUALIZE_EG: 1102 case CRT_ID_VISUALIZE_EG:
1103 /* look for a double buffering device like e.g. the 1103 /* Visualize cards can run either in "double buffer" or
1104 "INTERNAL_EG_DX1024" in the RDI precisionbook laptop 1104 "standard" mode. Depending on the mode, the card reports
1105 which won't work. The same device in non-double 1105 a different device name, e.g. "INTERNAL_EG_DX1024" in double
1106 buffering mode returns "INTERNAL_EG_X1024". */ 1106 buffer mode and "INTERNAL_EG_X1024" in standard mode.
1107 if (strstr(sti->outptr.dev_name, "EG_DX")) { 1107 Since this driver only supports standard mode, we check
1108 printk(KERN_WARNING 1108 if the device name contains the string "DX" and tell the
1109 "stifb: ignoring '%s'. Disable double buffering in IPL menu.\n", 1109 user how to reconfigure the card. */
1110 if (strstr(sti->outptr.dev_name, "DX")) {
1111 printk(KERN_WARNING "WARNING: stifb framebuffer driver does not "
1112 "support '%s' in double-buffer mode.\n"
1113 KERN_WARNING "WARNING: Please disable the double-buffer mode "
1114 "in IPL menu (the PARISC-BIOS).\n",
1110 sti->outptr.dev_name); 1115 sti->outptr.dev_name);
1111 goto out_err0; 1116 goto out_err0;
1112 } 1117 }
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 6d84ca2beead..bed6215c0794 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -3,7 +3,10 @@ Version 1.50
3Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is 3Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is
4done with "serverino" mount option). Add support for POSIX Unlink 4done with "serverino" mount option). Add support for POSIX Unlink
5(helps with certain sharing violation cases when server such as 5(helps with certain sharing violation cases when server such as
6Samba supports newer POSIX CIFS Protocol Extensions). 6Samba supports newer POSIX CIFS Protocol Extensions). Add "nounix"
7mount option to allow disabling the CIFS Unix Extensions for just
8that mount. Fix hang on spinlock in find_writable_file (race when
9reopening file after session crash).
7 10
8Version 1.49 11Version 1.49
9------------ 12------------
diff --git a/fs/cifs/README b/fs/cifs/README
index 85f1eb14083e..b806b11b5560 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -444,6 +444,13 @@ A partial list of the supported mount options follows:
444 noposixpaths If CIFS Unix extensions are supported, do not request 444 noposixpaths If CIFS Unix extensions are supported, do not request
445 posix path name support (this may cause servers to 445 posix path name support (this may cause servers to
446 reject creatingfile with certain reserved characters). 446 reject creatingfile with certain reserved characters).
447 nounix Disable the CIFS Unix Extensions for this mount (tree
448 connection). This is rarely needed, but it may be useful
449 in order to turn off multiple settings all at once (ie
450 posix acls, posix locks, posix paths, symlink support
451 and retrieving uids/gids/mode from the server) or to
452 work around a bug in server which implement the Unix
453 Extensions.
447 nobrl Do not send byte range lock requests to the server. 454 nobrl Do not send byte range lock requests to the server.
448 This is necessary for certain applications that break 455 This is necessary for certain applications that break
449 with cifs style mandatory byte range locks (and most 456 with cifs style mandatory byte range locks (and most
@@ -451,6 +458,12 @@ A partial list of the supported mount options follows:
451 byte range locks). 458 byte range locks).
452 remount remount the share (often used to change from ro to rw mounts 459 remount remount the share (often used to change from ro to rw mounts
453 or vice versa) 460 or vice versa)
461 servern Specify the server 's netbios name (RFC1001 name) to use
462 when attempting to setup a session to the server. This is
463 This is needed for mounting to some older servers (such
464 as OS/2 or Windows 98 and Windows ME) since they do not
465 support a default server name. A server name can be up
466 to 15 characters long and is usually uppercased.
454 sfu When the CIFS Unix Extensions are not negotiated, attempt to 467 sfu When the CIFS Unix Extensions are not negotiated, attempt to
455 create device files and fifos in a format compatible with 468 create device files and fifos in a format compatible with
456 Services for Unix (SFU). In addition retrieve bits 10-12 469 Services for Unix (SFU). In addition retrieve bits 10-12
diff --git a/fs/cifs/TODO b/fs/cifs/TODO
index d7bd51575fd6..29d4b2715254 100644
--- a/fs/cifs/TODO
+++ b/fs/cifs/TODO
@@ -82,8 +82,7 @@ u) DOS attrs - returned as pseudo-xattr in Samba format (check VFAT and NTFS for
82 82
83v) mount check for unmatched uids 83v) mount check for unmatched uids
84 84
85w) Add mount option for Linux extension disable per mount, and partial 85w) Add support for new vfs entry points for setlease and fallocate
86disable per mount (uid off, symlink/fifo/mknod on but what about posix acls?)
87 86
88x) Fix Samba 3 server to handle Linux kernel aio so dbench with lots of 87x) Fix Samba 3 server to handle Linux kernel aio so dbench with lots of
89processes can proceed better in parallel (on the server) 88processes can proceed better in parallel (on the server)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e13592afca9c..894b1f7b299d 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1904,6 +1904,25 @@ static int cifs_readpage(struct file *file, struct page *page)
1904 return rc; 1904 return rc;
1905} 1905}
1906 1906
1907static int is_inode_writable(struct cifsInodeInfo *cifs_inode)
1908{
1909 struct cifsFileInfo *open_file;
1910
1911 read_lock(&GlobalSMBSeslock);
1912 list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
1913 if (open_file->closePend)
1914 continue;
1915 if (open_file->pfile &&
1916 ((open_file->pfile->f_flags & O_RDWR) ||
1917 (open_file->pfile->f_flags & O_WRONLY))) {
1918 read_unlock(&GlobalSMBSeslock);
1919 return 1;
1920 }
1921 }
1922 read_unlock(&GlobalSMBSeslock);
1923 return 0;
1924}
1925
1907/* We do not want to update the file size from server for inodes 1926/* We do not want to update the file size from server for inodes
1908 open for write - to avoid races with writepage extending 1927 open for write - to avoid races with writepage extending
1909 the file - in the future we could consider allowing 1928 the file - in the future we could consider allowing
@@ -1912,19 +1931,13 @@ static int cifs_readpage(struct file *file, struct page *page)
1912 page caching in the current Linux kernel design */ 1931 page caching in the current Linux kernel design */
1913int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) 1932int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file)
1914{ 1933{
1915 struct cifsFileInfo *open_file = NULL; 1934 if (!cifsInode)
1916 1935 return 1;
1917 if (cifsInode)
1918 open_file = find_writable_file(cifsInode);
1919 1936
1920 if (open_file) { 1937 if (is_inode_writable(cifsInode)) {
1938 /* This inode is open for write at least once */
1921 struct cifs_sb_info *cifs_sb; 1939 struct cifs_sb_info *cifs_sb;
1922 1940
1923 /* there is not actually a write pending so let
1924 this handle go free and allow it to
1925 be closable if needed */
1926 atomic_dec(&open_file->wrtPending);
1927
1928 cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb); 1941 cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb);
1929 if ( cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO ) { 1942 if ( cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO ) {
1930 /* since no page cache to corrupt on directio 1943 /* since no page cache to corrupt on directio
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 2ea027dda215..892be9b4d1f3 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -372,6 +372,10 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
372 372
373 /* 2000 big enough to fit max user, domain, NOS name etc. */ 373 /* 2000 big enough to fit max user, domain, NOS name etc. */
374 str_area = kmalloc(2000, GFP_KERNEL); 374 str_area = kmalloc(2000, GFP_KERNEL);
375 if (str_area == NULL) {
376 cifs_small_buf_release(smb_buf);
377 return -ENOMEM;
378 }
375 bcc_ptr = str_area; 379 bcc_ptr = str_area;
376 380
377 ses->flags &= ~CIFS_SES_LANMAN; 381 ses->flags &= ~CIFS_SES_LANMAN;
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 2bc1428d621c..a6c9078af124 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -3161,12 +3161,9 @@ COMPATIBLE_IOCTL(SIOCSIWSENS)
3161COMPATIBLE_IOCTL(SIOCGIWSENS) 3161COMPATIBLE_IOCTL(SIOCGIWSENS)
3162COMPATIBLE_IOCTL(SIOCSIWRANGE) 3162COMPATIBLE_IOCTL(SIOCSIWRANGE)
3163COMPATIBLE_IOCTL(SIOCSIWPRIV) 3163COMPATIBLE_IOCTL(SIOCSIWPRIV)
3164COMPATIBLE_IOCTL(SIOCGIWPRIV)
3165COMPATIBLE_IOCTL(SIOCSIWSTATS) 3164COMPATIBLE_IOCTL(SIOCSIWSTATS)
3166COMPATIBLE_IOCTL(SIOCGIWSTATS)
3167COMPATIBLE_IOCTL(SIOCSIWAP) 3165COMPATIBLE_IOCTL(SIOCSIWAP)
3168COMPATIBLE_IOCTL(SIOCGIWAP) 3166COMPATIBLE_IOCTL(SIOCGIWAP)
3169COMPATIBLE_IOCTL(SIOCSIWSCAN)
3170COMPATIBLE_IOCTL(SIOCSIWRATE) 3167COMPATIBLE_IOCTL(SIOCSIWRATE)
3171COMPATIBLE_IOCTL(SIOCGIWRATE) 3168COMPATIBLE_IOCTL(SIOCGIWRATE)
3172COMPATIBLE_IOCTL(SIOCSIWRTS) 3169COMPATIBLE_IOCTL(SIOCSIWRTS)
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 52bb2638f7ab..6874785bb65a 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -974,6 +974,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
974 dio->get_block = get_block; 974 dio->get_block = get_block;
975 dio->end_io = end_io; 975 dio->end_io = end_io;
976 dio->map_bh.b_private = NULL; 976 dio->map_bh.b_private = NULL;
977 dio->map_bh.b_state = 0;
977 dio->final_block_in_bio = -1; 978 dio->final_block_in_bio = -1;
978 dio->next_block_for_io = -1; 979 dio->next_block_for_io = -1;
979 980
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index b455919c1998..2082daf083d8 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -1670,9 +1670,10 @@ static int can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
1670 with a deadlk here, we'd have to generate something like grant_lock with 1670 with a deadlk here, we'd have to generate something like grant_lock with
1671 the deadlk error.) */ 1671 the deadlk error.) */
1672 1672
1673/* returns the highest requested mode of all blocked conversions */ 1673/* Returns the highest requested mode of all blocked conversions; sets
1674 cw if there's a blocked conversion to DLM_LOCK_CW. */
1674 1675
1675static int grant_pending_convert(struct dlm_rsb *r, int high) 1676static int grant_pending_convert(struct dlm_rsb *r, int high, int *cw)
1676{ 1677{
1677 struct dlm_lkb *lkb, *s; 1678 struct dlm_lkb *lkb, *s;
1678 int hi, demoted, quit, grant_restart, demote_restart; 1679 int hi, demoted, quit, grant_restart, demote_restart;
@@ -1709,6 +1710,9 @@ static int grant_pending_convert(struct dlm_rsb *r, int high)
1709 } 1710 }
1710 1711
1711 hi = max_t(int, lkb->lkb_rqmode, hi); 1712 hi = max_t(int, lkb->lkb_rqmode, hi);
1713
1714 if (cw && lkb->lkb_rqmode == DLM_LOCK_CW)
1715 *cw = 1;
1712 } 1716 }
1713 1717
1714 if (grant_restart) 1718 if (grant_restart)
@@ -1721,29 +1725,52 @@ static int grant_pending_convert(struct dlm_rsb *r, int high)
1721 return max_t(int, high, hi); 1725 return max_t(int, high, hi);
1722} 1726}
1723 1727
1724static int grant_pending_wait(struct dlm_rsb *r, int high) 1728static int grant_pending_wait(struct dlm_rsb *r, int high, int *cw)
1725{ 1729{
1726 struct dlm_lkb *lkb, *s; 1730 struct dlm_lkb *lkb, *s;
1727 1731
1728 list_for_each_entry_safe(lkb, s, &r->res_waitqueue, lkb_statequeue) { 1732 list_for_each_entry_safe(lkb, s, &r->res_waitqueue, lkb_statequeue) {
1729 if (can_be_granted(r, lkb, 0, NULL)) 1733 if (can_be_granted(r, lkb, 0, NULL))
1730 grant_lock_pending(r, lkb); 1734 grant_lock_pending(r, lkb);
1731 else 1735 else {
1732 high = max_t(int, lkb->lkb_rqmode, high); 1736 high = max_t(int, lkb->lkb_rqmode, high);
1737 if (lkb->lkb_rqmode == DLM_LOCK_CW)
1738 *cw = 1;
1739 }
1733 } 1740 }
1734 1741
1735 return high; 1742 return high;
1736} 1743}
1737 1744
1745/* cw of 1 means there's a lock with a rqmode of DLM_LOCK_CW that's blocked
1746 on either the convert or waiting queue.
1747 high is the largest rqmode of all locks blocked on the convert or
1748 waiting queue. */
1749
1750static int lock_requires_bast(struct dlm_lkb *gr, int high, int cw)
1751{
1752 if (gr->lkb_grmode == DLM_LOCK_PR && cw) {
1753 if (gr->lkb_highbast < DLM_LOCK_EX)
1754 return 1;
1755 return 0;
1756 }
1757
1758 if (gr->lkb_highbast < high &&
1759 !__dlm_compat_matrix[gr->lkb_grmode+1][high+1])
1760 return 1;
1761 return 0;
1762}
1763
1738static void grant_pending_locks(struct dlm_rsb *r) 1764static void grant_pending_locks(struct dlm_rsb *r)
1739{ 1765{
1740 struct dlm_lkb *lkb, *s; 1766 struct dlm_lkb *lkb, *s;
1741 int high = DLM_LOCK_IV; 1767 int high = DLM_LOCK_IV;
1768 int cw = 0;
1742 1769
1743 DLM_ASSERT(is_master(r), dlm_dump_rsb(r);); 1770 DLM_ASSERT(is_master(r), dlm_dump_rsb(r););
1744 1771
1745 high = grant_pending_convert(r, high); 1772 high = grant_pending_convert(r, high, &cw);
1746 high = grant_pending_wait(r, high); 1773 high = grant_pending_wait(r, high, &cw);
1747 1774
1748 if (high == DLM_LOCK_IV) 1775 if (high == DLM_LOCK_IV)
1749 return; 1776 return;
@@ -1751,27 +1778,41 @@ static void grant_pending_locks(struct dlm_rsb *r)
1751 /* 1778 /*
1752 * If there are locks left on the wait/convert queue then send blocking 1779 * If there are locks left on the wait/convert queue then send blocking
1753 * ASTs to granted locks based on the largest requested mode (high) 1780 * ASTs to granted locks based on the largest requested mode (high)
1754 * found above. FIXME: highbast < high comparison not valid for PR/CW. 1781 * found above.
1755 */ 1782 */
1756 1783
1757 list_for_each_entry_safe(lkb, s, &r->res_grantqueue, lkb_statequeue) { 1784 list_for_each_entry_safe(lkb, s, &r->res_grantqueue, lkb_statequeue) {
1758 if (lkb->lkb_bastaddr && (lkb->lkb_highbast < high) && 1785 if (lkb->lkb_bastaddr && lock_requires_bast(lkb, high, cw)) {
1759 !__dlm_compat_matrix[lkb->lkb_grmode+1][high+1]) { 1786 if (cw && high == DLM_LOCK_PR)
1760 queue_bast(r, lkb, high); 1787 queue_bast(r, lkb, DLM_LOCK_CW);
1788 else
1789 queue_bast(r, lkb, high);
1761 lkb->lkb_highbast = high; 1790 lkb->lkb_highbast = high;
1762 } 1791 }
1763 } 1792 }
1764} 1793}
1765 1794
1795static int modes_require_bast(struct dlm_lkb *gr, struct dlm_lkb *rq)
1796{
1797 if ((gr->lkb_grmode == DLM_LOCK_PR && rq->lkb_rqmode == DLM_LOCK_CW) ||
1798 (gr->lkb_grmode == DLM_LOCK_CW && rq->lkb_rqmode == DLM_LOCK_PR)) {
1799 if (gr->lkb_highbast < DLM_LOCK_EX)
1800 return 1;
1801 return 0;
1802 }
1803
1804 if (gr->lkb_highbast < rq->lkb_rqmode && !modes_compat(gr, rq))
1805 return 1;
1806 return 0;
1807}
1808
1766static void send_bast_queue(struct dlm_rsb *r, struct list_head *head, 1809static void send_bast_queue(struct dlm_rsb *r, struct list_head *head,
1767 struct dlm_lkb *lkb) 1810 struct dlm_lkb *lkb)
1768{ 1811{
1769 struct dlm_lkb *gr; 1812 struct dlm_lkb *gr;
1770 1813
1771 list_for_each_entry(gr, head, lkb_statequeue) { 1814 list_for_each_entry(gr, head, lkb_statequeue) {
1772 if (gr->lkb_bastaddr && 1815 if (gr->lkb_bastaddr && modes_require_bast(gr, lkb)) {
1773 gr->lkb_highbast < lkb->lkb_rqmode &&
1774 !modes_compat(gr, lkb)) {
1775 queue_bast(r, gr, lkb->lkb_rqmode); 1816 queue_bast(r, gr, lkb->lkb_rqmode);
1776 gr->lkb_highbast = lkb->lkb_rqmode; 1817 gr->lkb_highbast = lkb->lkb_rqmode;
1777 } 1818 }
@@ -2235,7 +2276,7 @@ static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb)
2235 before we try again to grant this one. */ 2276 before we try again to grant this one. */
2236 2277
2237 if (is_demoted(lkb)) { 2278 if (is_demoted(lkb)) {
2238 grant_pending_convert(r, DLM_LOCK_IV); 2279 grant_pending_convert(r, DLM_LOCK_IV, NULL);
2239 if (_can_be_granted(r, lkb, 1)) { 2280 if (_can_be_granted(r, lkb, 1)) {
2240 grant_lock(r, lkb); 2281 grant_lock(r, lkb);
2241 queue_cast(r, lkb, 0); 2282 queue_cast(r, lkb, 0);
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index dd362739d291..9e9d2e82f40f 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -313,6 +313,7 @@ static void make_sockaddr(struct sockaddr_storage *saddr, uint16_t port,
313 in6_addr->sin6_port = cpu_to_be16(port); 313 in6_addr->sin6_port = cpu_to_be16(port);
314 *addr_len = sizeof(struct sockaddr_in6); 314 *addr_len = sizeof(struct sockaddr_in6);
315 } 315 }
316 memset((char *)saddr + *addr_len, 0, sizeof(struct sockaddr_storage) - *addr_len);
316} 317}
317 318
318/* Close a remote connection and tidy up */ 319/* Close a remote connection and tidy up */
@@ -332,8 +333,19 @@ static void close_connection(struct connection *con, bool and_other)
332 __free_page(con->rx_page); 333 __free_page(con->rx_page);
333 con->rx_page = NULL; 334 con->rx_page = NULL;
334 } 335 }
335 con->retries = 0; 336
336 mutex_unlock(&con->sock_mutex); 337 /* If we are an 'othercon' then NULL the pointer to us
338 from the parent and tidy ourself up */
339 if (test_bit(CF_IS_OTHERCON, &con->flags)) {
340 struct connection *parent = __nodeid2con(con->nodeid, 0);
341 parent->othercon = NULL;
342 kmem_cache_free(con_cache, con);
343 }
344 else {
345 /* Parent connections get reused */
346 con->retries = 0;
347 mutex_unlock(&con->sock_mutex);
348 }
337} 349}
338 350
339/* We only send shutdown messages to nodes that are not part of the cluster */ 351/* We only send shutdown messages to nodes that are not part of the cluster */
@@ -631,7 +643,7 @@ out_resched:
631 643
632out_close: 644out_close:
633 mutex_unlock(&con->sock_mutex); 645 mutex_unlock(&con->sock_mutex);
634 if (ret != -EAGAIN && !test_bit(CF_IS_OTHERCON, &con->flags)) { 646 if (ret != -EAGAIN) {
635 close_connection(con, false); 647 close_connection(con, false);
636 /* Reconnect when there is something to send */ 648 /* Reconnect when there is something to send */
637 } 649 }
@@ -1122,8 +1134,6 @@ static int tcp_listen_for_all(void)
1122 1134
1123 log_print("Using TCP for communications"); 1135 log_print("Using TCP for communications");
1124 1136
1125 set_bit(CF_IS_OTHERCON, &con->flags);
1126
1127 sock = tcp_create_listen_sock(con, dlm_local_addr[0]); 1137 sock = tcp_create_listen_sock(con, dlm_local_addr[0]);
1128 if (sock) { 1138 if (sock) {
1129 add_sock(sock, con); 1139 add_sock(sock, con);
@@ -1407,7 +1417,7 @@ void dlm_lowcomms_stop(void)
1407 for (i = 0; i <= max_nodeid; i++) { 1417 for (i = 0; i <= max_nodeid; i++) {
1408 con = __nodeid2con(i, 0); 1418 con = __nodeid2con(i, 0);
1409 if (con) { 1419 if (con) {
1410 con->flags |= 0xFF; 1420 con->flags |= 0x0F;
1411 if (con->sock) 1421 if (con->sock)
1412 con->sock->sk->sk_user_data = NULL; 1422 con->sock->sk->sk_user_data = NULL;
1413 } 1423 }
@@ -1423,8 +1433,6 @@ void dlm_lowcomms_stop(void)
1423 con = __nodeid2con(i, 0); 1433 con = __nodeid2con(i, 0);
1424 if (con) { 1434 if (con) {
1425 close_connection(con, true); 1435 close_connection(con, true);
1426 if (con->othercon)
1427 kmem_cache_free(con_cache, con->othercon);
1428 kmem_cache_free(con_cache, con); 1436 kmem_cache_free(con_cache, con);
1429 } 1437 }
1430 } 1438 }
diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index 073599dced2a..d09977528f69 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -56,8 +56,10 @@ static int dlm_add_member(struct dlm_ls *ls, int nodeid)
56 return -ENOMEM; 56 return -ENOMEM;
57 57
58 w = dlm_node_weight(ls->ls_name, nodeid); 58 w = dlm_node_weight(ls->ls_name, nodeid);
59 if (w < 0) 59 if (w < 0) {
60 kfree(memb);
60 return w; 61 return w;
62 }
61 63
62 memb->nodeid = nodeid; 64 memb->nodeid = nodeid;
63 memb->weight = w; 65 memb->weight = w;
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c
index e3a1527cbdbe..188b91c027e4 100644
--- a/fs/dlm/rcom.c
+++ b/fs/dlm/rcom.c
@@ -386,8 +386,7 @@ static void receive_rcom_lock_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in)
386 dlm_recover_process_copy(ls, rc_in); 386 dlm_recover_process_copy(ls, rc_in);
387} 387}
388 388
389static int send_ls_not_ready(struct dlm_ls *ls, int nodeid, 389static int send_ls_not_ready(int nodeid, struct dlm_rcom *rc_in)
390 struct dlm_rcom *rc_in)
391{ 390{
392 struct dlm_rcom *rc; 391 struct dlm_rcom *rc;
393 struct rcom_config *rf; 392 struct rcom_config *rf;
@@ -395,7 +394,7 @@ static int send_ls_not_ready(struct dlm_ls *ls, int nodeid,
395 char *mb; 394 char *mb;
396 int mb_len = sizeof(struct dlm_rcom) + sizeof(struct rcom_config); 395 int mb_len = sizeof(struct dlm_rcom) + sizeof(struct rcom_config);
397 396
398 mh = dlm_lowcomms_get_buffer(nodeid, mb_len, ls->ls_allocation, &mb); 397 mh = dlm_lowcomms_get_buffer(nodeid, mb_len, GFP_NOFS, &mb);
399 if (!mh) 398 if (!mh)
400 return -ENOBUFS; 399 return -ENOBUFS;
401 memset(mb, 0, mb_len); 400 memset(mb, 0, mb_len);
@@ -465,7 +464,7 @@ void dlm_receive_rcom(struct dlm_header *hd, int nodeid)
465 log_print("lockspace %x from %d type %x not found", 464 log_print("lockspace %x from %d type %x not found",
466 hd->h_lockspace, nodeid, rc->rc_type); 465 hd->h_lockspace, nodeid, rc->rc_type);
467 if (rc->rc_type == DLM_RCOM_STATUS) 466 if (rc->rc_type == DLM_RCOM_STATUS)
468 send_ls_not_ready(ls, nodeid, rc); 467 send_ls_not_ready(nodeid, rc);
469 return; 468 return;
470 } 469 }
471 470
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 0a50942b4378..131954b3fb98 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -353,6 +353,10 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
353 ecryptfs_printk(KERN_DEBUG, "Is a symlink; returning\n"); 353 ecryptfs_printk(KERN_DEBUG, "Is a symlink; returning\n");
354 goto out; 354 goto out;
355 } 355 }
356 if (special_file(lower_inode->i_mode)) {
357 ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n");
358 goto out;
359 }
356 if (!nd) { 360 if (!nd) {
357 ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave" 361 ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave"
358 "as we *think* we are about to unlink\n"); 362 "as we *think* we are about to unlink\n");
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index e557a6766927..a98497264fe8 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -813,6 +813,15 @@ out:
813 return rc; 813 return rc;
814} 814}
815 815
816static void do_sysfs_unregistration(void)
817{
818 sysfs_remove_file(&ecryptfs_subsys.kobj,
819 &sysfs_attr_version.attr);
820 sysfs_remove_file(&ecryptfs_subsys.kobj,
821 &sysfs_attr_version_str.attr);
822 subsystem_unregister(&ecryptfs_subsys);
823}
824
816static int __init ecryptfs_init(void) 825static int __init ecryptfs_init(void)
817{ 826{
818 int rc; 827 int rc;
@@ -851,6 +860,9 @@ static int __init ecryptfs_init(void)
851 if (rc) { 860 if (rc) {
852 ecryptfs_printk(KERN_ERR, "Failure occured while attempting to " 861 ecryptfs_printk(KERN_ERR, "Failure occured while attempting to "
853 "initialize the eCryptfs netlink socket\n"); 862 "initialize the eCryptfs netlink socket\n");
863 do_sysfs_unregistration();
864 unregister_filesystem(&ecryptfs_fs_type);
865 ecryptfs_free_kmem_caches();
854 } 866 }
855out: 867out:
856 return rc; 868 return rc;
@@ -858,11 +870,7 @@ out:
858 870
859static void __exit ecryptfs_exit(void) 871static void __exit ecryptfs_exit(void)
860{ 872{
861 sysfs_remove_file(&ecryptfs_subsys.kobj, 873 do_sysfs_unregistration();
862 &sysfs_attr_version.attr);
863 sysfs_remove_file(&ecryptfs_subsys.kobj,
864 &sysfs_attr_version_str.attr);
865 subsystem_unregister(&ecryptfs_subsys);
866 ecryptfs_release_messaging(ecryptfs_transport); 874 ecryptfs_release_messaging(ecryptfs_transport);
867 unregister_filesystem(&ecryptfs_fs_type); 875 unregister_filesystem(&ecryptfs_fs_type);
868 ecryptfs_free_kmem_caches(); 876 ecryptfs_free_kmem_caches();
diff --git a/fs/exec.c b/fs/exec.c
index 7bdea7937ee8..ce62f7b65f17 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1084,9 +1084,12 @@ int flush_old_exec(struct linux_binprm * bprm)
1084 */ 1084 */
1085 current->mm->task_size = TASK_SIZE; 1085 current->mm->task_size = TASK_SIZE;
1086 1086
1087 if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || 1087 if (bprm->e_uid != current->euid || bprm->e_gid != current->egid) {
1088 file_permission(bprm->file, MAY_READ) || 1088 suid_keys(current);
1089 (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { 1089 set_dumpable(current->mm, suid_dumpable);
1090 current->pdeath_signal = 0;
1091 } else if (file_permission(bprm->file, MAY_READ) ||
1092 (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) {
1090 suid_keys(current); 1093 suid_keys(current);
1091 set_dumpable(current->mm, suid_dumpable); 1094 set_dumpable(current->mm, suid_dumpable);
1092 } 1095 }
@@ -1177,8 +1180,10 @@ void compute_creds(struct linux_binprm *bprm)
1177{ 1180{
1178 int unsafe; 1181 int unsafe;
1179 1182
1180 if (bprm->e_uid != current->uid) 1183 if (bprm->e_uid != current->uid) {
1181 suid_keys(current); 1184 suid_keys(current);
1185 current->pdeath_signal = 0;
1186 }
1182 exec_keys(current); 1187 exec_keys(current);
1183 1188
1184 task_lock(current); 1189 task_lock(current);
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index aff70f0698fd..3b395c41b2f3 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -486,8 +486,8 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
486 gfs2_pin(sdp, bd->bd_bh); 486 gfs2_pin(sdp, bd->bd_bh);
487 tr->tr_num_databuf_new++; 487 tr->tr_num_databuf_new++;
488 } 488 }
489 sdp->sd_log_num_databuf++;
490 gfs2_log_lock(sdp); 489 gfs2_log_lock(sdp);
490 sdp->sd_log_num_databuf++;
491 list_add(&le->le_list, &sdp->sd_log_le_databuf); 491 list_add(&le->le_list, &sdp->sd_log_le_databuf);
492 gfs2_log_unlock(sdp); 492 gfs2_log_unlock(sdp);
493} 493}
@@ -523,7 +523,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
523 struct buffer_head *bh = NULL,*bh1 = NULL; 523 struct buffer_head *bh = NULL,*bh1 = NULL;
524 struct gfs2_log_descriptor *ld; 524 struct gfs2_log_descriptor *ld;
525 unsigned int limit; 525 unsigned int limit;
526 unsigned int total_dbuf = sdp->sd_log_num_databuf; 526 unsigned int total_dbuf;
527 unsigned int total_jdata = sdp->sd_log_num_jdata; 527 unsigned int total_jdata = sdp->sd_log_num_jdata;
528 unsigned int num, n; 528 unsigned int num, n;
529 __be64 *ptr = NULL; 529 __be64 *ptr = NULL;
@@ -535,6 +535,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
535 * into the log along with a header 535 * into the log along with a header
536 */ 536 */
537 gfs2_log_lock(sdp); 537 gfs2_log_lock(sdp);
538 total_dbuf = sdp->sd_log_num_databuf;
538 bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf, 539 bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf,
539 bd_le.le_list); 540 bd_le.le_list);
540 while(total_dbuf) { 541 while(total_dbuf) {
@@ -653,6 +654,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
653 break; 654 break;
654 } 655 }
655 bh = NULL; 656 bh = NULL;
657 BUG_ON(total_dbuf < num);
656 total_dbuf -= num; 658 total_dbuf -= num;
657 total_jdata -= num; 659 total_jdata -= num;
658 } 660 }
diff --git a/fs/gfs2/mount.c b/fs/gfs2/mount.c
index 6f006a804db3..4864659555d4 100644
--- a/fs/gfs2/mount.c
+++ b/fs/gfs2/mount.c
@@ -82,19 +82,20 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, char *data_arg, int remount)
82 char *options, *o, *v; 82 char *options, *o, *v;
83 int error = 0; 83 int error = 0;
84 84
85 /* If someone preloaded options, use those instead */ 85 if (!remount) {
86 spin_lock(&gfs2_sys_margs_lock); 86 /* If someone preloaded options, use those instead */
87 if (!remount && gfs2_sys_margs) { 87 spin_lock(&gfs2_sys_margs_lock);
88 data = gfs2_sys_margs; 88 if (gfs2_sys_margs) {
89 gfs2_sys_margs = NULL; 89 data = gfs2_sys_margs;
90 } 90 gfs2_sys_margs = NULL;
91 spin_unlock(&gfs2_sys_margs_lock); 91 }
92 spin_unlock(&gfs2_sys_margs_lock);
92 93
93 /* Set some defaults */ 94 /* Set some defaults */
94 memset(args, 0, sizeof(struct gfs2_args)); 95 args->ar_num_glockd = GFS2_GLOCKD_DEFAULT;
95 args->ar_num_glockd = GFS2_GLOCKD_DEFAULT; 96 args->ar_quota = GFS2_QUOTA_DEFAULT;
96 args->ar_quota = GFS2_QUOTA_DEFAULT; 97 args->ar_data = GFS2_DATA_DEFAULT;
97 args->ar_data = GFS2_DATA_DEFAULT; 98 }
98 99
99 /* Split the options into tokens with the "," character and 100 /* Split the options into tokens with the "," character and
100 process them */ 101 process them */
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index ce90032c010e..42a5f58f6fca 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -416,7 +416,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
416 416
417 error = gfs2_trans_begin(sdp, rblocks, 0); 417 error = gfs2_trans_begin(sdp, rblocks, 0);
418 if (error) 418 if (error)
419 goto out; 419 goto out_trans_fail;
420 420
421 if (gfs2_is_stuffed(ip)) { 421 if (gfs2_is_stuffed(ip)) {
422 if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) { 422 if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) {
@@ -434,6 +434,7 @@ prepare_write:
434out: 434out:
435 if (error) { 435 if (error) {
436 gfs2_trans_end(sdp); 436 gfs2_trans_end(sdp);
437out_trans_fail:
437 if (alloc_required) { 438 if (alloc_required) {
438 gfs2_inplace_release(ip); 439 gfs2_inplace_release(ip);
439out_qunlock: 440out_qunlock:
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 773421130116..94d76ace0b95 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -177,8 +177,8 @@ static const u32 fsflags_to_gfs2[32] = {
177 [5] = GFS2_DIF_APPENDONLY, 177 [5] = GFS2_DIF_APPENDONLY,
178 [7] = GFS2_DIF_NOATIME, 178 [7] = GFS2_DIF_NOATIME,
179 [12] = GFS2_DIF_EXHASH, 179 [12] = GFS2_DIF_EXHASH,
180 [14] = GFS2_DIF_JDATA, 180 [14] = GFS2_DIF_INHERIT_JDATA,
181 [20] = GFS2_DIF_DIRECTIO, 181 [20] = GFS2_DIF_INHERIT_DIRECTIO,
182}; 182};
183 183
184static const u32 gfs2_to_fsflags[32] = { 184static const u32 gfs2_to_fsflags[32] = {
@@ -187,8 +187,6 @@ static const u32 gfs2_to_fsflags[32] = {
187 [gfs2fl_AppendOnly] = FS_APPEND_FL, 187 [gfs2fl_AppendOnly] = FS_APPEND_FL,
188 [gfs2fl_NoAtime] = FS_NOATIME_FL, 188 [gfs2fl_NoAtime] = FS_NOATIME_FL,
189 [gfs2fl_ExHash] = FS_INDEX_FL, 189 [gfs2fl_ExHash] = FS_INDEX_FL,
190 [gfs2fl_Jdata] = FS_JOURNAL_DATA_FL,
191 [gfs2fl_Directio] = FS_DIRECTIO_FL,
192 [gfs2fl_InheritDirectio] = FS_DIRECTIO_FL, 190 [gfs2fl_InheritDirectio] = FS_DIRECTIO_FL,
193 [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL, 191 [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL,
194}; 192};
@@ -207,6 +205,12 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
207 return error; 205 return error;
208 206
209 fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_di.di_flags); 207 fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_di.di_flags);
208 if (!S_ISDIR(inode->i_mode)) {
209 if (ip->i_di.di_flags & GFS2_DIF_JDATA)
210 fsflags |= FS_JOURNAL_DATA_FL;
211 if (ip->i_di.di_flags & GFS2_DIF_DIRECTIO)
212 fsflags |= FS_DIRECTIO_FL;
213 }
210 if (put_user(fsflags, ptr)) 214 if (put_user(fsflags, ptr))
211 error = -EFAULT; 215 error = -EFAULT;
212 216
@@ -270,13 +274,6 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
270 if ((new_flags ^ flags) == 0) 274 if ((new_flags ^ flags) == 0)
271 goto out; 275 goto out;
272 276
273 if (S_ISDIR(inode->i_mode)) {
274 if ((new_flags ^ flags) & GFS2_DIF_JDATA)
275 new_flags ^= (GFS2_DIF_JDATA|GFS2_DIF_INHERIT_JDATA);
276 if ((new_flags ^ flags) & GFS2_DIF_DIRECTIO)
277 new_flags ^= (GFS2_DIF_DIRECTIO|GFS2_DIF_INHERIT_DIRECTIO);
278 }
279
280 error = -EINVAL; 277 error = -EINVAL;
281 if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET) 278 if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET)
282 goto out; 279 goto out;
@@ -315,11 +312,19 @@ out:
315 312
316static int gfs2_set_flags(struct file *filp, u32 __user *ptr) 313static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
317{ 314{
315 struct inode *inode = filp->f_path.dentry->d_inode;
318 u32 fsflags, gfsflags; 316 u32 fsflags, gfsflags;
319 if (get_user(fsflags, ptr)) 317 if (get_user(fsflags, ptr))
320 return -EFAULT; 318 return -EFAULT;
321 gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags); 319 gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags);
322 return do_gfs2_set_flags(filp, gfsflags, ~0); 320 if (!S_ISDIR(inode->i_mode)) {
321 if (gfsflags & GFS2_DIF_INHERIT_JDATA)
322 gfsflags ^= (GFS2_DIF_JDATA | GFS2_DIF_INHERIT_JDATA);
323 if (gfsflags & GFS2_DIF_INHERIT_DIRECTIO)
324 gfsflags ^= (GFS2_DIF_DIRECTIO | GFS2_DIF_INHERIT_DIRECTIO);
325 return do_gfs2_set_flags(filp, gfsflags, ~0);
326 }
327 return do_gfs2_set_flags(filp, gfsflags, ~GFS2_DIF_JDATA);
323} 328}
324 329
325static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 330static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index e4e040625153..ce48c4594ec8 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -863,16 +863,19 @@ static struct inode *try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked)
863 u64 no_addr; 863 u64 no_addr;
864 864
865 for(;;) { 865 for(;;) {
866 if (goal >= rgd->rd_data)
867 break;
866 goal = rgblk_search(rgd, goal, GFS2_BLKST_UNLINKED, 868 goal = rgblk_search(rgd, goal, GFS2_BLKST_UNLINKED,
867 GFS2_BLKST_UNLINKED); 869 GFS2_BLKST_UNLINKED);
868 if (goal == 0) 870 if (goal == BFITNOENT)
869 return 0; 871 break;
870 no_addr = goal + rgd->rd_data0; 872 no_addr = goal + rgd->rd_data0;
871 if (no_addr <= *last_unlinked) 873 goal++;
874 if (no_addr < *last_unlinked)
872 continue; 875 continue;
873 *last_unlinked = no_addr; 876 *last_unlinked = no_addr;
874 inode = gfs2_inode_lookup(rgd->rd_sbd->sd_vfs, DT_UNKNOWN, 877 inode = gfs2_inode_lookup(rgd->rd_sbd->sd_vfs, DT_UNKNOWN,
875 no_addr, -1); 878 no_addr, -1);
876 if (!IS_ERR(inode)) 879 if (!IS_ERR(inode))
877 return inode; 880 return inode;
878 } 881 }
@@ -1313,7 +1316,7 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal,
1313 bi->bi_len, blk, new_state); 1316 bi->bi_len, blk, new_state);
1314 } 1317 }
1315 1318
1316 return (blk == BFITNOENT) ? 0 : (bi->bi_start * GFS2_NBBY) + blk; 1319 return (blk == BFITNOENT) ? blk : (bi->bi_start * GFS2_NBBY) + blk;
1317} 1320}
1318 1321
1319/** 1322/**
@@ -1393,6 +1396,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip)
1393 goal = rgd->rd_last_alloc_data; 1396 goal = rgd->rd_last_alloc_data;
1394 1397
1395 blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED); 1398 blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED);
1399 BUG_ON(blk == BFITNOENT);
1396 rgd->rd_last_alloc_data = blk; 1400 rgd->rd_last_alloc_data = blk;
1397 1401
1398 block = rgd->rd_data0 + blk; 1402 block = rgd->rd_data0 + blk;
@@ -1437,6 +1441,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip)
1437 goal = rgd->rd_last_alloc_meta; 1441 goal = rgd->rd_last_alloc_meta;
1438 1442
1439 blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED); 1443 blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED);
1444 BUG_ON(blk == BFITNOENT);
1440 rgd->rd_last_alloc_meta = blk; 1445 rgd->rd_last_alloc_meta = blk;
1441 1446
1442 block = rgd->rd_data0 + blk; 1447 block = rgd->rd_data0 + blk;
@@ -1478,6 +1483,7 @@ u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation)
1478 1483
1479 blk = rgblk_search(rgd, rgd->rd_last_alloc_meta, 1484 blk = rgblk_search(rgd, rgd->rd_last_alloc_meta,
1480 GFS2_BLKST_FREE, GFS2_BLKST_DINODE); 1485 GFS2_BLKST_FREE, GFS2_BLKST_DINODE);
1486 BUG_ON(blk == BFITNOENT);
1481 1487
1482 rgd->rd_last_alloc_meta = blk; 1488 rgd->rd_last_alloc_meta = blk;
1483 1489
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 20ac403469a0..c55a761c22bb 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -20,10 +20,8 @@
20#include "delegation.h" 20#include "delegation.h"
21#include "internal.h" 21#include "internal.h"
22 22
23static void nfs_free_delegation(struct nfs_delegation *delegation) 23static void nfs_do_free_delegation(struct nfs_delegation *delegation)
24{ 24{
25 if (delegation->cred)
26 put_rpccred(delegation->cred);
27 kfree(delegation); 25 kfree(delegation);
28} 26}
29 27
@@ -31,7 +29,18 @@ static void nfs_free_delegation_callback(struct rcu_head *head)
31{ 29{
32 struct nfs_delegation *delegation = container_of(head, struct nfs_delegation, rcu); 30 struct nfs_delegation *delegation = container_of(head, struct nfs_delegation, rcu);
33 31
34 nfs_free_delegation(delegation); 32 nfs_do_free_delegation(delegation);
33}
34
35static void nfs_free_delegation(struct nfs_delegation *delegation)
36{
37 struct rpc_cred *cred;
38
39 cred = rcu_dereference(delegation->cred);
40 rcu_assign_pointer(delegation->cred, NULL);
41 call_rcu(&delegation->rcu, nfs_free_delegation_callback);
42 if (cred)
43 put_rpccred(cred);
35} 44}
36 45
37static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state) 46static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state)
@@ -166,7 +175,7 @@ static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation *
166 int res = 0; 175 int res = 0;
167 176
168 res = nfs4_proc_delegreturn(inode, delegation->cred, &delegation->stateid); 177 res = nfs4_proc_delegreturn(inode, delegation->cred, &delegation->stateid);
169 call_rcu(&delegation->rcu, nfs_free_delegation_callback); 178 nfs_free_delegation(delegation);
170 return res; 179 return res;
171} 180}
172 181
@@ -448,7 +457,7 @@ restart:
448 spin_unlock(&clp->cl_lock); 457 spin_unlock(&clp->cl_lock);
449 rcu_read_unlock(); 458 rcu_read_unlock();
450 if (delegation != NULL) 459 if (delegation != NULL)
451 call_rcu(&delegation->rcu, nfs_free_delegation_callback); 460 nfs_free_delegation(delegation);
452 goto restart; 461 goto restart;
453 } 462 }
454 rcu_read_unlock(); 463 rcu_read_unlock();
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index bca6cdcb9f0d..71a49c3acabd 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -468,7 +468,7 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str
468 ctx->lockowner = current->files; 468 ctx->lockowner = current->files;
469 ctx->error = 0; 469 ctx->error = 0;
470 ctx->dir_cookie = 0; 470 ctx->dir_cookie = 0;
471 kref_init(&ctx->kref); 471 atomic_set(&ctx->count, 1);
472 } 472 }
473 return ctx; 473 return ctx;
474} 474}
@@ -476,21 +476,18 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str
476struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx) 476struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx)
477{ 477{
478 if (ctx != NULL) 478 if (ctx != NULL)
479 kref_get(&ctx->kref); 479 atomic_inc(&ctx->count);
480 return ctx; 480 return ctx;
481} 481}
482 482
483static void nfs_free_open_context(struct kref *kref) 483void put_nfs_open_context(struct nfs_open_context *ctx)
484{ 484{
485 struct nfs_open_context *ctx = container_of(kref, 485 struct inode *inode = ctx->path.dentry->d_inode;
486 struct nfs_open_context, kref);
487 486
488 if (!list_empty(&ctx->list)) { 487 if (!atomic_dec_and_lock(&ctx->count, &inode->i_lock))
489 struct inode *inode = ctx->path.dentry->d_inode; 488 return;
490 spin_lock(&inode->i_lock); 489 list_del(&ctx->list);
491 list_del(&ctx->list); 490 spin_unlock(&inode->i_lock);
492 spin_unlock(&inode->i_lock);
493 }
494 if (ctx->state != NULL) 491 if (ctx->state != NULL)
495 nfs4_close_state(&ctx->path, ctx->state, ctx->mode); 492 nfs4_close_state(&ctx->path, ctx->state, ctx->mode);
496 if (ctx->cred != NULL) 493 if (ctx->cred != NULL)
@@ -500,11 +497,6 @@ static void nfs_free_open_context(struct kref *kref)
500 kfree(ctx); 497 kfree(ctx);
501} 498}
502 499
503void put_nfs_open_context(struct nfs_open_context *ctx)
504{
505 kref_put(&ctx->kref, nfs_free_open_context);
506}
507
508/* 500/*
509 * Ensure that mmap has a recent RPC credential for use when writing out 501 * Ensure that mmap has a recent RPC credential for use when writing out
510 * shared pages 502 * shared pages
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index 7f86e65182e4..aea76d0e5fbd 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -175,10 +175,8 @@ static void nfs_expire_automounts(struct work_struct *work)
175 175
176void nfs_release_automount_timer(void) 176void nfs_release_automount_timer(void)
177{ 177{
178 if (list_empty(&nfs_automount_list)) { 178 if (list_empty(&nfs_automount_list))
179 cancel_delayed_work(&nfs_automount_task); 179 cancel_delayed_work_sync(&nfs_automount_task);
180 flush_scheduled_work();
181 }
182} 180}
183 181
184/* 182/*
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 6ca2795ccd9c..62b3ae280310 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -332,11 +332,9 @@ static int can_open_cached(struct nfs4_state *state, int mode)
332 switch (mode & (FMODE_READ|FMODE_WRITE|O_EXCL)) { 332 switch (mode & (FMODE_READ|FMODE_WRITE|O_EXCL)) {
333 case FMODE_READ: 333 case FMODE_READ:
334 ret |= test_bit(NFS_O_RDONLY_STATE, &state->flags) != 0; 334 ret |= test_bit(NFS_O_RDONLY_STATE, &state->flags) != 0;
335 ret |= test_bit(NFS_O_RDWR_STATE, &state->flags) != 0;
336 break; 335 break;
337 case FMODE_WRITE: 336 case FMODE_WRITE:
338 ret |= test_bit(NFS_O_WRONLY_STATE, &state->flags) != 0; 337 ret |= test_bit(NFS_O_WRONLY_STATE, &state->flags) != 0;
339 ret |= test_bit(NFS_O_RDWR_STATE, &state->flags) != 0;
340 break; 338 break;
341 case FMODE_READ|FMODE_WRITE: 339 case FMODE_READ|FMODE_WRITE:
342 ret |= test_bit(NFS_O_RDWR_STATE, &state->flags) != 0; 340 ret |= test_bit(NFS_O_RDWR_STATE, &state->flags) != 0;
@@ -1260,7 +1258,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
1260 nfs_increment_open_seqid(task->tk_status, calldata->arg.seqid); 1258 nfs_increment_open_seqid(task->tk_status, calldata->arg.seqid);
1261 switch (task->tk_status) { 1259 switch (task->tk_status) {
1262 case 0: 1260 case 0:
1263 nfs_set_open_stateid(state, &calldata->res.stateid, calldata->arg.open_flags); 1261 nfs_set_open_stateid(state, &calldata->res.stateid, 0);
1264 renew_lease(server, calldata->timestamp); 1262 renew_lease(server, calldata->timestamp);
1265 break; 1263 break;
1266 case -NFS4ERR_STALE_STATEID: 1264 case -NFS4ERR_STALE_STATEID:
@@ -1286,23 +1284,19 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
1286 .rpc_cred = state->owner->so_cred, 1284 .rpc_cred = state->owner->so_cred,
1287 }; 1285 };
1288 int clear_rd, clear_wr, clear_rdwr; 1286 int clear_rd, clear_wr, clear_rdwr;
1289 int mode;
1290 1287
1291 if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) 1288 if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0)
1292 return; 1289 return;
1293 1290
1294 mode = FMODE_READ|FMODE_WRITE;
1295 clear_rd = clear_wr = clear_rdwr = 0; 1291 clear_rd = clear_wr = clear_rdwr = 0;
1296 spin_lock(&state->owner->so_lock); 1292 spin_lock(&state->owner->so_lock);
1297 /* Calculate the change in open mode */ 1293 /* Calculate the change in open mode */
1298 if (state->n_rdwr == 0) { 1294 if (state->n_rdwr == 0) {
1299 if (state->n_rdonly == 0) { 1295 if (state->n_rdonly == 0) {
1300 mode &= ~FMODE_READ;
1301 clear_rd |= test_and_clear_bit(NFS_O_RDONLY_STATE, &state->flags); 1296 clear_rd |= test_and_clear_bit(NFS_O_RDONLY_STATE, &state->flags);
1302 clear_rdwr |= test_and_clear_bit(NFS_O_RDWR_STATE, &state->flags); 1297 clear_rdwr |= test_and_clear_bit(NFS_O_RDWR_STATE, &state->flags);
1303 } 1298 }
1304 if (state->n_wronly == 0) { 1299 if (state->n_wronly == 0) {
1305 mode &= ~FMODE_WRITE;
1306 clear_wr |= test_and_clear_bit(NFS_O_WRONLY_STATE, &state->flags); 1300 clear_wr |= test_and_clear_bit(NFS_O_WRONLY_STATE, &state->flags);
1307 clear_rdwr |= test_and_clear_bit(NFS_O_RDWR_STATE, &state->flags); 1301 clear_rdwr |= test_and_clear_bit(NFS_O_RDWR_STATE, &state->flags);
1308 } 1302 }
@@ -1314,9 +1308,13 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
1314 return; 1308 return;
1315 } 1309 }
1316 nfs_fattr_init(calldata->res.fattr); 1310 nfs_fattr_init(calldata->res.fattr);
1317 if (mode != 0) 1311 if (test_bit(NFS_O_RDONLY_STATE, &state->flags) != 0) {
1318 msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; 1312 msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE];
1319 calldata->arg.open_flags = mode; 1313 calldata->arg.open_flags = FMODE_READ;
1314 } else if (test_bit(NFS_O_WRONLY_STATE, &state->flags) != 0) {
1315 msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE];
1316 calldata->arg.open_flags = FMODE_WRITE;
1317 }
1320 calldata->timestamp = jiffies; 1318 calldata->timestamp = jiffies;
1321 rpc_call_setup(task, &msg, 0); 1319 rpc_call_setup(task, &msg, 0);
1322} 1320}
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c
index 0505ca124034..3ea352d82eba 100644
--- a/fs/nfs/nfs4renewd.c
+++ b/fs/nfs/nfs4renewd.c
@@ -127,16 +127,15 @@ nfs4_schedule_state_renewal(struct nfs_client *clp)
127void 127void
128nfs4_renewd_prepare_shutdown(struct nfs_server *server) 128nfs4_renewd_prepare_shutdown(struct nfs_server *server)
129{ 129{
130 flush_scheduled_work(); 130 cancel_delayed_work(&server->nfs_client->cl_renewd);
131} 131}
132 132
133void 133void
134nfs4_kill_renewd(struct nfs_client *clp) 134nfs4_kill_renewd(struct nfs_client *clp)
135{ 135{
136 down_read(&clp->cl_sem); 136 down_read(&clp->cl_sem);
137 cancel_delayed_work(&clp->cl_renewd); 137 cancel_delayed_work_sync(&clp->cl_renewd);
138 up_read(&clp->cl_sem); 138 up_read(&clp->cl_sem);
139 flush_scheduled_work();
140} 139}
141 140
142/* 141/*
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index e9662ba81d86..3e4adf8c8312 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -341,8 +341,6 @@ nfs4_state_set_mode_locked(struct nfs4_state *state, mode_t mode)
341 else 341 else
342 list_move_tail(&state->open_states, &state->owner->so_states); 342 list_move_tail(&state->open_states, &state->owner->so_states);
343 } 343 }
344 if (mode == 0)
345 list_del_init(&state->inode_states);
346 state->state = mode; 344 state->state = mode;
347} 345}
348 346
@@ -415,8 +413,7 @@ void nfs4_put_open_state(struct nfs4_state *state)
415 if (!atomic_dec_and_lock(&state->count, &owner->so_lock)) 413 if (!atomic_dec_and_lock(&state->count, &owner->so_lock))
416 return; 414 return;
417 spin_lock(&inode->i_lock); 415 spin_lock(&inode->i_lock);
418 if (!list_empty(&state->inode_states)) 416 list_del(&state->inode_states);
419 list_del(&state->inode_states);
420 list_del(&state->open_states); 417 list_del(&state->open_states);
421 spin_unlock(&inode->i_lock); 418 spin_unlock(&inode->i_lock);
422 spin_unlock(&owner->so_lock); 419 spin_unlock(&owner->so_lock);
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index f5e11f4fa952..4f517665c9a0 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -3731,7 +3731,6 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
3731{ 3731{
3732 int status; 3732 int status;
3733 struct buffer_head *last_eb_bh = NULL; 3733 struct buffer_head *last_eb_bh = NULL;
3734 struct buffer_head *bh = NULL;
3735 struct ocfs2_insert_type insert = {0, }; 3734 struct ocfs2_insert_type insert = {0, };
3736 struct ocfs2_extent_rec rec; 3735 struct ocfs2_extent_rec rec;
3737 3736
@@ -3783,9 +3782,6 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
3783 ocfs2_extent_map_insert_rec(inode, &rec); 3782 ocfs2_extent_map_insert_rec(inode, &rec);
3784 3783
3785bail: 3784bail:
3786 if (bh)
3787 brelse(bh);
3788
3789 if (last_eb_bh) 3785 if (last_eb_bh)
3790 brelse(last_eb_bh); 3786 brelse(last_eb_bh);
3791 3787
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index f0bdfd944c44..685c18065c82 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -854,17 +854,25 @@ static void o2net_sendpage(struct o2net_sock_container *sc,
854 struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); 854 struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
855 ssize_t ret; 855 ssize_t ret;
856 856
857 857 while (1) {
858 mutex_lock(&sc->sc_send_lock); 858 mutex_lock(&sc->sc_send_lock);
859 ret = sc->sc_sock->ops->sendpage(sc->sc_sock, 859 ret = sc->sc_sock->ops->sendpage(sc->sc_sock,
860 virt_to_page(kmalloced_virt), 860 virt_to_page(kmalloced_virt),
861 (long)kmalloced_virt & ~PAGE_MASK, 861 (long)kmalloced_virt & ~PAGE_MASK,
862 size, MSG_DONTWAIT); 862 size, MSG_DONTWAIT);
863 mutex_unlock(&sc->sc_send_lock); 863 mutex_unlock(&sc->sc_send_lock);
864 if (ret != size) { 864 if (ret == size)
865 break;
866 if (ret == (ssize_t)-EAGAIN) {
867 mlog(0, "sendpage of size %zu to " SC_NODEF_FMT
868 " returned EAGAIN\n", size, SC_NODEF_ARGS(sc));
869 cond_resched();
870 continue;
871 }
865 mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT 872 mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT
866 " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret); 873 " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret);
867 o2net_ensure_shutdown(nn, sc, 0); 874 o2net_ensure_shutdown(nn, sc, 0);
875 break;
868 } 876 }
869} 877}
870 878
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index c4034f693e7b..4ffa715be09c 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -187,6 +187,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
187 int ret; 187 int ret;
188 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 188 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
189 handle_t *handle; 189 handle_t *handle;
190 struct ocfs2_dinode *di = (struct ocfs2_dinode *) bh->b_data;
190 191
191 mlog_entry_void(); 192 mlog_entry_void();
192 193
@@ -197,11 +198,27 @@ int ocfs2_update_inode_atime(struct inode *inode,
197 goto out; 198 goto out;
198 } 199 }
199 200
201 ret = ocfs2_journal_access(handle, inode, bh,
202 OCFS2_JOURNAL_ACCESS_WRITE);
203 if (ret) {
204 mlog_errno(ret);
205 goto out_commit;
206 }
207
208 /*
209 * Don't use ocfs2_mark_inode_dirty() here as we don't always
210 * have i_mutex to guard against concurrent changes to other
211 * inode fields.
212 */
200 inode->i_atime = CURRENT_TIME; 213 inode->i_atime = CURRENT_TIME;
201 ret = ocfs2_mark_inode_dirty(handle, inode, bh); 214 di->i_atime = cpu_to_le64(inode->i_atime.tv_sec);
215 di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec);
216
217 ret = ocfs2_journal_dirty(handle, bh);
202 if (ret < 0) 218 if (ret < 0)
203 mlog_errno(ret); 219 mlog_errno(ret);
204 220
221out_commit:
205 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); 222 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
206out: 223out:
207 mlog_exit(ret); 224 mlog_exit(ret);
@@ -1011,6 +1028,11 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
1011 } 1028 }
1012 1029
1013 if (size_change && attr->ia_size != i_size_read(inode)) { 1030 if (size_change && attr->ia_size != i_size_read(inode)) {
1031 if (attr->ia_size > sb->s_maxbytes) {
1032 status = -EFBIG;
1033 goto bail_unlock;
1034 }
1035
1014 if (i_size_read(inode) > attr->ia_size) 1036 if (i_size_read(inode) > attr->ia_size)
1015 status = ocfs2_truncate_file(inode, bh, attr->ia_size); 1037 status = ocfs2_truncate_file(inode, bh, attr->ia_size);
1016 else 1038 else
@@ -1516,7 +1538,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
1516 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1538 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1517 struct buffer_head *di_bh = NULL; 1539 struct buffer_head *di_bh = NULL;
1518 handle_t *handle; 1540 handle_t *handle;
1519 unsigned long long max_off = ocfs2_max_file_offset(inode->i_sb->s_blocksize_bits); 1541 unsigned long long max_off = inode->i_sb->s_maxbytes;
1520 1542
1521 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) 1543 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
1522 return -EROFS; 1544 return -EROFS;
@@ -1942,7 +1964,7 @@ static ssize_t ocfs2_file_buffered_write(struct file *file, loff_t *ppos,
1942 } 1964 }
1943 1965
1944 dst = kmap_atomic(page, KM_USER0); 1966 dst = kmap_atomic(page, KM_USER0);
1945 memcpy(dst + (pos & (PAGE_CACHE_SIZE - 1)), buf, bytes); 1967 memcpy(dst + (pos & (loff_t)(PAGE_CACHE_SIZE - 1)), buf, bytes);
1946 kunmap_atomic(dst, KM_USER0); 1968 kunmap_atomic(dst, KM_USER0);
1947 flush_dcache_page(page); 1969 flush_dcache_page(page);
1948 ocfs2_put_write_source(user_page); 1970 ocfs2_put_write_source(user_page);
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index d430fdab16e9..701e6d04ed5d 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -1080,6 +1080,7 @@ static int ocfs2_rename(struct inode *old_dir,
1080 struct buffer_head *old_inode_de_bh = NULL; // if old_dentry is a dir, 1080 struct buffer_head *old_inode_de_bh = NULL; // if old_dentry is a dir,
1081 // this is the 1st dirent bh 1081 // this is the 1st dirent bh
1082 nlink_t old_dir_nlink = old_dir->i_nlink; 1082 nlink_t old_dir_nlink = old_dir->i_nlink;
1083 struct ocfs2_dinode *old_di;
1083 1084
1084 /* At some point it might be nice to break this function up a 1085 /* At some point it might be nice to break this function up a
1085 * bit. */ 1086 * bit. */
@@ -1354,7 +1355,20 @@ static int ocfs2_rename(struct inode *old_dir,
1354 1355
1355 old_inode->i_ctime = CURRENT_TIME; 1356 old_inode->i_ctime = CURRENT_TIME;
1356 mark_inode_dirty(old_inode); 1357 mark_inode_dirty(old_inode);
1357 ocfs2_mark_inode_dirty(handle, old_inode, old_inode_bh); 1358
1359 status = ocfs2_journal_access(handle, old_inode, old_inode_bh,
1360 OCFS2_JOURNAL_ACCESS_WRITE);
1361 if (status >= 0) {
1362 old_di = (struct ocfs2_dinode *) old_inode_bh->b_data;
1363
1364 old_di->i_ctime = cpu_to_le64(old_inode->i_ctime.tv_sec);
1365 old_di->i_ctime_nsec = cpu_to_le32(old_inode->i_ctime.tv_nsec);
1366
1367 status = ocfs2_journal_dirty(handle, old_inode_bh);
1368 if (status < 0)
1369 mlog_errno(status);
1370 } else
1371 mlog_errno(status);
1358 1372
1359 /* now that the name has been added to new_dir, remove the old name */ 1373 /* now that the name has been added to new_dir, remove the old name */
1360 status = ocfs2_delete_entry(handle, old_dir, old_de, old_de_bh); 1374 status = ocfs2_delete_entry(handle, old_dir, old_de, old_de_bh);
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 5cc90a40b3c5..58307853fb4a 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -494,16 +494,16 @@ static inline unsigned int ocfs2_page_index_to_clusters(struct super_block *sb,
494/* 494/*
495 * Find the 1st page index which covers the given clusters. 495 * Find the 1st page index which covers the given clusters.
496 */ 496 */
497static inline unsigned long ocfs2_align_clusters_to_page_index(struct super_block *sb, 497static inline pgoff_t ocfs2_align_clusters_to_page_index(struct super_block *sb,
498 u32 clusters) 498 u32 clusters)
499{ 499{
500 unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits; 500 unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits;
501 unsigned long index = clusters; 501 pgoff_t index = clusters;
502 502
503 if (PAGE_CACHE_SHIFT > cbits) { 503 if (PAGE_CACHE_SHIFT > cbits) {
504 index = clusters >> (PAGE_CACHE_SHIFT - cbits); 504 index = (pgoff_t)clusters >> (PAGE_CACHE_SHIFT - cbits);
505 } else if (PAGE_CACHE_SHIFT < cbits) { 505 } else if (PAGE_CACHE_SHIFT < cbits) {
506 index = clusters << (cbits - PAGE_CACHE_SHIFT); 506 index = (pgoff_t)clusters << (cbits - PAGE_CACHE_SHIFT);
507 } 507 }
508 508
509 return index; 509 return index;
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 200c7d4790dc..f2fc9a795deb 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -316,39 +316,51 @@ static void ocfs2_destroy_inode(struct inode *inode)
316 kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode)); 316 kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode));
317} 317}
318 318
319/* From xfs_super.c:xfs_max_file_offset 319static unsigned long long ocfs2_max_file_offset(unsigned int bbits,
320 * Copyright (c) 2000-2004 Silicon Graphics, Inc. 320 unsigned int cbits)
321 */
322unsigned long long ocfs2_max_file_offset(unsigned int blockshift)
323{ 321{
324 unsigned int pagefactor = 1; 322 unsigned int bytes = 1 << cbits;
325 unsigned int bitshift = BITS_PER_LONG - 1; 323 unsigned int trim = bytes;
326 324 unsigned int bitshift = 32;
327 /* Figure out maximum filesize, on Linux this can depend on 325
328 * the filesystem blocksize (on 32 bit platforms). 326 /*
329 * __block_prepare_write does this in an [unsigned] long... 327 * i_size and all block offsets in ocfs2 are always 64 bits
330 * page->index << (PAGE_CACHE_SHIFT - bbits) 328 * wide. i_clusters is 32 bits, in cluster-sized units. So on
331 * So, for page sized blocks (4K on 32 bit platforms), 329 * 64 bit platforms, cluster size will be the limiting factor.
332 * this wraps at around 8Tb (hence MAX_LFS_FILESIZE which is
333 * (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
334 * but for smaller blocksizes it is less (bbits = log2 bsize).
335 * Note1: get_block_t takes a long (implicit cast from above)
336 * Note2: The Large Block Device (LBD and HAVE_SECTOR_T) patch
337 * can optionally convert the [unsigned] long from above into
338 * an [unsigned] long long.
339 */ 330 */
340 331
341#if BITS_PER_LONG == 32 332#if BITS_PER_LONG == 32
342# if defined(CONFIG_LBD) 333# if defined(CONFIG_LBD)
343 BUILD_BUG_ON(sizeof(sector_t) != 8); 334 BUILD_BUG_ON(sizeof(sector_t) != 8);
344 pagefactor = PAGE_CACHE_SIZE; 335 /*
345 bitshift = BITS_PER_LONG; 336 * We might be limited by page cache size.
337 */
338 if (bytes > PAGE_CACHE_SIZE) {
339 bytes = PAGE_CACHE_SIZE;
340 trim = 1;
341 /*
342 * Shift by 31 here so that we don't get larger than
343 * MAX_LFS_FILESIZE
344 */
345 bitshift = 31;
346 }
346# else 347# else
347 pagefactor = PAGE_CACHE_SIZE >> (PAGE_CACHE_SHIFT - blockshift); 348 /*
349 * We are limited by the size of sector_t. Use block size, as
350 * that's what we expose to the VFS.
351 */
352 bytes = 1 << bbits;
353 trim = 1;
354 bitshift = 31;
348# endif 355# endif
349#endif 356#endif
350 357
351 return (((unsigned long long)pagefactor) << bitshift) - 1; 358 /*
359 * Trim by a whole cluster when we can actually approach the
360 * on-disk limits. Otherwise we can overflow i_clusters when
361 * an extent start is at the max offset.
362 */
363 return (((unsigned long long)bytes) << bitshift) - trim;
352} 364}
353 365
354static int ocfs2_remount(struct super_block *sb, int *flags, char *data) 366static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
@@ -1259,8 +1271,8 @@ static int ocfs2_initialize_super(struct super_block *sb,
1259 int sector_size) 1271 int sector_size)
1260{ 1272{
1261 int status = 0; 1273 int status = 0;
1262 int i; 1274 int i, cbits, bbits;
1263 struct ocfs2_dinode *di = NULL; 1275 struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
1264 struct inode *inode = NULL; 1276 struct inode *inode = NULL;
1265 struct buffer_head *bitmap_bh = NULL; 1277 struct buffer_head *bitmap_bh = NULL;
1266 struct ocfs2_journal *journal; 1278 struct ocfs2_journal *journal;
@@ -1279,9 +1291,12 @@ static int ocfs2_initialize_super(struct super_block *sb,
1279 sb->s_fs_info = osb; 1291 sb->s_fs_info = osb;
1280 sb->s_op = &ocfs2_sops; 1292 sb->s_op = &ocfs2_sops;
1281 sb->s_export_op = &ocfs2_export_ops; 1293 sb->s_export_op = &ocfs2_export_ops;
1294 sb->s_time_gran = 1;
1282 sb->s_flags |= MS_NOATIME; 1295 sb->s_flags |= MS_NOATIME;
1283 /* this is needed to support O_LARGEFILE */ 1296 /* this is needed to support O_LARGEFILE */
1284 sb->s_maxbytes = ocfs2_max_file_offset(sb->s_blocksize_bits); 1297 cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
1298 bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
1299 sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
1285 1300
1286 osb->sb = sb; 1301 osb->sb = sb;
1287 /* Save off for ocfs2_rw_direct */ 1302 /* Save off for ocfs2_rw_direct */
@@ -1341,8 +1356,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
1341 goto bail; 1356 goto bail;
1342 } 1357 }
1343 1358
1344 di = (struct ocfs2_dinode *)bh->b_data;
1345
1346 osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); 1359 osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
1347 if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) { 1360 if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) {
1348 mlog(ML_ERROR, "Invalid number of node slots (%u)\n", 1361 mlog(ML_ERROR, "Invalid number of node slots (%u)\n",
diff --git a/fs/ocfs2/super.h b/fs/ocfs2/super.h
index 3b9cb3d0b008..783f5270f2a1 100644
--- a/fs/ocfs2/super.h
+++ b/fs/ocfs2/super.h
@@ -45,6 +45,4 @@ void __ocfs2_abort(struct super_block *sb,
45 45
46#define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args) 46#define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args)
47 47
48unsigned long long ocfs2_max_file_offset(unsigned int blockshift);
49
50#endif /* OCFS2_SUPER_H */ 48#endif /* OCFS2_SUPER_H */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index f9f987f8e661..ec3ffdadb4d2 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -232,7 +232,7 @@ struct acpi_processor_errata {
232 232
233extern int acpi_processor_preregister_performance(struct 233extern int acpi_processor_preregister_performance(struct
234 acpi_processor_performance 234 acpi_processor_performance
235 **performance); 235 *performance);
236 236
237extern int acpi_processor_register_performance(struct acpi_processor_performance 237extern int acpi_processor_register_performance(struct acpi_processor_performance
238 *performance, unsigned int cpu); 238 *performance, unsigned int cpu);
diff --git a/include/asm-alpha/fcntl.h b/include/asm-alpha/fcntl.h
index 87f2cf459e26..25da0017ec87 100644
--- a/include/asm-alpha/fcntl.h
+++ b/include/asm-alpha/fcntl.h
@@ -16,6 +16,7 @@
16#define O_LARGEFILE 0400000 /* will be set by the kernel on every open */ 16#define O_LARGEFILE 0400000 /* will be set by the kernel on every open */
17#define O_DIRECT 02000000 /* direct disk access - should check with OSF/1 */ 17#define O_DIRECT 02000000 /* direct disk access - should check with OSF/1 */
18#define O_NOATIME 04000000 18#define O_NOATIME 04000000
19#define O_CLOEXEC 010000000 /* set close_on_exec */
19 20
20#define F_GETLK 7 21#define F_GETLK 7
21#define F_SETLK 8 22#define F_SETLK 8
diff --git a/include/asm-arm/pgtable-nommu.h b/include/asm-arm/pgtable-nommu.h
index b186bc820e30..33c83dd87965 100644
--- a/include/asm-arm/pgtable-nommu.h
+++ b/include/asm-arm/pgtable-nommu.h
@@ -74,7 +74,6 @@ static inline int pte_file(pte_t pte) { return 0; }
74 * These would be in other places but having them here reduces the diffs. 74 * These would be in other places but having them here reduces the diffs.
75 */ 75 */
76extern unsigned int kobjsize(const void *objp); 76extern unsigned int kobjsize(const void *objp);
77extern int is_in_rom(unsigned long);
78 77
79/* 78/*
80 * No page table caches to initialise. 79 * No page table caches to initialise.
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index e30d4b3bd836..64bb92bb6773 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -255,6 +255,8 @@ static inline void memset_io(volatile void __iomem *addr, unsigned char val,
255 memset((void __force *)addr, val, count); 255 memset((void __force *)addr, val, count);
256} 256}
257 257
258#define mmiowb()
259
258#define IO_SPACE_LIMIT 0xffffffff 260#define IO_SPACE_LIMIT 0xffffffff
259 261
260extern void __iomem *__ioremap(unsigned long offset, size_t size, 262extern void __iomem *__ioremap(unsigned long offset, size_t size,
diff --git a/include/asm-avr32/pgalloc.h b/include/asm-avr32/pgalloc.h
index bb82e70cde8d..0e680f47209f 100644
--- a/include/asm-avr32/pgalloc.h
+++ b/include/asm-avr32/pgalloc.h
@@ -27,13 +27,7 @@ static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
27 */ 27 */
28static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) 28static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm)
29{ 29{
30 unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); 30 return kcalloc(USER_PTRS_PER_PGD, sizeof(pgd_t), GFP_KERNEL);
31 pgd_t *pgd = kmalloc(pgd_size, GFP_KERNEL);
32
33 if (pgd)
34 memset(pgd, 0, pgd_size);
35
36 return pgd;
37} 31}
38 32
39static inline void pgd_free(pgd_t *pgd) 33static inline void pgd_free(pgd_t *pgd)
@@ -44,18 +38,9 @@ static inline void pgd_free(pgd_t *pgd)
44static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 38static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
45 unsigned long address) 39 unsigned long address)
46{ 40{
47 int count = 0;
48 pte_t *pte; 41 pte_t *pte;
49 42
50 do { 43 pte = (pte_t *)get_zeroed_page(GFP_KERNEL | __GFP_REPEAT);
51 pte = (pte_t *) __get_free_page(GFP_KERNEL | __GFP_REPEAT);
52 if (pte)
53 clear_page(pte);
54 else {
55 current->state = TASK_UNINTERRUPTIBLE;
56 schedule_timeout(HZ);
57 }
58 } while (!pte && (count++ < 10));
59 44
60 return pte; 45 return pte;
61} 46}
@@ -63,18 +48,9 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
63static inline struct page *pte_alloc_one(struct mm_struct *mm, 48static inline struct page *pte_alloc_one(struct mm_struct *mm,
64 unsigned long address) 49 unsigned long address)
65{ 50{
66 int count = 0;
67 struct page *pte; 51 struct page *pte;
68 52
69 do { 53 pte = alloc_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
70 pte = alloc_pages(GFP_KERNEL, 0);
71 if (pte)
72 clear_page(page_address(pte));
73 else {
74 current->state = TASK_UNINTERRUPTIBLE;
75 schedule_timeout(HZ);
76 }
77 } while (!pte && (count++ < 10));
78 54
79 return pte; 55 return pte;
80} 56}
diff --git a/include/asm-avr32/pgtable.h b/include/asm-avr32/pgtable.h
index c07bdd10b891..018f6e2a0242 100644
--- a/include/asm-avr32/pgtable.h
+++ b/include/asm-avr32/pgtable.h
@@ -32,8 +32,6 @@
32#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) 32#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
33#define FIRST_USER_ADDRESS 0 33#define FIRST_USER_ADDRESS 0
34 34
35#define PTE_PHYS_MASK 0x1ffff000
36
37#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
38extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 36extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
39extern void paging_init(void); 37extern void paging_init(void);
@@ -265,7 +263,7 @@ static inline pte_t pte_mkyoung(pte_t pte)
265 * trivial. 263 * trivial.
266 */ 264 */
267#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) 265#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
268#define pte_page(x) phys_to_page(pte_val(x) & PTE_PHYS_MASK) 266#define pte_page(x) (pfn_to_page(pte_pfn(x)))
269 267
270/* 268/*
271 * Mark the prot value as uncacheable and unbufferable 269 * Mark the prot value as uncacheable and unbufferable
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index 7306c71a8926..cd84f1771e34 100644
--- a/include/asm-frv/unistd.h
+++ b/include/asm-frv/unistd.h
@@ -330,10 +330,11 @@
330#define __NR_signalfd 321 330#define __NR_signalfd 321
331#define __NR_timerfd 322 331#define __NR_timerfd 322
332#define __NR_eventfd 323 332#define __NR_eventfd 323
333#define __NR_fallocate 324
333 334
334#ifdef __KERNEL__ 335#ifdef __KERNEL__
335 336
336#define NR_syscalls 324 337#define NR_syscalls 325
337 338
338#define __ARCH_WANT_IPC_PARSE_VERSION 339#define __ARCH_WANT_IPC_PARSE_VERSION
339/* #define __ARCH_WANT_OLD_READDIR */ 340/* #define __ARCH_WANT_OLD_READDIR */
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index f605e8d0eed3..5f0d797d33fd 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -2,6 +2,7 @@
2#define _ASM_GENERIC_PGTABLE_H 2#define _ASM_GENERIC_PGTABLE_H
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5#ifdef CONFIG_MMU
5 6
6#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 7#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
7/* 8/*
@@ -133,41 +134,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
133#endif 134#endif
134 135
135/* 136/*
136 * A facility to provide lazy MMU batching. This allows PTE updates and
137 * page invalidations to be delayed until a call to leave lazy MMU mode
138 * is issued. Some architectures may benefit from doing this, and it is
139 * beneficial for both shadow and direct mode hypervisors, which may batch
140 * the PTE updates which happen during this window. Note that using this
141 * interface requires that read hazards be removed from the code. A read
142 * hazard could result in the direct mode hypervisor case, since the actual
143 * write to the page tables may not yet have taken place, so reads though
144 * a raw PTE pointer after it has been modified are not guaranteed to be
145 * up to date. This mode can only be entered and left under the protection of
146 * the page table locks for all page tables which may be modified. In the UP
147 * case, this is required so that preemption is disabled, and in the SMP case,
148 * it must synchronize the delayed page table writes properly on other CPUs.
149 */
150#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
151#define arch_enter_lazy_mmu_mode() do {} while (0)
152#define arch_leave_lazy_mmu_mode() do {} while (0)
153#define arch_flush_lazy_mmu_mode() do {} while (0)
154#endif
155
156/*
157 * A facility to provide batching of the reload of page tables with the
158 * actual context switch code for paravirtualized guests. By convention,
159 * only one of the lazy modes (CPU, MMU) should be active at any given
160 * time, entry should never be nested, and entry and exits should always
161 * be paired. This is for sanity of maintaining and reasoning about the
162 * kernel code.
163 */
164#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
165#define arch_enter_lazy_cpu_mode() do {} while (0)
166#define arch_leave_lazy_cpu_mode() do {} while (0)
167#define arch_flush_lazy_cpu_mode() do {} while (0)
168#endif
169
170/*
171 * When walking page tables, get the address of the next boundary, 137 * When walking page tables, get the address of the next boundary,
172 * or the end address of the range if that comes earlier. Although no 138 * or the end address of the range if that comes earlier. Although no
173 * vma end wraps to 0, rounded up __boundary may wrap to 0 throughout. 139 * vma end wraps to 0, rounded up __boundary may wrap to 0 throughout.
@@ -233,6 +199,43 @@ static inline int pmd_none_or_clear_bad(pmd_t *pmd)
233 } 199 }
234 return 0; 200 return 0;
235} 201}
202#endif /* CONFIG_MMU */
203
204/*
205 * A facility to provide lazy MMU batching. This allows PTE updates and
206 * page invalidations to be delayed until a call to leave lazy MMU mode
207 * is issued. Some architectures may benefit from doing this, and it is
208 * beneficial for both shadow and direct mode hypervisors, which may batch
209 * the PTE updates which happen during this window. Note that using this
210 * interface requires that read hazards be removed from the code. A read
211 * hazard could result in the direct mode hypervisor case, since the actual
212 * write to the page tables may not yet have taken place, so reads though
213 * a raw PTE pointer after it has been modified are not guaranteed to be
214 * up to date. This mode can only be entered and left under the protection of
215 * the page table locks for all page tables which may be modified. In the UP
216 * case, this is required so that preemption is disabled, and in the SMP case,
217 * it must synchronize the delayed page table writes properly on other CPUs.
218 */
219#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
220#define arch_enter_lazy_mmu_mode() do {} while (0)
221#define arch_leave_lazy_mmu_mode() do {} while (0)
222#define arch_flush_lazy_mmu_mode() do {} while (0)
223#endif
224
225/*
226 * A facility to provide batching of the reload of page tables with the
227 * actual context switch code for paravirtualized guests. By convention,
228 * only one of the lazy modes (CPU, MMU) should be active at any given
229 * time, entry should never be nested, and entry and exits should always
230 * be paired. This is for sanity of maintaining and reasoning about the
231 * kernel code.
232 */
233#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
234#define arch_enter_lazy_cpu_mode() do {} while (0)
235#define arch_leave_lazy_cpu_mode() do {} while (0)
236#define arch_flush_lazy_cpu_mode() do {} while (0)
237#endif
238
236#endif /* !__ASSEMBLY__ */ 239#endif /* !__ASSEMBLY__ */
237 240
238#endif /* _ASM_GENERIC_PGTABLE_H */ 241#endif /* _ASM_GENERIC_PGTABLE_H */
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index 1e8f6f252dd3..4091b33dcb10 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -116,6 +116,8 @@ extern void enable_NMI_through_LVT0 (void * dummy);
116extern int timer_over_8254; 116extern int timer_over_8254;
117extern int local_apic_timer_c2_ok; 117extern int local_apic_timer_c2_ok;
118 118
119extern int local_apic_timer_disabled;
120
119#else /* !CONFIG_X86_LOCAL_APIC */ 121#else /* !CONFIG_X86_LOCAL_APIC */
120static inline void lapic_shutdown(void) { } 122static inline void lapic_shutdown(void) { }
121 123
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index c961c03cf1e2..7b3aa28ebc6e 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -79,7 +79,7 @@
79#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */ 79#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
80#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */ 80#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */
81#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */ 81#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
82#define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */ 82/* 14 free */
83#define X86_FEATURE_SYNC_RDTSC (3*32+15) /* RDTSC synchronizes the CPU */ 83#define X86_FEATURE_SYNC_RDTSC (3*32+15) /* RDTSC synchronizes the CPU */
84#define X86_FEATURE_REP_GOOD (3*32+16) /* rep microcode works well on this CPU */ 84#define X86_FEATURE_REP_GOOD (3*32+16) /* rep microcode works well on this CPU */
85 85
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index 7df88be2dd9e..9fa3fa9e62d1 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -47,7 +47,8 @@ struct paravirt_ops
47 * The patch function should return the number of bytes of code 47 * The patch function should return the number of bytes of code
48 * generated, as we nop pad the rest in generic code. 48 * generated, as we nop pad the rest in generic code.
49 */ 49 */
50 unsigned (*patch)(u8 type, u16 clobber, void *firstinsn, unsigned len); 50 unsigned (*patch)(u8 type, u16 clobber, void *insnbuf,
51 unsigned long addr, unsigned len);
51 52
52 /* Basic arch-specific setup */ 53 /* Basic arch-specific setup */
53 void (*arch_setup)(void); 54 void (*arch_setup)(void);
@@ -253,13 +254,16 @@ extern struct paravirt_ops paravirt_ops;
253 254
254unsigned paravirt_patch_nop(void); 255unsigned paravirt_patch_nop(void);
255unsigned paravirt_patch_ignore(unsigned len); 256unsigned paravirt_patch_ignore(unsigned len);
256unsigned paravirt_patch_call(void *target, u16 tgt_clobbers, 257unsigned paravirt_patch_call(void *insnbuf,
257 void *site, u16 site_clobbers, 258 const void *target, u16 tgt_clobbers,
259 unsigned long addr, u16 site_clobbers,
258 unsigned len); 260 unsigned len);
259unsigned paravirt_patch_jmp(void *target, void *site, unsigned len); 261unsigned paravirt_patch_jmp(const void *target, void *insnbuf,
260unsigned paravirt_patch_default(u8 type, u16 clobbers, void *site, unsigned len); 262 unsigned long addr, unsigned len);
263unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
264 unsigned long addr, unsigned len);
261 265
262unsigned paravirt_patch_insns(void *site, unsigned len, 266unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
263 const char *start, const char *end); 267 const char *start, const char *end);
264 268
265int paravirt_disable_iospace(void); 269int paravirt_disable_iospace(void);
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index d790343e9982..4fcacc711385 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -8,6 +8,9 @@ struct pci_sysdata {
8 int node; /* NUMA node */ 8 int node; /* NUMA node */
9}; 9};
10 10
11/* scan a bus after allocating a pci_sysdata for it */
12extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
13
11#include <linux/mm.h> /* for struct page */ 14#include <linux/mm.h> /* for struct page */
12 15
13/* Can be used to override the logic in pci_scan_bus for skipping 16/* Can be used to override the logic in pci_scan_bus for skipping
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index f6bd804d9090..744d6bb24116 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -95,7 +95,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
95 return -EIO; 95 return -EIO;
96 if (dma_ops->set_dma_mask != NULL) 96 if (dma_ops->set_dma_mask != NULL)
97 return dma_ops->set_dma_mask(dev, dma_mask); 97 return dma_ops->set_dma_mask(dev, dma_mask);
98 if (!dev->dma_mask || !dma_supported(dev, *dev->dma_mask)) 98 if (!dev->dma_mask || !dma_supported(dev, dma_mask))
99 return -EIO; 99 return -EIO;
100 *dev->dma_mask = dma_mask; 100 *dev->dma_mask = dma_mask;
101 return 0; 101 return 0;
diff --git a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
index 695962f02059..3112ad14ad95 100644
--- a/include/asm-powerpc/mmu-hash64.h
+++ b/include/asm-powerpc/mmu-hash64.h
@@ -262,6 +262,7 @@ extern void slb_initialize(void);
262extern void slb_flush_and_rebolt(void); 262extern void slb_flush_and_rebolt(void);
263extern void stab_initialize(unsigned long stab); 263extern void stab_initialize(unsigned long stab);
264 264
265extern void slb_vmalloc_update(void);
265#endif /* __ASSEMBLY__ */ 266#endif /* __ASSEMBLY__ */
266 267
267/* 268/*
diff --git a/include/asm-powerpc/pgtable-64k.h b/include/asm-powerpc/pgtable-64k.h
index 31cbd3d7fce8..33ae9018fe72 100644
--- a/include/asm-powerpc/pgtable-64k.h
+++ b/include/asm-powerpc/pgtable-64k.h
@@ -49,12 +49,10 @@
49 49
50/* Shift to put page number into pte. 50/* Shift to put page number into pte.
51 * 51 *
52 * That gives us a max RPN of 32 bits, which means a max of 48 bits 52 * That gives us a max RPN of 34 bits, which means a max of 50 bits
53 * of addressable physical space. 53 * of addressable physical space, or 46 bits for the special 4k PFNs.
54 * We could get 3 more bits here by setting PTE_RPN_SHIFT to 29 but
55 * 32 makes PTEs more readable for debugging for now :)
56 */ 54 */
57#define PTE_RPN_SHIFT (32) 55#define PTE_RPN_SHIFT (30)
58#define PTE_RPN_MAX (1UL << (64 - PTE_RPN_SHIFT)) 56#define PTE_RPN_MAX (1UL << (64 - PTE_RPN_SHIFT))
59#define PTE_RPN_MASK (~((1UL<<PTE_RPN_SHIFT)-1)) 57#define PTE_RPN_MASK (~((1UL<<PTE_RPN_SHIFT)-1))
60 58
diff --git a/include/asm-powerpc/spu_priv1.h b/include/asm-powerpc/spu_priv1.h
index 7e78f6a1ab8b..0f37c7c90820 100644
--- a/include/asm-powerpc/spu_priv1.h
+++ b/include/asm-powerpc/spu_priv1.h
@@ -178,6 +178,7 @@ struct spu_management_ops {
178 int (*enumerate_spus)(int (*fn)(void *data)); 178 int (*enumerate_spus)(int (*fn)(void *data));
179 int (*create_spu)(struct spu *spu, void *data); 179 int (*create_spu)(struct spu *spu, void *data);
180 int (*destroy_spu)(struct spu *spu); 180 int (*destroy_spu)(struct spu *spu);
181 int (*init_affinity)(void);
181}; 182};
182 183
183extern const struct spu_management_ops* spu_management_ops; 184extern const struct spu_management_ops* spu_management_ops;
@@ -200,6 +201,12 @@ spu_destroy_spu (struct spu *spu)
200 return spu_management_ops->destroy_spu(spu); 201 return spu_management_ops->destroy_spu(spu);
201} 202}
202 203
204static inline int
205spu_init_affinity (void)
206{
207 return spu_management_ops->init_affinity();
208}
209
203/* 210/*
204 * The declarations folowing are put here for convenience 211 * The declarations folowing are put here for convenience
205 * and only intended to be used by the platform setup code. 212 * and only intended to be used by the platform setup code.
diff --git a/include/asm-sh/rts7751r2d.h b/include/asm-sh/rts7751r2d.h
index 10565ac7966a..5d7800aa31b5 100644
--- a/include/asm-sh/rts7751r2d.h
+++ b/include/asm-sh/rts7751r2d.h
@@ -37,7 +37,7 @@
37#define PA_VERREG 0xa4000032 /* FPGA Version Register */ 37#define PA_VERREG 0xa4000032 /* FPGA Version Register */
38#define PA_INPORT 0xa4000034 /* KEY Input Port control */ 38#define PA_INPORT 0xa4000034 /* KEY Input Port control */
39#define PA_OUTPORT 0xa4000036 /* LED control */ 39#define PA_OUTPORT 0xa4000036 /* LED control */
40#define PA_DMPORT 0xa4000038 /* DM270 Output Port control */ 40#define PA_BVERREG 0xa4000038 /* Board Revision Register */
41 41
42#define PA_AX88796L 0xaa000400 /* AX88796L Area */ 42#define PA_AX88796L 0xaa000400 /* AX88796L Area */
43#define PA_VOYAGER 0xab000000 /* VOYAGER GX Area */ 43#define PA_VOYAGER 0xab000000 /* VOYAGER GX Area */
diff --git a/include/asm-sparc/fcntl.h b/include/asm-sparc/fcntl.h
index 5db60b5ae7b0..5ec546349fc8 100644
--- a/include/asm-sparc/fcntl.h
+++ b/include/asm-sparc/fcntl.h
@@ -16,6 +16,7 @@
16#define O_LARGEFILE 0x40000 16#define O_LARGEFILE 0x40000
17#define O_DIRECT 0x100000 /* direct disk access hint */ 17#define O_DIRECT 0x100000 /* direct disk access hint */
18#define O_NOATIME 0x200000 18#define O_NOATIME 0x200000
19#define O_CLOEXEC 0x400000
19 20
20#define F_GETOWN 5 /* for sockets. */ 21#define F_GETOWN 5 /* for sockets. */
21#define F_SETOWN 6 /* for sockets. */ 22#define F_SETOWN 6 /* for sockets. */
diff --git a/include/asm-sparc/floppy.h b/include/asm-sparc/floppy.h
index 28ce2b9c3da8..acd06d8ff70a 100644
--- a/include/asm-sparc/floppy.h
+++ b/include/asm-sparc/floppy.h
@@ -48,7 +48,7 @@ struct sun_flpy_controller {
48 48
49/* You'll only ever find one controller on a SparcStation anyways. */ 49/* You'll only ever find one controller on a SparcStation anyways. */
50static struct sun_flpy_controller *sun_fdc = NULL; 50static struct sun_flpy_controller *sun_fdc = NULL;
51volatile unsigned char *fdc_status; 51extern volatile unsigned char *fdc_status;
52 52
53struct sun_floppy_ops { 53struct sun_floppy_ops {
54 unsigned char (*fd_inb)(int port); 54 unsigned char (*fd_inb)(int port);
@@ -225,13 +225,13 @@ static void sun_82077_fd_outb(unsigned char value, int port)
225 * underruns. If non-zero, doing_pdma encodes the direction of 225 * underruns. If non-zero, doing_pdma encodes the direction of
226 * the transfer for debugging. 1=read 2=write 226 * the transfer for debugging. 1=read 2=write
227 */ 227 */
228char *pdma_vaddr; 228extern char *pdma_vaddr;
229unsigned long pdma_size; 229extern unsigned long pdma_size;
230volatile int doing_pdma = 0; 230extern volatile int doing_pdma;
231 231
232/* This is software state */ 232/* This is software state */
233char *pdma_base = NULL; 233extern char *pdma_base;
234unsigned long pdma_areasize; 234extern unsigned long pdma_areasize;
235 235
236/* Common routines to all controller types on the Sparc. */ 236/* Common routines to all controller types on the Sparc. */
237static __inline__ void virtual_dma_init(void) 237static __inline__ void virtual_dma_init(void)
@@ -281,7 +281,8 @@ static __inline__ void sun_fd_enable_dma(void)
281} 281}
282 282
283/* Our low-level entry point in arch/sparc/kernel/entry.S */ 283/* Our low-level entry point in arch/sparc/kernel/entry.S */
284irqreturn_t floppy_hardint(int irq, void *unused); 284extern int sparc_floppy_request_irq(int irq, unsigned long flags,
285 irqreturn_t (*irq_handler)(int irq, void *));
285 286
286static int sun_fd_request_irq(void) 287static int sun_fd_request_irq(void)
287{ 288{
@@ -290,8 +291,9 @@ static int sun_fd_request_irq(void)
290 291
291 if(!once) { 292 if(!once) {
292 once = 1; 293 once = 1;
293 error = request_fast_irq(FLOPPY_IRQ, floppy_hardint, 294 error = sparc_floppy_request_irq(FLOPPY_IRQ,
294 IRQF_DISABLED, "floppy"); 295 IRQF_DISABLED,
296 floppy_interrupt);
295 return ((error == 0) ? 0 : -1); 297 return ((error == 0) ? 0 : -1);
296 } else return 0; 298 } else return 0;
297} 299}
diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h
index 61fb99643afd..fe205cc444b8 100644
--- a/include/asm-sparc/irq.h
+++ b/include/asm-sparc/irq.h
@@ -1,7 +1,6 @@
1/* $Id: irq.h,v 1.32 2000/08/26 02:42:28 anton Exp $ 1/* irq.h: IRQ registers on the Sparc.
2 * irq.h: IRQ registers on the Sparc.
3 * 2 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#ifndef _SPARC_IRQ_H 6#ifndef _SPARC_IRQ_H
@@ -13,6 +12,4 @@
13 12
14#define irq_canonicalize(irq) (irq) 13#define irq_canonicalize(irq) (irq)
15 14
16extern int request_fast_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, __const__ char *devname);
17
18#endif 15#endif
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index 350676c589f9..71f2a1998324 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -67,6 +67,7 @@ extern int of_set_property(struct device_node *node, const char *name, void *val
67extern int of_getintprop_default(struct device_node *np, 67extern int of_getintprop_default(struct device_node *np,
68 const char *name, 68 const char *name,
69 int def); 69 int def);
70extern int of_find_in_proplist(const char *list, const char *match, int len);
70 71
71extern void prom_build_devicetree(void); 72extern void prom_build_devicetree(void);
72 73
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h
index d036e4419d79..27d076c46964 100644
--- a/include/asm-sparc/sbus.h
+++ b/include/asm-sparc/sbus.h
@@ -68,7 +68,6 @@ struct sbus_dev {
68/* This struct describes the SBus(s) found on this machine. */ 68/* This struct describes the SBus(s) found on this machine. */
69struct sbus_bus { 69struct sbus_bus {
70 struct of_device ofdev; 70 struct of_device ofdev;
71 void *iommu; /* Opaque IOMMU cookie */
72 struct sbus_dev *devices; /* Link to devices on this SBus */ 71 struct sbus_dev *devices; /* Link to devices on this SBus */
73 struct sbus_bus *next; /* next SBus, if more than one SBus */ 72 struct sbus_bus *next; /* next SBus, if more than one SBus */
74 int prom_node; /* PROM device tree node for this SBus */ 73 int prom_node; /* PROM device tree node for this SBus */
diff --git a/include/asm-sparc/sfp-machine.h b/include/asm-sparc/sfp-machine.h
index ecfc86a4a725..266a42b8f99f 100644
--- a/include/asm-sparc/sfp-machine.h
+++ b/include/asm-sparc/sfp-machine.h
@@ -203,4 +203,10 @@ extern struct task_struct *last_task_used_math;
203#define FP_INHIBIT_RESULTS ((last_task_used_math->thread.fsr >> 23) & _fex) 203#define FP_INHIBIT_RESULTS ((last_task_used_math->thread.fsr >> 23) & _fex)
204#endif 204#endif
205 205
206#ifdef CONFIG_SMP
207#define FP_TRAPPING_EXCEPTIONS ((current->thread.fsr >> 23) & 0x1f)
208#else
209#define FP_TRAPPING_EXCEPTIONS ((last_task_used_math->thread.fsr >> 23) & 0x1f)
210#endif
211
206#endif 212#endif
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h
index a72a5f271f31..1fc655452b81 100644
--- a/include/asm-sparc64/dma-mapping.h
+++ b/include/asm-sparc64/dma-mapping.h
@@ -108,6 +108,25 @@ static inline void dma_sync_single_for_device(struct device *dev,
108 dma_ops->sync_single_for_device(dev, dma_handle, size, direction); 108 dma_ops->sync_single_for_device(dev, dma_handle, size, direction);
109} 109}
110 110
111static inline void dma_sync_single_range_for_cpu(struct device *dev,
112 dma_addr_t dma_handle,
113 unsigned long offset,
114 size_t size,
115 enum dma_data_direction direction)
116{
117 dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction);
118}
119
120static inline void dma_sync_single_range_for_device(struct device *dev,
121 dma_addr_t dma_handle,
122 unsigned long offset,
123 size_t size,
124 enum dma_data_direction direction)
125{
126 dma_sync_single_for_device(dev, dma_handle+offset, size, direction);
127}
128
129
111static inline void dma_sync_sg_for_cpu(struct device *dev, 130static inline void dma_sync_sg_for_cpu(struct device *dev,
112 struct scatterlist *sg, int nelems, 131 struct scatterlist *sg, int nelems,
113 enum dma_data_direction direction) 132 enum dma_data_direction direction)
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h
index 303d85e2f82e..8653e8665009 100644
--- a/include/asm-sparc64/elf.h
+++ b/include/asm-sparc64/elf.h
@@ -70,6 +70,7 @@
70#define HWCAP_SPARC_V9 16 70#define HWCAP_SPARC_V9 16
71#define HWCAP_SPARC_ULTRA3 32 71#define HWCAP_SPARC_ULTRA3 32
72#define HWCAP_SPARC_BLKINIT 64 72#define HWCAP_SPARC_BLKINIT 64
73#define HWCAP_SPARC_N2 128
73 74
74/* 75/*
75 * These are used to set parameters in the core dumps. 76 * These are used to set parameters in the core dumps.
@@ -155,8 +156,13 @@ static inline unsigned int sparc64_elf_hwcap(void)
155 156
156 if (tlb_type == cheetah || tlb_type == cheetah_plus) 157 if (tlb_type == cheetah || tlb_type == cheetah_plus)
157 cap |= HWCAP_SPARC_ULTRA3; 158 cap |= HWCAP_SPARC_ULTRA3;
158 else if (tlb_type == hypervisor) 159 else if (tlb_type == hypervisor) {
159 cap |= HWCAP_SPARC_BLKINIT; 160 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 ||
161 sun4v_chip_type == SUN4V_CHIP_NIAGARA2)
162 cap |= HWCAP_SPARC_BLKINIT;
163 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2)
164 cap |= HWCAP_SPARC_N2;
165 }
160 166
161 return cap; 167 return cap;
162} 168}
diff --git a/include/asm-sparc64/fcntl.h b/include/asm-sparc64/fcntl.h
index b2aecf0054bd..111f6b3b8925 100644
--- a/include/asm-sparc64/fcntl.h
+++ b/include/asm-sparc64/fcntl.h
@@ -16,7 +16,7 @@
16#define O_LARGEFILE 0x40000 16#define O_LARGEFILE 0x40000
17#define O_DIRECT 0x100000 /* direct disk access hint */ 17#define O_DIRECT 0x100000 /* direct disk access hint */
18#define O_NOATIME 0x200000 18#define O_NOATIME 0x200000
19 19#define O_CLOEXEC 0x400000
20 20
21#define F_GETOWN 5 /* for sockets. */ 21#define F_GETOWN 5 /* for sockets. */
22#define F_SETOWN 6 /* for sockets. */ 22#define F_SETOWN 6 /* for sockets. */
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h
index 3f23c5dc5f21..86dc5c018a19 100644
--- a/include/asm-sparc64/oplib.h
+++ b/include/asm-sparc64/oplib.h
@@ -1,8 +1,7 @@
1/* $Id: oplib.h,v 1.14 2001/12/19 00:29:51 davem Exp $ 1/* oplib.h: Describes the interface and available routines in the
2 * oplib.h: Describes the interface and available routines in the
3 * Linux Prom library. 2 * Linux Prom library.
4 * 3 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
6 * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 5 * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
7 */ 6 */
8 7
@@ -31,8 +30,10 @@ extern int prom_chosen_node;
31extern const char prom_peer_name[]; 30extern const char prom_peer_name[];
32extern const char prom_compatible_name[]; 31extern const char prom_compatible_name[];
33extern const char prom_root_compatible[]; 32extern const char prom_root_compatible[];
33extern const char prom_cpu_compatible[];
34extern const char prom_finddev_name[]; 34extern const char prom_finddev_name[];
35extern const char prom_chosen_path[]; 35extern const char prom_chosen_path[];
36extern const char prom_cpu_path[];
36extern const char prom_getprop_name[]; 37extern const char prom_getprop_name[];
37extern const char prom_mmu_name[]; 38extern const char prom_mmu_name[];
38extern const char prom_callmethod_name[]; 39extern const char prom_callmethod_name[];
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
index 31dcb92fbae0..07843f9f05df 100644
--- a/include/asm-sparc64/prom.h
+++ b/include/asm-sparc64/prom.h
@@ -76,6 +76,7 @@ extern int of_set_property(struct device_node *node, const char *name, void *val
76extern int of_getintprop_default(struct device_node *np, 76extern int of_getintprop_default(struct device_node *np,
77 const char *name, 77 const char *name,
78 int def); 78 int def);
79extern int of_find_in_proplist(const char *list, const char *match, int len);
79 80
80extern void prom_build_devicetree(void); 81extern void prom_build_devicetree(void);
81 82
diff --git a/include/asm-sparc64/sfp-machine.h b/include/asm-sparc64/sfp-machine.h
index 89d42431efb5..c9331b02d9c8 100644
--- a/include/asm-sparc64/sfp-machine.h
+++ b/include/asm-sparc64/sfp-machine.h
@@ -88,4 +88,6 @@
88 88
89#define FP_INHIBIT_RESULTS ((current_thread_info()->xfsr[0] >> 23) & _fex) 89#define FP_INHIBIT_RESULTS ((current_thread_info()->xfsr[0] >> 23) & _fex)
90 90
91#define FP_TRAPPING_EXCEPTIONS ((current_thread_info()->xfsr[0] >> 23) & 0x1f)
92
91#endif 93#endif
diff --git a/include/asm-sparc64/spitfire.h b/include/asm-sparc64/spitfire.h
index 23ad8a7987ad..cf7807813e85 100644
--- a/include/asm-sparc64/spitfire.h
+++ b/include/asm-sparc64/spitfire.h
@@ -38,6 +38,11 @@
38 38
39#define L1DCACHE_SIZE 0x4000 39#define L1DCACHE_SIZE 0x4000
40 40
41#define SUN4V_CHIP_INVALID 0x00
42#define SUN4V_CHIP_NIAGARA1 0x01
43#define SUN4V_CHIP_NIAGARA2 0x02
44#define SUN4V_CHIP_UNKNOWN 0xff
45
41#ifndef __ASSEMBLY__ 46#ifndef __ASSEMBLY__
42 47
43enum ultra_tlb_layout { 48enum ultra_tlb_layout {
@@ -49,6 +54,8 @@ enum ultra_tlb_layout {
49 54
50extern enum ultra_tlb_layout tlb_type; 55extern enum ultra_tlb_layout tlb_type;
51 56
57extern int sun4v_chip_type;
58
52extern int cheetah_pcache_forced_on; 59extern int cheetah_pcache_forced_on;
53extern void cheetah_enable_pcache(void); 60extern void cheetah_enable_pcache(void);
54 61
diff --git a/include/asm-sparc64/xor.h b/include/asm-sparc64/xor.h
index 8ce3f1813e28..a0233884fc94 100644
--- a/include/asm-sparc64/xor.h
+++ b/include/asm-sparc64/xor.h
@@ -63,4 +63,8 @@ static struct xor_block_template xor_block_niagara = {
63 63
64/* For VIS for everything except Niagara. */ 64/* For VIS for everything except Niagara. */
65#define XOR_SELECT_TEMPLATE(FASTEST) \ 65#define XOR_SELECT_TEMPLATE(FASTEST) \
66 (tlb_type == hypervisor ? &xor_block_niagara : &xor_block_VIS) 66 ((tlb_type == hypervisor && \
67 (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \
68 sun4v_chip_type == SUN4V_CHIP_NIAGARA2)) ? \
69 &xor_block_niagara : \
70 &xor_block_VIS)
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index 88926eb44f5c..5da8cb0c0599 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -10,6 +10,8 @@ struct pci_sysdata {
10 void* iommu; /* IOMMU private data */ 10 void* iommu; /* IOMMU private data */
11}; 11};
12 12
13extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
14
13#ifdef CONFIG_CALGARY_IOMMU 15#ifdef CONFIG_CALGARY_IOMMU
14static inline void* pci_iommu(struct pci_bus *bus) 16static inline void* pci_iommu(struct pci_bus *bus)
15{ 17{
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4d85262b4fa4..1ddef34f43c3 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -24,6 +24,8 @@
24#include <linux/mempool.h> 24#include <linux/mempool.h>
25#include <linux/ioprio.h> 25#include <linux/ioprio.h>
26 26
27#ifdef CONFIG_BLOCK
28
27/* Platforms may set this to teach the BIO layer about IOMMU hardware. */ 29/* Platforms may set this to teach the BIO layer about IOMMU hardware. */
28#include <asm/io.h> 30#include <asm/io.h>
29 31
@@ -361,4 +363,5 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
361 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 363 __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
362#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 364#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
363 365
366#endif /* CONFIG_BLOCK */
364#endif /* __LINUX_BIO_H */ 367#endif /* __LINUX_BIO_H */
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 90874a5d7d78..7b5d56b82b59 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -105,7 +105,7 @@ struct blk_io_trace {
105 */ 105 */
106struct blk_io_trace_remap { 106struct blk_io_trace_remap {
107 __be32 device; 107 __be32 device;
108 u32 __pad; 108 __be32 device_from;
109 __be64 sector; 109 __be64 sector;
110}; 110};
111 111
@@ -272,6 +272,7 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
272 return; 272 return;
273 273
274 r.device = cpu_to_be32(dev); 274 r.device = cpu_to_be32(dev);
275 r.device_from = cpu_to_be32(bio->bi_bdev->bd_dev);
275 r.sector = cpu_to_be64(to); 276 r.sector = cpu_to_be64(to);
276 277
277 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); 278 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index 102dc096e1cb..60e377b520f8 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -15,14 +15,18 @@ struct sg_io_v4 {
15 15
16 __u32 request_len; /* [i] in bytes */ 16 __u32 request_len; /* [i] in bytes */
17 __u64 request; /* [i], [*i] {SCSI: cdb} */ 17 __u64 request; /* [i], [*i] {SCSI: cdb} */
18 __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */
18 __u32 request_attr; /* [i] {SCSI: task attribute} */ 19 __u32 request_attr; /* [i] {SCSI: task attribute} */
19 __u32 request_tag; /* [i] {SCSI: task tag (only if flagged)} */
20 __u32 request_priority; /* [i] {SCSI: task priority} */ 20 __u32 request_priority; /* [i] {SCSI: task priority} */
21 __u32 request_extra; /* [i] {spare, for padding} */
21 __u32 max_response_len; /* [i] in bytes */ 22 __u32 max_response_len; /* [i] in bytes */
22 __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ 23 __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */
23 24
24 /* "din_" for data in (from device); "dout_" for data out (to device) */ 25 /* "dout_": data out (to device); "din_": data in (from device) */
26 __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else
27 dout_xfer points to array of iovec */
25 __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ 28 __u32 dout_xfer_len; /* [i] bytes to be transferred to device */
29 __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */
26 __u32 din_xfer_len; /* [i] bytes to be transferred from device */ 30 __u32 din_xfer_len; /* [i] bytes to be transferred from device */
27 __u64 dout_xferp; /* [i], [*i] */ 31 __u64 dout_xferp; /* [i], [*i] */
28 __u64 din_xferp; /* [i], [*o] */ 32 __u64 din_xferp; /* [i], [*o] */
@@ -39,8 +43,9 @@ struct sg_io_v4 {
39 __u32 info; /* [o] additional information */ 43 __u32 info; /* [o] additional information */
40 __u32 duration; /* [o] time to complete, in milliseconds */ 44 __u32 duration; /* [o] time to complete, in milliseconds */
41 __u32 response_len; /* [o] bytes of response actually written */ 45 __u32 response_len; /* [o] bytes of response actually written */
42 __s32 din_resid; /* [o] actual_din_xfer_len - din_xfer_len */ 46 __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */
43 __u32 generated_tag; /* [o] {SCSI: task tag that transport chose} */ 47 __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */
48 __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */
44 __u32 spare_out; /* [o] */ 49 __u32 spare_out; /* [o] */
45 50
46 __u32 padding; 51 __u32 padding;
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index e0bd46eb2414..def5a659b8a5 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -123,7 +123,6 @@ extern void clockevents_exchange_device(struct clock_event_device *old,
123extern void clockevents_set_mode(struct clock_event_device *dev, 123extern void clockevents_set_mode(struct clock_event_device *dev,
124 enum clock_event_mode mode); 124 enum clock_event_mode mode);
125extern int clockevents_register_notifier(struct notifier_block *nb); 125extern int clockevents_register_notifier(struct notifier_block *nb);
126extern void clockevents_unregister_notifier(struct notifier_block *nb);
127extern int clockevents_program_event(struct clock_event_device *dev, 126extern int clockevents_program_event(struct clock_event_device *dev,
128 ktime_t expires, ktime_t now); 127 ktime_t expires, ktime_t now);
129 128
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index c2236bbff412..1d5ded0836ee 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -41,8 +41,6 @@ extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr);
41extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs); 41extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs);
42extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs); 42extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs);
43 43
44extern struct sysdev_attribute attr_sched_mc_power_savings;
45extern struct sysdev_attribute attr_sched_smt_power_savings;
46extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); 44extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
47 45
48#ifdef CONFIG_HOTPLUG_CPU 46#ifdef CONFIG_HOTPLUG_CPU
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6bf139562947..16421f662a7a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1659,7 +1659,6 @@ extern int sb_min_blocksize(struct super_block *, int);
1659extern int generic_file_mmap(struct file *, struct vm_area_struct *); 1659extern int generic_file_mmap(struct file *, struct vm_area_struct *);
1660extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 1660extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
1661extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 1661extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
1662extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
1663int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 1662int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
1664extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 1663extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
1665extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); 1664extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
diff --git a/include/linux/init.h b/include/linux/init.h
index 1a4a283d19a9..74b1f43bf982 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -43,7 +43,7 @@
43#define __init __attribute__ ((__section__ (".init.text"))) __cold 43#define __init __attribute__ ((__section__ (".init.text"))) __cold
44#define __initdata __attribute__ ((__section__ (".init.data"))) 44#define __initdata __attribute__ ((__section__ (".init.data")))
45#define __exitdata __attribute__ ((__section__(".exit.data"))) 45#define __exitdata __attribute__ ((__section__(".exit.data")))
46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) __cold 46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
47 47
48/* modpost check for section mismatches during the kernel build. 48/* modpost check for section mismatches during the kernel build.
49 * A section mismatch happens when there are references from a 49 * A section mismatch happens when there are references from a
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 4300bb462d29..f592df74b3cf 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -224,9 +224,9 @@ extern void hex_dump_to_buffer(const void *buf, size_t len,
224 char *linebuf, size_t linebuflen, bool ascii); 224 char *linebuf, size_t linebuflen, bool ascii);
225extern void print_hex_dump(const char *level, const char *prefix_str, 225extern void print_hex_dump(const char *level, const char *prefix_str,
226 int prefix_type, int rowsize, int groupsize, 226 int prefix_type, int rowsize, int groupsize,
227 void *buf, size_t len, bool ascii); 227 const void *buf, size_t len, bool ascii);
228extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, 228extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
229 void *buf, size_t len); 229 const void *buf, size_t len);
230#define hex_asc(x) "0123456789abcdef"[x] 230#define hex_asc(x) "0123456789abcdef"[x]
231 231
232#ifdef DEBUG 232#ifdef DEBUG
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4a616d73cc25..e679b2751665 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1131,6 +1131,8 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
1131 1131
1132extern void linkwatch_run_queue(void); 1132extern void linkwatch_run_queue(void);
1133 1133
1134extern int netdev_compute_features(unsigned long all, unsigned long one);
1135
1134static inline int net_gso_ok(int features, int gso_type) 1136static inline int net_gso_ok(int features, int gso_type)
1135{ 1137{
1136 int feature = gso_type << NETIF_F_GSO_SHIFT; 1138 int feature = gso_type << NETIF_F_GSO_SHIFT;
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 43397a414cd6..ab57cb7d7c61 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -28,6 +28,7 @@ header-y += xt_policy.h
28header-y += xt_realm.h 28header-y += xt_realm.h
29header-y += xt_sctp.h 29header-y += xt_sctp.h
30header-y += xt_state.h 30header-y += xt_state.h
31header-y += xt_statistic.h
31header-y += xt_string.h 32header-y += xt_string.h
32header-y += xt_tcpmss.h 33header-y += xt_tcpmss.h
33header-y += xt_tcpudp.h 34header-y += xt_tcpudp.h
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 9ba4aec37c50..157dcb055b5c 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -71,7 +71,7 @@ struct nfs_access_entry {
71 71
72struct nfs4_state; 72struct nfs4_state;
73struct nfs_open_context { 73struct nfs_open_context {
74 struct kref kref; 74 atomic_t count;
75 struct path path; 75 struct path path;
76 struct rpc_cred *cred; 76 struct rpc_cred *cred;
77 struct nfs4_state *state; 77 struct nfs4_state *state;
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 28e3664fdf1b..cd13a78c5db8 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -75,7 +75,6 @@ struct proc_dir_entry {
75 write_proc_t *write_proc; 75 write_proc_t *write_proc;
76 atomic_t count; /* use count */ 76 atomic_t count; /* use count */
77 int deleted; /* delete flag */ 77 int deleted; /* delete flag */
78 void *set;
79 int pde_users; /* number of callers into module in progress */ 78 int pde_users; /* number of callers into module in progress */
80 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ 79 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
81 struct completion *pde_unload_completion; 80 struct completion *pde_unload_completion;
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index c6b7485eac7c..fe17d7d750c2 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -281,7 +281,6 @@ extern void FASTCALL(call_rcu(struct rcu_head *head,
281extern void FASTCALL(call_rcu_bh(struct rcu_head *head, 281extern void FASTCALL(call_rcu_bh(struct rcu_head *head,
282 void (*func)(struct rcu_head *head))); 282 void (*func)(struct rcu_head *head)));
283extern void synchronize_rcu(void); 283extern void synchronize_rcu(void);
284void synchronize_idle(void);
285extern void rcu_barrier(void); 284extern void rcu_barrier(void);
286 285
287#endif /* __KERNEL__ */ 286#endif /* __KERNEL__ */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 17249fae5014..682ef87da6eb 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -139,7 +139,7 @@ struct cfs_rq;
139extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m); 139extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m);
140extern void proc_sched_set_task(struct task_struct *p); 140extern void proc_sched_set_task(struct task_struct *p);
141extern void 141extern void
142print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq, u64 now); 142print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq);
143#else 143#else
144static inline void 144static inline void
145proc_sched_show_task(struct task_struct *p, struct seq_file *m) 145proc_sched_show_task(struct task_struct *p, struct seq_file *m)
@@ -149,7 +149,7 @@ static inline void proc_sched_set_task(struct task_struct *p)
149{ 149{
150} 150}
151static inline void 151static inline void
152print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq, u64 now) 152print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
153{ 153{
154} 154}
155#endif 155#endif
@@ -855,26 +855,24 @@ struct sched_domain;
855struct sched_class { 855struct sched_class {
856 struct sched_class *next; 856 struct sched_class *next;
857 857
858 void (*enqueue_task) (struct rq *rq, struct task_struct *p, 858 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup);
859 int wakeup, u64 now); 859 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
860 void (*dequeue_task) (struct rq *rq, struct task_struct *p,
861 int sleep, u64 now);
862 void (*yield_task) (struct rq *rq, struct task_struct *p); 860 void (*yield_task) (struct rq *rq, struct task_struct *p);
863 861
864 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p); 862 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p);
865 863
866 struct task_struct * (*pick_next_task) (struct rq *rq, u64 now); 864 struct task_struct * (*pick_next_task) (struct rq *rq);
867 void (*put_prev_task) (struct rq *rq, struct task_struct *p, u64 now); 865 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
868 866
869 int (*load_balance) (struct rq *this_rq, int this_cpu, 867 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
870 struct rq *busiest, 868 struct rq *busiest,
871 unsigned long max_nr_move, unsigned long max_load_move, 869 unsigned long max_nr_move, unsigned long max_load_move,
872 struct sched_domain *sd, enum cpu_idle_type idle, 870 struct sched_domain *sd, enum cpu_idle_type idle,
873 int *all_pinned, unsigned long *total_load_moved); 871 int *all_pinned, int *this_best_prio);
874 872
875 void (*set_curr_task) (struct rq *rq); 873 void (*set_curr_task) (struct rq *rq);
876 void (*task_tick) (struct rq *rq, struct task_struct *p); 874 void (*task_tick) (struct rq *rq, struct task_struct *p);
877 void (*task_new) (struct rq *rq, struct task_struct *p, u64 now); 875 void (*task_new) (struct rq *rq, struct task_struct *p);
878}; 876};
879 877
880struct load_weight { 878struct load_weight {
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 691a1748d9d2..6570719eafdf 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -274,6 +274,8 @@ struct tty_struct {
274#define TTY_PTY_LOCK 16 /* pty private */ 274#define TTY_PTY_LOCK 16 /* pty private */
275#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 275#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
276#define TTY_HUPPED 18 /* Post driver->hangup() */ 276#define TTY_HUPPED 18 /* Post driver->hangup() */
277#define TTY_FLUSHING 19 /* Flushing to ldisc in progress */
278#define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */
277 279
278#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 280#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
279 281
diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
index 93780abd01bc..bb46e7645d53 100644
--- a/include/math-emu/op-common.h
+++ b/include/math-emu/op-common.h
@@ -145,13 +145,16 @@ do { \
145 { \ 145 { \
146 X##_e = 1; \ 146 X##_e = 1; \
147 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \ 147 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
148 FP_SET_EXCEPTION(FP_EX_INEXACT); \
148 } \ 149 } \
149 else \ 150 else \
150 { \ 151 { \
151 X##_e = 0; \ 152 X##_e = 0; \
152 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \ 153 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
153 FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
154 } \ 154 } \
155 if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) || \
156 (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
157 FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
155 } \ 158 } \
156 else \ 159 else \
157 { \ 160 { \
diff --git a/include/math-emu/soft-fp.h b/include/math-emu/soft-fp.h
index d02eb64a865b..a0721ef5c2f9 100644
--- a/include/math-emu/soft-fp.h
+++ b/include/math-emu/soft-fp.h
@@ -97,12 +97,19 @@
97#define FP_INHIBIT_RESULTS 0 97#define FP_INHIBIT_RESULTS 0
98#endif 98#endif
99 99
100#ifndef FP_TRAPPING_EXCEPTIONS
101#define FP_TRAPPING_EXCPETIONS 0
102#endif
103
100#define FP_SET_EXCEPTION(ex) \ 104#define FP_SET_EXCEPTION(ex) \
101 _fex |= (ex) 105 _fex |= (ex)
102 106
103#define FP_UNSET_EXCEPTION(ex) \ 107#define FP_UNSET_EXCEPTION(ex) \
104 _fex &= ~(ex) 108 _fex &= ~(ex)
105 109
110#define FP_CUR_EXCEPTIONS \
111 (_fex)
112
106#define FP_CLEAR_EXCEPTIONS \ 113#define FP_CLEAR_EXCEPTIONS \
107 _fex = 0 114 _fex = 0
108 115
diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
index 7a671603fca6..9bf059817aec 100644
--- a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
@@ -21,4 +21,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
21extern int nf_conntrack_ipv4_compat_init(void); 21extern int nf_conntrack_ipv4_compat_init(void);
22extern void nf_conntrack_ipv4_compat_fini(void); 22extern void nf_conntrack_ipv4_compat_fini(void);
23 23
24extern void need_ipv4_conntrack(void);
25
24#endif /*_NF_CONNTRACK_IPV4_H*/ 26#endif /*_NF_CONNTRACK_IPV4_H*/
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 16baef4dab7e..d529045c1679 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -190,6 +190,16 @@ void sctp_assocs_proc_exit(void);
190 190
191 191
192/* 192/*
193 * Module global variables
194 */
195
196 /*
197 * sctp/protocol.c
198 */
199extern struct kmem_cache *sctp_chunk_cachep __read_mostly;
200extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
201
202/*
193 * Section: Macros, externs, and inlines 203 * Section: Macros, externs, and inlines
194 */ 204 */
195 205
diff --git a/include/net/tcp.h b/include/net/tcp.h
index c209361ab74a..185c7ecce4cc 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -281,7 +281,7 @@ extern int tcp_v4_remember_stamp(struct sock *sk);
281 281
282extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 282extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
283 283
284extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, 284extern int tcp_sendmsg(struct kiocb *iocb, struct socket *sock,
285 struct msghdr *msg, size_t size); 285 struct msghdr *msg, size_t size);
286extern ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags); 286extern ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags);
287 287
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index 02e26c1672bf..3465f31a21c4 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -13,8 +13,6 @@ struct scsi_driver {
13 13
14 int (*init_command)(struct scsi_cmnd *); 14 int (*init_command)(struct scsi_cmnd *);
15 void (*rescan)(struct device *); 15 void (*rescan)(struct device *);
16 int (*issue_flush)(struct device *, sector_t *);
17 int (*prepare_flush)(struct request_queue *, struct request *);
18}; 16};
19#define to_scsi_driver(drv) \ 17#define to_scsi_driver(drv) \
20 container_of((drv), struct scsi_driver, gendrv) 18 container_of((drv), struct scsi_driver, gendrv)
diff --git a/include/scsi/sd.h b/include/scsi/sd.h
index 78583fee0ab2..ce02ad1f5185 100644
--- a/include/scsi/sd.h
+++ b/include/scsi/sd.h
@@ -56,8 +56,6 @@ static int sd_suspend(struct device *dev, pm_message_t state);
56static int sd_resume(struct device *dev); 56static int sd_resume(struct device *dev);
57static void sd_rescan(struct device *); 57static void sd_rescan(struct device *);
58static int sd_init_command(struct scsi_cmnd *); 58static int sd_init_command(struct scsi_cmnd *);
59static int sd_issue_flush(struct device *, sector_t *);
60static void sd_prepare_flush(struct request_queue *, struct request *);
61static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); 59static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
62static void scsi_disk_release(struct class_device *cdev); 60static void scsi_disk_release(struct class_device *cdev);
63static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); 61static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index a777d3761416..3401293359e8 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1992,19 +1992,19 @@ int __audit_signal_info(int sig, struct task_struct *t)
1992 extern uid_t audit_sig_uid; 1992 extern uid_t audit_sig_uid;
1993 extern u32 audit_sig_sid; 1993 extern u32 audit_sig_sid;
1994 1994
1995 if (audit_pid && t->tgid == audit_pid && 1995 if (audit_pid && t->tgid == audit_pid) {
1996 (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1)) { 1996 if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1) {
1997 audit_sig_pid = tsk->pid; 1997 audit_sig_pid = tsk->pid;
1998 if (ctx) 1998 if (ctx)
1999 audit_sig_uid = ctx->loginuid; 1999 audit_sig_uid = ctx->loginuid;
2000 else 2000 else
2001 audit_sig_uid = tsk->uid; 2001 audit_sig_uid = tsk->uid;
2002 selinux_get_task_sid(tsk, &audit_sig_sid); 2002 selinux_get_task_sid(tsk, &audit_sig_sid);
2003 }
2004 if (!audit_signals || audit_dummy_context())
2005 return 0;
2003 } 2006 }
2004 2007
2005 if (!audit_signals) /* audit_context checked in wrapper */
2006 return 0;
2007
2008 /* optimize the common case by putting first signal recipient directly 2008 /* optimize the common case by putting first signal recipient directly
2009 * in audit_context */ 2009 * in audit_context */
2010 if (!ctx->target_pid) { 2010 if (!ctx->target_pid) {
diff --git a/kernel/exit.c b/kernel/exit.c
index 464c2b172f07..9578c1ae19ca 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -813,7 +813,7 @@ static void exit_notify(struct task_struct *tsk)
813 __kill_pgrp_info(SIGCONT, SEND_SIG_PRIV, pgrp); 813 __kill_pgrp_info(SIGCONT, SEND_SIG_PRIV, pgrp);
814 } 814 }
815 815
816 /* Let father know we died 816 /* Let father know we died
817 * 817 *
818 * Thread signals are configurable, but you aren't going to use 818 * Thread signals are configurable, but you aren't going to use
819 * that to send signals to arbitary processes. 819 * that to send signals to arbitary processes.
@@ -826,9 +826,7 @@ static void exit_notify(struct task_struct *tsk)
826 * If our self_exec id doesn't match our parent_exec_id then 826 * If our self_exec id doesn't match our parent_exec_id then
827 * we have changed execution domain as these two values started 827 * we have changed execution domain as these two values started
828 * the same after a fork. 828 * the same after a fork.
829 *
830 */ 829 */
831
832 if (tsk->exit_signal != SIGCHLD && tsk->exit_signal != -1 && 830 if (tsk->exit_signal != SIGCHLD && tsk->exit_signal != -1 &&
833 ( tsk->parent_exec_id != t->self_exec_id || 831 ( tsk->parent_exec_id != t->self_exec_id ||
834 tsk->self_exec_id != tsk->parent_exec_id) 832 tsk->self_exec_id != tsk->parent_exec_id)
@@ -848,9 +846,7 @@ static void exit_notify(struct task_struct *tsk)
848 } 846 }
849 847
850 state = EXIT_ZOMBIE; 848 state = EXIT_ZOMBIE;
851 if (tsk->exit_signal == -1 && 849 if (tsk->exit_signal == -1 && likely(!tsk->ptrace))
852 (likely(tsk->ptrace == 0) ||
853 unlikely(tsk->parent->signal->flags & SIGNAL_GROUP_EXIT)))
854 state = EXIT_DEAD; 850 state = EXIT_DEAD;
855 tsk->exit_state = state; 851 tsk->exit_state = state;
856 852
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 615ce97c6cfd..f1a73f0b54e7 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -352,13 +352,10 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
352 * keep it masked and get out of here 352 * keep it masked and get out of here
353 */ 353 */
354 action = desc->action; 354 action = desc->action;
355 if (unlikely(!action || (desc->status & IRQ_DISABLED))) { 355 if (unlikely(!action || (desc->status & IRQ_DISABLED)))
356 desc->status |= IRQ_PENDING;
357 goto out_unlock; 356 goto out_unlock;
358 }
359 357
360 desc->status |= IRQ_INPROGRESS; 358 desc->status |= IRQ_INPROGRESS;
361 desc->status &= ~IRQ_PENDING;
362 spin_unlock(&desc->lock); 359 spin_unlock(&desc->lock);
363 360
364 action_ret = handle_IRQ_event(irq, action); 361 action_ret = handle_IRQ_event(irq, action);
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c
index c38272746887..a8046791ba2d 100644
--- a/kernel/irq/resend.c
+++ b/kernel/irq/resend.c
@@ -63,15 +63,11 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq)
63 desc->chip->enable(irq); 63 desc->chip->enable(irq);
64 64
65 /* 65 /*
66 * Temporary hack to figure out more about the problem, which 66 * We do not resend level type interrupts. Level type
67 * is causing the ancient network cards to die. 67 * interrupts are resent by hardware when they are still
68 * active.
68 */ 69 */
69 if (desc->handle_irq != handle_edge_irq) { 70 if ((status & (IRQ_LEVEL | IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
70 WARN_ON_ONCE(1);
71 return;
72 }
73
74 if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
75 desc->status = (status & ~IRQ_PENDING) | IRQ_REPLAY; 71 desc->status = (status & ~IRQ_PENDING) | IRQ_REPLAY;
76 72
77 if (!desc->chip || !desc->chip->retrigger || 73 if (!desc->chip || !desc->chip->retrigger ||
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 3e9f513a728d..4b8a4493c541 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1063,6 +1063,11 @@ EXPORT_SYMBOL_GPL(register_kprobe);
1063EXPORT_SYMBOL_GPL(unregister_kprobe); 1063EXPORT_SYMBOL_GPL(unregister_kprobe);
1064EXPORT_SYMBOL_GPL(register_jprobe); 1064EXPORT_SYMBOL_GPL(register_jprobe);
1065EXPORT_SYMBOL_GPL(unregister_jprobe); 1065EXPORT_SYMBOL_GPL(unregister_jprobe);
1066#ifdef CONFIG_KPROBES
1066EXPORT_SYMBOL_GPL(jprobe_return); 1067EXPORT_SYMBOL_GPL(jprobe_return);
1068#endif
1069
1070#ifdef CONFIG_KPROBES
1067EXPORT_SYMBOL_GPL(register_kretprobe); 1071EXPORT_SYMBOL_GPL(register_kretprobe);
1068EXPORT_SYMBOL_GPL(unregister_kretprobe); 1072EXPORT_SYMBOL_GPL(unregister_kretprobe);
1073#endif
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index a3b7854b8f7c..a686590d88c1 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -709,7 +709,8 @@ static void mark_nosave_pages(struct memory_bitmap *bm)
709 region->end_pfn << PAGE_SHIFT); 709 region->end_pfn << PAGE_SHIFT);
710 710
711 for (pfn = region->start_pfn; pfn < region->end_pfn; pfn++) 711 for (pfn = region->start_pfn; pfn < region->end_pfn; pfn++)
712 memory_bm_set_bit(bm, pfn); 712 if (pfn_valid(pfn))
713 memory_bm_set_bit(bm, pfn);
713 } 714 }
714} 715}
715 716
diff --git a/kernel/printk.c b/kernel/printk.c
index 051d27e36a6c..bd2cd062878d 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -732,7 +732,7 @@ int __init add_preferred_console(char *name, int idx, char *options)
732 return 0; 732 return 0;
733} 733}
734 734
735int __init update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options) 735int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options)
736{ 736{
737 struct console_cmdline *c; 737 struct console_cmdline *c;
738 int i; 738 int i;
diff --git a/kernel/profile.c b/kernel/profile.c
index 5b20fe977bed..cb1e37d2dac3 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -199,11 +199,11 @@ EXPORT_SYMBOL_GPL(register_timer_hook);
199EXPORT_SYMBOL_GPL(unregister_timer_hook); 199EXPORT_SYMBOL_GPL(unregister_timer_hook);
200EXPORT_SYMBOL_GPL(task_handoff_register); 200EXPORT_SYMBOL_GPL(task_handoff_register);
201EXPORT_SYMBOL_GPL(task_handoff_unregister); 201EXPORT_SYMBOL_GPL(task_handoff_unregister);
202EXPORT_SYMBOL_GPL(profile_event_register);
203EXPORT_SYMBOL_GPL(profile_event_unregister);
202 204
203#endif /* CONFIG_PROFILING */ 205#endif /* CONFIG_PROFILING */
204 206
205EXPORT_SYMBOL_GPL(profile_event_register);
206EXPORT_SYMBOL_GPL(profile_event_unregister);
207 207
208#ifdef CONFIG_SMP 208#ifdef CONFIG_SMP
209/* 209/*
diff --git a/kernel/sched.c b/kernel/sched.c
index 72bb9483d949..45e17b83b7f1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -263,6 +263,7 @@ struct rq {
263 263
264 unsigned int clock_warps, clock_overflows; 264 unsigned int clock_warps, clock_overflows;
265 unsigned int clock_unstable_events; 265 unsigned int clock_unstable_events;
266 u64 tick_timestamp;
266 267
267 atomic_t nr_iowait; 268 atomic_t nr_iowait;
268 269
@@ -318,15 +319,19 @@ static inline int cpu_of(struct rq *rq)
318} 319}
319 320
320/* 321/*
321 * Per-runqueue clock, as finegrained as the platform can give us: 322 * Update the per-runqueue clock, as finegrained as the platform can give
323 * us, but without assuming monotonicity, etc.:
322 */ 324 */
323static unsigned long long __rq_clock(struct rq *rq) 325static void __update_rq_clock(struct rq *rq)
324{ 326{
325 u64 prev_raw = rq->prev_clock_raw; 327 u64 prev_raw = rq->prev_clock_raw;
326 u64 now = sched_clock(); 328 u64 now = sched_clock();
327 s64 delta = now - prev_raw; 329 s64 delta = now - prev_raw;
328 u64 clock = rq->clock; 330 u64 clock = rq->clock;
329 331
332#ifdef CONFIG_SCHED_DEBUG
333 WARN_ON_ONCE(cpu_of(rq) != smp_processor_id());
334#endif
330 /* 335 /*
331 * Protect against sched_clock() occasionally going backwards: 336 * Protect against sched_clock() occasionally going backwards:
332 */ 337 */
@@ -337,8 +342,11 @@ static unsigned long long __rq_clock(struct rq *rq)
337 /* 342 /*
338 * Catch too large forward jumps too: 343 * Catch too large forward jumps too:
339 */ 344 */
340 if (unlikely(delta > 2*TICK_NSEC)) { 345 if (unlikely(clock + delta > rq->tick_timestamp + TICK_NSEC)) {
341 clock++; 346 if (clock < rq->tick_timestamp + TICK_NSEC)
347 clock = rq->tick_timestamp + TICK_NSEC;
348 else
349 clock++;
342 rq->clock_overflows++; 350 rq->clock_overflows++;
343 } else { 351 } else {
344 if (unlikely(delta > rq->clock_max_delta)) 352 if (unlikely(delta > rq->clock_max_delta))
@@ -349,18 +357,12 @@ static unsigned long long __rq_clock(struct rq *rq)
349 357
350 rq->prev_clock_raw = now; 358 rq->prev_clock_raw = now;
351 rq->clock = clock; 359 rq->clock = clock;
352
353 return clock;
354} 360}
355 361
356static inline unsigned long long rq_clock(struct rq *rq) 362static void update_rq_clock(struct rq *rq)
357{ 363{
358 int this_cpu = smp_processor_id(); 364 if (likely(smp_processor_id() == cpu_of(rq)))
359 365 __update_rq_clock(rq);
360 if (this_cpu == cpu_of(rq))
361 return __rq_clock(rq);
362
363 return rq->clock;
364} 366}
365 367
366/* 368/*
@@ -386,9 +388,12 @@ unsigned long long cpu_clock(int cpu)
386{ 388{
387 unsigned long long now; 389 unsigned long long now;
388 unsigned long flags; 390 unsigned long flags;
391 struct rq *rq;
389 392
390 local_irq_save(flags); 393 local_irq_save(flags);
391 now = rq_clock(cpu_rq(cpu)); 394 rq = cpu_rq(cpu);
395 update_rq_clock(rq);
396 now = rq->clock;
392 local_irq_restore(flags); 397 local_irq_restore(flags);
393 398
394 return now; 399 return now;
@@ -637,6 +642,11 @@ static u64 div64_likely32(u64 divident, unsigned long divisor)
637 642
638#define WMULT_SHIFT 32 643#define WMULT_SHIFT 32
639 644
645/*
646 * Shift right and round:
647 */
648#define RSR(x, y) (((x) + (1UL << ((y) - 1))) >> (y))
649
640static unsigned long 650static unsigned long
641calc_delta_mine(unsigned long delta_exec, unsigned long weight, 651calc_delta_mine(unsigned long delta_exec, unsigned long weight,
642 struct load_weight *lw) 652 struct load_weight *lw)
@@ -644,18 +654,17 @@ calc_delta_mine(unsigned long delta_exec, unsigned long weight,
644 u64 tmp; 654 u64 tmp;
645 655
646 if (unlikely(!lw->inv_weight)) 656 if (unlikely(!lw->inv_weight))
647 lw->inv_weight = WMULT_CONST / lw->weight; 657 lw->inv_weight = (WMULT_CONST - lw->weight/2) / lw->weight + 1;
648 658
649 tmp = (u64)delta_exec * weight; 659 tmp = (u64)delta_exec * weight;
650 /* 660 /*
651 * Check whether we'd overflow the 64-bit multiplication: 661 * Check whether we'd overflow the 64-bit multiplication:
652 */ 662 */
653 if (unlikely(tmp > WMULT_CONST)) { 663 if (unlikely(tmp > WMULT_CONST))
654 tmp = ((tmp >> WMULT_SHIFT/2) * lw->inv_weight) 664 tmp = RSR(RSR(tmp, WMULT_SHIFT/2) * lw->inv_weight,
655 >> (WMULT_SHIFT/2); 665 WMULT_SHIFT/2);
656 } else { 666 else
657 tmp = (tmp * lw->inv_weight) >> WMULT_SHIFT; 667 tmp = RSR(tmp * lw->inv_weight, WMULT_SHIFT);
658 }
659 668
660 return (unsigned long)min(tmp, (u64)(unsigned long)LONG_MAX); 669 return (unsigned long)min(tmp, (u64)(unsigned long)LONG_MAX);
661} 670}
@@ -703,11 +712,14 @@ static void update_load_sub(struct load_weight *lw, unsigned long dec)
703 * the relative distance between them is ~25%.) 712 * the relative distance between them is ~25%.)
704 */ 713 */
705static const int prio_to_weight[40] = { 714static const int prio_to_weight[40] = {
706/* -20 */ 88818, 71054, 56843, 45475, 36380, 29104, 23283, 18626, 14901, 11921, 715 /* -20 */ 88761, 71755, 56483, 46273, 36291,
707/* -10 */ 9537, 7629, 6103, 4883, 3906, 3125, 2500, 2000, 1600, 1280, 716 /* -15 */ 29154, 23254, 18705, 14949, 11916,
708/* 0 */ NICE_0_LOAD /* 1024 */, 717 /* -10 */ 9548, 7620, 6100, 4904, 3906,
709/* 1 */ 819, 655, 524, 419, 336, 268, 215, 172, 137, 718 /* -5 */ 3121, 2501, 1991, 1586, 1277,
710/* 10 */ 110, 87, 70, 56, 45, 36, 29, 23, 18, 15, 719 /* 0 */ 1024, 820, 655, 526, 423,
720 /* 5 */ 335, 272, 215, 172, 137,
721 /* 10 */ 110, 87, 70, 56, 45,
722 /* 15 */ 36, 29, 23, 18, 15,
711}; 723};
712 724
713/* 725/*
@@ -718,14 +730,14 @@ static const int prio_to_weight[40] = {
718 * into multiplications: 730 * into multiplications:
719 */ 731 */
720static const u32 prio_to_wmult[40] = { 732static const u32 prio_to_wmult[40] = {
721/* -20 */ 48356, 60446, 75558, 94446, 118058, 733 /* -20 */ 48388, 59856, 76040, 92818, 118348,
722/* -15 */ 147573, 184467, 230589, 288233, 360285, 734 /* -15 */ 147320, 184698, 229616, 287308, 360437,
723/* -10 */ 450347, 562979, 703746, 879575, 1099582, 735 /* -10 */ 449829, 563644, 704093, 875809, 1099582,
724/* -5 */ 1374389, 1717986, 2147483, 2684354, 3355443, 736 /* -5 */ 1376151, 1717300, 2157191, 2708050, 3363326,
725/* 0 */ 4194304, 5244160, 6557201, 8196502, 10250518, 737 /* 0 */ 4194304, 5237765, 6557202, 8165337, 10153587,
726/* 5 */ 12782640, 16025997, 19976592, 24970740, 31350126, 738 /* 5 */ 12820798, 15790321, 19976592, 24970740, 31350126,
727/* 10 */ 39045157, 49367440, 61356675, 76695844, 95443717, 739 /* 10 */ 39045157, 49367440, 61356676, 76695844, 95443717,
728/* 15 */ 119304647, 148102320, 186737708, 238609294, 286331153, 740 /* 15 */ 119304647, 148102320, 186737708, 238609294, 286331153,
729}; 741};
730 742
731static void activate_task(struct rq *rq, struct task_struct *p, int wakeup); 743static void activate_task(struct rq *rq, struct task_struct *p, int wakeup);
@@ -745,8 +757,7 @@ static int balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
745 unsigned long max_nr_move, unsigned long max_load_move, 757 unsigned long max_nr_move, unsigned long max_load_move,
746 struct sched_domain *sd, enum cpu_idle_type idle, 758 struct sched_domain *sd, enum cpu_idle_type idle,
747 int *all_pinned, unsigned long *load_moved, 759 int *all_pinned, unsigned long *load_moved,
748 int this_best_prio, int best_prio, int best_prio_seen, 760 int *this_best_prio, struct rq_iterator *iterator);
749 struct rq_iterator *iterator);
750 761
751#include "sched_stats.h" 762#include "sched_stats.h"
752#include "sched_rt.c" 763#include "sched_rt.c"
@@ -782,14 +793,14 @@ static void __update_curr_load(struct rq *rq, struct load_stat *ls)
782 * This function is called /before/ updating rq->ls.load 793 * This function is called /before/ updating rq->ls.load
783 * and when switching tasks. 794 * and when switching tasks.
784 */ 795 */
785static void update_curr_load(struct rq *rq, u64 now) 796static void update_curr_load(struct rq *rq)
786{ 797{
787 struct load_stat *ls = &rq->ls; 798 struct load_stat *ls = &rq->ls;
788 u64 start; 799 u64 start;
789 800
790 start = ls->load_update_start; 801 start = ls->load_update_start;
791 ls->load_update_start = now; 802 ls->load_update_start = rq->clock;
792 ls->delta_stat += now - start; 803 ls->delta_stat += rq->clock - start;
793 /* 804 /*
794 * Stagger updates to ls->delta_fair. Very frequent updates 805 * Stagger updates to ls->delta_fair. Very frequent updates
795 * can be expensive. 806 * can be expensive.
@@ -798,30 +809,28 @@ static void update_curr_load(struct rq *rq, u64 now)
798 __update_curr_load(rq, ls); 809 __update_curr_load(rq, ls);
799} 810}
800 811
801static inline void 812static inline void inc_load(struct rq *rq, const struct task_struct *p)
802inc_load(struct rq *rq, const struct task_struct *p, u64 now)
803{ 813{
804 update_curr_load(rq, now); 814 update_curr_load(rq);
805 update_load_add(&rq->ls.load, p->se.load.weight); 815 update_load_add(&rq->ls.load, p->se.load.weight);
806} 816}
807 817
808static inline void 818static inline void dec_load(struct rq *rq, const struct task_struct *p)
809dec_load(struct rq *rq, const struct task_struct *p, u64 now)
810{ 819{
811 update_curr_load(rq, now); 820 update_curr_load(rq);
812 update_load_sub(&rq->ls.load, p->se.load.weight); 821 update_load_sub(&rq->ls.load, p->se.load.weight);
813} 822}
814 823
815static void inc_nr_running(struct task_struct *p, struct rq *rq, u64 now) 824static void inc_nr_running(struct task_struct *p, struct rq *rq)
816{ 825{
817 rq->nr_running++; 826 rq->nr_running++;
818 inc_load(rq, p, now); 827 inc_load(rq, p);
819} 828}
820 829
821static void dec_nr_running(struct task_struct *p, struct rq *rq, u64 now) 830static void dec_nr_running(struct task_struct *p, struct rq *rq)
822{ 831{
823 rq->nr_running--; 832 rq->nr_running--;
824 dec_load(rq, p, now); 833 dec_load(rq, p);
825} 834}
826 835
827static void set_load_weight(struct task_struct *p) 836static void set_load_weight(struct task_struct *p)
@@ -848,18 +857,16 @@ static void set_load_weight(struct task_struct *p)
848 p->se.load.inv_weight = prio_to_wmult[p->static_prio - MAX_RT_PRIO]; 857 p->se.load.inv_weight = prio_to_wmult[p->static_prio - MAX_RT_PRIO];
849} 858}
850 859
851static void 860static void enqueue_task(struct rq *rq, struct task_struct *p, int wakeup)
852enqueue_task(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
853{ 861{
854 sched_info_queued(p); 862 sched_info_queued(p);
855 p->sched_class->enqueue_task(rq, p, wakeup, now); 863 p->sched_class->enqueue_task(rq, p, wakeup);
856 p->se.on_rq = 1; 864 p->se.on_rq = 1;
857} 865}
858 866
859static void 867static void dequeue_task(struct rq *rq, struct task_struct *p, int sleep)
860dequeue_task(struct rq *rq, struct task_struct *p, int sleep, u64 now)
861{ 868{
862 p->sched_class->dequeue_task(rq, p, sleep, now); 869 p->sched_class->dequeue_task(rq, p, sleep);
863 p->se.on_rq = 0; 870 p->se.on_rq = 0;
864} 871}
865 872
@@ -914,13 +921,11 @@ static int effective_prio(struct task_struct *p)
914 */ 921 */
915static void activate_task(struct rq *rq, struct task_struct *p, int wakeup) 922static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
916{ 923{
917 u64 now = rq_clock(rq);
918
919 if (p->state == TASK_UNINTERRUPTIBLE) 924 if (p->state == TASK_UNINTERRUPTIBLE)
920 rq->nr_uninterruptible--; 925 rq->nr_uninterruptible--;
921 926
922 enqueue_task(rq, p, wakeup, now); 927 enqueue_task(rq, p, wakeup);
923 inc_nr_running(p, rq, now); 928 inc_nr_running(p, rq);
924} 929}
925 930
926/* 931/*
@@ -928,13 +933,13 @@ static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
928 */ 933 */
929static inline void activate_idle_task(struct task_struct *p, struct rq *rq) 934static inline void activate_idle_task(struct task_struct *p, struct rq *rq)
930{ 935{
931 u64 now = rq_clock(rq); 936 update_rq_clock(rq);
932 937
933 if (p->state == TASK_UNINTERRUPTIBLE) 938 if (p->state == TASK_UNINTERRUPTIBLE)
934 rq->nr_uninterruptible--; 939 rq->nr_uninterruptible--;
935 940
936 enqueue_task(rq, p, 0, now); 941 enqueue_task(rq, p, 0);
937 inc_nr_running(p, rq, now); 942 inc_nr_running(p, rq);
938} 943}
939 944
940/* 945/*
@@ -942,13 +947,11 @@ static inline void activate_idle_task(struct task_struct *p, struct rq *rq)
942 */ 947 */
943static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep) 948static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep)
944{ 949{
945 u64 now = rq_clock(rq);
946
947 if (p->state == TASK_UNINTERRUPTIBLE) 950 if (p->state == TASK_UNINTERRUPTIBLE)
948 rq->nr_uninterruptible++; 951 rq->nr_uninterruptible++;
949 952
950 dequeue_task(rq, p, sleep, now); 953 dequeue_task(rq, p, sleep);
951 dec_nr_running(p, rq, now); 954 dec_nr_running(p, rq);
952} 955}
953 956
954/** 957/**
@@ -1516,6 +1519,7 @@ out_set_cpu:
1516 1519
1517out_activate: 1520out_activate:
1518#endif /* CONFIG_SMP */ 1521#endif /* CONFIG_SMP */
1522 update_rq_clock(rq);
1519 activate_task(rq, p, 1); 1523 activate_task(rq, p, 1);
1520 /* 1524 /*
1521 * Sync wakeups (i.e. those types of wakeups where the waker 1525 * Sync wakeups (i.e. those types of wakeups where the waker
@@ -1647,12 +1651,11 @@ void fastcall wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
1647 unsigned long flags; 1651 unsigned long flags;
1648 struct rq *rq; 1652 struct rq *rq;
1649 int this_cpu; 1653 int this_cpu;
1650 u64 now;
1651 1654
1652 rq = task_rq_lock(p, &flags); 1655 rq = task_rq_lock(p, &flags);
1653 BUG_ON(p->state != TASK_RUNNING); 1656 BUG_ON(p->state != TASK_RUNNING);
1654 this_cpu = smp_processor_id(); /* parent's CPU */ 1657 this_cpu = smp_processor_id(); /* parent's CPU */
1655 now = rq_clock(rq); 1658 update_rq_clock(rq);
1656 1659
1657 p->prio = effective_prio(p); 1660 p->prio = effective_prio(p);
1658 1661
@@ -1666,8 +1669,8 @@ void fastcall wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
1666 * Let the scheduling class do new task startup 1669 * Let the scheduling class do new task startup
1667 * management (if any): 1670 * management (if any):
1668 */ 1671 */
1669 p->sched_class->task_new(rq, p, now); 1672 p->sched_class->task_new(rq, p);
1670 inc_nr_running(p, rq, now); 1673 inc_nr_running(p, rq);
1671 } 1674 }
1672 check_preempt_curr(rq, p); 1675 check_preempt_curr(rq, p);
1673 task_rq_unlock(rq, &flags); 1676 task_rq_unlock(rq, &flags);
@@ -1954,7 +1957,6 @@ static void update_cpu_load(struct rq *this_rq)
1954 unsigned long total_load = this_rq->ls.load.weight; 1957 unsigned long total_load = this_rq->ls.load.weight;
1955 unsigned long this_load = total_load; 1958 unsigned long this_load = total_load;
1956 struct load_stat *ls = &this_rq->ls; 1959 struct load_stat *ls = &this_rq->ls;
1957 u64 now = __rq_clock(this_rq);
1958 int i, scale; 1960 int i, scale;
1959 1961
1960 this_rq->nr_load_updates++; 1962 this_rq->nr_load_updates++;
@@ -1962,7 +1964,7 @@ static void update_cpu_load(struct rq *this_rq)
1962 goto do_avg; 1964 goto do_avg;
1963 1965
1964 /* Update delta_fair/delta_exec fields first */ 1966 /* Update delta_fair/delta_exec fields first */
1965 update_curr_load(this_rq, now); 1967 update_curr_load(this_rq);
1966 1968
1967 fair_delta64 = ls->delta_fair + 1; 1969 fair_delta64 = ls->delta_fair + 1;
1968 ls->delta_fair = 0; 1970 ls->delta_fair = 0;
@@ -1970,8 +1972,8 @@ static void update_cpu_load(struct rq *this_rq)
1970 exec_delta64 = ls->delta_exec + 1; 1972 exec_delta64 = ls->delta_exec + 1;
1971 ls->delta_exec = 0; 1973 ls->delta_exec = 0;
1972 1974
1973 sample_interval64 = now - ls->load_update_last; 1975 sample_interval64 = this_rq->clock - ls->load_update_last;
1974 ls->load_update_last = now; 1976 ls->load_update_last = this_rq->clock;
1975 1977
1976 if ((s64)sample_interval64 < (s64)TICK_NSEC) 1978 if ((s64)sample_interval64 < (s64)TICK_NSEC)
1977 sample_interval64 = TICK_NSEC; 1979 sample_interval64 = TICK_NSEC;
@@ -2026,6 +2028,8 @@ static void double_rq_lock(struct rq *rq1, struct rq *rq2)
2026 spin_lock(&rq1->lock); 2028 spin_lock(&rq1->lock);
2027 } 2029 }
2028 } 2030 }
2031 update_rq_clock(rq1);
2032 update_rq_clock(rq2);
2029} 2033}
2030 2034
2031/* 2035/*
@@ -2166,8 +2170,7 @@ static int balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
2166 unsigned long max_nr_move, unsigned long max_load_move, 2170 unsigned long max_nr_move, unsigned long max_load_move,
2167 struct sched_domain *sd, enum cpu_idle_type idle, 2171 struct sched_domain *sd, enum cpu_idle_type idle,
2168 int *all_pinned, unsigned long *load_moved, 2172 int *all_pinned, unsigned long *load_moved,
2169 int this_best_prio, int best_prio, int best_prio_seen, 2173 int *this_best_prio, struct rq_iterator *iterator)
2170 struct rq_iterator *iterator)
2171{ 2174{
2172 int pulled = 0, pinned = 0, skip_for_load; 2175 int pulled = 0, pinned = 0, skip_for_load;
2173 struct task_struct *p; 2176 struct task_struct *p;
@@ -2192,12 +2195,8 @@ next:
2192 */ 2195 */
2193 skip_for_load = (p->se.load.weight >> 1) > rem_load_move + 2196 skip_for_load = (p->se.load.weight >> 1) > rem_load_move +
2194 SCHED_LOAD_SCALE_FUZZ; 2197 SCHED_LOAD_SCALE_FUZZ;
2195 if (skip_for_load && p->prio < this_best_prio) 2198 if ((skip_for_load && p->prio >= *this_best_prio) ||
2196 skip_for_load = !best_prio_seen && p->prio == best_prio;
2197 if (skip_for_load ||
2198 !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) { 2199 !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
2199
2200 best_prio_seen |= p->prio == best_prio;
2201 p = iterator->next(iterator->arg); 2200 p = iterator->next(iterator->arg);
2202 goto next; 2201 goto next;
2203 } 2202 }
@@ -2211,8 +2210,8 @@ next:
2211 * and the prescribed amount of weighted load. 2210 * and the prescribed amount of weighted load.
2212 */ 2211 */
2213 if (pulled < max_nr_move && rem_load_move > 0) { 2212 if (pulled < max_nr_move && rem_load_move > 0) {
2214 if (p->prio < this_best_prio) 2213 if (p->prio < *this_best_prio)
2215 this_best_prio = p->prio; 2214 *this_best_prio = p->prio;
2216 p = iterator->next(iterator->arg); 2215 p = iterator->next(iterator->arg);
2217 goto next; 2216 goto next;
2218 } 2217 }
@@ -2231,32 +2230,52 @@ out:
2231} 2230}
2232 2231
2233/* 2232/*
2234 * move_tasks tries to move up to max_nr_move tasks and max_load_move weighted 2233 * move_tasks tries to move up to max_load_move weighted load from busiest to
2235 * load from busiest to this_rq, as part of a balancing operation within 2234 * this_rq, as part of a balancing operation within domain "sd".
2236 * "domain". Returns the number of tasks moved. 2235 * Returns 1 if successful and 0 otherwise.
2237 * 2236 *
2238 * Called with both runqueues locked. 2237 * Called with both runqueues locked.
2239 */ 2238 */
2240static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest, 2239static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
2241 unsigned long max_nr_move, unsigned long max_load_move, 2240 unsigned long max_load_move,
2242 struct sched_domain *sd, enum cpu_idle_type idle, 2241 struct sched_domain *sd, enum cpu_idle_type idle,
2243 int *all_pinned) 2242 int *all_pinned)
2244{ 2243{
2245 struct sched_class *class = sched_class_highest; 2244 struct sched_class *class = sched_class_highest;
2246 unsigned long load_moved, total_nr_moved = 0, nr_moved; 2245 unsigned long total_load_moved = 0;
2247 long rem_load_move = max_load_move; 2246 int this_best_prio = this_rq->curr->prio;
2248 2247
2249 do { 2248 do {
2250 nr_moved = class->load_balance(this_rq, this_cpu, busiest, 2249 total_load_moved +=
2251 max_nr_move, (unsigned long)rem_load_move, 2250 class->load_balance(this_rq, this_cpu, busiest,
2252 sd, idle, all_pinned, &load_moved); 2251 ULONG_MAX, max_load_move - total_load_moved,
2253 total_nr_moved += nr_moved; 2252 sd, idle, all_pinned, &this_best_prio);
2254 max_nr_move -= nr_moved;
2255 rem_load_move -= load_moved;
2256 class = class->next; 2253 class = class->next;
2257 } while (class && max_nr_move && rem_load_move > 0); 2254 } while (class && max_load_move > total_load_moved);
2258 2255
2259 return total_nr_moved; 2256 return total_load_moved > 0;
2257}
2258
2259/*
2260 * move_one_task tries to move exactly one task from busiest to this_rq, as
2261 * part of active balancing operations within "domain".
2262 * Returns 1 if successful and 0 otherwise.
2263 *
2264 * Called with both runqueues locked.
2265 */
2266static int move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
2267 struct sched_domain *sd, enum cpu_idle_type idle)
2268{
2269 struct sched_class *class;
2270 int this_best_prio = MAX_PRIO;
2271
2272 for (class = sched_class_highest; class; class = class->next)
2273 if (class->load_balance(this_rq, this_cpu, busiest,
2274 1, ULONG_MAX, sd, idle, NULL,
2275 &this_best_prio))
2276 return 1;
2277
2278 return 0;
2260} 2279}
2261 2280
2262/* 2281/*
@@ -2588,11 +2607,6 @@ find_busiest_queue(struct sched_group *group, enum cpu_idle_type idle,
2588 */ 2607 */
2589#define MAX_PINNED_INTERVAL 512 2608#define MAX_PINNED_INTERVAL 512
2590 2609
2591static inline unsigned long minus_1_or_zero(unsigned long n)
2592{
2593 return n > 0 ? n - 1 : 0;
2594}
2595
2596/* 2610/*
2597 * Check this_cpu to ensure it is balanced within domain. Attempt to move 2611 * Check this_cpu to ensure it is balanced within domain. Attempt to move
2598 * tasks if there is an imbalance. 2612 * tasks if there is an imbalance.
@@ -2601,7 +2615,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
2601 struct sched_domain *sd, enum cpu_idle_type idle, 2615 struct sched_domain *sd, enum cpu_idle_type idle,
2602 int *balance) 2616 int *balance)
2603{ 2617{
2604 int nr_moved, all_pinned = 0, active_balance = 0, sd_idle = 0; 2618 int ld_moved, all_pinned = 0, active_balance = 0, sd_idle = 0;
2605 struct sched_group *group; 2619 struct sched_group *group;
2606 unsigned long imbalance; 2620 unsigned long imbalance;
2607 struct rq *busiest; 2621 struct rq *busiest;
@@ -2642,18 +2656,17 @@ redo:
2642 2656
2643 schedstat_add(sd, lb_imbalance[idle], imbalance); 2657 schedstat_add(sd, lb_imbalance[idle], imbalance);
2644 2658
2645 nr_moved = 0; 2659 ld_moved = 0;
2646 if (busiest->nr_running > 1) { 2660 if (busiest->nr_running > 1) {
2647 /* 2661 /*
2648 * Attempt to move tasks. If find_busiest_group has found 2662 * Attempt to move tasks. If find_busiest_group has found
2649 * an imbalance but busiest->nr_running <= 1, the group is 2663 * an imbalance but busiest->nr_running <= 1, the group is
2650 * still unbalanced. nr_moved simply stays zero, so it is 2664 * still unbalanced. ld_moved simply stays zero, so it is
2651 * correctly treated as an imbalance. 2665 * correctly treated as an imbalance.
2652 */ 2666 */
2653 local_irq_save(flags); 2667 local_irq_save(flags);
2654 double_rq_lock(this_rq, busiest); 2668 double_rq_lock(this_rq, busiest);
2655 nr_moved = move_tasks(this_rq, this_cpu, busiest, 2669 ld_moved = move_tasks(this_rq, this_cpu, busiest,
2656 minus_1_or_zero(busiest->nr_running),
2657 imbalance, sd, idle, &all_pinned); 2670 imbalance, sd, idle, &all_pinned);
2658 double_rq_unlock(this_rq, busiest); 2671 double_rq_unlock(this_rq, busiest);
2659 local_irq_restore(flags); 2672 local_irq_restore(flags);
@@ -2661,7 +2674,7 @@ redo:
2661 /* 2674 /*
2662 * some other cpu did the load balance for us. 2675 * some other cpu did the load balance for us.
2663 */ 2676 */
2664 if (nr_moved && this_cpu != smp_processor_id()) 2677 if (ld_moved && this_cpu != smp_processor_id())
2665 resched_cpu(this_cpu); 2678 resched_cpu(this_cpu);
2666 2679
2667 /* All tasks on this runqueue were pinned by CPU affinity */ 2680 /* All tasks on this runqueue were pinned by CPU affinity */
@@ -2673,7 +2686,7 @@ redo:
2673 } 2686 }
2674 } 2687 }
2675 2688
2676 if (!nr_moved) { 2689 if (!ld_moved) {
2677 schedstat_inc(sd, lb_failed[idle]); 2690 schedstat_inc(sd, lb_failed[idle]);
2678 sd->nr_balance_failed++; 2691 sd->nr_balance_failed++;
2679 2692
@@ -2722,10 +2735,10 @@ redo:
2722 sd->balance_interval *= 2; 2735 sd->balance_interval *= 2;
2723 } 2736 }
2724 2737
2725 if (!nr_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER && 2738 if (!ld_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
2726 !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE)) 2739 !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
2727 return -1; 2740 return -1;
2728 return nr_moved; 2741 return ld_moved;
2729 2742
2730out_balanced: 2743out_balanced:
2731 schedstat_inc(sd, lb_balanced[idle]); 2744 schedstat_inc(sd, lb_balanced[idle]);
@@ -2757,7 +2770,7 @@ load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)
2757 struct sched_group *group; 2770 struct sched_group *group;
2758 struct rq *busiest = NULL; 2771 struct rq *busiest = NULL;
2759 unsigned long imbalance; 2772 unsigned long imbalance;
2760 int nr_moved = 0; 2773 int ld_moved = 0;
2761 int sd_idle = 0; 2774 int sd_idle = 0;
2762 int all_pinned = 0; 2775 int all_pinned = 0;
2763 cpumask_t cpus = CPU_MASK_ALL; 2776 cpumask_t cpus = CPU_MASK_ALL;
@@ -2792,12 +2805,13 @@ redo:
2792 2805
2793 schedstat_add(sd, lb_imbalance[CPU_NEWLY_IDLE], imbalance); 2806 schedstat_add(sd, lb_imbalance[CPU_NEWLY_IDLE], imbalance);
2794 2807
2795 nr_moved = 0; 2808 ld_moved = 0;
2796 if (busiest->nr_running > 1) { 2809 if (busiest->nr_running > 1) {
2797 /* Attempt to move tasks */ 2810 /* Attempt to move tasks */
2798 double_lock_balance(this_rq, busiest); 2811 double_lock_balance(this_rq, busiest);
2799 nr_moved = move_tasks(this_rq, this_cpu, busiest, 2812 /* this_rq->clock is already updated */
2800 minus_1_or_zero(busiest->nr_running), 2813 update_rq_clock(busiest);
2814 ld_moved = move_tasks(this_rq, this_cpu, busiest,
2801 imbalance, sd, CPU_NEWLY_IDLE, 2815 imbalance, sd, CPU_NEWLY_IDLE,
2802 &all_pinned); 2816 &all_pinned);
2803 spin_unlock(&busiest->lock); 2817 spin_unlock(&busiest->lock);
@@ -2809,7 +2823,7 @@ redo:
2809 } 2823 }
2810 } 2824 }
2811 2825
2812 if (!nr_moved) { 2826 if (!ld_moved) {
2813 schedstat_inc(sd, lb_failed[CPU_NEWLY_IDLE]); 2827 schedstat_inc(sd, lb_failed[CPU_NEWLY_IDLE]);
2814 if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER && 2828 if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
2815 !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE)) 2829 !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
@@ -2817,7 +2831,7 @@ redo:
2817 } else 2831 } else
2818 sd->nr_balance_failed = 0; 2832 sd->nr_balance_failed = 0;
2819 2833
2820 return nr_moved; 2834 return ld_moved;
2821 2835
2822out_balanced: 2836out_balanced:
2823 schedstat_inc(sd, lb_balanced[CPU_NEWLY_IDLE]); 2837 schedstat_inc(sd, lb_balanced[CPU_NEWLY_IDLE]);
@@ -2894,6 +2908,8 @@ static void active_load_balance(struct rq *busiest_rq, int busiest_cpu)
2894 2908
2895 /* move a task from busiest_rq to target_rq */ 2909 /* move a task from busiest_rq to target_rq */
2896 double_lock_balance(busiest_rq, target_rq); 2910 double_lock_balance(busiest_rq, target_rq);
2911 update_rq_clock(busiest_rq);
2912 update_rq_clock(target_rq);
2897 2913
2898 /* Search for an sd spanning us and the target CPU. */ 2914 /* Search for an sd spanning us and the target CPU. */
2899 for_each_domain(target_cpu, sd) { 2915 for_each_domain(target_cpu, sd) {
@@ -2905,8 +2921,8 @@ static void active_load_balance(struct rq *busiest_rq, int busiest_cpu)
2905 if (likely(sd)) { 2921 if (likely(sd)) {
2906 schedstat_inc(sd, alb_cnt); 2922 schedstat_inc(sd, alb_cnt);
2907 2923
2908 if (move_tasks(target_rq, target_cpu, busiest_rq, 1, 2924 if (move_one_task(target_rq, target_cpu, busiest_rq,
2909 ULONG_MAX, sd, CPU_IDLE, NULL)) 2925 sd, CPU_IDLE))
2910 schedstat_inc(sd, alb_pushed); 2926 schedstat_inc(sd, alb_pushed);
2911 else 2927 else
2912 schedstat_inc(sd, alb_failed); 2928 schedstat_inc(sd, alb_failed);
@@ -3090,7 +3106,7 @@ static void run_rebalance_domains(struct softirq_action *h)
3090 if (need_resched()) 3106 if (need_resched())
3091 break; 3107 break;
3092 3108
3093 rebalance_domains(balance_cpu, SCHED_IDLE); 3109 rebalance_domains(balance_cpu, CPU_IDLE);
3094 3110
3095 rq = cpu_rq(balance_cpu); 3111 rq = cpu_rq(balance_cpu);
3096 if (time_after(this_rq->next_balance, rq->next_balance)) 3112 if (time_after(this_rq->next_balance, rq->next_balance))
@@ -3175,8 +3191,7 @@ static int balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
3175 unsigned long max_nr_move, unsigned long max_load_move, 3191 unsigned long max_nr_move, unsigned long max_load_move,
3176 struct sched_domain *sd, enum cpu_idle_type idle, 3192 struct sched_domain *sd, enum cpu_idle_type idle,
3177 int *all_pinned, unsigned long *load_moved, 3193 int *all_pinned, unsigned long *load_moved,
3178 int this_best_prio, int best_prio, int best_prio_seen, 3194 int *this_best_prio, struct rq_iterator *iterator)
3179 struct rq_iterator *iterator)
3180{ 3195{
3181 *load_moved = 0; 3196 *load_moved = 0;
3182 3197
@@ -3202,7 +3217,8 @@ unsigned long long task_sched_runtime(struct task_struct *p)
3202 rq = task_rq_lock(p, &flags); 3217 rq = task_rq_lock(p, &flags);
3203 ns = p->se.sum_exec_runtime; 3218 ns = p->se.sum_exec_runtime;
3204 if (rq->curr == p) { 3219 if (rq->curr == p) {
3205 delta_exec = rq_clock(rq) - p->se.exec_start; 3220 update_rq_clock(rq);
3221 delta_exec = rq->clock - p->se.exec_start;
3206 if ((s64)delta_exec > 0) 3222 if ((s64)delta_exec > 0)
3207 ns += delta_exec; 3223 ns += delta_exec;
3208 } 3224 }
@@ -3296,11 +3312,19 @@ void scheduler_tick(void)
3296 int cpu = smp_processor_id(); 3312 int cpu = smp_processor_id();
3297 struct rq *rq = cpu_rq(cpu); 3313 struct rq *rq = cpu_rq(cpu);
3298 struct task_struct *curr = rq->curr; 3314 struct task_struct *curr = rq->curr;
3315 u64 next_tick = rq->tick_timestamp + TICK_NSEC;
3299 3316
3300 spin_lock(&rq->lock); 3317 spin_lock(&rq->lock);
3318 __update_rq_clock(rq);
3319 /*
3320 * Let rq->clock advance by at least TICK_NSEC:
3321 */
3322 if (unlikely(rq->clock < next_tick))
3323 rq->clock = next_tick;
3324 rq->tick_timestamp = rq->clock;
3325 update_cpu_load(rq);
3301 if (curr != rq->idle) /* FIXME: needed? */ 3326 if (curr != rq->idle) /* FIXME: needed? */
3302 curr->sched_class->task_tick(rq, curr); 3327 curr->sched_class->task_tick(rq, curr);
3303 update_cpu_load(rq);
3304 spin_unlock(&rq->lock); 3328 spin_unlock(&rq->lock);
3305 3329
3306#ifdef CONFIG_SMP 3330#ifdef CONFIG_SMP
@@ -3382,7 +3406,7 @@ static inline void schedule_debug(struct task_struct *prev)
3382 * Pick up the highest-prio task: 3406 * Pick up the highest-prio task:
3383 */ 3407 */
3384static inline struct task_struct * 3408static inline struct task_struct *
3385pick_next_task(struct rq *rq, struct task_struct *prev, u64 now) 3409pick_next_task(struct rq *rq, struct task_struct *prev)
3386{ 3410{
3387 struct sched_class *class; 3411 struct sched_class *class;
3388 struct task_struct *p; 3412 struct task_struct *p;
@@ -3392,14 +3416,14 @@ pick_next_task(struct rq *rq, struct task_struct *prev, u64 now)
3392 * the fair class we can call that function directly: 3416 * the fair class we can call that function directly:
3393 */ 3417 */
3394 if (likely(rq->nr_running == rq->cfs.nr_running)) { 3418 if (likely(rq->nr_running == rq->cfs.nr_running)) {
3395 p = fair_sched_class.pick_next_task(rq, now); 3419 p = fair_sched_class.pick_next_task(rq);
3396 if (likely(p)) 3420 if (likely(p))
3397 return p; 3421 return p;
3398 } 3422 }
3399 3423
3400 class = sched_class_highest; 3424 class = sched_class_highest;
3401 for ( ; ; ) { 3425 for ( ; ; ) {
3402 p = class->pick_next_task(rq, now); 3426 p = class->pick_next_task(rq);
3403 if (p) 3427 if (p)
3404 return p; 3428 return p;
3405 /* 3429 /*
@@ -3418,7 +3442,6 @@ asmlinkage void __sched schedule(void)
3418 struct task_struct *prev, *next; 3442 struct task_struct *prev, *next;
3419 long *switch_count; 3443 long *switch_count;
3420 struct rq *rq; 3444 struct rq *rq;
3421 u64 now;
3422 int cpu; 3445 int cpu;
3423 3446
3424need_resched: 3447need_resched:
@@ -3436,6 +3459,7 @@ need_resched_nonpreemptible:
3436 3459
3437 spin_lock_irq(&rq->lock); 3460 spin_lock_irq(&rq->lock);
3438 clear_tsk_need_resched(prev); 3461 clear_tsk_need_resched(prev);
3462 __update_rq_clock(rq);
3439 3463
3440 if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { 3464 if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
3441 if (unlikely((prev->state & TASK_INTERRUPTIBLE) && 3465 if (unlikely((prev->state & TASK_INTERRUPTIBLE) &&
@@ -3450,9 +3474,8 @@ need_resched_nonpreemptible:
3450 if (unlikely(!rq->nr_running)) 3474 if (unlikely(!rq->nr_running))
3451 idle_balance(cpu, rq); 3475 idle_balance(cpu, rq);
3452 3476
3453 now = __rq_clock(rq); 3477 prev->sched_class->put_prev_task(rq, prev);
3454 prev->sched_class->put_prev_task(rq, prev, now); 3478 next = pick_next_task(rq, prev);
3455 next = pick_next_task(rq, prev, now);
3456 3479
3457 sched_info_switch(prev, next); 3480 sched_info_switch(prev, next);
3458 3481
@@ -3895,17 +3918,16 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
3895 unsigned long flags; 3918 unsigned long flags;
3896 int oldprio, on_rq; 3919 int oldprio, on_rq;
3897 struct rq *rq; 3920 struct rq *rq;
3898 u64 now;
3899 3921
3900 BUG_ON(prio < 0 || prio > MAX_PRIO); 3922 BUG_ON(prio < 0 || prio > MAX_PRIO);
3901 3923
3902 rq = task_rq_lock(p, &flags); 3924 rq = task_rq_lock(p, &flags);
3903 now = rq_clock(rq); 3925 update_rq_clock(rq);
3904 3926
3905 oldprio = p->prio; 3927 oldprio = p->prio;
3906 on_rq = p->se.on_rq; 3928 on_rq = p->se.on_rq;
3907 if (on_rq) 3929 if (on_rq)
3908 dequeue_task(rq, p, 0, now); 3930 dequeue_task(rq, p, 0);
3909 3931
3910 if (rt_prio(prio)) 3932 if (rt_prio(prio))
3911 p->sched_class = &rt_sched_class; 3933 p->sched_class = &rt_sched_class;
@@ -3915,7 +3937,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
3915 p->prio = prio; 3937 p->prio = prio;
3916 3938
3917 if (on_rq) { 3939 if (on_rq) {
3918 enqueue_task(rq, p, 0, now); 3940 enqueue_task(rq, p, 0);
3919 /* 3941 /*
3920 * Reschedule if we are currently running on this runqueue and 3942 * Reschedule if we are currently running on this runqueue and
3921 * our priority decreased, or if we are not currently running on 3943 * our priority decreased, or if we are not currently running on
@@ -3938,7 +3960,6 @@ void set_user_nice(struct task_struct *p, long nice)
3938 int old_prio, delta, on_rq; 3960 int old_prio, delta, on_rq;
3939 unsigned long flags; 3961 unsigned long flags;
3940 struct rq *rq; 3962 struct rq *rq;
3941 u64 now;
3942 3963
3943 if (TASK_NICE(p) == nice || nice < -20 || nice > 19) 3964 if (TASK_NICE(p) == nice || nice < -20 || nice > 19)
3944 return; 3965 return;
@@ -3947,7 +3968,7 @@ void set_user_nice(struct task_struct *p, long nice)
3947 * the task might be in the middle of scheduling on another CPU. 3968 * the task might be in the middle of scheduling on another CPU.
3948 */ 3969 */
3949 rq = task_rq_lock(p, &flags); 3970 rq = task_rq_lock(p, &flags);
3950 now = rq_clock(rq); 3971 update_rq_clock(rq);
3951 /* 3972 /*
3952 * The RT priorities are set via sched_setscheduler(), but we still 3973 * The RT priorities are set via sched_setscheduler(), but we still
3953 * allow the 'normal' nice value to be set - but as expected 3974 * allow the 'normal' nice value to be set - but as expected
@@ -3960,8 +3981,8 @@ void set_user_nice(struct task_struct *p, long nice)
3960 } 3981 }
3961 on_rq = p->se.on_rq; 3982 on_rq = p->se.on_rq;
3962 if (on_rq) { 3983 if (on_rq) {
3963 dequeue_task(rq, p, 0, now); 3984 dequeue_task(rq, p, 0);
3964 dec_load(rq, p, now); 3985 dec_load(rq, p);
3965 } 3986 }
3966 3987
3967 p->static_prio = NICE_TO_PRIO(nice); 3988 p->static_prio = NICE_TO_PRIO(nice);
@@ -3971,8 +3992,8 @@ void set_user_nice(struct task_struct *p, long nice)
3971 delta = p->prio - old_prio; 3992 delta = p->prio - old_prio;
3972 3993
3973 if (on_rq) { 3994 if (on_rq) {
3974 enqueue_task(rq, p, 0, now); 3995 enqueue_task(rq, p, 0);
3975 inc_load(rq, p, now); 3996 inc_load(rq, p);
3976 /* 3997 /*
3977 * If the task increased its priority or is running and 3998 * If the task increased its priority or is running and
3978 * lowered its priority, then reschedule its CPU: 3999 * lowered its priority, then reschedule its CPU:
@@ -4208,6 +4229,7 @@ recheck:
4208 spin_unlock_irqrestore(&p->pi_lock, flags); 4229 spin_unlock_irqrestore(&p->pi_lock, flags);
4209 goto recheck; 4230 goto recheck;
4210 } 4231 }
4232 update_rq_clock(rq);
4211 on_rq = p->se.on_rq; 4233 on_rq = p->se.on_rq;
4212 if (on_rq) 4234 if (on_rq)
4213 deactivate_task(rq, p, 0); 4235 deactivate_task(rq, p, 0);
@@ -4463,10 +4485,8 @@ long sched_getaffinity(pid_t pid, cpumask_t *mask)
4463out_unlock: 4485out_unlock:
4464 read_unlock(&tasklist_lock); 4486 read_unlock(&tasklist_lock);
4465 mutex_unlock(&sched_hotcpu_mutex); 4487 mutex_unlock(&sched_hotcpu_mutex);
4466 if (retval)
4467 return retval;
4468 4488
4469 return 0; 4489 return retval;
4470} 4490}
4471 4491
4472/** 4492/**
@@ -4966,6 +4986,7 @@ static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)
4966 on_rq = p->se.on_rq; 4986 on_rq = p->se.on_rq;
4967 if (on_rq) 4987 if (on_rq)
4968 deactivate_task(rq_src, p, 0); 4988 deactivate_task(rq_src, p, 0);
4989
4969 set_task_cpu(p, dest_cpu); 4990 set_task_cpu(p, dest_cpu);
4970 if (on_rq) { 4991 if (on_rq) {
4971 activate_task(rq_dest, p, 0); 4992 activate_task(rq_dest, p, 0);
@@ -5198,7 +5219,8 @@ static void migrate_dead_tasks(unsigned int dead_cpu)
5198 for ( ; ; ) { 5219 for ( ; ; ) {
5199 if (!rq->nr_running) 5220 if (!rq->nr_running)
5200 break; 5221 break;
5201 next = pick_next_task(rq, rq->curr, rq_clock(rq)); 5222 update_rq_clock(rq);
5223 next = pick_next_task(rq, rq->curr);
5202 if (!next) 5224 if (!next)
5203 break; 5225 break;
5204 migrate_dead(dead_cpu, next); 5226 migrate_dead(dead_cpu, next);
@@ -5210,12 +5232,19 @@ static void migrate_dead_tasks(unsigned int dead_cpu)
5210#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_SYSCTL) 5232#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_SYSCTL)
5211 5233
5212static struct ctl_table sd_ctl_dir[] = { 5234static struct ctl_table sd_ctl_dir[] = {
5213 {CTL_UNNUMBERED, "sched_domain", NULL, 0, 0755, NULL, }, 5235 {
5236 .procname = "sched_domain",
5237 .mode = 0755,
5238 },
5214 {0,}, 5239 {0,},
5215}; 5240};
5216 5241
5217static struct ctl_table sd_ctl_root[] = { 5242static struct ctl_table sd_ctl_root[] = {
5218 {CTL_UNNUMBERED, "kernel", NULL, 0, 0755, sd_ctl_dir, }, 5243 {
5244 .procname = "kernel",
5245 .mode = 0755,
5246 .child = sd_ctl_dir,
5247 },
5219 {0,}, 5248 {0,},
5220}; 5249};
5221 5250
@@ -5231,11 +5260,10 @@ static struct ctl_table *sd_alloc_ctl_entry(int n)
5231} 5260}
5232 5261
5233static void 5262static void
5234set_table_entry(struct ctl_table *entry, int ctl_name, 5263set_table_entry(struct ctl_table *entry,
5235 const char *procname, void *data, int maxlen, 5264 const char *procname, void *data, int maxlen,
5236 mode_t mode, proc_handler *proc_handler) 5265 mode_t mode, proc_handler *proc_handler)
5237{ 5266{
5238 entry->ctl_name = ctl_name;
5239 entry->procname = procname; 5267 entry->procname = procname;
5240 entry->data = data; 5268 entry->data = data;
5241 entry->maxlen = maxlen; 5269 entry->maxlen = maxlen;
@@ -5248,28 +5276,28 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)
5248{ 5276{
5249 struct ctl_table *table = sd_alloc_ctl_entry(14); 5277 struct ctl_table *table = sd_alloc_ctl_entry(14);
5250 5278
5251 set_table_entry(&table[0], 1, "min_interval", &sd->min_interval, 5279 set_table_entry(&table[0], "min_interval", &sd->min_interval,
5252 sizeof(long), 0644, proc_doulongvec_minmax); 5280 sizeof(long), 0644, proc_doulongvec_minmax);
5253 set_table_entry(&table[1], 2, "max_interval", &sd->max_interval, 5281 set_table_entry(&table[1], "max_interval", &sd->max_interval,
5254 sizeof(long), 0644, proc_doulongvec_minmax); 5282 sizeof(long), 0644, proc_doulongvec_minmax);
5255 set_table_entry(&table[2], 3, "busy_idx", &sd->busy_idx, 5283 set_table_entry(&table[2], "busy_idx", &sd->busy_idx,
5256 sizeof(int), 0644, proc_dointvec_minmax); 5284 sizeof(int), 0644, proc_dointvec_minmax);
5257 set_table_entry(&table[3], 4, "idle_idx", &sd->idle_idx, 5285 set_table_entry(&table[3], "idle_idx", &sd->idle_idx,
5258 sizeof(int), 0644, proc_dointvec_minmax); 5286 sizeof(int), 0644, proc_dointvec_minmax);
5259 set_table_entry(&table[4], 5, "newidle_idx", &sd->newidle_idx, 5287 set_table_entry(&table[4], "newidle_idx", &sd->newidle_idx,
5260 sizeof(int), 0644, proc_dointvec_minmax); 5288 sizeof(int), 0644, proc_dointvec_minmax);
5261 set_table_entry(&table[5], 6, "wake_idx", &sd->wake_idx, 5289 set_table_entry(&table[5], "wake_idx", &sd->wake_idx,
5262 sizeof(int), 0644, proc_dointvec_minmax); 5290 sizeof(int), 0644, proc_dointvec_minmax);
5263 set_table_entry(&table[6], 7, "forkexec_idx", &sd->forkexec_idx, 5291 set_table_entry(&table[6], "forkexec_idx", &sd->forkexec_idx,
5264 sizeof(int), 0644, proc_dointvec_minmax); 5292 sizeof(int), 0644, proc_dointvec_minmax);
5265 set_table_entry(&table[7], 8, "busy_factor", &sd->busy_factor, 5293 set_table_entry(&table[7], "busy_factor", &sd->busy_factor,
5266 sizeof(int), 0644, proc_dointvec_minmax); 5294 sizeof(int), 0644, proc_dointvec_minmax);
5267 set_table_entry(&table[8], 9, "imbalance_pct", &sd->imbalance_pct, 5295 set_table_entry(&table[8], "imbalance_pct", &sd->imbalance_pct,
5268 sizeof(int), 0644, proc_dointvec_minmax); 5296 sizeof(int), 0644, proc_dointvec_minmax);
5269 set_table_entry(&table[10], 11, "cache_nice_tries", 5297 set_table_entry(&table[10], "cache_nice_tries",
5270 &sd->cache_nice_tries, 5298 &sd->cache_nice_tries,
5271 sizeof(int), 0644, proc_dointvec_minmax); 5299 sizeof(int), 0644, proc_dointvec_minmax);
5272 set_table_entry(&table[12], 13, "flags", &sd->flags, 5300 set_table_entry(&table[12], "flags", &sd->flags,
5273 sizeof(int), 0644, proc_dointvec_minmax); 5301 sizeof(int), 0644, proc_dointvec_minmax);
5274 5302
5275 return table; 5303 return table;
@@ -5289,7 +5317,6 @@ static ctl_table *sd_alloc_ctl_cpu_table(int cpu)
5289 i = 0; 5317 i = 0;
5290 for_each_domain(cpu, sd) { 5318 for_each_domain(cpu, sd) {
5291 snprintf(buf, 32, "domain%d", i); 5319 snprintf(buf, 32, "domain%d", i);
5292 entry->ctl_name = i + 1;
5293 entry->procname = kstrdup(buf, GFP_KERNEL); 5320 entry->procname = kstrdup(buf, GFP_KERNEL);
5294 entry->mode = 0755; 5321 entry->mode = 0755;
5295 entry->child = sd_alloc_ctl_domain_table(sd); 5322 entry->child = sd_alloc_ctl_domain_table(sd);
@@ -5310,7 +5337,6 @@ static void init_sched_domain_sysctl(void)
5310 5337
5311 for (i = 0; i < cpu_num; i++, entry++) { 5338 for (i = 0; i < cpu_num; i++, entry++) {
5312 snprintf(buf, 32, "cpu%d", i); 5339 snprintf(buf, 32, "cpu%d", i);
5313 entry->ctl_name = i + 1;
5314 entry->procname = kstrdup(buf, GFP_KERNEL); 5340 entry->procname = kstrdup(buf, GFP_KERNEL);
5315 entry->mode = 0755; 5341 entry->mode = 0755;
5316 entry->child = sd_alloc_ctl_cpu_table(i); 5342 entry->child = sd_alloc_ctl_cpu_table(i);
@@ -5379,6 +5405,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
5379 rq->migration_thread = NULL; 5405 rq->migration_thread = NULL;
5380 /* Idle task back to normal (off runqueue, low prio) */ 5406 /* Idle task back to normal (off runqueue, low prio) */
5381 rq = task_rq_lock(rq->idle, &flags); 5407 rq = task_rq_lock(rq->idle, &flags);
5408 update_rq_clock(rq);
5382 deactivate_task(rq, rq->idle, 0); 5409 deactivate_task(rq, rq->idle, 0);
5383 rq->idle->static_prio = MAX_PRIO; 5410 rq->idle->static_prio = MAX_PRIO;
5384 __setscheduler(rq, rq->idle, SCHED_NORMAL, 0); 5411 __setscheduler(rq, rq->idle, SCHED_NORMAL, 0);
@@ -6301,7 +6328,7 @@ int partition_sched_domains(cpumask_t *partition1, cpumask_t *partition2)
6301} 6328}
6302 6329
6303#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) 6330#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
6304int arch_reinit_sched_domains(void) 6331static int arch_reinit_sched_domains(void)
6305{ 6332{
6306 int err; 6333 int err;
6307 6334
@@ -6330,24 +6357,6 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
6330 return ret ? ret : count; 6357 return ret ? ret : count;
6331} 6358}
6332 6359
6333int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls)
6334{
6335 int err = 0;
6336
6337#ifdef CONFIG_SCHED_SMT
6338 if (smt_capable())
6339 err = sysfs_create_file(&cls->kset.kobj,
6340 &attr_sched_smt_power_savings.attr);
6341#endif
6342#ifdef CONFIG_SCHED_MC
6343 if (!err && mc_capable())
6344 err = sysfs_create_file(&cls->kset.kobj,
6345 &attr_sched_mc_power_savings.attr);
6346#endif
6347 return err;
6348}
6349#endif
6350
6351#ifdef CONFIG_SCHED_MC 6360#ifdef CONFIG_SCHED_MC
6352static ssize_t sched_mc_power_savings_show(struct sys_device *dev, char *page) 6361static ssize_t sched_mc_power_savings_show(struct sys_device *dev, char *page)
6353{ 6362{
@@ -6358,8 +6367,8 @@ static ssize_t sched_mc_power_savings_store(struct sys_device *dev,
6358{ 6367{
6359 return sched_power_savings_store(buf, count, 0); 6368 return sched_power_savings_store(buf, count, 0);
6360} 6369}
6361SYSDEV_ATTR(sched_mc_power_savings, 0644, sched_mc_power_savings_show, 6370static SYSDEV_ATTR(sched_mc_power_savings, 0644, sched_mc_power_savings_show,
6362 sched_mc_power_savings_store); 6371 sched_mc_power_savings_store);
6363#endif 6372#endif
6364 6373
6365#ifdef CONFIG_SCHED_SMT 6374#ifdef CONFIG_SCHED_SMT
@@ -6372,8 +6381,26 @@ static ssize_t sched_smt_power_savings_store(struct sys_device *dev,
6372{ 6381{
6373 return sched_power_savings_store(buf, count, 1); 6382 return sched_power_savings_store(buf, count, 1);
6374} 6383}
6375SYSDEV_ATTR(sched_smt_power_savings, 0644, sched_smt_power_savings_show, 6384static SYSDEV_ATTR(sched_smt_power_savings, 0644, sched_smt_power_savings_show,
6376 sched_smt_power_savings_store); 6385 sched_smt_power_savings_store);
6386#endif
6387
6388int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls)
6389{
6390 int err = 0;
6391
6392#ifdef CONFIG_SCHED_SMT
6393 if (smt_capable())
6394 err = sysfs_create_file(&cls->kset.kobj,
6395 &attr_sched_smt_power_savings.attr);
6396#endif
6397#ifdef CONFIG_SCHED_MC
6398 if (!err && mc_capable())
6399 err = sysfs_create_file(&cls->kset.kobj,
6400 &attr_sched_mc_power_savings.attr);
6401#endif
6402 return err;
6403}
6377#endif 6404#endif
6378 6405
6379/* 6406/*
@@ -6616,12 +6643,13 @@ void normalize_rt_tasks(void)
6616 goto out_unlock; 6643 goto out_unlock;
6617#endif 6644#endif
6618 6645
6646 update_rq_clock(rq);
6619 on_rq = p->se.on_rq; 6647 on_rq = p->se.on_rq;
6620 if (on_rq) 6648 if (on_rq)
6621 deactivate_task(task_rq(p), p, 0); 6649 deactivate_task(rq, p, 0);
6622 __setscheduler(rq, p, SCHED_NORMAL, 0); 6650 __setscheduler(rq, p, SCHED_NORMAL, 0);
6623 if (on_rq) { 6651 if (on_rq) {
6624 activate_task(task_rq(p), p, 0); 6652 activate_task(rq, p, 0);
6625 resched_task(rq->curr); 6653 resched_task(rq->curr);
6626 } 6654 }
6627#ifdef CONFIG_SMP 6655#ifdef CONFIG_SMP
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 1c61e5315ad2..87e524762b85 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -29,34 +29,34 @@
29 } while (0) 29 } while (0)
30 30
31static void 31static void
32print_task(struct seq_file *m, struct rq *rq, struct task_struct *p, u64 now) 32print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
33{ 33{
34 if (rq->curr == p) 34 if (rq->curr == p)
35 SEQ_printf(m, "R"); 35 SEQ_printf(m, "R");
36 else 36 else
37 SEQ_printf(m, " "); 37 SEQ_printf(m, " ");
38 38
39 SEQ_printf(m, "%15s %5d %15Ld %13Ld %13Ld %9Ld %5d " 39 SEQ_printf(m, "%15s %5d %15Ld %13Ld %13Ld %9Ld %5d ",
40 "%15Ld %15Ld %15Ld %15Ld %15Ld\n",
41 p->comm, p->pid, 40 p->comm, p->pid,
42 (long long)p->se.fair_key, 41 (long long)p->se.fair_key,
43 (long long)(p->se.fair_key - rq->cfs.fair_clock), 42 (long long)(p->se.fair_key - rq->cfs.fair_clock),
44 (long long)p->se.wait_runtime, 43 (long long)p->se.wait_runtime,
45 (long long)(p->nvcsw + p->nivcsw), 44 (long long)(p->nvcsw + p->nivcsw),
46 p->prio, 45 p->prio);
47#ifdef CONFIG_SCHEDSTATS 46#ifdef CONFIG_SCHEDSTATS
47 SEQ_printf(m, "%15Ld %15Ld %15Ld %15Ld %15Ld\n",
48 (long long)p->se.sum_exec_runtime, 48 (long long)p->se.sum_exec_runtime,
49 (long long)p->se.sum_wait_runtime, 49 (long long)p->se.sum_wait_runtime,
50 (long long)p->se.sum_sleep_runtime, 50 (long long)p->se.sum_sleep_runtime,
51 (long long)p->se.wait_runtime_overruns, 51 (long long)p->se.wait_runtime_overruns,
52 (long long)p->se.wait_runtime_underruns 52 (long long)p->se.wait_runtime_underruns);
53#else 53#else
54 0LL, 0LL, 0LL, 0LL, 0LL 54 SEQ_printf(m, "%15Ld %15Ld %15Ld %15Ld %15Ld\n",
55 0LL, 0LL, 0LL, 0LL, 0LL);
55#endif 56#endif
56 );
57} 57}
58 58
59static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu, u64 now) 59static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)
60{ 60{
61 struct task_struct *g, *p; 61 struct task_struct *g, *p;
62 62
@@ -77,7 +77,7 @@ static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu, u64 now)
77 if (!p->se.on_rq || task_cpu(p) != rq_cpu) 77 if (!p->se.on_rq || task_cpu(p) != rq_cpu)
78 continue; 78 continue;
79 79
80 print_task(m, rq, p, now); 80 print_task(m, rq, p);
81 } while_each_thread(g, p); 81 } while_each_thread(g, p);
82 82
83 read_unlock_irq(&tasklist_lock); 83 read_unlock_irq(&tasklist_lock);
@@ -106,9 +106,9 @@ print_cfs_rq_runtime_sum(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
106 (long long)wait_runtime_rq_sum); 106 (long long)wait_runtime_rq_sum);
107} 107}
108 108
109void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq, u64 now) 109void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
110{ 110{
111 SEQ_printf(m, "\ncfs_rq %p\n", cfs_rq); 111 SEQ_printf(m, "\ncfs_rq\n");
112 112
113#define P(x) \ 113#define P(x) \
114 SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(cfs_rq->x)) 114 SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(cfs_rq->x))
@@ -124,7 +124,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq, u64 now)
124 print_cfs_rq_runtime_sum(m, cpu, cfs_rq); 124 print_cfs_rq_runtime_sum(m, cpu, cfs_rq);
125} 125}
126 126
127static void print_cpu(struct seq_file *m, int cpu, u64 now) 127static void print_cpu(struct seq_file *m, int cpu)
128{ 128{
129 struct rq *rq = &per_cpu(runqueues, cpu); 129 struct rq *rq = &per_cpu(runqueues, cpu);
130 130
@@ -166,9 +166,9 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now)
166 P(cpu_load[4]); 166 P(cpu_load[4]);
167#undef P 167#undef P
168 168
169 print_cfs_stats(m, cpu, now); 169 print_cfs_stats(m, cpu);
170 170
171 print_rq(m, rq, cpu, now); 171 print_rq(m, rq, cpu);
172} 172}
173 173
174static int sched_debug_show(struct seq_file *m, void *v) 174static int sched_debug_show(struct seq_file *m, void *v)
@@ -184,7 +184,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
184 SEQ_printf(m, "now at %Lu nsecs\n", (unsigned long long)now); 184 SEQ_printf(m, "now at %Lu nsecs\n", (unsigned long long)now);
185 185
186 for_each_online_cpu(cpu) 186 for_each_online_cpu(cpu)
187 print_cpu(m, cpu, now); 187 print_cpu(m, cpu);
188 188
189 SEQ_printf(m, "\n"); 189 SEQ_printf(m, "\n");
190 190
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 6f579ff5a9bc..fedbb51bba96 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -75,7 +75,7 @@ enum {
75 75
76unsigned int sysctl_sched_features __read_mostly = 76unsigned int sysctl_sched_features __read_mostly =
77 SCHED_FEAT_FAIR_SLEEPERS *1 | 77 SCHED_FEAT_FAIR_SLEEPERS *1 |
78 SCHED_FEAT_SLEEPER_AVG *1 | 78 SCHED_FEAT_SLEEPER_AVG *0 |
79 SCHED_FEAT_SLEEPER_LOAD_AVG *1 | 79 SCHED_FEAT_SLEEPER_LOAD_AVG *1 |
80 SCHED_FEAT_PRECISE_CPU_LOAD *1 | 80 SCHED_FEAT_PRECISE_CPU_LOAD *1 |
81 SCHED_FEAT_START_DEBIT *1 | 81 SCHED_FEAT_START_DEBIT *1 |
@@ -222,21 +222,25 @@ niced_granularity(struct sched_entity *curr, unsigned long granularity)
222{ 222{
223 u64 tmp; 223 u64 tmp;
224 224
225 if (likely(curr->load.weight == NICE_0_LOAD))
226 return granularity;
225 /* 227 /*
226 * Negative nice levels get the same granularity as nice-0: 228 * Positive nice levels get the same granularity as nice-0:
227 */ 229 */
228 if (likely(curr->load.weight >= NICE_0_LOAD)) 230 if (likely(curr->load.weight < NICE_0_LOAD)) {
229 return granularity; 231 tmp = curr->load.weight * (u64)granularity;
232 return (long) (tmp >> NICE_0_SHIFT);
233 }
230 /* 234 /*
231 * Positive nice level tasks get linearly finer 235 * Negative nice level tasks get linearly finer
232 * granularity: 236 * granularity:
233 */ 237 */
234 tmp = curr->load.weight * (u64)granularity; 238 tmp = curr->load.inv_weight * (u64)granularity;
235 239
236 /* 240 /*
237 * It will always fit into 'long': 241 * It will always fit into 'long':
238 */ 242 */
239 return (long) (tmp >> NICE_0_SHIFT); 243 return (long) (tmp >> WMULT_SHIFT);
240} 244}
241 245
242static inline void 246static inline void
@@ -281,31 +285,28 @@ add_wait_runtime(struct cfs_rq *cfs_rq, struct sched_entity *se, long delta)
281 * are not in our scheduling class. 285 * are not in our scheduling class.
282 */ 286 */
283static inline void 287static inline void
284__update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr, u64 now) 288__update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr)
285{ 289{
286 unsigned long delta, delta_exec, delta_fair; 290 unsigned long delta, delta_exec, delta_fair, delta_mine;
287 long delta_mine;
288 struct load_weight *lw = &cfs_rq->load; 291 struct load_weight *lw = &cfs_rq->load;
289 unsigned long load = lw->weight; 292 unsigned long load = lw->weight;
290 293
291 if (unlikely(!load))
292 return;
293
294 delta_exec = curr->delta_exec; 294 delta_exec = curr->delta_exec;
295 schedstat_set(curr->exec_max, max((u64)delta_exec, curr->exec_max)); 295 schedstat_set(curr->exec_max, max((u64)delta_exec, curr->exec_max));
296 296
297 curr->sum_exec_runtime += delta_exec; 297 curr->sum_exec_runtime += delta_exec;
298 cfs_rq->exec_clock += delta_exec; 298 cfs_rq->exec_clock += delta_exec;
299 299
300 if (unlikely(!load))
301 return;
302
300 delta_fair = calc_delta_fair(delta_exec, lw); 303 delta_fair = calc_delta_fair(delta_exec, lw);
301 delta_mine = calc_delta_mine(delta_exec, curr->load.weight, lw); 304 delta_mine = calc_delta_mine(delta_exec, curr->load.weight, lw);
302 305
303 if (cfs_rq->sleeper_bonus > sysctl_sched_stat_granularity) { 306 if (cfs_rq->sleeper_bonus > sysctl_sched_granularity) {
304 delta = calc_delta_mine(cfs_rq->sleeper_bonus, 307 delta = min(cfs_rq->sleeper_bonus, (u64)delta_exec);
305 curr->load.weight, lw); 308 delta = calc_delta_mine(delta, curr->load.weight, lw);
306 if (unlikely(delta > cfs_rq->sleeper_bonus)) 309 delta = min((u64)delta, cfs_rq->sleeper_bonus);
307 delta = cfs_rq->sleeper_bonus;
308
309 cfs_rq->sleeper_bonus -= delta; 310 cfs_rq->sleeper_bonus -= delta;
310 delta_mine -= delta; 311 delta_mine -= delta;
311 } 312 }
@@ -321,7 +322,7 @@ __update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr, u64 now)
321 add_wait_runtime(cfs_rq, curr, delta_mine - delta_exec); 322 add_wait_runtime(cfs_rq, curr, delta_mine - delta_exec);
322} 323}
323 324
324static void update_curr(struct cfs_rq *cfs_rq, u64 now) 325static void update_curr(struct cfs_rq *cfs_rq)
325{ 326{
326 struct sched_entity *curr = cfs_rq_curr(cfs_rq); 327 struct sched_entity *curr = cfs_rq_curr(cfs_rq);
327 unsigned long delta_exec; 328 unsigned long delta_exec;
@@ -334,22 +335,22 @@ static void update_curr(struct cfs_rq *cfs_rq, u64 now)
334 * since the last time we changed load (this cannot 335 * since the last time we changed load (this cannot
335 * overflow on 32 bits): 336 * overflow on 32 bits):
336 */ 337 */
337 delta_exec = (unsigned long)(now - curr->exec_start); 338 delta_exec = (unsigned long)(rq_of(cfs_rq)->clock - curr->exec_start);
338 339
339 curr->delta_exec += delta_exec; 340 curr->delta_exec += delta_exec;
340 341
341 if (unlikely(curr->delta_exec > sysctl_sched_stat_granularity)) { 342 if (unlikely(curr->delta_exec > sysctl_sched_stat_granularity)) {
342 __update_curr(cfs_rq, curr, now); 343 __update_curr(cfs_rq, curr);
343 curr->delta_exec = 0; 344 curr->delta_exec = 0;
344 } 345 }
345 curr->exec_start = now; 346 curr->exec_start = rq_of(cfs_rq)->clock;
346} 347}
347 348
348static inline void 349static inline void
349update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now) 350update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
350{ 351{
351 se->wait_start_fair = cfs_rq->fair_clock; 352 se->wait_start_fair = cfs_rq->fair_clock;
352 schedstat_set(se->wait_start, now); 353 schedstat_set(se->wait_start, rq_of(cfs_rq)->clock);
353} 354}
354 355
355/* 356/*
@@ -377,8 +378,7 @@ calc_weighted(unsigned long delta, unsigned long weight, int shift)
377/* 378/*
378 * Task is being enqueued - update stats: 379 * Task is being enqueued - update stats:
379 */ 380 */
380static void 381static void update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se)
381update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
382{ 382{
383 s64 key; 383 s64 key;
384 384
@@ -387,7 +387,7 @@ update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
387 * a dequeue/enqueue event is a NOP) 387 * a dequeue/enqueue event is a NOP)
388 */ 388 */
389 if (se != cfs_rq_curr(cfs_rq)) 389 if (se != cfs_rq_curr(cfs_rq))
390 update_stats_wait_start(cfs_rq, se, now); 390 update_stats_wait_start(cfs_rq, se);
391 /* 391 /*
392 * Update the key: 392 * Update the key:
393 */ 393 */
@@ -407,7 +407,8 @@ update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
407 (WMULT_SHIFT - NICE_0_SHIFT); 407 (WMULT_SHIFT - NICE_0_SHIFT);
408 } else { 408 } else {
409 tmp = se->wait_runtime; 409 tmp = se->wait_runtime;
410 key -= (tmp * se->load.weight) >> NICE_0_SHIFT; 410 key -= (tmp * se->load.inv_weight) >>
411 (WMULT_SHIFT - NICE_0_SHIFT);
411 } 412 }
412 } 413 }
413 414
@@ -418,11 +419,12 @@ update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
418 * Note: must be called with a freshly updated rq->fair_clock. 419 * Note: must be called with a freshly updated rq->fair_clock.
419 */ 420 */
420static inline void 421static inline void
421__update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now) 422__update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
422{ 423{
423 unsigned long delta_fair = se->delta_fair_run; 424 unsigned long delta_fair = se->delta_fair_run;
424 425
425 schedstat_set(se->wait_max, max(se->wait_max, now - se->wait_start)); 426 schedstat_set(se->wait_max, max(se->wait_max,
427 rq_of(cfs_rq)->clock - se->wait_start));
426 428
427 if (unlikely(se->load.weight != NICE_0_LOAD)) 429 if (unlikely(se->load.weight != NICE_0_LOAD))
428 delta_fair = calc_weighted(delta_fair, se->load.weight, 430 delta_fair = calc_weighted(delta_fair, se->load.weight,
@@ -432,7 +434,7 @@ __update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
432} 434}
433 435
434static void 436static void
435update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now) 437update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
436{ 438{
437 unsigned long delta_fair; 439 unsigned long delta_fair;
438 440
@@ -442,7 +444,7 @@ update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
442 se->delta_fair_run += delta_fair; 444 se->delta_fair_run += delta_fair;
443 if (unlikely(abs(se->delta_fair_run) >= 445 if (unlikely(abs(se->delta_fair_run) >=
444 sysctl_sched_stat_granularity)) { 446 sysctl_sched_stat_granularity)) {
445 __update_stats_wait_end(cfs_rq, se, now); 447 __update_stats_wait_end(cfs_rq, se);
446 se->delta_fair_run = 0; 448 se->delta_fair_run = 0;
447 } 449 }
448 450
@@ -451,34 +453,34 @@ update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
451} 453}
452 454
453static inline void 455static inline void
454update_stats_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now) 456update_stats_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se)
455{ 457{
456 update_curr(cfs_rq, now); 458 update_curr(cfs_rq);
457 /* 459 /*
458 * Mark the end of the wait period if dequeueing a 460 * Mark the end of the wait period if dequeueing a
459 * waiting task: 461 * waiting task:
460 */ 462 */
461 if (se != cfs_rq_curr(cfs_rq)) 463 if (se != cfs_rq_curr(cfs_rq))
462 update_stats_wait_end(cfs_rq, se, now); 464 update_stats_wait_end(cfs_rq, se);
463} 465}
464 466
465/* 467/*
466 * We are picking a new current task - update its stats: 468 * We are picking a new current task - update its stats:
467 */ 469 */
468static inline void 470static inline void
469update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now) 471update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
470{ 472{
471 /* 473 /*
472 * We are starting a new run period: 474 * We are starting a new run period:
473 */ 475 */
474 se->exec_start = now; 476 se->exec_start = rq_of(cfs_rq)->clock;
475} 477}
476 478
477/* 479/*
478 * We are descheduling a task - update its stats: 480 * We are descheduling a task - update its stats:
479 */ 481 */
480static inline void 482static inline void
481update_stats_curr_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now) 483update_stats_curr_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
482{ 484{
483 se->exec_start = 0; 485 se->exec_start = 0;
484} 486}
@@ -487,8 +489,7 @@ update_stats_curr_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
487 * Scheduling class queueing methods: 489 * Scheduling class queueing methods:
488 */ 490 */
489 491
490static void 492static void __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
491__enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
492{ 493{
493 unsigned long load = cfs_rq->load.weight, delta_fair; 494 unsigned long load = cfs_rq->load.weight, delta_fair;
494 long prev_runtime; 495 long prev_runtime;
@@ -518,12 +519,13 @@ __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
518 * Track the amount of bonus we've given to sleepers: 519 * Track the amount of bonus we've given to sleepers:
519 */ 520 */
520 cfs_rq->sleeper_bonus += delta_fair; 521 cfs_rq->sleeper_bonus += delta_fair;
522 if (unlikely(cfs_rq->sleeper_bonus > sysctl_sched_runtime_limit))
523 cfs_rq->sleeper_bonus = sysctl_sched_runtime_limit;
521 524
522 schedstat_add(cfs_rq, wait_runtime, se->wait_runtime); 525 schedstat_add(cfs_rq, wait_runtime, se->wait_runtime);
523} 526}
524 527
525static void 528static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
526enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
527{ 529{
528 struct task_struct *tsk = task_of(se); 530 struct task_struct *tsk = task_of(se);
529 unsigned long delta_fair; 531 unsigned long delta_fair;
@@ -538,7 +540,7 @@ enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
538 se->delta_fair_sleep += delta_fair; 540 se->delta_fair_sleep += delta_fair;
539 if (unlikely(abs(se->delta_fair_sleep) >= 541 if (unlikely(abs(se->delta_fair_sleep) >=
540 sysctl_sched_stat_granularity)) { 542 sysctl_sched_stat_granularity)) {
541 __enqueue_sleeper(cfs_rq, se, now); 543 __enqueue_sleeper(cfs_rq, se);
542 se->delta_fair_sleep = 0; 544 se->delta_fair_sleep = 0;
543 } 545 }
544 546
@@ -546,7 +548,7 @@ enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
546 548
547#ifdef CONFIG_SCHEDSTATS 549#ifdef CONFIG_SCHEDSTATS
548 if (se->sleep_start) { 550 if (se->sleep_start) {
549 u64 delta = now - se->sleep_start; 551 u64 delta = rq_of(cfs_rq)->clock - se->sleep_start;
550 552
551 if ((s64)delta < 0) 553 if ((s64)delta < 0)
552 delta = 0; 554 delta = 0;
@@ -558,7 +560,7 @@ enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
558 se->sum_sleep_runtime += delta; 560 se->sum_sleep_runtime += delta;
559 } 561 }
560 if (se->block_start) { 562 if (se->block_start) {
561 u64 delta = now - se->block_start; 563 u64 delta = rq_of(cfs_rq)->clock - se->block_start;
562 564
563 if ((s64)delta < 0) 565 if ((s64)delta < 0)
564 delta = 0; 566 delta = 0;
@@ -573,26 +575,24 @@ enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
573} 575}
574 576
575static void 577static void
576enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, 578enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup)
577 int wakeup, u64 now)
578{ 579{
579 /* 580 /*
580 * Update the fair clock. 581 * Update the fair clock.
581 */ 582 */
582 update_curr(cfs_rq, now); 583 update_curr(cfs_rq);
583 584
584 if (wakeup) 585 if (wakeup)
585 enqueue_sleeper(cfs_rq, se, now); 586 enqueue_sleeper(cfs_rq, se);
586 587
587 update_stats_enqueue(cfs_rq, se, now); 588 update_stats_enqueue(cfs_rq, se);
588 __enqueue_entity(cfs_rq, se); 589 __enqueue_entity(cfs_rq, se);
589} 590}
590 591
591static void 592static void
592dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, 593dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
593 int sleep, u64 now)
594{ 594{
595 update_stats_dequeue(cfs_rq, se, now); 595 update_stats_dequeue(cfs_rq, se);
596 if (sleep) { 596 if (sleep) {
597 se->sleep_start_fair = cfs_rq->fair_clock; 597 se->sleep_start_fair = cfs_rq->fair_clock;
598#ifdef CONFIG_SCHEDSTATS 598#ifdef CONFIG_SCHEDSTATS
@@ -600,9 +600,9 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
600 struct task_struct *tsk = task_of(se); 600 struct task_struct *tsk = task_of(se);
601 601
602 if (tsk->state & TASK_INTERRUPTIBLE) 602 if (tsk->state & TASK_INTERRUPTIBLE)
603 se->sleep_start = now; 603 se->sleep_start = rq_of(cfs_rq)->clock;
604 if (tsk->state & TASK_UNINTERRUPTIBLE) 604 if (tsk->state & TASK_UNINTERRUPTIBLE)
605 se->block_start = now; 605 se->block_start = rq_of(cfs_rq)->clock;
606 } 606 }
607 cfs_rq->wait_runtime -= se->wait_runtime; 607 cfs_rq->wait_runtime -= se->wait_runtime;
608#endif 608#endif
@@ -629,7 +629,7 @@ __check_preempt_curr_fair(struct cfs_rq *cfs_rq, struct sched_entity *se,
629} 629}
630 630
631static inline void 631static inline void
632set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now) 632set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
633{ 633{
634 /* 634 /*
635 * Any task has to be enqueued before it get to execute on 635 * Any task has to be enqueued before it get to execute on
@@ -638,49 +638,46 @@ set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
638 * done a put_prev_task_fair() shortly before this, which 638 * done a put_prev_task_fair() shortly before this, which
639 * updated rq->fair_clock - used by update_stats_wait_end()) 639 * updated rq->fair_clock - used by update_stats_wait_end())
640 */ 640 */
641 update_stats_wait_end(cfs_rq, se, now); 641 update_stats_wait_end(cfs_rq, se);
642 update_stats_curr_start(cfs_rq, se, now); 642 update_stats_curr_start(cfs_rq, se);
643 set_cfs_rq_curr(cfs_rq, se); 643 set_cfs_rq_curr(cfs_rq, se);
644} 644}
645 645
646static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq, u64 now) 646static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq)
647{ 647{
648 struct sched_entity *se = __pick_next_entity(cfs_rq); 648 struct sched_entity *se = __pick_next_entity(cfs_rq);
649 649
650 set_next_entity(cfs_rq, se, now); 650 set_next_entity(cfs_rq, se);
651 651
652 return se; 652 return se;
653} 653}
654 654
655static void 655static void put_prev_entity(struct cfs_rq *cfs_rq, struct sched_entity *prev)
656put_prev_entity(struct cfs_rq *cfs_rq, struct sched_entity *prev, u64 now)
657{ 656{
658 /* 657 /*
659 * If still on the runqueue then deactivate_task() 658 * If still on the runqueue then deactivate_task()
660 * was not called and update_curr() has to be done: 659 * was not called and update_curr() has to be done:
661 */ 660 */
662 if (prev->on_rq) 661 if (prev->on_rq)
663 update_curr(cfs_rq, now); 662 update_curr(cfs_rq);
664 663
665 update_stats_curr_end(cfs_rq, prev, now); 664 update_stats_curr_end(cfs_rq, prev);
666 665
667 if (prev->on_rq) 666 if (prev->on_rq)
668 update_stats_wait_start(cfs_rq, prev, now); 667 update_stats_wait_start(cfs_rq, prev);
669 set_cfs_rq_curr(cfs_rq, NULL); 668 set_cfs_rq_curr(cfs_rq, NULL);
670} 669}
671 670
672static void entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) 671static void entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
673{ 672{
674 struct rq *rq = rq_of(cfs_rq);
675 struct sched_entity *next; 673 struct sched_entity *next;
676 u64 now = __rq_clock(rq);
677 674
678 /* 675 /*
679 * Dequeue and enqueue the task to update its 676 * Dequeue and enqueue the task to update its
680 * position within the tree: 677 * position within the tree:
681 */ 678 */
682 dequeue_entity(cfs_rq, curr, 0, now); 679 dequeue_entity(cfs_rq, curr, 0);
683 enqueue_entity(cfs_rq, curr, 0, now); 680 enqueue_entity(cfs_rq, curr, 0);
684 681
685 /* 682 /*
686 * Reschedule if another task tops the current one. 683 * Reschedule if another task tops the current one.
@@ -785,8 +782,7 @@ static inline int is_same_group(struct task_struct *curr, struct task_struct *p)
785 * increased. Here we update the fair scheduling stats and 782 * increased. Here we update the fair scheduling stats and
786 * then put the task into the rbtree: 783 * then put the task into the rbtree:
787 */ 784 */
788static void 785static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup)
789enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
790{ 786{
791 struct cfs_rq *cfs_rq; 787 struct cfs_rq *cfs_rq;
792 struct sched_entity *se = &p->se; 788 struct sched_entity *se = &p->se;
@@ -795,7 +791,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
795 if (se->on_rq) 791 if (se->on_rq)
796 break; 792 break;
797 cfs_rq = cfs_rq_of(se); 793 cfs_rq = cfs_rq_of(se);
798 enqueue_entity(cfs_rq, se, wakeup, now); 794 enqueue_entity(cfs_rq, se, wakeup);
799 } 795 }
800} 796}
801 797
@@ -804,15 +800,14 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
804 * decreased. We remove the task from the rbtree and 800 * decreased. We remove the task from the rbtree and
805 * update the fair scheduling stats: 801 * update the fair scheduling stats:
806 */ 802 */
807static void 803static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep)
808dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep, u64 now)
809{ 804{
810 struct cfs_rq *cfs_rq; 805 struct cfs_rq *cfs_rq;
811 struct sched_entity *se = &p->se; 806 struct sched_entity *se = &p->se;
812 807
813 for_each_sched_entity(se) { 808 for_each_sched_entity(se) {
814 cfs_rq = cfs_rq_of(se); 809 cfs_rq = cfs_rq_of(se);
815 dequeue_entity(cfs_rq, se, sleep, now); 810 dequeue_entity(cfs_rq, se, sleep);
816 /* Don't dequeue parent if it has other entities besides us */ 811 /* Don't dequeue parent if it has other entities besides us */
817 if (cfs_rq->load.weight) 812 if (cfs_rq->load.weight)
818 break; 813 break;
@@ -825,14 +820,14 @@ dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep, u64 now)
825static void yield_task_fair(struct rq *rq, struct task_struct *p) 820static void yield_task_fair(struct rq *rq, struct task_struct *p)
826{ 821{
827 struct cfs_rq *cfs_rq = task_cfs_rq(p); 822 struct cfs_rq *cfs_rq = task_cfs_rq(p);
828 u64 now = __rq_clock(rq);
829 823
824 __update_rq_clock(rq);
830 /* 825 /*
831 * Dequeue and enqueue the task to update its 826 * Dequeue and enqueue the task to update its
832 * position within the tree: 827 * position within the tree:
833 */ 828 */
834 dequeue_entity(cfs_rq, &p->se, 0, now); 829 dequeue_entity(cfs_rq, &p->se, 0);
835 enqueue_entity(cfs_rq, &p->se, 0, now); 830 enqueue_entity(cfs_rq, &p->se, 0);
836} 831}
837 832
838/* 833/*
@@ -845,7 +840,8 @@ static void check_preempt_curr_fair(struct rq *rq, struct task_struct *p)
845 unsigned long gran; 840 unsigned long gran;
846 841
847 if (unlikely(rt_prio(p->prio))) { 842 if (unlikely(rt_prio(p->prio))) {
848 update_curr(cfs_rq, rq_clock(rq)); 843 update_rq_clock(rq);
844 update_curr(cfs_rq);
849 resched_task(curr); 845 resched_task(curr);
850 return; 846 return;
851 } 847 }
@@ -861,7 +857,7 @@ static void check_preempt_curr_fair(struct rq *rq, struct task_struct *p)
861 __check_preempt_curr_fair(cfs_rq, &p->se, &curr->se, gran); 857 __check_preempt_curr_fair(cfs_rq, &p->se, &curr->se, gran);
862} 858}
863 859
864static struct task_struct *pick_next_task_fair(struct rq *rq, u64 now) 860static struct task_struct *pick_next_task_fair(struct rq *rq)
865{ 861{
866 struct cfs_rq *cfs_rq = &rq->cfs; 862 struct cfs_rq *cfs_rq = &rq->cfs;
867 struct sched_entity *se; 863 struct sched_entity *se;
@@ -870,7 +866,7 @@ static struct task_struct *pick_next_task_fair(struct rq *rq, u64 now)
870 return NULL; 866 return NULL;
871 867
872 do { 868 do {
873 se = pick_next_entity(cfs_rq, now); 869 se = pick_next_entity(cfs_rq);
874 cfs_rq = group_cfs_rq(se); 870 cfs_rq = group_cfs_rq(se);
875 } while (cfs_rq); 871 } while (cfs_rq);
876 872
@@ -880,14 +876,14 @@ static struct task_struct *pick_next_task_fair(struct rq *rq, u64 now)
880/* 876/*
881 * Account for a descheduled task: 877 * Account for a descheduled task:
882 */ 878 */
883static void put_prev_task_fair(struct rq *rq, struct task_struct *prev, u64 now) 879static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
884{ 880{
885 struct sched_entity *se = &prev->se; 881 struct sched_entity *se = &prev->se;
886 struct cfs_rq *cfs_rq; 882 struct cfs_rq *cfs_rq;
887 883
888 for_each_sched_entity(se) { 884 for_each_sched_entity(se) {
889 cfs_rq = cfs_rq_of(se); 885 cfs_rq = cfs_rq_of(se);
890 put_prev_entity(cfs_rq, se, now); 886 put_prev_entity(cfs_rq, se);
891 } 887 }
892} 888}
893 889
@@ -930,6 +926,7 @@ static struct task_struct *load_balance_next_fair(void *arg)
930 return __load_balance_iterator(cfs_rq, cfs_rq->rb_load_balance_curr); 926 return __load_balance_iterator(cfs_rq, cfs_rq->rb_load_balance_curr);
931} 927}
932 928
929#ifdef CONFIG_FAIR_GROUP_SCHED
933static int cfs_rq_best_prio(struct cfs_rq *cfs_rq) 930static int cfs_rq_best_prio(struct cfs_rq *cfs_rq)
934{ 931{
935 struct sched_entity *curr; 932 struct sched_entity *curr;
@@ -943,12 +940,13 @@ static int cfs_rq_best_prio(struct cfs_rq *cfs_rq)
943 940
944 return p->prio; 941 return p->prio;
945} 942}
943#endif
946 944
947static int 945static unsigned long
948load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest, 946load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
949 unsigned long max_nr_move, unsigned long max_load_move, 947 unsigned long max_nr_move, unsigned long max_load_move,
950 struct sched_domain *sd, enum cpu_idle_type idle, 948 struct sched_domain *sd, enum cpu_idle_type idle,
951 int *all_pinned, unsigned long *total_load_moved) 949 int *all_pinned, int *this_best_prio)
952{ 950{
953 struct cfs_rq *busy_cfs_rq; 951 struct cfs_rq *busy_cfs_rq;
954 unsigned long load_moved, total_nr_moved = 0, nr_moved; 952 unsigned long load_moved, total_nr_moved = 0, nr_moved;
@@ -959,15 +957,14 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
959 cfs_rq_iterator.next = load_balance_next_fair; 957 cfs_rq_iterator.next = load_balance_next_fair;
960 958
961 for_each_leaf_cfs_rq(busiest, busy_cfs_rq) { 959 for_each_leaf_cfs_rq(busiest, busy_cfs_rq) {
960#ifdef CONFIG_FAIR_GROUP_SCHED
962 struct cfs_rq *this_cfs_rq; 961 struct cfs_rq *this_cfs_rq;
963 long imbalance; 962 long imbalance;
964 unsigned long maxload; 963 unsigned long maxload;
965 int this_best_prio, best_prio, best_prio_seen = 0;
966 964
967 this_cfs_rq = cpu_cfs_rq(busy_cfs_rq, this_cpu); 965 this_cfs_rq = cpu_cfs_rq(busy_cfs_rq, this_cpu);
968 966
969 imbalance = busy_cfs_rq->load.weight - 967 imbalance = busy_cfs_rq->load.weight - this_cfs_rq->load.weight;
970 this_cfs_rq->load.weight;
971 /* Don't pull if this_cfs_rq has more load than busy_cfs_rq */ 968 /* Don't pull if this_cfs_rq has more load than busy_cfs_rq */
972 if (imbalance <= 0) 969 if (imbalance <= 0)
973 continue; 970 continue;
@@ -976,27 +973,17 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
976 imbalance /= 2; 973 imbalance /= 2;
977 maxload = min(rem_load_move, imbalance); 974 maxload = min(rem_load_move, imbalance);
978 975
979 this_best_prio = cfs_rq_best_prio(this_cfs_rq); 976 *this_best_prio = cfs_rq_best_prio(this_cfs_rq);
980 best_prio = cfs_rq_best_prio(busy_cfs_rq); 977#else
981 978# define maxload rem_load_move
982 /* 979#endif
983 * Enable handling of the case where there is more than one task
984 * with the best priority. If the current running task is one
985 * of those with prio==best_prio we know it won't be moved
986 * and therefore it's safe to override the skip (based on load)
987 * of any task we find with that prio.
988 */
989 if (cfs_rq_curr(busy_cfs_rq) == &busiest->curr->se)
990 best_prio_seen = 1;
991
992 /* pass busy_cfs_rq argument into 980 /* pass busy_cfs_rq argument into
993 * load_balance_[start|next]_fair iterators 981 * load_balance_[start|next]_fair iterators
994 */ 982 */
995 cfs_rq_iterator.arg = busy_cfs_rq; 983 cfs_rq_iterator.arg = busy_cfs_rq;
996 nr_moved = balance_tasks(this_rq, this_cpu, busiest, 984 nr_moved = balance_tasks(this_rq, this_cpu, busiest,
997 max_nr_move, maxload, sd, idle, all_pinned, 985 max_nr_move, maxload, sd, idle, all_pinned,
998 &load_moved, this_best_prio, best_prio, 986 &load_moved, this_best_prio, &cfs_rq_iterator);
999 best_prio_seen, &cfs_rq_iterator);
1000 987
1001 total_nr_moved += nr_moved; 988 total_nr_moved += nr_moved;
1002 max_nr_move -= nr_moved; 989 max_nr_move -= nr_moved;
@@ -1006,9 +993,7 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
1006 break; 993 break;
1007 } 994 }
1008 995
1009 *total_load_moved = max_load_move - rem_load_move; 996 return max_load_move - rem_load_move;
1010
1011 return total_nr_moved;
1012} 997}
1013 998
1014/* 999/*
@@ -1032,14 +1017,14 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr)
1032 * monopolize the CPU. Note: the parent runqueue is locked, 1017 * monopolize the CPU. Note: the parent runqueue is locked,
1033 * the child is not running yet. 1018 * the child is not running yet.
1034 */ 1019 */
1035static void task_new_fair(struct rq *rq, struct task_struct *p, u64 now) 1020static void task_new_fair(struct rq *rq, struct task_struct *p)
1036{ 1021{
1037 struct cfs_rq *cfs_rq = task_cfs_rq(p); 1022 struct cfs_rq *cfs_rq = task_cfs_rq(p);
1038 struct sched_entity *se = &p->se; 1023 struct sched_entity *se = &p->se;
1039 1024
1040 sched_info_queued(p); 1025 sched_info_queued(p);
1041 1026
1042 update_stats_enqueue(cfs_rq, se, now); 1027 update_stats_enqueue(cfs_rq, se);
1043 /* 1028 /*
1044 * Child runs first: we let it run before the parent 1029 * Child runs first: we let it run before the parent
1045 * until it reschedules once. We set up the key so that 1030 * until it reschedules once. We set up the key so that
@@ -1072,15 +1057,10 @@ static void task_new_fair(struct rq *rq, struct task_struct *p, u64 now)
1072 */ 1057 */
1073static void set_curr_task_fair(struct rq *rq) 1058static void set_curr_task_fair(struct rq *rq)
1074{ 1059{
1075 struct task_struct *curr = rq->curr; 1060 struct sched_entity *se = &rq->curr.se;
1076 struct sched_entity *se = &curr->se;
1077 u64 now = rq_clock(rq);
1078 struct cfs_rq *cfs_rq;
1079 1061
1080 for_each_sched_entity(se) { 1062 for_each_sched_entity(se)
1081 cfs_rq = cfs_rq_of(se); 1063 set_next_entity(cfs_rq_of(se), se);
1082 set_next_entity(cfs_rq, se, now);
1083 }
1084} 1064}
1085#else 1065#else
1086static void set_curr_task_fair(struct rq *rq) 1066static void set_curr_task_fair(struct rq *rq)
@@ -1109,12 +1089,11 @@ struct sched_class fair_sched_class __read_mostly = {
1109}; 1089};
1110 1090
1111#ifdef CONFIG_SCHED_DEBUG 1091#ifdef CONFIG_SCHED_DEBUG
1112void print_cfs_stats(struct seq_file *m, int cpu, u64 now) 1092static void print_cfs_stats(struct seq_file *m, int cpu)
1113{ 1093{
1114 struct rq *rq = cpu_rq(cpu);
1115 struct cfs_rq *cfs_rq; 1094 struct cfs_rq *cfs_rq;
1116 1095
1117 for_each_leaf_cfs_rq(rq, cfs_rq) 1096 for_each_leaf_cfs_rq(cpu_rq(cpu), cfs_rq)
1118 print_cfs_rq(m, cpu, cfs_rq, now); 1097 print_cfs_rq(m, cpu, cfs_rq);
1119} 1098}
1120#endif 1099#endif
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c
index 41841e741c4a..3503fb2d9f96 100644
--- a/kernel/sched_idletask.c
+++ b/kernel/sched_idletask.c
@@ -13,7 +13,7 @@ static void check_preempt_curr_idle(struct rq *rq, struct task_struct *p)
13 resched_task(rq->idle); 13 resched_task(rq->idle);
14} 14}
15 15
16static struct task_struct *pick_next_task_idle(struct rq *rq, u64 now) 16static struct task_struct *pick_next_task_idle(struct rq *rq)
17{ 17{
18 schedstat_inc(rq, sched_goidle); 18 schedstat_inc(rq, sched_goidle);
19 19
@@ -25,7 +25,7 @@ static struct task_struct *pick_next_task_idle(struct rq *rq, u64 now)
25 * message if some code attempts to do it: 25 * message if some code attempts to do it:
26 */ 26 */
27static void 27static void
28dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep, u64 now) 28dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep)
29{ 29{
30 spin_unlock_irq(&rq->lock); 30 spin_unlock_irq(&rq->lock);
31 printk(KERN_ERR "bad: scheduling from the idle thread!\n"); 31 printk(KERN_ERR "bad: scheduling from the idle thread!\n");
@@ -33,15 +33,15 @@ dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep, u64 now)
33 spin_lock_irq(&rq->lock); 33 spin_lock_irq(&rq->lock);
34} 34}
35 35
36static void put_prev_task_idle(struct rq *rq, struct task_struct *prev, u64 now) 36static void put_prev_task_idle(struct rq *rq, struct task_struct *prev)
37{ 37{
38} 38}
39 39
40static int 40static unsigned long
41load_balance_idle(struct rq *this_rq, int this_cpu, struct rq *busiest, 41load_balance_idle(struct rq *this_rq, int this_cpu, struct rq *busiest,
42 unsigned long max_nr_move, unsigned long max_load_move, 42 unsigned long max_nr_move, unsigned long max_load_move,
43 struct sched_domain *sd, enum cpu_idle_type idle, 43 struct sched_domain *sd, enum cpu_idle_type idle,
44 int *all_pinned, unsigned long *total_load_moved) 44 int *all_pinned, int *this_best_prio)
45{ 45{
46 return 0; 46 return 0;
47} 47}
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 002fcf8d3f64..dcdcad632fd9 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -7,7 +7,7 @@
7 * Update the current task's runtime statistics. Skip current tasks that 7 * Update the current task's runtime statistics. Skip current tasks that
8 * are not in our scheduling class. 8 * are not in our scheduling class.
9 */ 9 */
10static inline void update_curr_rt(struct rq *rq, u64 now) 10static inline void update_curr_rt(struct rq *rq)
11{ 11{
12 struct task_struct *curr = rq->curr; 12 struct task_struct *curr = rq->curr;
13 u64 delta_exec; 13 u64 delta_exec;
@@ -15,18 +15,17 @@ static inline void update_curr_rt(struct rq *rq, u64 now)
15 if (!task_has_rt_policy(curr)) 15 if (!task_has_rt_policy(curr))
16 return; 16 return;
17 17
18 delta_exec = now - curr->se.exec_start; 18 delta_exec = rq->clock - curr->se.exec_start;
19 if (unlikely((s64)delta_exec < 0)) 19 if (unlikely((s64)delta_exec < 0))
20 delta_exec = 0; 20 delta_exec = 0;
21 21
22 schedstat_set(curr->se.exec_max, max(curr->se.exec_max, delta_exec)); 22 schedstat_set(curr->se.exec_max, max(curr->se.exec_max, delta_exec));
23 23
24 curr->se.sum_exec_runtime += delta_exec; 24 curr->se.sum_exec_runtime += delta_exec;
25 curr->se.exec_start = now; 25 curr->se.exec_start = rq->clock;
26} 26}
27 27
28static void 28static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)
29enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
30{ 29{
31 struct rt_prio_array *array = &rq->rt.active; 30 struct rt_prio_array *array = &rq->rt.active;
32 31
@@ -37,12 +36,11 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
37/* 36/*
38 * Adding/removing a task to/from a priority array: 37 * Adding/removing a task to/from a priority array:
39 */ 38 */
40static void 39static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep)
41dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep, u64 now)
42{ 40{
43 struct rt_prio_array *array = &rq->rt.active; 41 struct rt_prio_array *array = &rq->rt.active;
44 42
45 update_curr_rt(rq, now); 43 update_curr_rt(rq);
46 44
47 list_del(&p->run_list); 45 list_del(&p->run_list);
48 if (list_empty(array->queue + p->prio)) 46 if (list_empty(array->queue + p->prio))
@@ -75,7 +73,7 @@ static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p)
75 resched_task(rq->curr); 73 resched_task(rq->curr);
76} 74}
77 75
78static struct task_struct *pick_next_task_rt(struct rq *rq, u64 now) 76static struct task_struct *pick_next_task_rt(struct rq *rq)
79{ 77{
80 struct rt_prio_array *array = &rq->rt.active; 78 struct rt_prio_array *array = &rq->rt.active;
81 struct task_struct *next; 79 struct task_struct *next;
@@ -89,14 +87,14 @@ static struct task_struct *pick_next_task_rt(struct rq *rq, u64 now)
89 queue = array->queue + idx; 87 queue = array->queue + idx;
90 next = list_entry(queue->next, struct task_struct, run_list); 88 next = list_entry(queue->next, struct task_struct, run_list);
91 89
92 next->se.exec_start = now; 90 next->se.exec_start = rq->clock;
93 91
94 return next; 92 return next;
95} 93}
96 94
97static void put_prev_task_rt(struct rq *rq, struct task_struct *p, u64 now) 95static void put_prev_task_rt(struct rq *rq, struct task_struct *p)
98{ 96{
99 update_curr_rt(rq, now); 97 update_curr_rt(rq);
100 p->se.exec_start = 0; 98 p->se.exec_start = 0;
101} 99}
102 100
@@ -172,28 +170,15 @@ static struct task_struct *load_balance_next_rt(void *arg)
172 return p; 170 return p;
173} 171}
174 172
175static int 173static unsigned long
176load_balance_rt(struct rq *this_rq, int this_cpu, struct rq *busiest, 174load_balance_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
177 unsigned long max_nr_move, unsigned long max_load_move, 175 unsigned long max_nr_move, unsigned long max_load_move,
178 struct sched_domain *sd, enum cpu_idle_type idle, 176 struct sched_domain *sd, enum cpu_idle_type idle,
179 int *all_pinned, unsigned long *load_moved) 177 int *all_pinned, int *this_best_prio)
180{ 178{
181 int this_best_prio, best_prio, best_prio_seen = 0;
182 int nr_moved; 179 int nr_moved;
183 struct rq_iterator rt_rq_iterator; 180 struct rq_iterator rt_rq_iterator;
184 181 unsigned long load_moved;
185 best_prio = sched_find_first_bit(busiest->rt.active.bitmap);
186 this_best_prio = sched_find_first_bit(this_rq->rt.active.bitmap);
187
188 /*
189 * Enable handling of the case where there is more than one task
190 * with the best priority. If the current running task is one
191 * of those with prio==best_prio we know it won't be moved
192 * and therefore it's safe to override the skip (based on load)
193 * of any task we find with that prio.
194 */
195 if (busiest->curr->prio == best_prio)
196 best_prio_seen = 1;
197 182
198 rt_rq_iterator.start = load_balance_start_rt; 183 rt_rq_iterator.start = load_balance_start_rt;
199 rt_rq_iterator.next = load_balance_next_rt; 184 rt_rq_iterator.next = load_balance_next_rt;
@@ -203,11 +188,10 @@ load_balance_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
203 rt_rq_iterator.arg = busiest; 188 rt_rq_iterator.arg = busiest;
204 189
205 nr_moved = balance_tasks(this_rq, this_cpu, busiest, max_nr_move, 190 nr_moved = balance_tasks(this_rq, this_cpu, busiest, max_nr_move,
206 max_load_move, sd, idle, all_pinned, load_moved, 191 max_load_move, sd, idle, all_pinned, &load_moved,
207 this_best_prio, best_prio, best_prio_seen, 192 this_best_prio, &rt_rq_iterator);
208 &rt_rq_iterator);
209 193
210 return nr_moved; 194 return load_moved;
211} 195}
212 196
213static void task_tick_rt(struct rq *rq, struct task_struct *p) 197static void task_tick_rt(struct rq *rq, struct task_struct *p)
diff --git a/kernel/signal.c b/kernel/signal.c
index ef8156a6aad5..b27c01a66448 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1561,10 +1561,6 @@ static inline int may_ptrace_stop(void)
1561 (current->ptrace & PT_ATTACHED))) 1561 (current->ptrace & PT_ATTACHED)))
1562 return 0; 1562 return 0;
1563 1563
1564 if (unlikely(current->signal == current->parent->signal) &&
1565 unlikely(current->signal->flags & SIGNAL_GROUP_EXIT))
1566 return 0;
1567
1568 /* 1564 /*
1569 * Are we in the middle of do_coredump? 1565 * Are we in the middle of do_coredump?
1570 * If so and our tracer is also part of the coredump stopping 1566 * If so and our tracer is also part of the coredump stopping
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 79c891e6266c..8bdb8c07e04f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1023,6 +1023,7 @@ static ctl_table vm_table[] = {
1023 .mode = 0644, 1023 .mode = 0644,
1024 .proc_handler = &proc_doulongvec_minmax, 1024 .proc_handler = &proc_doulongvec_minmax,
1025 }, 1025 },
1026#endif
1026#ifdef CONFIG_NUMA 1027#ifdef CONFIG_NUMA
1027 { 1028 {
1028 .ctl_name = CTL_UNNUMBERED, 1029 .ctl_name = CTL_UNNUMBERED,
@@ -1034,7 +1035,6 @@ static ctl_table vm_table[] = {
1034 .strategy = &sysctl_string, 1035 .strategy = &sysctl_string,
1035 }, 1036 },
1036#endif 1037#endif
1037#endif
1038#if defined(CONFIG_X86_32) || \ 1038#if defined(CONFIG_X86_32) || \
1039 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) 1039 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1040 { 1040 {
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 2ad1c37b8dfe..41dd3105ce7f 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -113,16 +113,6 @@ int clockevents_register_notifier(struct notifier_block *nb)
113 return ret; 113 return ret;
114} 114}
115 115
116/**
117 * clockevents_unregister_notifier - unregister a clock events change listener
118 */
119void clockevents_unregister_notifier(struct notifier_block *nb)
120{
121 spin_lock(&clockevents_lock);
122 raw_notifier_chain_unregister(&clockevents_chain, nb);
123 spin_unlock(&clockevents_lock);
124}
125
126/* 116/*
127 * Notify about a clock event change. Called with clockevents_lock 117 * Notify about a clock event change. Called with clockevents_lock
128 * held. 118 * held.
diff --git a/lib/hexdump.c b/lib/hexdump.c
index 473f5aed6cae..bd5edaeaa80b 100644
--- a/lib/hexdump.c
+++ b/lib/hexdump.c
@@ -145,9 +145,9 @@ EXPORT_SYMBOL(hex_dump_to_buffer);
145 */ 145 */
146void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, 146void print_hex_dump(const char *level, const char *prefix_str, int prefix_type,
147 int rowsize, int groupsize, 147 int rowsize, int groupsize,
148 void *buf, size_t len, bool ascii) 148 const void *buf, size_t len, bool ascii)
149{ 149{
150 u8 *ptr = buf; 150 const u8 *ptr = buf;
151 int i, linelen, remaining = len; 151 int i, linelen, remaining = len;
152 unsigned char linebuf[200]; 152 unsigned char linebuf[200];
153 153
@@ -189,7 +189,7 @@ EXPORT_SYMBOL(print_hex_dump);
189 * rowsize of 16, groupsize of 1, and ASCII output included. 189 * rowsize of 16, groupsize of 1, and ASCII output included.
190 */ 190 */
191void print_hex_dump_bytes(const char *prefix_str, int prefix_type, 191void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
192 void *buf, size_t len) 192 const void *buf, size_t len)
193{ 193{
194 print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, 16, 1, 194 print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, 16, 1,
195 buf, len, 1); 195 buf, len, 1);
diff --git a/mm/filemap.c b/mm/filemap.c
index 6cf700d41844..90b657b50f81 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -843,7 +843,7 @@ static void shrink_readahead_size_eio(struct file *filp,
843/** 843/**
844 * do_generic_mapping_read - generic file read routine 844 * do_generic_mapping_read - generic file read routine
845 * @mapping: address_space to be read 845 * @mapping: address_space to be read
846 * @ra: file's readahead state 846 * @_ra: file's readahead state
847 * @filp: the file to read 847 * @filp: the file to read
848 * @ppos: current file position 848 * @ppos: current file position
849 * @desc: read_descriptor 849 * @desc: read_descriptor
@@ -1218,26 +1218,6 @@ out:
1218} 1218}
1219EXPORT_SYMBOL(generic_file_aio_read); 1219EXPORT_SYMBOL(generic_file_aio_read);
1220 1220
1221int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size)
1222{
1223 ssize_t written;
1224 unsigned long count = desc->count;
1225 struct file *file = desc->arg.data;
1226
1227 if (size > count)
1228 size = count;
1229
1230 written = file->f_op->sendpage(file, page, offset,
1231 size, &file->f_pos, size<count);
1232 if (written < 0) {
1233 desc->error = written;
1234 written = 0;
1235 }
1236 desc->count = count - written;
1237 desc->written += written;
1238 return written;
1239}
1240
1241static ssize_t 1221static ssize_t
1242do_readahead(struct address_space *mapping, struct file *filp, 1222do_readahead(struct address_space *mapping, struct file *filp,
1243 unsigned long index, unsigned long nr) 1223 unsigned long index, unsigned long nr)
diff --git a/mm/slub.c b/mm/slub.c
index 6c6d74ff0694..69d02e3e439e 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -211,7 +211,8 @@ static inline void ClearSlabDebug(struct page *page)
211#define MAX_OBJECTS_PER_SLAB 65535 211#define MAX_OBJECTS_PER_SLAB 65535
212 212
213/* Internal SLUB flags */ 213/* Internal SLUB flags */
214#define __OBJECT_POISON 0x80000000 /* Poison object */ 214#define __OBJECT_POISON 0x80000000 /* Poison object */
215#define __SYSFS_ADD_DEFERRED 0x40000000 /* Not yet visible via sysfs */
215 216
216/* Not all arches define cache_line_size */ 217/* Not all arches define cache_line_size */
217#ifndef cache_line_size 218#ifndef cache_line_size
@@ -2277,10 +2278,26 @@ panic:
2277} 2278}
2278 2279
2279#ifdef CONFIG_ZONE_DMA 2280#ifdef CONFIG_ZONE_DMA
2281
2282static void sysfs_add_func(struct work_struct *w)
2283{
2284 struct kmem_cache *s;
2285
2286 down_write(&slub_lock);
2287 list_for_each_entry(s, &slab_caches, list) {
2288 if (s->flags & __SYSFS_ADD_DEFERRED) {
2289 s->flags &= ~__SYSFS_ADD_DEFERRED;
2290 sysfs_slab_add(s);
2291 }
2292 }
2293 up_write(&slub_lock);
2294}
2295
2296static DECLARE_WORK(sysfs_add_work, sysfs_add_func);
2297
2280static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags) 2298static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
2281{ 2299{
2282 struct kmem_cache *s; 2300 struct kmem_cache *s;
2283 struct kmem_cache *x;
2284 char *text; 2301 char *text;
2285 size_t realsize; 2302 size_t realsize;
2286 2303
@@ -2289,22 +2306,36 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
2289 return s; 2306 return s;
2290 2307
2291 /* Dynamically create dma cache */ 2308 /* Dynamically create dma cache */
2292 x = kmalloc(kmem_size, flags & ~SLUB_DMA); 2309 if (flags & __GFP_WAIT)
2293 if (!x) 2310 down_write(&slub_lock);
2294 panic("Unable to allocate memory for dma cache\n"); 2311 else {
2312 if (!down_write_trylock(&slub_lock))
2313 goto out;
2314 }
2315
2316 if (kmalloc_caches_dma[index])
2317 goto unlock_out;
2295 2318
2296 realsize = kmalloc_caches[index].objsize; 2319 realsize = kmalloc_caches[index].objsize;
2297 text = kasprintf(flags & ~SLUB_DMA, "kmalloc_dma-%d", 2320 text = kasprintf(flags & ~SLUB_DMA, "kmalloc_dma-%d", (unsigned int)realsize),
2298 (unsigned int)realsize); 2321 s = kmalloc(kmem_size, flags & ~SLUB_DMA);
2299 s = create_kmalloc_cache(x, text, realsize, flags); 2322
2300 down_write(&slub_lock); 2323 if (!s || !text || !kmem_cache_open(s, flags, text,
2301 if (!kmalloc_caches_dma[index]) { 2324 realsize, ARCH_KMALLOC_MINALIGN,
2302 kmalloc_caches_dma[index] = s; 2325 SLAB_CACHE_DMA|__SYSFS_ADD_DEFERRED, NULL)) {
2303 up_write(&slub_lock); 2326 kfree(s);
2304 return s; 2327 kfree(text);
2328 goto unlock_out;
2305 } 2329 }
2330
2331 list_add(&s->list, &slab_caches);
2332 kmalloc_caches_dma[index] = s;
2333
2334 schedule_work(&sysfs_add_work);
2335
2336unlock_out:
2306 up_write(&slub_lock); 2337 up_write(&slub_lock);
2307 kmem_cache_destroy(s); 2338out:
2308 return kmalloc_caches_dma[index]; 2339 return kmalloc_caches_dma[index];
2309} 2340}
2310#endif 2341#endif
@@ -2500,15 +2531,11 @@ int kmem_cache_shrink(struct kmem_cache *s)
2500 slab_unlock(page); 2531 slab_unlock(page);
2501 discard_slab(s, page); 2532 discard_slab(s, page);
2502 } else { 2533 } else {
2503 if (n->nr_partial > MAX_PARTIAL) 2534 list_move(&page->lru,
2504 list_move(&page->lru, 2535 slabs_by_inuse + page->inuse);
2505 slabs_by_inuse + page->inuse);
2506 } 2536 }
2507 } 2537 }
2508 2538
2509 if (n->nr_partial <= MAX_PARTIAL)
2510 goto out;
2511
2512 /* 2539 /*
2513 * Rebuild the partial list with the slabs filled up most 2540 * Rebuild the partial list with the slabs filled up most
2514 * first and the least used slabs at the end. 2541 * first and the least used slabs at the end.
@@ -2516,7 +2543,6 @@ int kmem_cache_shrink(struct kmem_cache *s)
2516 for (i = s->objects - 1; i >= 0; i--) 2543 for (i = s->objects - 1; i >= 0; i--)
2517 list_splice(slabs_by_inuse + i, n->partial.prev); 2544 list_splice(slabs_by_inuse + i, n->partial.prev);
2518 2545
2519 out:
2520 spin_unlock_irqrestore(&n->list_lock, flags); 2546 spin_unlock_irqrestore(&n->list_lock, flags);
2521 } 2547 }
2522 2548
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index c0040c9064a1..bd08aa090763 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -319,7 +319,7 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
319 static const char fmt[] = "%30s %12lu\n"; 319 static const char fmt[] = "%30s %12lu\n";
320 int i; 320 int i;
321 321
322 if ((vlandev == NULL) || (!(vlandev->priv_flags & IFF_802_1Q_VLAN))) 322 if (!(vlandev->priv_flags & IFF_802_1Q_VLAN))
323 return 0; 323 return 0;
324 324
325 seq_printf(seq, "%s VID: %d REORDER_HDR: %i dev->priv_flags: %hx\n", 325 seq_printf(seq, "%s VID: %d REORDER_HDR: %i dev->priv_flags: %hx\n",
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 2770fb451ae8..59d5aa3366f2 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -21,7 +21,6 @@
21#include <net/dst.h> 21#include <net/dst.h>
22#include <linux/proc_fs.h> 22#include <linux/proc_fs.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/proc_fs.h>
25#include <linux/seq_file.h> 24#include <linux/seq_file.h>
26 25
27/* TokenRing if needed */ 26/* TokenRing if needed */
diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c
index 16be0c14780a..8443af57a374 100644
--- a/net/ax25/ax25_iface.c
+++ b/net/ax25/ax25_iface.c
@@ -69,7 +69,6 @@ void ax25_protocol_release(unsigned int pid)
69 if (protocol->pid == pid) { 69 if (protocol->pid == pid) {
70 protocol_list = protocol->next; 70 protocol_list = protocol->next;
71 write_unlock_bh(&protocol_list_lock); 71 write_unlock_bh(&protocol_list_lock);
72 kfree(protocol);
73 return; 72 return;
74 } 73 }
75 74
@@ -78,7 +77,6 @@ void ax25_protocol_release(unsigned int pid)
78 s = protocol->next; 77 s = protocol->next;
79 protocol->next = protocol->next->next; 78 protocol->next = protocol->next->next;
80 write_unlock_bh(&protocol_list_lock); 79 write_unlock_bh(&protocol_list_lock);
81 kfree(s);
82 return; 80 return;
83 } 81 }
84 82
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 5e1892d8d874..0eded176ce99 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -179,5 +179,5 @@ void br_dev_setup(struct net_device *dev)
179 dev->priv_flags = IFF_EBRIDGE; 179 dev->priv_flags = IFF_EBRIDGE;
180 180
181 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | 181 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
182 NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST; 182 NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX;
183} 183}
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index b40dada002bf..749f0e8f541d 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -349,43 +349,15 @@ int br_min_mtu(const struct net_bridge *br)
349void br_features_recompute(struct net_bridge *br) 349void br_features_recompute(struct net_bridge *br)
350{ 350{
351 struct net_bridge_port *p; 351 struct net_bridge_port *p;
352 unsigned long features, checksum; 352 unsigned long features;
353 353
354 checksum = br->feature_mask & NETIF_F_ALL_CSUM ? NETIF_F_NO_CSUM : 0; 354 features = br->feature_mask;
355 features = br->feature_mask & ~NETIF_F_ALL_CSUM;
356 355
357 list_for_each_entry(p, &br->port_list, list) { 356 list_for_each_entry(p, &br->port_list, list) {
358 unsigned long feature = p->dev->features; 357 features = netdev_compute_features(features, p->dev->features);
359
360 /* if device needs checksumming, downgrade to hw checksumming */
361 if (checksum & NETIF_F_NO_CSUM && !(feature & NETIF_F_NO_CSUM))
362 checksum ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM;
363
364 /* if device can't do all checksum, downgrade to ipv4/ipv6 */
365 if (checksum & NETIF_F_HW_CSUM && !(feature & NETIF_F_HW_CSUM))
366 checksum ^= NETIF_F_HW_CSUM
367 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
368
369 if (checksum & NETIF_F_IPV6_CSUM && !(feature & NETIF_F_IPV6_CSUM))
370 checksum &= ~NETIF_F_IPV6_CSUM;
371
372 if (!(feature & NETIF_F_IP_CSUM))
373 checksum = 0;
374
375 if (feature & NETIF_F_GSO)
376 feature |= NETIF_F_GSO_SOFTWARE;
377 feature |= NETIF_F_GSO;
378
379 features &= feature;
380 } 358 }
381 359
382 if (!(checksum & NETIF_F_ALL_CSUM)) 360 br->dev->features = features;
383 features &= ~NETIF_F_SG;
384 if (!(features & NETIF_F_SG))
385 features &= ~NETIF_F_GSO_MASK;
386
387 br->dev->features = features | checksum | NETIF_F_LLTX |
388 NETIF_F_GSO_ROBUST;
389} 361}
390 362
391/* called with RTNL */ 363/* called with RTNL */
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 1ea2f86f7683..1a430eccec9b 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -132,7 +132,7 @@ static void br_stp_start(struct net_bridge *br)
132 } else { 132 } else {
133 br->stp_enabled = BR_KERNEL_STP; 133 br->stp_enabled = BR_KERNEL_STP;
134 printk(KERN_INFO "%s: starting userspace STP failed, " 134 printk(KERN_INFO "%s: starting userspace STP failed, "
135 "staring kernel STP\n", br->dev->name); 135 "starting kernel STP\n", br->dev->name);
136 136
137 /* To start timers on any ports left in blocking */ 137 /* To start timers on any ports left in blocking */
138 spin_lock_bh(&br->lock); 138 spin_lock_bh(&br->lock);
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 4f42263e0a8a..88f43003b193 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -147,20 +147,26 @@ static ssize_t show_stp_state(struct device *d,
147 return sprintf(buf, "%d\n", br->stp_enabled); 147 return sprintf(buf, "%d\n", br->stp_enabled);
148} 148}
149 149
150static void set_stp_state(struct net_bridge *br, unsigned long val)
151{
152 rtnl_lock();
153 spin_unlock_bh(&br->lock);
154 br_stp_set_enabled(br, val);
155 spin_lock_bh(&br->lock);
156 rtnl_unlock();
157}
158 150
159static ssize_t store_stp_state(struct device *d, 151static ssize_t store_stp_state(struct device *d,
160 struct device_attribute *attr, const char *buf, 152 struct device_attribute *attr, const char *buf,
161 size_t len) 153 size_t len)
162{ 154{
163 return store_bridge_parm(d, buf, len, set_stp_state); 155 struct net_bridge *br = to_bridge(d);
156 char *endp;
157 unsigned long val;
158
159 if (!capable(CAP_NET_ADMIN))
160 return -EPERM;
161
162 val = simple_strtoul(buf, &endp, 0);
163 if (endp == buf)
164 return -EINVAL;
165
166 rtnl_lock();
167 br_stp_set_enabled(br, val);
168 rtnl_unlock();
169
164} 170}
165static DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state, 171static DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state,
166 store_stp_state); 172 store_stp_state);
diff --git a/net/core/dev.c b/net/core/dev.c
index 6cc8a70350ac..a76021c71207 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3993,6 +3993,45 @@ static int __init netdev_dma_register(void)
3993static int __init netdev_dma_register(void) { return -ENODEV; } 3993static int __init netdev_dma_register(void) { return -ENODEV; }
3994#endif /* CONFIG_NET_DMA */ 3994#endif /* CONFIG_NET_DMA */
3995 3995
3996/**
3997 * netdev_compute_feature - compute conjunction of two feature sets
3998 * @all: first feature set
3999 * @one: second feature set
4000 *
4001 * Computes a new feature set after adding a device with feature set
4002 * @one to the master device with current feature set @all. Returns
4003 * the new feature set.
4004 */
4005int netdev_compute_features(unsigned long all, unsigned long one)
4006{
4007 /* if device needs checksumming, downgrade to hw checksumming */
4008 if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM))
4009 all ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM;
4010
4011 /* if device can't do all checksum, downgrade to ipv4/ipv6 */
4012 if (all & NETIF_F_HW_CSUM && !(one & NETIF_F_HW_CSUM))
4013 all ^= NETIF_F_HW_CSUM
4014 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
4015
4016 if (one & NETIF_F_GSO)
4017 one |= NETIF_F_GSO_SOFTWARE;
4018 one |= NETIF_F_GSO;
4019
4020 /* If even one device supports robust GSO, enable it for all. */
4021 if (one & NETIF_F_GSO_ROBUST)
4022 all |= NETIF_F_GSO_ROBUST;
4023
4024 all &= one | NETIF_F_LLTX;
4025
4026 if (!(all & NETIF_F_ALL_CSUM))
4027 all &= ~NETIF_F_SG;
4028 if (!(all & NETIF_F_SG))
4029 all &= ~NETIF_F_GSO_MASK;
4030
4031 return all;
4032}
4033EXPORT_SYMBOL(netdev_compute_features);
4034
3996/* 4035/*
3997 * Initialize the DEV module. At boot time this walks the device list and 4036 * Initialize the DEV module. At boot time this walks the device list and
3998 * unhooks any devices that fail to initialise (normally hardware not 4037 * unhooks any devices that fail to initialise (normally hardware not
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 2ab0a60046a5..c5e059352d43 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -948,7 +948,6 @@ int dev_ethtool(struct ifreq *ifr)
948 return rc; 948 return rc;
949} 949}
950 950
951EXPORT_SYMBOL(dev_ethtool);
952EXPORT_SYMBOL(ethtool_op_get_link); 951EXPORT_SYMBOL(ethtool_op_get_link);
953EXPORT_SYMBOL(ethtool_op_get_sg); 952EXPORT_SYMBOL(ethtool_op_get_sg);
954EXPORT_SYMBOL(ethtool_op_get_tso); 953EXPORT_SYMBOL(ethtool_op_get_tso);
diff --git a/net/core/utils.c b/net/core/utils.c
index 2030bb8c2d30..0bf17da40d52 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -25,6 +25,7 @@
25#include <linux/random.h> 25#include <linux/random.h>
26#include <linux/percpu.h> 26#include <linux/percpu.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <net/sock.h>
28 29
29#include <asm/byteorder.h> 30#include <asm/byteorder.h>
30#include <asm/system.h> 31#include <asm/system.h>
diff --git a/net/dccp/ccid.c b/net/dccp/ccid.c
index ccbf72c793b6..c45088b5e6fb 100644
--- a/net/dccp/ccid.c
+++ b/net/dccp/ccid.c
@@ -40,6 +40,7 @@ static inline void ccids_write_unlock(void)
40static inline void ccids_read_lock(void) 40static inline void ccids_read_lock(void)
41{ 41{
42 atomic_inc(&ccids_lockct); 42 atomic_inc(&ccids_lockct);
43 smp_mb__after_atomic_inc();
43 spin_unlock_wait(&ccids_lock); 44 spin_unlock_wait(&ccids_lock);
44} 45}
45 46
diff --git a/net/dccp/feat.c b/net/dccp/feat.c
index cd845df5320d..5ebdd86c1b99 100644
--- a/net/dccp/feat.c
+++ b/net/dccp/feat.c
@@ -327,10 +327,16 @@ static void dccp_feat_empty_confirm(struct dccp_minisock *dmsk,
327 } 327 }
328 328
329 switch (type) { 329 switch (type) {
330 case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break; 330 case DCCPO_CHANGE_L:
331 case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break; 331 opt->dccpop_type = DCCPO_CONFIRM_R;
332 default: DCCP_WARN("invalid type %d\n", type); return; 332 break;
333 333 case DCCPO_CHANGE_R:
334 opt->dccpop_type = DCCPO_CONFIRM_L;
335 break;
336 default:
337 DCCP_WARN("invalid type %d\n", type);
338 kfree(opt);
339 return;
334 } 340 }
335 opt->dccpop_feat = feature; 341 opt->dccpop_feat = feature;
336 opt->dccpop_val = NULL; 342 opt->dccpop_val = NULL;
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index b5524f32ac2d..35c96bcc0f32 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -1146,6 +1146,9 @@ static void __exit econet_proto_exit(void)
1146 sock_release(udpsock); 1146 sock_release(udpsock);
1147#endif 1147#endif
1148 unregister_netdevice_notifier(&econet_netdev_notifier); 1148 unregister_netdevice_notifier(&econet_netdev_notifier);
1149#ifdef CONFIG_ECONET_NATIVE
1150 dev_remove_pack(&econet_packet_type);
1151#endif
1149 sock_unregister(econet_family_ops.family); 1152 sock_unregister(econet_family_ops.family);
1150 proto_unregister(&econet_proto); 1153 proto_unregister(&econet_proto);
1151} 1154}
diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c
index f13937bf9e8c..d054e9224b3e 100644
--- a/net/ieee80211/softmac/ieee80211softmac_wx.c
+++ b/net/ieee80211/softmac/ieee80211softmac_wx.c
@@ -74,8 +74,8 @@ ieee80211softmac_wx_set_essid(struct net_device *net_dev,
74 struct ieee80211softmac_auth_queue_item *authptr; 74 struct ieee80211softmac_auth_queue_item *authptr;
75 int length = 0; 75 int length = 0;
76 76
77check_assoc_again:
77 mutex_lock(&sm->associnfo.mutex); 78 mutex_lock(&sm->associnfo.mutex);
78
79 /* Check if we're already associating to this or another network 79 /* Check if we're already associating to this or another network
80 * If it's another network, cancel and start over with our new network 80 * If it's another network, cancel and start over with our new network
81 * If it's our network, ignore the change, we're already doing it! 81 * If it's our network, ignore the change, we're already doing it!
@@ -98,13 +98,18 @@ ieee80211softmac_wx_set_essid(struct net_device *net_dev,
98 cancel_delayed_work(&authptr->work); 98 cancel_delayed_work(&authptr->work);
99 sm->associnfo.bssvalid = 0; 99 sm->associnfo.bssvalid = 0;
100 sm->associnfo.bssfixed = 0; 100 sm->associnfo.bssfixed = 0;
101 flush_scheduled_work();
102 sm->associnfo.associating = 0; 101 sm->associnfo.associating = 0;
103 sm->associnfo.associated = 0; 102 sm->associnfo.associated = 0;
103 /* We must unlock to avoid deadlocks with the assoc workqueue
104 * on the associnfo.mutex */
105 mutex_unlock(&sm->associnfo.mutex);
106 flush_scheduled_work();
107 /* Avoid race! Check assoc status again. Maybe someone started an
108 * association while we flushed. */
109 goto check_assoc_again;
104 } 110 }
105 } 111 }
106 112
107
108 sm->associnfo.static_essid = 0; 113 sm->associnfo.static_essid = 0;
109 sm->associnfo.assoc_wait = 0; 114 sm->associnfo.assoc_wait = 0;
110 115
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 06c08e5740fb..e68103475cca 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -831,7 +831,7 @@ const struct proto_ops inet_stream_ops = {
831 .shutdown = inet_shutdown, 831 .shutdown = inet_shutdown,
832 .setsockopt = sock_common_setsockopt, 832 .setsockopt = sock_common_setsockopt,
833 .getsockopt = sock_common_getsockopt, 833 .getsockopt = sock_common_getsockopt,
834 .sendmsg = inet_sendmsg, 834 .sendmsg = tcp_sendmsg,
835 .recvmsg = sock_common_recvmsg, 835 .recvmsg = sock_common_recvmsg,
836 .mmap = sock_no_mmap, 836 .mmap = sock_no_mmap,
837 .sendpage = tcp_sendpage, 837 .sendpage = tcp_sendpage,
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index c9e2b5e6305e..0f1d7beacf78 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -75,7 +75,6 @@
75#include <net/icmp.h> 75#include <net/icmp.h>
76#include <net/checksum.h> 76#include <net/checksum.h>
77#include <net/inetpeer.h> 77#include <net/inetpeer.h>
78#include <net/checksum.h>
79#include <linux/igmp.h> 78#include <linux/igmp.h>
80#include <linux/netfilter_ipv4.h> 79#include <linux/netfilter_ipv4.h>
81#include <linux/netfilter_bridge.h> 80#include <linux/netfilter_bridge.h>
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 342ca8d89458..c5b247077539 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1281,9 +1281,9 @@ static int __init ip_auto_config(void)
1281 */ 1281 */
1282 if (ic_myaddr == NONE || 1282 if (ic_myaddr == NONE ||
1283#ifdef CONFIG_ROOT_NFS 1283#ifdef CONFIG_ROOT_NFS
1284 (MAJOR(ROOT_DEV) == UNNAMED_MAJOR 1284 (root_server_addr == NONE
1285 && root_server_addr == NONE 1285 && ic_servaddr == NONE
1286 && ic_servaddr == NONE) || 1286 && ROOT_DEV == Root_NFS) ||
1287#endif 1287#endif
1288 ic_first_dev->next) { 1288 ic_first_dev->next) {
1289#ifdef IPCONFIG_DYNAMIC 1289#ifdef IPCONFIG_DYNAMIC
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index e1052bcf4ed1..902fd578aa3c 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -29,7 +29,6 @@
29#include <linux/proc_fs.h> 29#include <linux/proc_fs.h>
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31#include <linux/swap.h> 31#include <linux/swap.h>
32#include <linux/proc_fs.h>
33#include <linux/seq_file.h> 32#include <linux/seq_file.h>
34 33
35#include <linux/netfilter.h> 34#include <linux/netfilter.h>
@@ -909,7 +908,7 @@ ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
909 write_lock_bh(&__ip_vs_svc_lock); 908 write_lock_bh(&__ip_vs_svc_lock);
910 909
911 /* Wait until all other svc users go away */ 910 /* Wait until all other svc users go away */
912 while (atomic_read(&svc->usecnt) > 1) {}; 911 IP_VS_WAIT_WHILE(atomic_read(&svc->usecnt) > 1);
913 912
914 /* call the update_service, because server weight may be changed */ 913 /* call the update_service, because server weight may be changed */
915 svc->scheduler->update_service(svc); 914 svc->scheduler->update_service(svc);
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index dcc12b183474..69bd362b5fa2 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -19,7 +19,6 @@
19#include <linux/udp.h> 19#include <linux/udp.h>
20#include <linux/icmp.h> 20#include <linux/icmp.h>
21#include <linux/if_arp.h> 21#include <linux/if_arp.h>
22#include <linux/proc_fs.h>
23#include <linux/seq_file.h> 22#include <linux/seq_file.h>
24#include <linux/netfilter_arp.h> 23#include <linux/netfilter_arp.h>
25#include <linux/netfilter/x_tables.h> 24#include <linux/netfilter/x_tables.h>
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
index 321804315659..6d0c0f7364ad 100644
--- a/net/ipv4/netfilter/ipt_recent.c
+++ b/net/ipv4/netfilter/ipt_recent.c
@@ -387,12 +387,17 @@ static int recent_seq_open(struct inode *inode, struct file *file)
387 st = kzalloc(sizeof(*st), GFP_KERNEL); 387 st = kzalloc(sizeof(*st), GFP_KERNEL);
388 if (st == NULL) 388 if (st == NULL)
389 return -ENOMEM; 389 return -ENOMEM;
390
390 ret = seq_open(file, &recent_seq_ops); 391 ret = seq_open(file, &recent_seq_ops);
391 if (ret) 392 if (ret) {
392 kfree(st); 393 kfree(st);
394 goto out;
395 }
396
393 st->table = pde->data; 397 st->table = pde->data;
394 seq = file->private_data; 398 seq = file->private_data;
395 seq->private = st; 399 seq->private = st;
400out:
396 return ret; 401 return ret;
397} 402}
398 403
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index 64552afd01cb..d9b5177989c6 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -509,3 +509,9 @@ static void __exit nf_conntrack_l3proto_ipv4_fini(void)
509 509
510module_init(nf_conntrack_l3proto_ipv4_init); 510module_init(nf_conntrack_l3proto_ipv4_init);
511module_exit(nf_conntrack_l3proto_ipv4_fini); 511module_exit(nf_conntrack_l3proto_ipv4_fini);
512
513void need_ipv4_conntrack(void)
514{
515 return;
516}
517EXPORT_SYMBOL_GPL(need_ipv4_conntrack);
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
index 27c7918e442a..b3dd5de9a258 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
@@ -294,15 +294,14 @@ static int exp_open(struct inode *inode, struct file *file)
294 struct ct_expect_iter_state *st; 294 struct ct_expect_iter_state *st;
295 int ret; 295 int ret;
296 296
297 st = kmalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL); 297 st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
298 if (st == NULL) 298 if (!st)
299 return -ENOMEM; 299 return -ENOMEM;
300 ret = seq_open(file, &exp_seq_ops); 300 ret = seq_open(file, &exp_seq_ops);
301 if (ret) 301 if (ret)
302 goto out_free; 302 goto out_free;
303 seq = file->private_data; 303 seq = file->private_data;
304 seq->private = st; 304 seq->private = st;
305 memset(st, 0, sizeof(struct ct_expect_iter_state));
306 return ret; 305 return ret;
307out_free: 306out_free:
308 kfree(st); 307 kfree(st);
diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c
index a889ec3ec83a..e14d41976c27 100644
--- a/net/ipv4/netfilter/nf_nat_sip.c
+++ b/net/ipv4/netfilter/nf_nat_sip.c
@@ -104,7 +104,7 @@ static unsigned int ip_nat_sip(struct sk_buff **pskb,
104 dataoff = ip_hdrlen(*pskb) + sizeof(struct udphdr); 104 dataoff = ip_hdrlen(*pskb) + sizeof(struct udphdr);
105 datalen = (*pskb)->len - dataoff; 105 datalen = (*pskb)->len - dataoff;
106 if (datalen < sizeof("SIP/2.0") - 1) 106 if (datalen < sizeof("SIP/2.0") - 1)
107 return NF_DROP; 107 return NF_ACCEPT;
108 108
109 addr_map_init(ct, &map); 109 addr_map_init(ct, &map);
110 110
diff --git a/net/ipv4/netfilter/nf_nat_standalone.c b/net/ipv4/netfilter/nf_nat_standalone.c
index 332814dac503..46cc99def165 100644
--- a/net/ipv4/netfilter/nf_nat_standalone.c
+++ b/net/ipv4/netfilter/nf_nat_standalone.c
@@ -328,7 +328,7 @@ static int __init nf_nat_standalone_init(void)
328{ 328{
329 int ret = 0; 329 int ret = 0;
330 330
331 need_conntrack(); 331 need_ipv4_conntrack();
332 332
333#ifdef CONFIG_XFRM 333#ifdef CONFIG_XFRM
334 BUG_ON(ip_nat_decode_session != NULL); 334 BUG_ON(ip_nat_decode_session != NULL);
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 24d7c9f31918..c6d71526f625 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -900,8 +900,9 @@ static int raw_seq_open(struct inode *inode, struct file *file)
900{ 900{
901 struct seq_file *seq; 901 struct seq_file *seq;
902 int rc = -ENOMEM; 902 int rc = -ENOMEM;
903 struct raw_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); 903 struct raw_iter_state *s;
904 904
905 s = kzalloc(sizeof(*s), GFP_KERNEL);
905 if (!s) 906 if (!s)
906 goto out; 907 goto out;
907 rc = seq_open(file, &raw_seq_ops); 908 rc = seq_open(file, &raw_seq_ops);
@@ -910,7 +911,6 @@ static int raw_seq_open(struct inode *inode, struct file *file)
910 911
911 seq = file->private_data; 912 seq = file->private_data;
912 seq->private = s; 913 seq->private = s;
913 memset(s, 0, sizeof(*s));
914out: 914out:
915 return rc; 915 return rc;
916out_kfree: 916out_kfree:
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index df42b7fb3268..c7ca94bd152c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -374,8 +374,9 @@ static int rt_cache_seq_open(struct inode *inode, struct file *file)
374{ 374{
375 struct seq_file *seq; 375 struct seq_file *seq;
376 int rc = -ENOMEM; 376 int rc = -ENOMEM;
377 struct rt_cache_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); 377 struct rt_cache_iter_state *s;
378 378
379 s = kzalloc(sizeof(*s), GFP_KERNEL);
379 if (!s) 380 if (!s)
380 goto out; 381 goto out;
381 rc = seq_open(file, &rt_cache_seq_ops); 382 rc = seq_open(file, &rt_cache_seq_ops);
@@ -383,7 +384,6 @@ static int rt_cache_seq_open(struct inode *inode, struct file *file)
383 goto out_kfree; 384 goto out_kfree;
384 seq = file->private_data; 385 seq = file->private_data;
385 seq->private = s; 386 seq->private = s;
386 memset(s, 0, sizeof(*s));
387out: 387out:
388 return rc; 388 return rc;
389out_kfree: 389out_kfree:
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index da4c0b6ab79a..7e740112b238 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -658,9 +658,10 @@ static inline int select_size(struct sock *sk)
658 return tmp; 658 return tmp;
659} 659}
660 660
661int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 661int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
662 size_t size) 662 size_t size)
663{ 663{
664 struct sock *sk = sock->sk;
664 struct iovec *iov; 665 struct iovec *iov;
665 struct tcp_sock *tp = tcp_sk(sk); 666 struct tcp_sock *tp = tcp_sk(sk);
666 struct sk_buff *skb; 667 struct sk_buff *skb;
diff --git a/net/ipv4/tcp_htcp.c b/net/ipv4/tcp_htcp.c
index b66556c0a5bd..5215691f2760 100644
--- a/net/ipv4/tcp_htcp.c
+++ b/net/ipv4/tcp_htcp.c
@@ -79,7 +79,6 @@ static u32 htcp_cwnd_undo(struct sock *sk)
79static inline void measure_rtt(struct sock *sk, u32 srtt) 79static inline void measure_rtt(struct sock *sk, u32 srtt)
80{ 80{
81 const struct inet_connection_sock *icsk = inet_csk(sk); 81 const struct inet_connection_sock *icsk = inet_csk(sk);
82 const struct tcp_sock *tp = tcp_sk(sk);
83 struct htcp *ca = inet_csk_ca(sk); 82 struct htcp *ca = inet_csk_ca(sk);
84 83
85 /* keep track of minimum RTT seen so far, minRTT is zero at first */ 84 /* keep track of minimum RTT seen so far, minRTT is zero at first */
@@ -87,8 +86,7 @@ static inline void measure_rtt(struct sock *sk, u32 srtt)
87 ca->minRTT = srtt; 86 ca->minRTT = srtt;
88 87
89 /* max RTT */ 88 /* max RTT */
90 if (icsk->icsk_ca_state == TCP_CA_Open 89 if (icsk->icsk_ca_state == TCP_CA_Open) {
91 && tp->snd_ssthresh < 0xFFFF && htcp_ccount(ca) > 3) {
92 if (ca->maxRTT < ca->minRTT) 90 if (ca->maxRTT < ca->minRTT)
93 ca->maxRTT = ca->minRTT; 91 ca->maxRTT = ca->minRTT;
94 if (ca->maxRTT < srtt 92 if (ca->maxRTT < srtt
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 378ca8a086a3..f030435e0eb4 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -102,11 +102,14 @@ int sysctl_tcp_abc __read_mostly;
102#define FLAG_DATA_LOST 0x80 /* SACK detected data lossage. */ 102#define FLAG_DATA_LOST 0x80 /* SACK detected data lossage. */
103#define FLAG_SLOWPATH 0x100 /* Do not skip RFC checks for window update.*/ 103#define FLAG_SLOWPATH 0x100 /* Do not skip RFC checks for window update.*/
104#define FLAG_ONLY_ORIG_SACKED 0x200 /* SACKs only non-rexmit sent before RTO */ 104#define FLAG_ONLY_ORIG_SACKED 0x200 /* SACKs only non-rexmit sent before RTO */
105#define FLAG_SND_UNA_ADVANCED 0x400 /* Snd_una was changed (!= FLAG_DATA_ACKED) */
106#define FLAG_DSACKING_ACK 0x800 /* SACK blocks contained DSACK info */
105 107
106#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) 108#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
107#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED) 109#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)
108#define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE) 110#define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE)
109#define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED) 111#define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED)
112#define FLAG_ANY_PROGRESS (FLAG_FORWARD_PROGRESS|FLAG_SND_UNA_ADVANCED)
110 113
111#define IsReno(tp) ((tp)->rx_opt.sack_ok == 0) 114#define IsReno(tp) ((tp)->rx_opt.sack_ok == 0)
112#define IsFack(tp) ((tp)->rx_opt.sack_ok & 2) 115#define IsFack(tp) ((tp)->rx_opt.sack_ok & 2)
@@ -964,12 +967,14 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
964 967
965 /* Check for D-SACK. */ 968 /* Check for D-SACK. */
966 if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) { 969 if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) {
970 flag |= FLAG_DSACKING_ACK;
967 found_dup_sack = 1; 971 found_dup_sack = 1;
968 tp->rx_opt.sack_ok |= 4; 972 tp->rx_opt.sack_ok |= 4;
969 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV); 973 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV);
970 } else if (num_sacks > 1 && 974 } else if (num_sacks > 1 &&
971 !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) && 975 !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) &&
972 !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) { 976 !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) {
977 flag |= FLAG_DSACKING_ACK;
973 found_dup_sack = 1; 978 found_dup_sack = 1;
974 tp->rx_opt.sack_ok |= 4; 979 tp->rx_opt.sack_ok |= 4;
975 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV); 980 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV);
@@ -1856,7 +1861,7 @@ static void tcp_cwnd_down(struct sock *sk, int flag)
1856 struct tcp_sock *tp = tcp_sk(sk); 1861 struct tcp_sock *tp = tcp_sk(sk);
1857 int decr = tp->snd_cwnd_cnt + 1; 1862 int decr = tp->snd_cwnd_cnt + 1;
1858 1863
1859 if ((flag&FLAG_FORWARD_PROGRESS) || 1864 if ((flag&(FLAG_ANY_PROGRESS|FLAG_DSACKING_ACK)) ||
1860 (IsReno(tp) && !(flag&FLAG_NOT_DUP))) { 1865 (IsReno(tp) && !(flag&FLAG_NOT_DUP))) {
1861 tp->snd_cwnd_cnt = decr&1; 1866 tp->snd_cwnd_cnt = decr&1;
1862 decr >>= 1; 1867 decr >>= 1;
@@ -2107,15 +2112,13 @@ static void tcp_mtup_probe_success(struct sock *sk, struct sk_buff *skb)
2107 * tcp_xmit_retransmit_queue(). 2112 * tcp_xmit_retransmit_queue().
2108 */ 2113 */
2109static void 2114static void
2110tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una, 2115tcp_fastretrans_alert(struct sock *sk, int prior_packets, int flag)
2111 int prior_packets, int flag)
2112{ 2116{
2113 struct inet_connection_sock *icsk = inet_csk(sk); 2117 struct inet_connection_sock *icsk = inet_csk(sk);
2114 struct tcp_sock *tp = tcp_sk(sk); 2118 struct tcp_sock *tp = tcp_sk(sk);
2115 int is_dupack = (tp->snd_una == prior_snd_una && 2119 int is_dupack = !(flag&(FLAG_SND_UNA_ADVANCED|FLAG_NOT_DUP));
2116 (!(flag&FLAG_NOT_DUP) || 2120 int do_lost = is_dupack || ((flag&FLAG_DATA_SACKED) &&
2117 ((flag&FLAG_DATA_SACKED) && 2121 (tp->fackets_out > tp->reordering));
2118 (tp->fackets_out > tp->reordering))));
2119 2122
2120 /* Some technical things: 2123 /* Some technical things:
2121 * 1. Reno does not count dupacks (sacked_out) automatically. */ 2124 * 1. Reno does not count dupacks (sacked_out) automatically. */
@@ -2192,14 +2195,14 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
2192 /* F. Process state. */ 2195 /* F. Process state. */
2193 switch (icsk->icsk_ca_state) { 2196 switch (icsk->icsk_ca_state) {
2194 case TCP_CA_Recovery: 2197 case TCP_CA_Recovery:
2195 if (prior_snd_una == tp->snd_una) { 2198 if (!(flag & FLAG_SND_UNA_ADVANCED)) {
2196 if (IsReno(tp) && is_dupack) 2199 if (IsReno(tp) && is_dupack)
2197 tcp_add_reno_sack(sk); 2200 tcp_add_reno_sack(sk);
2198 } else { 2201 } else {
2199 int acked = prior_packets - tp->packets_out; 2202 int acked = prior_packets - tp->packets_out;
2200 if (IsReno(tp)) 2203 if (IsReno(tp))
2201 tcp_remove_reno_sacks(sk, acked); 2204 tcp_remove_reno_sacks(sk, acked);
2202 is_dupack = tcp_try_undo_partial(sk, acked); 2205 do_lost = tcp_try_undo_partial(sk, acked);
2203 } 2206 }
2204 break; 2207 break;
2205 case TCP_CA_Loss: 2208 case TCP_CA_Loss:
@@ -2215,7 +2218,7 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
2215 /* Loss is undone; fall through to processing in Open state. */ 2218 /* Loss is undone; fall through to processing in Open state. */
2216 default: 2219 default:
2217 if (IsReno(tp)) { 2220 if (IsReno(tp)) {
2218 if (tp->snd_una != prior_snd_una) 2221 if (flag & FLAG_SND_UNA_ADVANCED)
2219 tcp_reset_reno_sack(tp); 2222 tcp_reset_reno_sack(tp);
2220 if (is_dupack) 2223 if (is_dupack)
2221 tcp_add_reno_sack(sk); 2224 tcp_add_reno_sack(sk);
@@ -2264,7 +2267,7 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
2264 tcp_set_ca_state(sk, TCP_CA_Recovery); 2267 tcp_set_ca_state(sk, TCP_CA_Recovery);
2265 } 2268 }
2266 2269
2267 if (is_dupack || tcp_head_timedout(sk)) 2270 if (do_lost || tcp_head_timedout(sk))
2268 tcp_update_scoreboard(sk); 2271 tcp_update_scoreboard(sk);
2269 tcp_cwnd_down(sk, flag); 2272 tcp_cwnd_down(sk, flag);
2270 tcp_xmit_retransmit_queue(sk); 2273 tcp_xmit_retransmit_queue(sk);
@@ -2684,7 +2687,7 @@ static void tcp_undo_spur_to_response(struct sock *sk, int flag)
2684 * to prove that the RTO is indeed spurious. It transfers the control 2687 * to prove that the RTO is indeed spurious. It transfers the control
2685 * from F-RTO to the conventional RTO recovery 2688 * from F-RTO to the conventional RTO recovery
2686 */ 2689 */
2687static int tcp_process_frto(struct sock *sk, u32 prior_snd_una, int flag) 2690static int tcp_process_frto(struct sock *sk, int flag)
2688{ 2691{
2689 struct tcp_sock *tp = tcp_sk(sk); 2692 struct tcp_sock *tp = tcp_sk(sk);
2690 2693
@@ -2704,8 +2707,7 @@ static int tcp_process_frto(struct sock *sk, u32 prior_snd_una, int flag)
2704 * ACK isn't duplicate nor advances window, e.g., opposite dir 2707 * ACK isn't duplicate nor advances window, e.g., opposite dir
2705 * data, winupdate 2708 * data, winupdate
2706 */ 2709 */
2707 if ((tp->snd_una == prior_snd_una) && (flag&FLAG_NOT_DUP) && 2710 if (!(flag&FLAG_ANY_PROGRESS) && (flag&FLAG_NOT_DUP))
2708 !(flag&FLAG_FORWARD_PROGRESS))
2709 return 1; 2711 return 1;
2710 2712
2711 if (!(flag&FLAG_DATA_ACKED)) { 2713 if (!(flag&FLAG_DATA_ACKED)) {
@@ -2785,6 +2787,9 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
2785 if (before(ack, prior_snd_una)) 2787 if (before(ack, prior_snd_una))
2786 goto old_ack; 2788 goto old_ack;
2787 2789
2790 if (after(ack, prior_snd_una))
2791 flag |= FLAG_SND_UNA_ADVANCED;
2792
2788 if (sysctl_tcp_abc) { 2793 if (sysctl_tcp_abc) {
2789 if (icsk->icsk_ca_state < TCP_CA_CWR) 2794 if (icsk->icsk_ca_state < TCP_CA_CWR)
2790 tp->bytes_acked += ack - prior_snd_una; 2795 tp->bytes_acked += ack - prior_snd_una;
@@ -2837,14 +2842,14 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
2837 flag |= tcp_clean_rtx_queue(sk, &seq_rtt); 2842 flag |= tcp_clean_rtx_queue(sk, &seq_rtt);
2838 2843
2839 if (tp->frto_counter) 2844 if (tp->frto_counter)
2840 frto_cwnd = tcp_process_frto(sk, prior_snd_una, flag); 2845 frto_cwnd = tcp_process_frto(sk, flag);
2841 2846
2842 if (tcp_ack_is_dubious(sk, flag)) { 2847 if (tcp_ack_is_dubious(sk, flag)) {
2843 /* Advance CWND, if state allows this. */ 2848 /* Advance CWND, if state allows this. */
2844 if ((flag & FLAG_DATA_ACKED) && !frto_cwnd && 2849 if ((flag & FLAG_DATA_ACKED) && !frto_cwnd &&
2845 tcp_may_raise_cwnd(sk, flag)) 2850 tcp_may_raise_cwnd(sk, flag))
2846 tcp_cong_avoid(sk, ack, prior_in_flight, 0); 2851 tcp_cong_avoid(sk, ack, prior_in_flight, 0);
2847 tcp_fastretrans_alert(sk, prior_snd_una, prior_packets, flag); 2852 tcp_fastretrans_alert(sk, prior_packets, flag);
2848 } else { 2853 } else {
2849 if ((flag & FLAG_DATA_ACKED) && !frto_cwnd) 2854 if ((flag & FLAG_DATA_ACKED) && !frto_cwnd)
2850 tcp_cong_avoid(sk, ack, prior_in_flight, 1); 2855 tcp_cong_avoid(sk, ack, prior_in_flight, 1);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 3f5f7423b95c..9c94627c8c7e 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2425,7 +2425,6 @@ struct proto tcp_prot = {
2425 .shutdown = tcp_shutdown, 2425 .shutdown = tcp_shutdown,
2426 .setsockopt = tcp_setsockopt, 2426 .setsockopt = tcp_setsockopt,
2427 .getsockopt = tcp_getsockopt, 2427 .getsockopt = tcp_getsockopt,
2428 .sendmsg = tcp_sendmsg,
2429 .recvmsg = tcp_recvmsg, 2428 .recvmsg = tcp_recvmsg,
2430 .backlog_rcv = tcp_v4_do_rcv, 2429 .backlog_rcv = tcp_v4_do_rcv,
2431 .hash = tcp_v4_hash, 2430 .hash = tcp_v4_hash,
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index eed09373a45d..b5f96372ad73 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -484,7 +484,7 @@ const struct proto_ops inet6_stream_ops = {
484 .shutdown = inet_shutdown, /* ok */ 484 .shutdown = inet_shutdown, /* ok */
485 .setsockopt = sock_common_setsockopt, /* ok */ 485 .setsockopt = sock_common_setsockopt, /* ok */
486 .getsockopt = sock_common_getsockopt, /* ok */ 486 .getsockopt = sock_common_getsockopt, /* ok */
487 .sendmsg = inet_sendmsg, /* ok */ 487 .sendmsg = tcp_sendmsg, /* ok */
488 .recvmsg = sock_common_recvmsg, /* ok */ 488 .recvmsg = sock_common_recvmsg, /* ok */
489 .mmap = sock_no_mmap, 489 .mmap = sock_no_mmap,
490 .sendpage = tcp_sendpage, 490 .sendpage = tcp_sendpage,
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index d6846393182d..761a910f4f97 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -820,7 +820,7 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
820 return 0; 820 return 0;
821 821
822 len = min_t(unsigned int, len, ipv6_optlen(hdr)); 822 len = min_t(unsigned int, len, ipv6_optlen(hdr));
823 if (copy_to_user(optval, hdr, len)); 823 if (copy_to_user(optval, hdr, len))
824 return -EFAULT; 824 return -EFAULT;
825 return ipv6_optlen(hdr); 825 return ipv6_optlen(hdr);
826} 826}
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index f10f3689d671..0f7defb482e9 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -56,7 +56,6 @@
56#include <net/inet_ecn.h> 56#include <net/inet_ecn.h>
57#include <net/protocol.h> 57#include <net/protocol.h>
58#include <net/xfrm.h> 58#include <net/xfrm.h>
59#include <net/addrconf.h>
60#include <net/snmp.h> 59#include <net/snmp.h>
61#include <net/dsfield.h> 60#include <net/dsfield.h>
62#include <net/timewait_sock.h> 61#include <net/timewait_sock.h>
@@ -2115,7 +2114,6 @@ struct proto tcpv6_prot = {
2115 .shutdown = tcp_shutdown, 2114 .shutdown = tcp_shutdown,
2116 .setsockopt = tcp_setsockopt, 2115 .setsockopt = tcp_setsockopt,
2117 .getsockopt = tcp_getsockopt, 2116 .getsockopt = tcp_getsockopt,
2118 .sendmsg = tcp_sendmsg,
2119 .recvmsg = tcp_recvmsg, 2117 .recvmsg = tcp_recvmsg,
2120 .backlog_rcv = tcp_v6_do_rcv, 2118 .backlog_rcv = tcp_v6_do_rcv,
2121 .hash = tcp_v6_hash, 2119 .hash = tcp_v6_hash,
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 7b0a95abe934..5502df115a63 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1206,6 +1206,9 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr,
1206 x->sel.prefixlen_s = addr->sadb_address_prefixlen; 1206 x->sel.prefixlen_s = addr->sadb_address_prefixlen;
1207 } 1207 }
1208 1208
1209 if (!x->sel.family)
1210 x->sel.family = x->props.family;
1211
1209 if (ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]) { 1212 if (ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]) {
1210 struct sadb_x_nat_t_type* n_type; 1213 struct sadb_x_nat_t_type* n_type;
1211 struct xfrm_encap_tmpl *natt; 1214 struct xfrm_encap_tmpl *natt;
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 799a9208c4b4..095be91829ca 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -271,9 +271,11 @@ static void add_files(struct ieee80211_sub_if_data *sdata)
271 } 271 }
272} 272}
273 273
274#define DEBUGFS_DEL(name, type)\ 274#define DEBUGFS_DEL(name, type) \
275 debugfs_remove(sdata->debugfs.type.name);\ 275 do { \
276 sdata->debugfs.type.name = NULL; 276 debugfs_remove(sdata->debugfs.type.name); \
277 sdata->debugfs.type.name = NULL; \
278 } while (0)
277 279
278static void del_sta_files(struct ieee80211_sub_if_data *sdata) 280static void del_sta_files(struct ieee80211_sub_if_data *sdata)
279{ 281{
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index d41e696f3980..da34ea70276f 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -157,7 +157,7 @@ static ssize_t sta_last_seq_ctrl_read(struct file *file, char __user *userbuf,
157 struct sta_info *sta = file->private_data; 157 struct sta_info *sta = file->private_data;
158 for (i = 0; i < NUM_RX_DATA_QUEUES; i++) 158 for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
159 p += scnprintf(p, sizeof(buf)+buf-p, "%x ", 159 p += scnprintf(p, sizeof(buf)+buf-p, "%x ",
160 sta->last_seq_ctrl[i]); 160 le16_to_cpu(sta->last_seq_ctrl[i]));
161 p += scnprintf(p, sizeof(buf)+buf-p, "\n"); 161 p += scnprintf(p, sizeof(buf)+buf-p, "\n");
162 return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); 162 return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
163} 163}
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index c944b17d0fc0..7286c389a4d0 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -1650,6 +1650,7 @@ static int ieee80211_master_start_xmit(struct sk_buff *skb,
1650 if (skb_headroom(skb) < headroom) { 1650 if (skb_headroom(skb) < headroom) {
1651 if (pskb_expand_head(skb, headroom, 0, GFP_ATOMIC)) { 1651 if (pskb_expand_head(skb, headroom, 0, GFP_ATOMIC)) {
1652 dev_kfree_skb(skb); 1652 dev_kfree_skb(skb);
1653 dev_put(odev);
1653 return 0; 1654 return 0;
1654 } 1655 }
1655 } 1656 }
@@ -4677,7 +4678,6 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
4677 memset(skb->cb, 0, sizeof(skb->cb)); 4678 memset(skb->cb, 0, sizeof(skb->cb));
4678 netif_rx(skb); 4679 netif_rx(skb);
4679 skb = skb2; 4680 skb = skb2;
4680 break;
4681 } 4681 }
4682 } 4682 }
4683 out: 4683 out:
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index d0e1ab5589db..e7904db55325 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -697,17 +697,24 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
697 if (!netif_running(dev)) 697 if (!netif_running(dev))
698 return -ENETDOWN; 698 return -ENETDOWN;
699 699
700 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) { 700 switch (sdata->type) {
701 if (sdata->type == IEEE80211_IF_TYPE_STA || 701 case IEEE80211_IF_TYPE_STA:
702 sdata->type == IEEE80211_IF_TYPE_IBSS) { 702 case IEEE80211_IF_TYPE_IBSS:
703 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
703 ssid = sdata->u.sta.ssid; 704 ssid = sdata->u.sta.ssid;
704 ssid_len = sdata->u.sta.ssid_len; 705 ssid_len = sdata->u.sta.ssid_len;
705 } else if (sdata->type == IEEE80211_IF_TYPE_AP) { 706 }
707 break;
708 case IEEE80211_IF_TYPE_AP:
709 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
706 ssid = sdata->u.ap.ssid; 710 ssid = sdata->u.ap.ssid;
707 ssid_len = sdata->u.ap.ssid_len; 711 ssid_len = sdata->u.ap.ssid_len;
708 } else 712 }
709 return -EINVAL; 713 break;
714 default:
715 return -EOPNOTSUPP;
710 } 716 }
717
711 return ieee80211_sta_req_scan(dev, ssid, ssid_len); 718 return ieee80211_sta_req_scan(dev, ssid, ssid_len);
712} 719}
713 720
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 7ba352e3ffe0..0d99b685df5f 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -2154,7 +2154,11 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
2154 return 0; 2154 return 0;
2155 } else { 2155 } else {
2156 if (ifsta->state != IEEE80211_AUTHENTICATE) { 2156 if (ifsta->state != IEEE80211_AUTHENTICATE) {
2157 ieee80211_sta_start_scan(dev, NULL, 0); 2157 if (ifsta->auto_ssid_sel)
2158 ieee80211_sta_start_scan(dev, NULL, 0);
2159 else
2160 ieee80211_sta_start_scan(dev, ifsta->ssid,
2161 ifsta->ssid_len);
2158 ifsta->state = IEEE80211_AUTHENTICATE; 2162 ifsta->state = IEEE80211_AUTHENTICATE;
2159 set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); 2163 set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request);
2160 } else 2164 } else
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index eb6695dcd73b..3ac64e25f10c 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -477,15 +477,14 @@ static int exp_open(struct inode *inode, struct file *file)
477 struct ct_expect_iter_state *st; 477 struct ct_expect_iter_state *st;
478 int ret; 478 int ret;
479 479
480 st = kmalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL); 480 st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
481 if (st == NULL) 481 if (!st)
482 return -ENOMEM; 482 return -ENOMEM;
483 ret = seq_open(file, &exp_seq_ops); 483 ret = seq_open(file, &exp_seq_ops);
484 if (ret) 484 if (ret)
485 goto out_free; 485 goto out_free;
486 seq = file->private_data; 486 seq = file->private_data;
487 seq->private = st; 487 seq->private = st;
488 memset(st, 0, sizeof(struct ct_expect_iter_state));
489 return ret; 488 return ret;
490out_free: 489out_free:
491 kfree(st); 490 kfree(st);
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 6f89b105a205..2863e72b4091 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1052,17 +1052,18 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1052 } 1052 }
1053 /* implicit 'else' */ 1053 /* implicit 'else' */
1054 1054
1055 /* we only allow nat config for new conntracks */
1056 if (cda[CTA_NAT_SRC-1] || cda[CTA_NAT_DST-1]) {
1057 err = -EINVAL;
1058 goto out_unlock;
1059 }
1060
1061 /* We manipulate the conntrack inside the global conntrack table lock, 1055 /* We manipulate the conntrack inside the global conntrack table lock,
1062 * so there's no need to increase the refcount */ 1056 * so there's no need to increase the refcount */
1063 err = -EEXIST; 1057 err = -EEXIST;
1064 if (!(nlh->nlmsg_flags & NLM_F_EXCL)) 1058 if (!(nlh->nlmsg_flags & NLM_F_EXCL)) {
1065 err = ctnetlink_change_conntrack(nf_ct_tuplehash_to_ctrack(h), cda); 1059 /* we only allow nat config for new conntracks */
1060 if (cda[CTA_NAT_SRC-1] || cda[CTA_NAT_DST-1]) {
1061 err = -EINVAL;
1062 goto out_unlock;
1063 }
1064 err = ctnetlink_change_conntrack(nf_ct_tuplehash_to_ctrack(h),
1065 cda);
1066 }
1066 1067
1067out_unlock: 1068out_unlock:
1068 write_unlock_bh(&nf_conntrack_lock); 1069 write_unlock_bh(&nf_conntrack_lock);
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 1276a442f10c..d449fa47491c 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -295,6 +295,7 @@ static int epaddr_len(struct nf_conn *ct, const char *dptr,
295static int skp_epaddr_len(struct nf_conn *ct, const char *dptr, 295static int skp_epaddr_len(struct nf_conn *ct, const char *dptr,
296 const char *limit, int *shift) 296 const char *limit, int *shift)
297{ 297{
298 const char *start = dptr;
298 int s = *shift; 299 int s = *shift;
299 300
300 /* Search for @, but stop at the end of the line. 301 /* Search for @, but stop at the end of the line.
@@ -309,8 +310,10 @@ static int skp_epaddr_len(struct nf_conn *ct, const char *dptr,
309 if (dptr <= limit && *dptr == '@') { 310 if (dptr <= limit && *dptr == '@') {
310 dptr++; 311 dptr++;
311 (*shift)++; 312 (*shift)++;
312 } else 313 } else {
314 dptr = start;
313 *shift = s; 315 *shift = s;
316 }
314 317
315 return epaddr_len(ct, dptr, limit, shift); 318 return epaddr_len(ct, dptr, limit, shift);
316} 319}
@@ -330,7 +333,8 @@ int ct_sip_get_info(struct nf_conn *ct,
330 333
331 while (dptr <= limit) { 334 while (dptr <= limit) {
332 if ((strncmp(dptr, hnfo->lname, hnfo->lnlen) != 0) && 335 if ((strncmp(dptr, hnfo->lname, hnfo->lnlen) != 0) &&
333 (strncmp(dptr, hnfo->sname, hnfo->snlen) != 0)) { 336 (hnfo->sname == NULL ||
337 strncmp(dptr, hnfo->sname, hnfo->snlen) != 0)) {
334 dptr++; 338 dptr++;
335 continue; 339 continue;
336 } 340 }
diff --git a/net/netfilter/xt_u32.c b/net/netfilter/xt_u32.c
index 74f9b14c012f..bec427915b30 100644
--- a/net/netfilter/xt_u32.c
+++ b/net/netfilter/xt_u32.c
@@ -36,7 +36,7 @@ static bool u32_match_it(const struct xt_u32 *data,
36 at = 0; 36 at = 0;
37 pos = ct->location[0].number; 37 pos = ct->location[0].number;
38 38
39 if (skb->len < 4 || pos > skb->len - 4); 39 if (skb->len < 4 || pos > skb->len - 4)
40 return false; 40 return false;
41 41
42 ret = skb_copy_bits(skb, pos, &n, sizeof(n)); 42 ret = skb_copy_bits(skb, pos, &n, sizeof(n));
diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
index f46a0aeec44f..b6c844b7e1c1 100644
--- a/net/netlabel/netlabel_domainhash.c
+++ b/net/netlabel/netlabel_domainhash.c
@@ -126,7 +126,9 @@ static struct netlbl_dom_map *netlbl_domhsh_search(const char *domain, u32 def)
126 126
127 if (domain != NULL) { 127 if (domain != NULL) {
128 bkt = netlbl_domhsh_hash(domain); 128 bkt = netlbl_domhsh_hash(domain);
129 list_for_each_entry_rcu(iter, &netlbl_domhsh->tbl[bkt], list) 129 list_for_each_entry_rcu(iter,
130 &rcu_dereference(netlbl_domhsh)->tbl[bkt],
131 list)
130 if (iter->valid && strcmp(iter->domain, domain) == 0) 132 if (iter->valid && strcmp(iter->domain, domain) == 0)
131 return iter; 133 return iter;
132 } 134 }
@@ -227,7 +229,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry,
227 spin_lock(&netlbl_domhsh_lock); 229 spin_lock(&netlbl_domhsh_lock);
228 if (netlbl_domhsh_search(entry->domain, 0) == NULL) 230 if (netlbl_domhsh_search(entry->domain, 0) == NULL)
229 list_add_tail_rcu(&entry->list, 231 list_add_tail_rcu(&entry->list,
230 &netlbl_domhsh->tbl[bkt]); 232 &rcu_dereference(netlbl_domhsh)->tbl[bkt]);
231 else 233 else
232 ret_val = -EEXIST; 234 ret_val = -EEXIST;
233 spin_unlock(&netlbl_domhsh_lock); 235 spin_unlock(&netlbl_domhsh_lock);
@@ -423,8 +425,8 @@ int netlbl_domhsh_walk(u32 *skip_bkt,
423 iter_bkt < rcu_dereference(netlbl_domhsh)->size; 425 iter_bkt < rcu_dereference(netlbl_domhsh)->size;
424 iter_bkt++, chain_cnt = 0) { 426 iter_bkt++, chain_cnt = 0) {
425 list_for_each_entry_rcu(iter_entry, 427 list_for_each_entry_rcu(iter_entry,
426 &netlbl_domhsh->tbl[iter_bkt], 428 &rcu_dereference(netlbl_domhsh)->tbl[iter_bkt],
427 list) 429 list)
428 if (iter_entry->valid) { 430 if (iter_entry->valid) {
429 if (chain_cnt++ < *skip_chain) 431 if (chain_cnt++ < *skip_chain)
430 continue; 432 continue;
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index bf90e60f8411..6085be578459 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -16,7 +16,6 @@
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/skbuff.h> 18#include <linux/skbuff.h>
19#include <linux/module.h>
20#include <linux/rtnetlink.h> 19#include <linux/rtnetlink.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <net/act_api.h> 21#include <net/act_api.h>
diff --git a/net/sctp/input.c b/net/sctp/input.c
index d57ff7f3c576..47e56017f4ce 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -590,7 +590,7 @@ out_unlock:
590 * Return 0 - If further processing is needed. 590 * Return 0 - If further processing is needed.
591 * Return 1 - If the packet can be discarded right away. 591 * Return 1 - If the packet can be discarded right away.
592 */ 592 */
593int sctp_rcv_ootb(struct sk_buff *skb) 593static int sctp_rcv_ootb(struct sk_buff *skb)
594{ 594{
595 sctp_chunkhdr_t *ch; 595 sctp_chunkhdr_t *ch;
596 __u8 *ch_end; 596 __u8 *ch_end;
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 2c29394fd92e..f8aa23dda1c1 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -641,6 +641,8 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
641 newsctp6sk = (struct sctp6_sock *)newsk; 641 newsctp6sk = (struct sctp6_sock *)newsk;
642 inet_sk(newsk)->pinet6 = &newsctp6sk->inet6; 642 inet_sk(newsk)->pinet6 = &newsctp6sk->inet6;
643 643
644 sctp_sk(newsk)->v4mapped = sctp_sk(sk)->v4mapped;
645
644 newinet = inet_sk(newsk); 646 newinet = inet_sk(newsk);
645 newnp = inet6_sk(newsk); 647 newnp = inet6_sk(newsk);
646 648
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 8d18f570c2e6..51c4d7fef1d2 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -65,8 +65,6 @@
65#include <net/sctp/sctp.h> 65#include <net/sctp/sctp.h>
66#include <net/sctp/sm.h> 66#include <net/sctp/sm.h>
67 67
68extern struct kmem_cache *sctp_chunk_cachep;
69
70SCTP_STATIC 68SCTP_STATIC
71struct sctp_chunk *sctp_make_chunk(const struct sctp_association *asoc, 69struct sctp_chunk *sctp_make_chunk(const struct sctp_association *asoc,
72 __u8 type, __u8 flags, int paylen); 70 __u8 type, __u8 flags, int paylen);
@@ -115,15 +113,12 @@ void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code,
115 const void *payload, size_t paylen) 113 const void *payload, size_t paylen)
116{ 114{
117 sctp_errhdr_t err; 115 sctp_errhdr_t err;
118 int padlen;
119 __u16 len; 116 __u16 len;
120 117
121 /* Cause code constants are now defined in network order. */ 118 /* Cause code constants are now defined in network order. */
122 err.cause = cause_code; 119 err.cause = cause_code;
123 len = sizeof(sctp_errhdr_t) + paylen; 120 len = sizeof(sctp_errhdr_t) + paylen;
124 padlen = len % 4;
125 err.length = htons(len); 121 err.length = htons(len);
126 len += padlen;
127 chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err); 122 chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err);
128 sctp_addto_chunk(chunk, paylen, payload); 123 sctp_addto_chunk(chunk, paylen, payload);
129} 124}
@@ -1454,7 +1449,6 @@ no_hmac:
1454 do_gettimeofday(&tv); 1449 do_gettimeofday(&tv);
1455 1450
1456 if (!asoc && tv_lt(bear_cookie->expiration, tv)) { 1451 if (!asoc && tv_lt(bear_cookie->expiration, tv)) {
1457 __u16 len;
1458 /* 1452 /*
1459 * Section 3.3.10.3 Stale Cookie Error (3) 1453 * Section 3.3.10.3 Stale Cookie Error (3)
1460 * 1454 *
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index fd2dfdd7d7fd..71cad56dd73f 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -97,6 +97,13 @@ static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands,
97 const struct sctp_association *asoc, 97 const struct sctp_association *asoc,
98 struct sctp_transport *transport); 98 struct sctp_transport *transport);
99 99
100static sctp_disposition_t sctp_sf_abort_violation(
101 const struct sctp_association *asoc,
102 void *arg,
103 sctp_cmd_seq_t *commands,
104 const __u8 *payload,
105 const size_t paylen);
106
100static sctp_disposition_t sctp_sf_violation_chunklen( 107static sctp_disposition_t sctp_sf_violation_chunklen(
101 const struct sctp_endpoint *ep, 108 const struct sctp_endpoint *ep,
102 const struct sctp_association *asoc, 109 const struct sctp_association *asoc,
@@ -104,6 +111,13 @@ static sctp_disposition_t sctp_sf_violation_chunklen(
104 void *arg, 111 void *arg,
105 sctp_cmd_seq_t *commands); 112 sctp_cmd_seq_t *commands);
106 113
114static sctp_disposition_t sctp_sf_violation_ctsn(
115 const struct sctp_endpoint *ep,
116 const struct sctp_association *asoc,
117 const sctp_subtype_t type,
118 void *arg,
119 sctp_cmd_seq_t *commands);
120
107/* Small helper function that checks if the chunk length 121/* Small helper function that checks if the chunk length
108 * is of the appropriate length. The 'required_length' argument 122 * is of the appropriate length. The 'required_length' argument
109 * is set to be the size of a specific chunk we are testing. 123 * is set to be the size of a specific chunk we are testing.
@@ -2880,6 +2894,13 @@ sctp_disposition_t sctp_sf_eat_sack_6_2(const struct sctp_endpoint *ep,
2880 return SCTP_DISPOSITION_DISCARD; 2894 return SCTP_DISPOSITION_DISCARD;
2881 } 2895 }
2882 2896
2897 /* If Cumulative TSN Ack beyond the max tsn currently
2898 * send, terminating the association and respond to the
2899 * sender with an ABORT.
2900 */
2901 if (!TSN_lt(ctsn, asoc->next_tsn))
2902 return sctp_sf_violation_ctsn(ep, asoc, type, arg, commands);
2903
2883 /* Return this SACK for further processing. */ 2904 /* Return this SACK for further processing. */
2884 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, SCTP_SACKH(sackh)); 2905 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, SCTP_SACKH(sackh));
2885 2906
@@ -3691,40 +3712,21 @@ sctp_disposition_t sctp_sf_violation(const struct sctp_endpoint *ep,
3691 return SCTP_DISPOSITION_VIOLATION; 3712 return SCTP_DISPOSITION_VIOLATION;
3692} 3713}
3693 3714
3694
3695/* 3715/*
3696 * Handle a protocol violation when the chunk length is invalid. 3716 * Common function to handle a protocol violation.
3697 * "Invalid" length is identified as smaller then the minimal length a
3698 * given chunk can be. For example, a SACK chunk has invalid length
3699 * if it's length is set to be smaller then the size of sctp_sack_chunk_t.
3700 *
3701 * We inform the other end by sending an ABORT with a Protocol Violation
3702 * error code.
3703 *
3704 * Section: Not specified
3705 * Verification Tag: Nothing to do
3706 * Inputs
3707 * (endpoint, asoc, chunk)
3708 *
3709 * Outputs
3710 * (reply_msg, msg_up, counters)
3711 *
3712 * Generate an ABORT chunk and terminate the association.
3713 */ 3717 */
3714static sctp_disposition_t sctp_sf_violation_chunklen( 3718static sctp_disposition_t sctp_sf_abort_violation(
3715 const struct sctp_endpoint *ep,
3716 const struct sctp_association *asoc, 3719 const struct sctp_association *asoc,
3717 const sctp_subtype_t type,
3718 void *arg, 3720 void *arg,
3719 sctp_cmd_seq_t *commands) 3721 sctp_cmd_seq_t *commands,
3722 const __u8 *payload,
3723 const size_t paylen)
3720{ 3724{
3721 struct sctp_chunk *chunk = arg; 3725 struct sctp_chunk *chunk = arg;
3722 struct sctp_chunk *abort = NULL; 3726 struct sctp_chunk *abort = NULL;
3723 char err_str[]="The following chunk had invalid length:";
3724 3727
3725 /* Make the abort chunk. */ 3728 /* Make the abort chunk. */
3726 abort = sctp_make_abort_violation(asoc, chunk, err_str, 3729 abort = sctp_make_abort_violation(asoc, chunk, payload, paylen);
3727 sizeof(err_str));
3728 if (!abort) 3730 if (!abort)
3729 goto nomem; 3731 goto nomem;
3730 3732
@@ -3756,6 +3758,57 @@ nomem:
3756 return SCTP_DISPOSITION_NOMEM; 3758 return SCTP_DISPOSITION_NOMEM;
3757} 3759}
3758 3760
3761/*
3762 * Handle a protocol violation when the chunk length is invalid.
3763 * "Invalid" length is identified as smaller then the minimal length a
3764 * given chunk can be. For example, a SACK chunk has invalid length
3765 * if it's length is set to be smaller then the size of sctp_sack_chunk_t.
3766 *
3767 * We inform the other end by sending an ABORT with a Protocol Violation
3768 * error code.
3769 *
3770 * Section: Not specified
3771 * Verification Tag: Nothing to do
3772 * Inputs
3773 * (endpoint, asoc, chunk)
3774 *
3775 * Outputs
3776 * (reply_msg, msg_up, counters)
3777 *
3778 * Generate an ABORT chunk and terminate the association.
3779 */
3780static sctp_disposition_t sctp_sf_violation_chunklen(
3781 const struct sctp_endpoint *ep,
3782 const struct sctp_association *asoc,
3783 const sctp_subtype_t type,
3784 void *arg,
3785 sctp_cmd_seq_t *commands)
3786{
3787 char err_str[]="The following chunk had invalid length:";
3788
3789 return sctp_sf_abort_violation(asoc, arg, commands, err_str,
3790 sizeof(err_str));
3791}
3792
3793/* Handle a protocol violation when the peer trying to advance the
3794 * cumulative tsn ack to a point beyond the max tsn currently sent.
3795 *
3796 * We inform the other end by sending an ABORT with a Protocol Violation
3797 * error code.
3798 */
3799static sctp_disposition_t sctp_sf_violation_ctsn(
3800 const struct sctp_endpoint *ep,
3801 const struct sctp_association *asoc,
3802 const sctp_subtype_t type,
3803 void *arg,
3804 sctp_cmd_seq_t *commands)
3805{
3806 char err_str[]="The cumulative tsn ack beyond the max tsn currently sent:";
3807
3808 return sctp_sf_abort_violation(asoc, arg, commands, err_str,
3809 sizeof(err_str));
3810}
3811
3759/*************************************************************************** 3812/***************************************************************************
3760 * These are the state functions for handling primitive (Section 10) events. 3813 * These are the state functions for handling primitive (Section 10) events.
3761 ***************************************************************************/ 3814 ***************************************************************************/
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index ee88f2ea5101..01c6364245b7 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -107,8 +107,6 @@ static void sctp_sock_migrate(struct sock *, struct sock *,
107 struct sctp_association *, sctp_socket_type_t); 107 struct sctp_association *, sctp_socket_type_t);
108static char *sctp_hmac_alg = SCTP_COOKIE_HMAC_ALG; 108static char *sctp_hmac_alg = SCTP_COOKIE_HMAC_ALG;
109 109
110extern struct kmem_cache *sctp_bucket_cachep;
111
112/* Get the sndbuf space available at the time on the association. */ 110/* Get the sndbuf space available at the time on the association. */
113static inline int sctp_wspace(struct sctp_association *asoc) 111static inline int sctp_wspace(struct sctp_association *asoc)
114{ 112{
@@ -433,7 +431,7 @@ out:
433 * 431 *
434 * Only sctp_setsockopt_bindx() is supposed to call this function. 432 * Only sctp_setsockopt_bindx() is supposed to call this function.
435 */ 433 */
436int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt) 434static int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt)
437{ 435{
438 int cnt; 436 int cnt;
439 int retval = 0; 437 int retval = 0;
@@ -602,7 +600,7 @@ out:
602 * 600 *
603 * Only sctp_setsockopt_bindx() is supposed to call this function. 601 * Only sctp_setsockopt_bindx() is supposed to call this function.
604 */ 602 */
605int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) 603static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
606{ 604{
607 struct sctp_sock *sp = sctp_sk(sk); 605 struct sctp_sock *sp = sctp_sk(sk);
608 struct sctp_endpoint *ep = sp->ep; 606 struct sctp_endpoint *ep = sp->ep;
@@ -977,7 +975,7 @@ static int __sctp_connect(struct sock* sk,
977 int err = 0; 975 int err = 0;
978 int addrcnt = 0; 976 int addrcnt = 0;
979 int walk_size = 0; 977 int walk_size = 0;
980 union sctp_addr *sa_addr; 978 union sctp_addr *sa_addr = NULL;
981 void *addr_buf; 979 void *addr_buf;
982 unsigned short port; 980 unsigned short port;
983 unsigned int f_flags = 0; 981 unsigned int f_flags = 0;
@@ -1011,7 +1009,10 @@ static int __sctp_connect(struct sock* sk,
1011 goto out_free; 1009 goto out_free;
1012 } 1010 }
1013 1011
1014 err = sctp_verify_addr(sk, sa_addr, af->sockaddr_len); 1012 /* Save current address so we can work with it */
1013 memcpy(&to, sa_addr, af->sockaddr_len);
1014
1015 err = sctp_verify_addr(sk, &to, af->sockaddr_len);
1015 if (err) 1016 if (err)
1016 goto out_free; 1017 goto out_free;
1017 1018
@@ -1021,12 +1022,11 @@ static int __sctp_connect(struct sock* sk,
1021 if (asoc && asoc->peer.port && asoc->peer.port != port) 1022 if (asoc && asoc->peer.port && asoc->peer.port != port)
1022 goto out_free; 1023 goto out_free;
1023 1024
1024 memcpy(&to, sa_addr, af->sockaddr_len);
1025 1025
1026 /* Check if there already is a matching association on the 1026 /* Check if there already is a matching association on the
1027 * endpoint (other than the one created here). 1027 * endpoint (other than the one created here).
1028 */ 1028 */
1029 asoc2 = sctp_endpoint_lookup_assoc(ep, sa_addr, &transport); 1029 asoc2 = sctp_endpoint_lookup_assoc(ep, &to, &transport);
1030 if (asoc2 && asoc2 != asoc) { 1030 if (asoc2 && asoc2 != asoc) {
1031 if (asoc2->state >= SCTP_STATE_ESTABLISHED) 1031 if (asoc2->state >= SCTP_STATE_ESTABLISHED)
1032 err = -EISCONN; 1032 err = -EISCONN;
@@ -1039,7 +1039,7 @@ static int __sctp_connect(struct sock* sk,
1039 * make sure that there is no peeled-off association matching 1039 * make sure that there is no peeled-off association matching
1040 * the peer address even on another socket. 1040 * the peer address even on another socket.
1041 */ 1041 */
1042 if (sctp_endpoint_is_peeled_off(ep, sa_addr)) { 1042 if (sctp_endpoint_is_peeled_off(ep, &to)) {
1043 err = -EADDRNOTAVAIL; 1043 err = -EADDRNOTAVAIL;
1044 goto out_free; 1044 goto out_free;
1045 } 1045 }
@@ -1070,7 +1070,7 @@ static int __sctp_connect(struct sock* sk,
1070 } 1070 }
1071 } 1071 }
1072 1072
1073 scope = sctp_scope(sa_addr); 1073 scope = sctp_scope(&to);
1074 asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL); 1074 asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL);
1075 if (!asoc) { 1075 if (!asoc) {
1076 err = -ENOMEM; 1076 err = -ENOMEM;
@@ -1079,7 +1079,7 @@ static int __sctp_connect(struct sock* sk,
1079 } 1079 }
1080 1080
1081 /* Prime the peer's transport structures. */ 1081 /* Prime the peer's transport structures. */
1082 transport = sctp_assoc_add_peer(asoc, sa_addr, GFP_KERNEL, 1082 transport = sctp_assoc_add_peer(asoc, &to, GFP_KERNEL,
1083 SCTP_UNKNOWN); 1083 SCTP_UNKNOWN);
1084 if (!transport) { 1084 if (!transport) {
1085 err = -ENOMEM; 1085 err = -ENOMEM;
@@ -1103,8 +1103,8 @@ static int __sctp_connect(struct sock* sk,
1103 1103
1104 /* Initialize sk's dport and daddr for getpeername() */ 1104 /* Initialize sk's dport and daddr for getpeername() */
1105 inet_sk(sk)->dport = htons(asoc->peer.port); 1105 inet_sk(sk)->dport = htons(asoc->peer.port);
1106 af = sctp_get_af_specific(to.sa.sa_family); 1106 af = sctp_get_af_specific(sa_addr->sa.sa_family);
1107 af->to_sk_daddr(&to, sk); 1107 af->to_sk_daddr(sa_addr, sk);
1108 sk->sk_err = 0; 1108 sk->sk_err = 0;
1109 1109
1110 /* in-kernel sockets don't generally have a file allocated to them 1110 /* in-kernel sockets don't generally have a file allocated to them
@@ -1531,7 +1531,6 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1531 goto out_unlock; 1531 goto out_unlock;
1532 } 1532 }
1533 if (sinfo_flags & SCTP_ABORT) { 1533 if (sinfo_flags & SCTP_ABORT) {
1534 struct sctp_chunk *chunk;
1535 1534
1536 chunk = sctp_make_abort_user(asoc, msg, msg_len); 1535 chunk = sctp_make_abort_user(asoc, msg, msg_len);
1537 if (!chunk) { 1536 if (!chunk) {
@@ -4353,7 +4352,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
4353 space_left, &bytes_copied); 4352 space_left, &bytes_copied);
4354 if (cnt < 0) { 4353 if (cnt < 0) {
4355 err = cnt; 4354 err = cnt;
4356 goto error; 4355 goto error_lock;
4357 } 4356 }
4358 goto copy_getaddrs; 4357 goto copy_getaddrs;
4359 } 4358 }
@@ -4367,7 +4366,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
4367 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; 4366 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
4368 if (space_left < addrlen) { 4367 if (space_left < addrlen) {
4369 err = -ENOMEM; /*fixme: right error?*/ 4368 err = -ENOMEM; /*fixme: right error?*/
4370 goto error; 4369 goto error_lock;
4371 } 4370 }
4372 memcpy(buf, &temp, addrlen); 4371 memcpy(buf, &temp, addrlen);
4373 buf += addrlen; 4372 buf += addrlen;
@@ -4381,15 +4380,21 @@ copy_getaddrs:
4381 4380
4382 if (copy_to_user(to, addrs, bytes_copied)) { 4381 if (copy_to_user(to, addrs, bytes_copied)) {
4383 err = -EFAULT; 4382 err = -EFAULT;
4384 goto error; 4383 goto out;
4385 } 4384 }
4386 if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) { 4385 if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) {
4387 err = -EFAULT; 4386 err = -EFAULT;
4388 goto error; 4387 goto out;
4389 } 4388 }
4390 if (put_user(bytes_copied, optlen)) 4389 if (put_user(bytes_copied, optlen))
4391 err = -EFAULT; 4390 err = -EFAULT;
4392error: 4391
4392 goto out;
4393
4394error_lock:
4395 sctp_read_unlock(addr_lock);
4396
4397out:
4393 kfree(addrs); 4398 kfree(addrs);
4394 return err; 4399 return err;
4395} 4400}
@@ -5964,7 +5969,7 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo)
5964 return err; 5969 return err;
5965} 5970}
5966 5971
5967void sctp_wait_for_close(struct sock *sk, long timeout) 5972static void sctp_wait_for_close(struct sock *sk, long timeout)
5968{ 5973{
5969 DEFINE_WAIT(wait); 5974 DEFINE_WAIT(wait);
5970 5975
diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c
index d3192a1babcc..1ff0daade304 100644
--- a/net/sctp/tsnmap.c
+++ b/net/sctp/tsnmap.c
@@ -161,7 +161,7 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
161 __u16 *start, __u16 *end) 161 __u16 *start, __u16 *end)
162{ 162{
163 int started, ended; 163 int started, ended;
164 __u16 _start, _end, offset; 164 __u16 start_, end_, offset;
165 165
166 /* We haven't found a gap yet. */ 166 /* We haven't found a gap yet. */
167 started = ended = 0; 167 started = ended = 0;
@@ -175,7 +175,7 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
175 175
176 offset = iter->start - map->base_tsn; 176 offset = iter->start - map->base_tsn;
177 sctp_tsnmap_find_gap_ack(map->tsn_map, offset, map->len, 0, 177 sctp_tsnmap_find_gap_ack(map->tsn_map, offset, map->len, 0,
178 &started, &_start, &ended, &_end); 178 &started, &start_, &ended, &end_);
179 } 179 }
180 180
181 /* Do we need to check the overflow map? */ 181 /* Do we need to check the overflow map? */
@@ -193,8 +193,8 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
193 offset, 193 offset,
194 map->len, 194 map->len,
195 map->len, 195 map->len,
196 &started, &_start, 196 &started, &start_,
197 &ended, &_end); 197 &ended, &end_);
198 } 198 }
199 199
200 /* The Gap Ack Block happens to end at the end of the 200 /* The Gap Ack Block happens to end at the end of the
@@ -202,7 +202,7 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
202 */ 202 */
203 if (started && !ended) { 203 if (started && !ended) {
204 ended++; 204 ended++;
205 _end = map->len + map->len - 1; 205 end_ = map->len + map->len - 1;
206 } 206 }
207 207
208 /* If we found a Gap Ack Block, return the start and end and 208 /* If we found a Gap Ack Block, return the start and end and
@@ -215,8 +215,8 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
215 int gap = map->cumulative_tsn_ack_point - 215 int gap = map->cumulative_tsn_ack_point -
216 map->base_tsn; 216 map->base_tsn;
217 217
218 *start = _start - gap; 218 *start = start_ - gap;
219 *end = _end - gap; 219 *end = end_ - gap;
220 220
221 /* Move the iterator forward. */ 221 /* Move the iterator forward. */
222 iter->start = map->cumulative_tsn_ack_point + *end + 1; 222 iter->start = map->cumulative_tsn_ack_point + *end + 1;
diff --git a/net/socket.c b/net/socket.c
index ec077037f534..7d44453dfae1 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1168,7 +1168,7 @@ static int __sock_create(int family, int type, int protocol,
1168 module_put(pf->owner); 1168 module_put(pf->owner);
1169 err = security_socket_post_create(sock, family, type, protocol, kern); 1169 err = security_socket_post_create(sock, family, type, protocol, kern);
1170 if (err) 1170 if (err)
1171 goto out_release; 1171 goto out_sock_release;
1172 *res = sock; 1172 *res = sock;
1173 1173
1174 return 0; 1174 return 0;
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 4bbc59cc237c..53995af9ca4b 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -736,9 +736,6 @@ gss_do_free_ctx(struct gss_cl_ctx *ctx)
736{ 736{
737 dprintk("RPC: gss_free_ctx\n"); 737 dprintk("RPC: gss_free_ctx\n");
738 738
739 if (ctx->gc_gss_ctx)
740 gss_delete_sec_context(&ctx->gc_gss_ctx);
741
742 kfree(ctx->gc_wire_ctx.data); 739 kfree(ctx->gc_wire_ctx.data);
743 kfree(ctx); 740 kfree(ctx);
744} 741}
@@ -753,7 +750,13 @@ gss_free_ctx_callback(struct rcu_head *head)
753static void 750static void
754gss_free_ctx(struct gss_cl_ctx *ctx) 751gss_free_ctx(struct gss_cl_ctx *ctx)
755{ 752{
753 struct gss_ctx *gc_gss_ctx;
754
755 gc_gss_ctx = rcu_dereference(ctx->gc_gss_ctx);
756 rcu_assign_pointer(ctx->gc_gss_ctx, NULL);
756 call_rcu(&ctx->gc_rcu, gss_free_ctx_callback); 757 call_rcu(&ctx->gc_rcu, gss_free_ctx_callback);
758 if (gc_gss_ctx)
759 gss_delete_sec_context(&gc_gss_ctx);
757} 760}
758 761
759static void 762static void
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index dc2f41e9f577..7da7050f06c3 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -42,7 +42,6 @@
42#include <linux/pagemap.h> 42#include <linux/pagemap.h>
43 43
44#include <linux/sunrpc/auth_gss.h> 44#include <linux/sunrpc/auth_gss.h>
45#include <linux/sunrpc/svcauth.h>
46#include <linux/sunrpc/gss_err.h> 45#include <linux/sunrpc/gss_err.h>
47#include <linux/sunrpc/svcauth.h> 46#include <linux/sunrpc/svcauth.h>
48#include <linux/sunrpc/svcauth_gss.h> 47#include <linux/sunrpc/svcauth_gss.h>
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 01c3c4105204..ebe344f34d1a 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -371,8 +371,7 @@ int cache_unregister(struct cache_detail *cd)
371 } 371 }
372 if (list_empty(&cache_list)) { 372 if (list_empty(&cache_list)) {
373 /* module must be being unloaded so its safe to kill the worker */ 373 /* module must be being unloaded so its safe to kill the worker */
374 cancel_delayed_work(&cache_cleaner); 374 cancel_delayed_work_sync(&cache_cleaner);
375 flush_scheduled_work();
376 } 375 }
377 return 0; 376 return 0;
378} 377}
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 650af064ff8d..669e12a4ed18 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -132,8 +132,7 @@ rpc_close_pipes(struct inode *inode)
132 rpci->nwriters = 0; 132 rpci->nwriters = 0;
133 if (ops->release_pipe) 133 if (ops->release_pipe)
134 ops->release_pipe(inode); 134 ops->release_pipe(inode);
135 cancel_delayed_work(&rpci->queue_timeout); 135 cancel_delayed_work_sync(&rpci->queue_timeout);
136 flush_workqueue(rpciod_workqueue);
137 } 136 }
138 rpc_inode_setowner(inode, NULL); 137 rpc_inode_setowner(inode, NULL);
139 mutex_unlock(&inode->i_mutex); 138 mutex_unlock(&inode->i_mutex);
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index b5723c262a3e..954d7ec86c7e 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -50,8 +50,6 @@ static RPC_WAITQ(delay_queue, "delayq");
50/* 50/*
51 * rpciod-related stuff 51 * rpciod-related stuff
52 */ 52 */
53static DEFINE_MUTEX(rpciod_mutex);
54static atomic_t rpciod_users = ATOMIC_INIT(0);
55struct workqueue_struct *rpciod_workqueue; 53struct workqueue_struct *rpciod_workqueue;
56 54
57/* 55/*
@@ -961,60 +959,49 @@ void rpc_killall_tasks(struct rpc_clnt *clnt)
961 spin_unlock(&clnt->cl_lock); 959 spin_unlock(&clnt->cl_lock);
962} 960}
963 961
962int rpciod_up(void)
963{
964 return try_module_get(THIS_MODULE) ? 0 : -EINVAL;
965}
966
967void rpciod_down(void)
968{
969 module_put(THIS_MODULE);
970}
971
964/* 972/*
965 * Start up the rpciod process if it's not already running. 973 * Start up the rpciod workqueue.
966 */ 974 */
967int 975static int rpciod_start(void)
968rpciod_up(void)
969{ 976{
970 struct workqueue_struct *wq; 977 struct workqueue_struct *wq;
971 int error = 0;
972
973 if (atomic_inc_not_zero(&rpciod_users))
974 return 0;
975
976 mutex_lock(&rpciod_mutex);
977 978
978 /* Guard against races with rpciod_down() */
979 if (rpciod_workqueue != NULL)
980 goto out_ok;
981 /* 979 /*
982 * Create the rpciod thread and wait for it to start. 980 * Create the rpciod thread and wait for it to start.
983 */ 981 */
984 dprintk("RPC: creating workqueue rpciod\n"); 982 dprintk("RPC: creating workqueue rpciod\n");
985 error = -ENOMEM;
986 wq = create_workqueue("rpciod"); 983 wq = create_workqueue("rpciod");
987 if (wq == NULL)
988 goto out;
989
990 rpciod_workqueue = wq; 984 rpciod_workqueue = wq;
991 error = 0; 985 return rpciod_workqueue != NULL;
992out_ok:
993 atomic_inc(&rpciod_users);
994out:
995 mutex_unlock(&rpciod_mutex);
996 return error;
997} 986}
998 987
999void 988static void rpciod_stop(void)
1000rpciod_down(void)
1001{ 989{
1002 if (!atomic_dec_and_test(&rpciod_users)) 990 struct workqueue_struct *wq = NULL;
1003 return;
1004 991
1005 mutex_lock(&rpciod_mutex); 992 if (rpciod_workqueue == NULL)
993 return;
1006 dprintk("RPC: destroying workqueue rpciod\n"); 994 dprintk("RPC: destroying workqueue rpciod\n");
1007 995
1008 if (atomic_read(&rpciod_users) == 0 && rpciod_workqueue != NULL) { 996 wq = rpciod_workqueue;
1009 destroy_workqueue(rpciod_workqueue); 997 rpciod_workqueue = NULL;
1010 rpciod_workqueue = NULL; 998 destroy_workqueue(wq);
1011 }
1012 mutex_unlock(&rpciod_mutex);
1013} 999}
1014 1000
1015void 1001void
1016rpc_destroy_mempool(void) 1002rpc_destroy_mempool(void)
1017{ 1003{
1004 rpciod_stop();
1018 if (rpc_buffer_mempool) 1005 if (rpc_buffer_mempool)
1019 mempool_destroy(rpc_buffer_mempool); 1006 mempool_destroy(rpc_buffer_mempool);
1020 if (rpc_task_mempool) 1007 if (rpc_task_mempool)
@@ -1048,6 +1035,8 @@ rpc_init_mempool(void)
1048 rpc_buffer_slabp); 1035 rpc_buffer_slabp);
1049 if (!rpc_buffer_mempool) 1036 if (!rpc_buffer_mempool)
1050 goto err_nomem; 1037 goto err_nomem;
1038 if (!rpciod_start())
1039 goto err_nomem;
1051 return 0; 1040 return 0;
1052err_nomem: 1041err_nomem:
1053 rpc_destroy_mempool(); 1042 rpc_destroy_mempool();
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 1d674e0848fa..1b17fecee747 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2383,10 +2383,10 @@ void tipc_link_changeover(struct link *l_ptr)
2383 struct tipc_msg *msg = buf_msg(crs); 2383 struct tipc_msg *msg = buf_msg(crs);
2384 2384
2385 if ((msg_user(msg) == MSG_BUNDLER) && split_bundles) { 2385 if ((msg_user(msg) == MSG_BUNDLER) && split_bundles) {
2386 u32 msgcount = msg_msgcnt(msg);
2387 struct tipc_msg *m = msg_get_wrapped(msg); 2386 struct tipc_msg *m = msg_get_wrapped(msg);
2388 unchar* pos = (unchar*)m; 2387 unchar* pos = (unchar*)m;
2389 2388
2389 msgcount = msg_msgcnt(msg);
2390 while (msgcount--) { 2390 while (msgcount--) {
2391 msg_set_seqno(m,msg_seqno(msg)); 2391 msg_set_seqno(m,msg_seqno(msg));
2392 tipc_link_tunnel(l_ptr, &tunnel_hdr, m, 2392 tipc_link_tunnel(l_ptr, &tunnel_hdr, m,
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index d8473eefcd23..ac7dfdda7973 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -501,7 +501,7 @@ end_node:
501 * sequence overlapping with the requested sequence 501 * sequence overlapping with the requested sequence
502 */ 502 */
503 503
504void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s) 504static void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s)
505{ 505{
506 struct sub_seq *sseq = nseq->sseqs; 506 struct sub_seq *sseq = nseq->sseqs;
507 507
diff --git a/net/tipc/node.c b/net/tipc/node.c
index e2e452a62ba1..598f4d3a0098 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -241,8 +241,6 @@ struct node *tipc_node_attach_link(struct link *l_ptr)
241 char addr_string[16]; 241 char addr_string[16];
242 242
243 if (n_ptr->link_cnt >= 2) { 243 if (n_ptr->link_cnt >= 2) {
244 char addr_string[16];
245
246 err("Attempt to create third link to %s\n", 244 err("Attempt to create third link to %s\n",
247 addr_string_fill(addr_string, n_ptr->addr)); 245 addr_string_fill(addr_string, n_ptr->addr));
248 return NULL; 246 return NULL;
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 5d2b9ce84d0a..76088153524c 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -41,7 +41,6 @@
41#include "addr.h" 41#include "addr.h"
42#include "link.h" 42#include "link.h"
43#include "node.h" 43#include "node.h"
44#include "port.h"
45#include "name_table.h" 44#include "name_table.h"
46#include "user_reg.h" 45#include "user_reg.h"
47#include "msg.h" 46#include "msg.h"
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 849cc06bd914..9ab31a3ce3ad 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -46,7 +46,6 @@
46#include <linux/capability.h> 46#include <linux/capability.h>
47#include <linux/errno.h> /* return codes */ 47#include <linux/errno.h> /* return codes */
48#include <linux/kernel.h> 48#include <linux/kernel.h>
49#include <linux/init.h>
50#include <linux/module.h> /* support for loadable modules */ 49#include <linux/module.h> /* support for loadable modules */
51#include <linux/slab.h> /* kmalloc(), kfree() */ 50#include <linux/slab.h> /* kmalloc(), kfree() */
52#include <linux/mm.h> 51#include <linux/mm.h>
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index e5a3be03aa0d..7012891d39f2 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -23,10 +23,9 @@
23#include <linux/netfilter.h> 23#include <linux/netfilter.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/cache.h> 25#include <linux/cache.h>
26#include <linux/audit.h>
26#include <net/xfrm.h> 27#include <net/xfrm.h>
27#include <net/ip.h> 28#include <net/ip.h>
28#include <linux/audit.h>
29#include <linux/cache.h>
30 29
31#include "xfrm_hash.h" 30#include "xfrm_hash.h"
32 31
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 31be405efb55..d4356e6f7f9b 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -19,9 +19,8 @@
19#include <linux/ipsec.h> 19#include <linux/ipsec.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/cache.h> 21#include <linux/cache.h>
22#include <asm/uaccess.h>
23#include <linux/audit.h> 22#include <linux/audit.h>
24#include <linux/cache.h> 23#include <asm/uaccess.h>
25 24
26#include "xfrm_hash.h" 25#include "xfrm_hash.h"
27 26
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 73751ab6ec0c..dae7d30dca0f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -9,7 +9,7 @@ use strict;
9my $P = $0; 9my $P = $0;
10$P =~ s@.*/@@g; 10$P =~ s@.*/@@g;
11 11
12my $V = '0.08'; 12my $V = '0.09';
13 13
14use Getopt::Long qw(:config no_auto_abbrev); 14use Getopt::Long qw(:config no_auto_abbrev);
15 15
@@ -311,7 +311,7 @@ sub process {
311 311
312 my $Ident = qr{[A-Za-z\d_]+}; 312 my $Ident = qr{[A-Za-z\d_]+};
313 my $Storage = qr{extern|static}; 313 my $Storage = qr{extern|static};
314 my $Sparse = qr{__user|__kernel|__force|__iomem}; 314 my $Sparse = qr{__user|__kernel|__force|__iomem|__must_check|__init_refok};
315 my $NonptrType = qr{ 315 my $NonptrType = qr{
316 \b 316 \b
317 (?:const\s+)? 317 (?:const\s+)?
@@ -325,6 +325,7 @@ sub process {
325 unsigned| 325 unsigned|
326 float| 326 float|
327 double| 327 double|
328 bool|
328 long\s+int| 329 long\s+int|
329 long\s+long| 330 long\s+long|
330 long\s+long\s+int| 331 long\s+long\s+int|
@@ -340,7 +341,8 @@ sub process {
340 }x; 341 }x;
341 my $Type = qr{ 342 my $Type = qr{
342 \b$NonptrType\b 343 \b$NonptrType\b
343 (?:\s*\*+\s*const|\s*\*+)? 344 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
345 (?:\s+$Sparse)*
344 }x; 346 }x;
345 my $Declare = qr{(?:$Storage\s+)?$Type}; 347 my $Declare = qr{(?:$Storage\s+)?$Type};
346 my $Attribute = qr{const|__read_mostly|__init|__initdata|__meminit}; 348 my $Attribute = qr{const|__read_mostly|__init|__initdata|__meminit};
@@ -494,16 +496,15 @@ sub process {
494 ERROR("use tabs not spaces\n" . $herevet); 496 ERROR("use tabs not spaces\n" . $herevet);
495 } 497 }
496 498
497 #
498 # The rest of our checks refer specifically to C style
499 # only apply those _outside_ comments.
500 #
501 next if ($in_comment);
502
503# Remove comments from the line before processing. 499# Remove comments from the line before processing.
504 $line =~ s@/\*.*\*/@@g; 500 my $comment_edge = ($line =~ s@/\*.*\*/@@g) +
505 $line =~ s@/\*.*@@; 501 ($line =~ s@/\*.*@@) +
506 $line =~ s@.*\*/@@; 502 ($line =~ s@^(.).*\*/@$1@);
503
504# The rest of our checks refer specifically to C style
505# only apply those _outside_ comments. Only skip
506# lines in the middle of comments.
507 next if (!$comment_edge && $in_comment);
507 508
508# Standardise the strings and chars within the input to simplify matching. 509# Standardise the strings and chars within the input to simplify matching.
509 $line = sanitise_line($line); 510 $line = sanitise_line($line);
@@ -599,7 +600,7 @@ sub process {
599 if (($prevline !~ /^}/) && 600 if (($prevline !~ /^}/) &&
600 ($prevline !~ /^\+}/) && 601 ($prevline !~ /^\+}/) &&
601 ($prevline !~ /^ }/) && 602 ($prevline !~ /^ }/) &&
602 ($prevline !~ /\s$name(?:\s+$Attribute)?\s*(?:;|=)/)) { 603 ($prevline !~ /\b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=)/)) {
603 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); 604 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr);
604 } 605 }
605 } 606 }
@@ -680,9 +681,9 @@ sub process {
680 681
681# check for spaces between functions and their parentheses. 682# check for spaces between functions and their parentheses.
682 if ($line =~ /($Ident)\s+\(/ && 683 if ($line =~ /($Ident)\s+\(/ &&
683 $1 !~ /^(?:if|for|while|switch|return|volatile)$/ && 684 $1 !~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright)$/ &&
684 $line !~ /$Type\s+\(/ && $line !~ /^.\#\s*define\b/) { 685 $line !~ /$Type\s+\(/ && $line !~ /^.\#\s*define\b/) {
685 ERROR("no space between function name and open parenthesis '('\n" . $herecurr); 686 WARN("no space between function name and open parenthesis '('\n" . $herecurr);
686 } 687 }
687# Check operator spacing. 688# Check operator spacing.
688 # Note we expand the line with the leading + as the real 689 # Note we expand the line with the leading + as the real
@@ -712,6 +713,7 @@ sub process {
712 $c = 'W' if ($elements[$n + 2] =~ /^\s/); 713 $c = 'W' if ($elements[$n + 2] =~ /^\s/);
713 $c = 'B' if ($elements[$n + 2] =~ /^(\)|\]|;)/); 714 $c = 'B' if ($elements[$n + 2] =~ /^(\)|\]|;)/);
714 $c = 'O' if ($elements[$n + 2] eq ''); 715 $c = 'O' if ($elements[$n + 2] eq '');
716 $c = 'E' if ($elements[$n + 2] =~ /\s*\\$/);
715 } else { 717 } else {
716 $c = 'E'; 718 $c = 'E';
717 } 719 }
@@ -812,7 +814,11 @@ sub process {
812 814
813 # All the others need spaces both sides. 815 # All the others need spaces both sides.
814 } elsif ($ctx !~ /[EW]x[WE]/) { 816 } elsif ($ctx !~ /[EW]x[WE]/) {
815 ERROR("need spaces around that '$op' $at\n" . $hereptr); 817 # Ignore email addresses <foo@bar>
818 if (!($op eq '<' && $cb =~ /$;\S+\@\S+>/) &&
819 !($op eq '>' && $cb =~ /<\S+\@\S+$;/)) {
820 ERROR("need spaces around that '$op' $at\n" . $hereptr);
821 }
816 } 822 }
817 $off += length($elements[$n + 1]); 823 $off += length($elements[$n + 1]);
818 } 824 }
@@ -823,15 +829,24 @@ sub process {
823 WARN("multiple assignments should be avoided\n" . $herecurr); 829 WARN("multiple assignments should be avoided\n" . $herecurr);
824 } 830 }
825 831
826# check for multiple declarations, allowing for a function declaration 832## # check for multiple declarations, allowing for a function declaration
827# continuation. 833## # continuation.
828 if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ && 834## if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
829 $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) { 835## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
830 WARN("declaring multiple variables together should be avoided\n" . $herecurr); 836##
831 } 837## # Remove any bracketed sections to ensure we do not
838## # falsly report the parameters of functions.
839## my $ln = $line;
840## while ($ln =~ s/\([^\(\)]*\)//g) {
841## }
842## if ($ln =~ /,/) {
843## WARN("declaring multiple variables together should be avoided\n" . $herecurr);
844## }
845## }
832 846
833#need space before brace following if, while, etc 847#need space before brace following if, while, etc
834 if ($line =~ /\(.*\){/ || $line =~ /do{/) { 848 if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
849 $line =~ /do{/) {
835 ERROR("need a space before the open brace '{'\n" . $herecurr); 850 ERROR("need a space before the open brace '{'\n" . $herecurr);
836 } 851 }
837 852
@@ -841,6 +856,22 @@ sub process {
841 ERROR("need a space after that close brace '}'\n" . $herecurr); 856 ERROR("need a space after that close brace '}'\n" . $herecurr);
842 } 857 }
843 858
859# check spacing on square brackets
860 if ($line =~ /\[\s/ && $line !~ /\[\s*$/) {
861 ERROR("no space after that open square bracket '['\n" . $herecurr);
862 }
863 if ($line =~ /\s\]/) {
864 ERROR("no space before that close square bracket ']'\n" . $herecurr);
865 }
866
867# check spacing on paretheses
868 if ($line =~ /\(\s/ && $line !~ /\(\s*$/) {
869 ERROR("no space after that open parenthesis '('\n" . $herecurr);
870 }
871 if ($line =~ /\s\)/) {
872 ERROR("no space before that close parenthesis ')'\n" . $herecurr);
873 }
874
844#goto labels aren't indented, allow a single space however 875#goto labels aren't indented, allow a single space however
845 if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and 876 if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and
846 !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) { 877 !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) {
@@ -910,7 +941,7 @@ sub process {
910 # grabbing the statement after the identifier 941 # grabbing the statement after the identifier
911 $prevline =~ m{^(.#\s*define\s*$Ident(?:\([^\)]*\))?\s*)(.*)\\\s*$}; 942 $prevline =~ m{^(.#\s*define\s*$Ident(?:\([^\)]*\))?\s*)(.*)\\\s*$};
912 ##print "1<$1> 2<$2>\n"; 943 ##print "1<$1> 2<$2>\n";
913 if ($2 ne '') { 944 if (defined $2 && $2 ne '') {
914 $off = length($1); 945 $off = length($1);
915 $ln--; 946 $ln--;
916 $cnt++; 947 $cnt++;
@@ -950,8 +981,10 @@ sub process {
950 my ($lvl, @block) = ctx_block_level($nr, $cnt); 981 my ($lvl, @block) = ctx_block_level($nr, $cnt);
951 982
952 my $stmt = join(' ', @block); 983 my $stmt = join(' ', @block);
953 $stmt =~ s/^[^{]*{//; 984 $stmt =~ s/(^[^{]*){//;
954 $stmt =~ s/}[^}]*$//; 985 my $before = $1;
986 $stmt =~ s/}([^}]*$)//;
987 my $after = $1;
955 988
956 #print "block<" . join(' ', @block) . "><" . scalar(@block) . ">\n"; 989 #print "block<" . join(' ', @block) . "><" . scalar(@block) . ">\n";
957 #print "stmt<$stmt>\n\n"; 990 #print "stmt<$stmt>\n\n";
@@ -963,12 +996,14 @@ sub process {
963 # Also nested if's often require braces to 996 # Also nested if's often require braces to
964 # disambiguate the else binding so shhh there. 997 # disambiguate the else binding so shhh there.
965 my @semi = ($stmt =~ /;/g); 998 my @semi = ($stmt =~ /;/g);
999 push(@semi, "/**/") if ($stmt =~ m@/\*@);
966 ##print "semi<" . scalar(@semi) . ">\n"; 1000 ##print "semi<" . scalar(@semi) . ">\n";
967 if ($lvl == 0 && scalar(@semi) < 2 && 1001 if ($lvl == 0 && scalar(@semi) < 2 &&
968 $stmt !~ /{/ && $stmt !~ /\bif\b/) { 1002 $stmt !~ /{/ && $stmt !~ /\bif\b/ &&
1003 $before !~ /}/ && $after !~ /{/) {
969 my $herectx = "$here\n" . join("\n", @control, @block[1 .. $#block]) . "\n"; 1004 my $herectx = "$here\n" . join("\n", @control, @block[1 .. $#block]) . "\n";
970 shift(@block); 1005 shift(@block);
971 ERROR("braces {} are not necessary for single statement blocks\n" . $herectx); 1006 WARN("braces {} are not necessary for single statement blocks\n" . $herectx);
972 } 1007 }
973 } 1008 }
974 } 1009 }
@@ -1013,6 +1048,11 @@ sub process {
1013# $clean = 0; 1048# $clean = 0;
1014# } 1049# }
1015 1050
1051# warn about spacing in #ifdefs
1052 if ($line =~ /^.#\s*(ifdef|ifndef|elif)\s\s+/) {
1053 ERROR("exactly one space required after that #$1\n" . $herecurr);
1054 }
1055
1016# check for spinlock_t definitions without a comment. 1056# check for spinlock_t definitions without a comment.
1017 if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/) { 1057 if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/) {
1018 my $which = $1; 1058 my $which = $1;
@@ -1027,14 +1067,14 @@ sub process {
1027 } 1067 }
1028 } 1068 }
1029# check of hardware specific defines 1069# check of hardware specific defines
1030 if ($line =~ m@^.#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@) { 1070 if ($line =~ m@^.#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) {
1031 CHK("architecture specific defines should be avoided\n" . $herecurr); 1071 CHK("architecture specific defines should be avoided\n" . $herecurr);
1032 } 1072 }
1033 1073
1034# check the location of the inline attribute, that it is between 1074# check the location of the inline attribute, that it is between
1035# storage class and type. 1075# storage class and type.
1036 if ($line =~ /$Type\s+(?:inline|__always_inline)\b/ || 1076 if ($line =~ /$Type\s+(?:inline|__always_inline|noinline)\b/ ||
1037 $line =~ /\b(?:inline|always_inline)\s+$Storage/) { 1077 $line =~ /\b(?:inline|__always_inline|noinline)\s+$Storage/) {
1038 ERROR("inline keyword should sit between storage class and type\n" . $herecurr); 1078 ERROR("inline keyword should sit between storage class and type\n" . $herecurr);
1039 } 1079 }
1040 1080
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index dca0344cc1bc..f2950cab74a6 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -74,7 +74,6 @@ struct cs4231_dma_control {
74 void (*enable)(struct cs4231_dma_control *dma_cont, int on); 74 void (*enable)(struct cs4231_dma_control *dma_cont, int on);
75 int (*request)(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len); 75 int (*request)(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len);
76 unsigned int (*address)(struct cs4231_dma_control *dma_cont); 76 unsigned int (*address)(struct cs4231_dma_control *dma_cont);
77 void (*reset)(struct snd_cs4231 *chip);
78 void (*preallocate)(struct snd_cs4231 *chip, struct snd_pcm *pcm); 77 void (*preallocate)(struct snd_cs4231 *chip, struct snd_pcm *pcm);
79#ifdef EBUS_SUPPORT 78#ifdef EBUS_SUPPORT
80 struct ebus_dma_info ebus_info; 79 struct ebus_dma_info ebus_info;
@@ -1214,10 +1213,6 @@ static int __init snd_cs4231_probe(struct snd_cs4231 *chip)
1214 1213
1215 spin_lock_irqsave(&chip->lock, flags); 1214 spin_lock_irqsave(&chip->lock, flags);
1216 1215
1217
1218 /* Reset DMA engine (sbus only). */
1219 chip->p_dma.reset(chip);
1220
1221 __cs4231_readb(chip, CS4231P(chip, STATUS)); /* clear any pendings IRQ */ 1216 __cs4231_readb(chip, CS4231P(chip, STATUS)); /* clear any pendings IRQ */
1222 __cs4231_writeb(chip, 0, CS4231P(chip, STATUS)); 1217 __cs4231_writeb(chip, 0, CS4231P(chip, STATUS));
1223 mb(); 1218 mb();
@@ -1861,14 +1856,13 @@ static void sbus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
1861 if (!on) { 1856 if (!on) {
1862 sbus_writel(0, base->regs + base->dir + APCNC); 1857 sbus_writel(0, base->regs + base->dir + APCNC);
1863 sbus_writel(0, base->regs + base->dir + APCNVA); 1858 sbus_writel(0, base->regs + base->dir + APCNVA);
1864 sbus_writel(0, base->regs + base->dir + APCC); 1859 if ( base->dir == APC_PLAY ) {
1865 sbus_writel(0, base->regs + base->dir + APCVA); 1860 sbus_writel(0, base->regs + base->dir + APCC);
1861 sbus_writel(0, base->regs + base->dir + APCVA);
1862 }
1866 1863
1867 /* ACK any APC interrupts. */ 1864 udelay(1200);
1868 csr = sbus_readl(base->regs + APCCSR);
1869 sbus_writel(csr, base->regs + APCCSR);
1870 } 1865 }
1871 udelay(1000);
1872 csr = sbus_readl(base->regs + APCCSR); 1866 csr = sbus_readl(base->regs + APCCSR);
1873 shift = 0; 1867 shift = 0;
1874 if ( base->dir == APC_PLAY ) 1868 if ( base->dir == APC_PLAY )
@@ -1894,23 +1888,6 @@ static unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont)
1894 return sbus_readl(base->regs + base->dir + APCVA); 1888 return sbus_readl(base->regs + base->dir + APCVA);
1895} 1889}
1896 1890
1897static void sbus_dma_reset(struct snd_cs4231 *chip)
1898{
1899 sbus_writel(APC_CHIP_RESET, chip->port + APCCSR);
1900 sbus_writel(0x00, chip->port + APCCSR);
1901 sbus_writel(sbus_readl(chip->port + APCCSR) | APC_CDC_RESET,
1902 chip->port + APCCSR);
1903
1904 udelay(20);
1905
1906 sbus_writel(sbus_readl(chip->port + APCCSR) & ~APC_CDC_RESET,
1907 chip->port + APCCSR);
1908 sbus_writel(sbus_readl(chip->port + APCCSR) | (APC_XINT_ENA |
1909 APC_XINT_PENA |
1910 APC_XINT_CENA),
1911 chip->port + APCCSR);
1912}
1913
1914static void sbus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm) 1891static void sbus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm)
1915{ 1892{
1916 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS, 1893 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS,
@@ -1986,14 +1963,12 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card,
1986 chip->p_dma.enable = sbus_dma_enable; 1963 chip->p_dma.enable = sbus_dma_enable;
1987 chip->p_dma.request = sbus_dma_request; 1964 chip->p_dma.request = sbus_dma_request;
1988 chip->p_dma.address = sbus_dma_addr; 1965 chip->p_dma.address = sbus_dma_addr;
1989 chip->p_dma.reset = sbus_dma_reset;
1990 chip->p_dma.preallocate = sbus_dma_preallocate; 1966 chip->p_dma.preallocate = sbus_dma_preallocate;
1991 1967
1992 chip->c_dma.prepare = sbus_dma_prepare; 1968 chip->c_dma.prepare = sbus_dma_prepare;
1993 chip->c_dma.enable = sbus_dma_enable; 1969 chip->c_dma.enable = sbus_dma_enable;
1994 chip->c_dma.request = sbus_dma_request; 1970 chip->c_dma.request = sbus_dma_request;
1995 chip->c_dma.address = sbus_dma_addr; 1971 chip->c_dma.address = sbus_dma_addr;
1996 chip->c_dma.reset = sbus_dma_reset;
1997 chip->c_dma.preallocate = sbus_dma_preallocate; 1972 chip->c_dma.preallocate = sbus_dma_preallocate;
1998 1973
1999 if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt, 1974 if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt,
@@ -2087,11 +2062,6 @@ static unsigned int _ebus_dma_addr(struct cs4231_dma_control *dma_cont)
2087 return ebus_dma_addr(&dma_cont->ebus_info); 2062 return ebus_dma_addr(&dma_cont->ebus_info);
2088} 2063}
2089 2064
2090static void _ebus_dma_reset(struct snd_cs4231 *chip)
2091{
2092 return;
2093}
2094
2095static void _ebus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm) 2065static void _ebus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm)
2096{ 2066{
2097 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 2067 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -2171,14 +2141,12 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card,
2171 chip->p_dma.enable = _ebus_dma_enable; 2141 chip->p_dma.enable = _ebus_dma_enable;
2172 chip->p_dma.request = _ebus_dma_request; 2142 chip->p_dma.request = _ebus_dma_request;
2173 chip->p_dma.address = _ebus_dma_addr; 2143 chip->p_dma.address = _ebus_dma_addr;
2174 chip->p_dma.reset = _ebus_dma_reset;
2175 chip->p_dma.preallocate = _ebus_dma_preallocate; 2144 chip->p_dma.preallocate = _ebus_dma_preallocate;
2176 2145
2177 chip->c_dma.prepare = _ebus_dma_prepare; 2146 chip->c_dma.prepare = _ebus_dma_prepare;
2178 chip->c_dma.enable = _ebus_dma_enable; 2147 chip->c_dma.enable = _ebus_dma_enable;
2179 chip->c_dma.request = _ebus_dma_request; 2148 chip->c_dma.request = _ebus_dma_request;
2180 chip->c_dma.address = _ebus_dma_addr; 2149 chip->c_dma.address = _ebus_dma_addr;
2181 chip->c_dma.reset = _ebus_dma_reset;
2182 chip->c_dma.preallocate = _ebus_dma_preallocate; 2150 chip->c_dma.preallocate = _ebus_dma_preallocate;
2183 2151
2184 chip->port = ioremap(edev->resource[0].start, 0x10); 2152 chip->port = ioremap(edev->resource[0].start, 0x10);