aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/SubmittingPatches4
-rw-r--r--Documentation/i386/boot.txt38
-rw-r--r--Documentation/i386/zero-page.txt122
-rw-r--r--Documentation/ja_JP/SubmittingPatches556
-rw-r--r--Documentation/kernel-parameters.txt8
-rw-r--r--Documentation/lguest/lguest.c178
-rw-r--r--Documentation/networking/00-INDEX2
-rw-r--r--Documentation/networking/ip-sysctl.txt6
-rw-r--r--Documentation/networking/net-modules.txt315
-rw-r--r--Documentation/networking/tc-actions-env-rules.txt29
-rw-r--r--Documentation/scsi/link_power_management_policy.txt19
-rw-r--r--MAINTAINERS54
-rw-r--r--Makefile10
-rw-r--r--arch/arm/configs/zylonite_defconfig736
-rw-r--r--arch/arm/mach-ixp2000/Kconfig2
-rw-r--r--arch/arm/mach-netx/xc.c6
-rw-r--r--arch/arm/mach-omap1/board-h2.c4
-rw-r--r--arch/arm/mach-omap2/clock.c2
-rw-r--r--arch/arm/mach-pxa/mfp.c2
-rw-r--r--arch/arm/mach-pxa/pxa300.c2
-rw-r--r--arch/arm/mach-pxa/pxa320.c2
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c2
-rw-r--r--arch/arm/mach-pxa/time.c3
-rw-r--r--arch/arm/mach-pxa/zylonite.c2
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa300.c2
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa320.c2
-rw-r--r--arch/arm/mm/proc-arm926.S4
-rw-r--r--arch/blackfin/Kconfig15
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig2
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig2
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig279
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/PNAV-10_defconfig2
-rw-r--r--arch/blackfin/kernel/dma-mapping.c1
-rw-r--r--arch/blackfin/kernel/entry.S6
-rw-r--r--arch/blackfin/kernel/fixed_code.S14
-rw-r--r--arch/blackfin/kernel/gptimers.c47
-rw-r--r--arch/blackfin/kernel/setup.c13
-rw-r--r--arch/blackfin/kernel/traps.c340
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S11
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c53
-rw-r--r--arch/blackfin/mach-bf533/boards/H8606.c345
-rw-r--r--arch/blackfin/mach-bf533/boards/Makefile1
-rw-r--r--arch/blackfin/mach-bf533/boards/cm_bf533.c42
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c4
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537.c4
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c6
-rw-r--r--arch/blackfin/mach-common/entry.S2
-rw-r--r--arch/frv/mb93090-mb00/pci-dma.c3
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/i386/.gitignore1
-rw-r--r--arch/ia64/configs/sn2_defconfig106
-rw-r--r--arch/ia64/kernel/efi.c2
-rw-r--r--arch/ia64/kernel/gate.lds.S3
-rw-r--r--arch/ia64/kernel/msi_ia64.c2
-rw-r--r--arch/ia64/kernel/setup.c49
-rw-r--r--arch/ia64/kernel/smpboot.c21
-rw-r--r--arch/ia64/mm/init.c4
-rw-r--r--arch/ia64/scripts/check-segrel.lds1
-rw-r--r--arch/ia64/sn/kernel/mca.c1
-rw-r--r--arch/m68k/kernel/dma.c2
-rw-r--r--arch/mips/Kconfig19
-rw-r--r--arch/mips/au1000/common/irq.c32
-rw-r--r--arch/mips/au1000/common/time.c22
-rw-r--r--arch/mips/au1000/mtx-1/Makefile3
-rw-r--r--arch/mips/au1000/mtx-1/platform.c77
-rw-r--r--arch/mips/au1000/pb1200/Makefile2
-rw-r--r--arch/mips/au1000/pb1200/board_setup.c6
-rw-r--r--arch/mips/au1000/pb1200/irqmap.c100
-rw-r--r--arch/mips/basler/excite/excite_setup.c21
-rw-r--r--arch/mips/configs/db1000_defconfig1
-rw-r--r--arch/mips/configs/db1100_defconfig1
-rw-r--r--arch/mips/configs/db1200_defconfig1
-rw-r--r--arch/mips/configs/db1500_defconfig1
-rw-r--r--arch/mips/configs/db1550_defconfig1
-rw-r--r--arch/mips/configs/pb1100_defconfig1
-rw-r--r--arch/mips/configs/pb1500_defconfig1
-rw-r--r--arch/mips/configs/pb1550_defconfig1
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig2
-rw-r--r--arch/mips/gt64120/wrppmc/time.c6
-rw-r--r--arch/mips/jazz/irq.c27
-rw-r--r--arch/mips/jmr3927/rbhma3100/setup.c83
-rw-r--r--arch/mips/kernel/Makefile5
-rw-r--r--arch/mips/kernel/cevt-bcm1480.c149
-rw-r--r--arch/mips/kernel/cevt-gt641xx.c12
-rw-r--r--arch/mips/kernel/cevt-r4k.c45
-rw-r--r--arch/mips/kernel/cevt-sb1250.c148
-rw-r--r--arch/mips/kernel/cevt-txx9.c171
-rw-r--r--arch/mips/kernel/csrc-bcm1480.c54
-rw-r--r--arch/mips/kernel/csrc-sb1250.c70
-rw-r--r--arch/mips/kernel/i8253.c25
-rw-r--r--arch/mips/kernel/irixsig.c8
-rw-r--r--arch/mips/kernel/ptrace.c18
-rw-r--r--arch/mips/kernel/ptrace32.c4
-rw-r--r--arch/mips/kernel/smtc.c57
-rw-r--r--arch/mips/kernel/syscall.c9
-rw-r--r--arch/mips/kernel/time.c88
-rw-r--r--arch/mips/kernel/vmlinux.lds.S32
-rw-r--r--arch/mips/kernel/vpe.c4
-rw-r--r--arch/mips/lasat/setup.c7
-rw-r--r--arch/mips/mips-boards/generic/time.c52
-rw-r--r--arch/mips/mipssim/sim_time.c52
-rw-r--r--arch/mips/mm/c-r3k.c60
-rw-r--r--arch/mips/mm/c-r4k.c21
-rw-r--r--arch/mips/mm/dma-default.c2
-rw-r--r--arch/mips/pci/fixup-pmcmsp.c2
-rw-r--r--arch/mips/pci/fixup-tb0219.c2
-rw-r--r--arch/mips/pci/ops-pmcmsp.c2
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_serial.c2
-rw-r--r--arch/mips/qemu/q-irq.c1
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c11
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c128
-rw-r--r--arch/mips/sgi-ip32/ip32-platform.c2
-rw-r--r--arch/mips/sibyte/Kconfig14
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c40
-rw-r--r--arch/mips/sibyte/bcm1480/time.c162
-rw-r--r--arch/mips/sibyte/sb1250/irq.c38
-rw-r--r--arch/mips/sibyte/sb1250/time.c194
-rw-r--r--arch/mips/sni/time.c87
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c17
-rw-r--r--arch/mips/tx4938/toshiba_rbtx4938/setup.c19
-rw-r--r--arch/s390/Kconfig2
-rw-r--r--arch/sh/Kconfig8
-rw-r--r--arch/sh/Kconfig.debug8
-rw-r--r--arch/sh/Makefile2
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c71
-rw-r--r--arch/sh/boards/se/7722/setup.c4
-rw-r--r--arch/sh/configs/r7785rp_defconfig299
-rw-r--r--arch/sh/drivers/pci/pci-st40.c4
-rw-r--r--arch/sh/kernel/cpu/irq/ipr.c9
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c27
-rw-r--r--arch/sh/kernel/irq.c8
-rw-r--r--arch/sh/kernel/setup.c46
-rw-r--r--arch/sh/kernel/vmlinux.lds.S201
-rw-r--r--arch/sh/kernel/vsyscall/vsyscall.lds.S5
-rw-r--r--arch/sh/mm/copy_page.S4
-rw-r--r--arch/sh/oprofile/op_model_sh7750.c22
-rw-r--r--arch/sh/tools/mach-types29
-rw-r--r--arch/sh64/Kconfig2
-rw-r--r--arch/sh64/configs/cayman_defconfig140
-rw-r--r--arch/sh64/configs/harp_defconfig105
-rw-r--r--arch/sh64/configs/sim_defconfig68
-rw-r--r--arch/sparc/kernel/pcic.c2
-rw-r--r--arch/sparc/kernel/process.c7
-rw-r--r--arch/sparc/kernel/time.c9
-rw-r--r--arch/sparc/mm/btfixup.c5
-rw-r--r--arch/sparc/mm/io-unit.c2
-rw-r--r--arch/sparc/mm/sun4c.c15
-rw-r--r--arch/sparc64/Kconfig2
-rw-r--r--arch/sparc64/defconfig69
-rw-r--r--arch/sparc64/kernel/binfmt_elf32.c4
-rw-r--r--arch/sparc64/kernel/central.c9
-rw-r--r--arch/sparc64/kernel/iommu_common.c2
-rw-r--r--arch/sparc64/kernel/ldc.c2
-rw-r--r--arch/sparc64/kernel/semaphore.c5
-rw-r--r--arch/sparc64/kernel/smp.c4
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c2
-rw-r--r--arch/sparc64/kernel/sys_sparc.c2
-rw-r--r--arch/sparc64/kernel/time.c2
-rw-r--r--arch/sparc64/kernel/traps.c9
-rw-r--r--arch/sparc64/mm/init.c4
-rw-r--r--arch/sparc64/mm/tsb.c4
-rw-r--r--arch/sparc64/mm/ultra.S7
-rw-r--r--arch/sparc64/prom/console.c9
-rw-r--r--arch/sparc64/prom/tree.c49
-rw-r--r--arch/um/Kconfig.i3862
-rw-r--r--arch/um/Makefile-i3865
-rw-r--r--arch/um/Makefile-x86_645
-rw-r--r--arch/um/drivers/ubd_kern.c2
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/um/sys-i386/ptrace.c8
-rw-r--r--arch/um/sys-x86_64/ptrace.c4
-rw-r--r--arch/x86/Kconfig.cpu (renamed from arch/i386/Kconfig.cpu)0
-rw-r--r--arch/x86/Kconfig.debug (renamed from arch/i386/Kconfig.debug)49
-rw-r--r--arch/x86/Kconfig.i386 (renamed from arch/i386/Kconfig)4
-rw-r--r--arch/x86/Kconfig.x86_64 (renamed from arch/x86_64/Kconfig)13
-rw-r--r--arch/x86/Makefile16
-rw-r--r--arch/x86/Makefile_32 (renamed from arch/i386/Makefile)7
-rw-r--r--arch/x86/Makefile_32.cpu (renamed from arch/i386/Makefile.cpu)0
-rw-r--r--arch/x86/Makefile_64 (renamed from arch/x86_64/Makefile)5
-rw-r--r--arch/x86/boot/boot.h8
-rw-r--r--arch/x86/boot/compressed/head_32.S12
-rw-r--r--arch/x86/boot/compressed/head_64.S7
-rw-r--r--arch/x86/boot/header.S62
-rw-r--r--arch/x86/boot/video-bios.c2
-rw-r--r--arch/x86/boot/video-vesa.c2
-rw-r--r--arch/x86/boot/video.c2
-rw-r--r--arch/x86/configs/i386_defconfig (renamed from arch/i386/defconfig)0
-rw-r--r--arch/x86/configs/x86_64_defconfig (renamed from arch/x86_64/defconfig)2
-rw-r--r--arch/x86/kernel/Makefile_642
-rw-r--r--arch/x86/kernel/acpi/processor.c3
-rw-r--r--arch/x86/kernel/aperture_64.c15
-rw-r--r--arch/x86/kernel/asm-offsets_64.c10
-rw-r--r--arch/x86/kernel/cpu/proc.c10
-rw-r--r--arch/x86/kernel/crash.c6
-rw-r--r--arch/x86/kernel/early-quirks.c14
-rw-r--r--arch/x86/kernel/machine_kexec_64.c2
-rw-r--r--arch/x86/kernel/pci-calgary_64.c2
-rw-r--r--arch/x86/kernel/pci-dma_64.c10
-rw-r--r--arch/x86/kernel/pci-gart_64.c23
-rw-r--r--arch/x86/kernel/pci-nommu_64.c2
-rw-r--r--arch/x86/kernel/pci-swiotlb_64.c2
-rw-r--r--arch/x86/kernel/reboot_64.c2
-rw-r--r--arch/x86/kernel/setup_32.c3
-rw-r--r--arch/x86/kernel/setup_64.c10
-rw-r--r--arch/x86/kernel/smp_32.c8
-rw-r--r--arch/x86/lguest/boot.c54
-rw-r--r--arch/x86/lguest/i386_head.S8
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c4
-rw-r--r--arch/x86/mm/discontig_32.c4
-rw-r--r--arch/x86/mm/fault_32.c2
-rw-r--r--arch/x86/mm/init_64.c6
-rw-r--r--arch/x86_64/.gitignore1
-rw-r--r--arch/x86_64/Kconfig.debug61
-rw-r--r--arch/xtensa/Kconfig2
-rw-r--r--block/cfq-iosched.c7
-rw-r--r--block/compat_ioctl.c2
-rw-r--r--block/ll_rw_blk.c45
-rw-r--r--crypto/hmac.c11
-rw-r--r--crypto/tcrypt.c20
-rw-r--r--drivers/acpi/Kconfig10
-rw-r--r--drivers/acpi/battery.c164
-rw-r--r--drivers/acpi/bus.c8
-rw-r--r--drivers/acpi/button.c37
-rw-r--r--drivers/acpi/ec.c146
-rw-r--r--drivers/acpi/fan.c72
-rw-r--r--drivers/acpi/power.c63
-rw-r--r--drivers/acpi/sleep/main.c5
-rw-r--r--drivers/acpi/sleep/proc.c66
-rw-r--r--drivers/ata/ahci.c318
-rw-r--r--drivers/ata/libata-core.c419
-rw-r--r--drivers/ata/libata-eh.c203
-rw-r--r--drivers/ata/libata-scsi.c98
-rw-r--r--drivers/ata/libata.h2
-rw-r--r--drivers/ata/pata_acpi.c4
-rw-r--r--drivers/ata/pata_icside.c42
-rw-r--r--drivers/ata/pata_ns87415.c2
-rw-r--r--drivers/ata/pata_optidma.c2
-rw-r--r--drivers/ata/pata_pcmcia.c12
-rw-r--r--drivers/ata/pata_pdc2027x.c2
-rw-r--r--drivers/ata/pata_pdc202xx_old.c4
-rw-r--r--drivers/ata/pata_scc.c13
-rw-r--r--drivers/ata/pata_via.c2
-rw-r--r--drivers/ata/pata_winbond.c2
-rw-r--r--drivers/ata/pdc_adma.c12
-rw-r--r--drivers/ata/sata_fsl.c159
-rw-r--r--drivers/ata/sata_inic162x.c4
-rw-r--r--drivers/ata/sata_mv.c7
-rw-r--r--drivers/ata/sata_nv.c126
-rw-r--r--drivers/ata/sata_promise.c142
-rw-r--r--drivers/ata/sata_qstor.c3
-rw-r--r--drivers/ata/sata_sil.c11
-rw-r--r--drivers/ata/sata_sil24.c15
-rw-r--r--drivers/ata/sata_sis.c64
-rw-r--r--drivers/ata/sata_svw.c10
-rw-r--r--drivers/ata/sata_sx4.c177
-rw-r--r--drivers/ata/sata_uli.c18
-rw-r--r--drivers/ata/sata_via.c20
-rw-r--r--drivers/ata/sata_vsc.c15
-rw-r--r--drivers/base/core.c6
-rw-r--r--drivers/block/cciss.c14
-rw-r--r--drivers/block/cciss_scsi.c14
-rw-r--r--drivers/block/cciss_scsi.h14
-rw-r--r--drivers/block/cryptoloop.c9
-rw-r--r--drivers/block/sunvdc.c1
-rw-r--r--drivers/block/ub.c11
-rw-r--r--drivers/block/virtio_blk.c10
-rw-r--r--drivers/cdrom/viocd.c3
-rw-r--r--drivers/char/agp/Kconfig4
-rw-r--r--drivers/char/agp/amd64-agp.c2
-rw-r--r--drivers/char/mem.c4
-rw-r--r--drivers/connector/connector.c5
-rw-r--r--drivers/cpuidle/cpuidle.c1
-rw-r--r--drivers/cpuidle/governor.c3
-rw-r--r--drivers/crypto/padlock-sha.c4
-rw-r--r--drivers/dma/Kconfig1
-rw-r--r--drivers/firewire/fw-ohci.c37
-rw-r--r--drivers/hid/hid-input.c22
-rw-r--r--drivers/hid/usbhid/hid-quirks.c8
-rw-r--r--drivers/hid/usbhid/hiddev.c2
-rw-r--r--drivers/ide/arm/icside.c16
-rw-r--r--drivers/ide/ide-iops.c3
-rw-r--r--drivers/ide/pci/cy82c693.c6
-rw-r--r--drivers/ide/pci/generic.c2
-rw-r--r--drivers/ide/pci/hpt366.c32
-rw-r--r--drivers/ide/pci/sc1200.c9
-rw-r--r--drivers/ieee1394/dma.c4
-rw-r--r--drivers/ieee1394/ieee1394_transactions.c2
-rw-r--r--drivers/infiniband/core/fmr_pool.c8
-rw-r--r--drivers/infiniband/core/umem.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_eeprom.c10
-rw-r--r--drivers/infiniband/hw/ipath/ipath_intr.c18
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ruc.c14
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_memfree.c9
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c2
-rw-r--r--drivers/input/joystick/xpad.c2
-rw-r--r--drivers/input/misc/pcspkr.c2
-rw-r--r--drivers/input/mouse/appletouch.c125
-rw-r--r--drivers/input/mouse/inport.c2
-rw-r--r--drivers/input/mouse/logibm.c2
-rw-r--r--drivers/input/serio/hp_sdc.c4
-rw-r--r--drivers/isdn/capi/capidrv.c25
-rw-r--r--drivers/isdn/sc/shmem.c9
-rw-r--r--drivers/lguest/core.c5
-rw-r--r--drivers/lguest/hypercalls.c11
-rw-r--r--drivers/lguest/interrupts_and_traps.c37
-rw-r--r--drivers/lguest/lg.h7
-rw-r--r--drivers/lguest/lguest_device.c11
-rw-r--r--drivers/lguest/lguest_user.c23
-rw-r--r--drivers/lguest/page_tables.c113
-rw-r--r--drivers/lguest/segments.c48
-rw-r--r--drivers/lguest/x86/core.c122
-rw-r--r--drivers/lguest/x86/switcher_32.S71
-rw-r--r--drivers/md/dm-crypt.c10
-rw-r--r--drivers/md/raid6algos.c4
-rw-r--r--drivers/md/raid6mmx.c2
-rw-r--r--drivers/md/raid6sse1.c2
-rw-r--r--drivers/md/raid6sse2.c4
-rw-r--r--drivers/md/raid6x86.h2
-rw-r--r--drivers/media/common/saa7146_core.c3
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.h2
-rw-r--r--drivers/media/video/ivtv/ivtv-udma.c6
-rw-r--r--drivers/media/video/videobuf-dma-sg.c10
-rw-r--r--drivers/message/i2o/i2o_block.c1
-rw-r--r--drivers/misc/fujitsu-laptop.c7
-rw-r--r--drivers/mmc/core/mmc_ops.c22
-rw-r--r--drivers/mmc/core/sd_ops.c4
-rw-r--r--drivers/mmc/host/au1xmmc.c6
-rw-r--r--drivers/mmc/host/imxmmc.c2
-rw-r--r--drivers/mmc/host/mmc_spi.c52
-rw-r--r--drivers/mmc/host/mmci.c6
-rw-r--r--drivers/mmc/host/pxamci.c12
-rw-r--r--drivers/mmc/host/sdhci.c2
-rw-r--r--drivers/mmc/host/wbsd.c2
-rw-r--r--drivers/net/Kconfig35
-rw-r--r--drivers/net/Makefile4
-rw-r--r--drivers/net/bfin_mac.c2
-rw-r--r--drivers/net/bonding/bond_main.c5
-rw-r--r--drivers/net/bonding/bonding.h1
-rw-r--r--drivers/net/cpmac.c145
-rw-r--r--drivers/net/e1000/e1000.h8
-rw-r--r--drivers/net/e1000/e1000_ethtool.c29
-rw-r--r--drivers/net/e1000/e1000_hw.c4
-rw-r--r--drivers/net/e1000/e1000_main.c7
-rw-r--r--drivers/net/e1000/e1000_param.c23
-rw-r--r--drivers/net/e1000e/82571.c2
-rw-r--r--drivers/net/e1000e/e1000.h5
-rw-r--r--drivers/net/e1000e/ethtool.c4
-rw-r--r--drivers/net/e1000e/netdev.c425
-rw-r--r--drivers/net/e1000e/param.c35
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c28
-rw-r--r--drivers/net/fec_mpc52xx.c1112
-rw-r--r--drivers/net/fec_mpc52xx.h313
-rw-r--r--drivers/net/fec_mpc52xx_phy.c198
-rw-r--r--drivers/net/forcedeth.c16
-rw-r--r--drivers/net/ipg.c22
-rw-r--r--drivers/net/ipg.h20
-rw-r--r--drivers/net/irda/au1k_ir.c11
-rw-r--r--drivers/net/ixgb/ixgb.h7
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c7
-rw-r--r--drivers/net/ixgb/ixgb_hw.c4
-rw-r--r--drivers/net/ixgb/ixgb_main.c15
-rw-r--r--drivers/net/ixgb/ixgb_param.c43
-rw-r--r--drivers/net/ixgbe/ixgbe.h2
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c3
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c9
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--drivers/net/mlx4/icm.c4
-rw-r--r--drivers/net/myri10ge/myri10ge.c6
-rw-r--r--drivers/net/natsemi.c1
-rw-r--r--drivers/net/pcmcia/3c574_cs.c2
-rw-r--r--drivers/net/pcmcia/3c589_cs.c2
-rw-r--r--drivers/net/pcmcia/axnet_cs.c2
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c2
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c2
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c2
-rw-r--r--drivers/net/ppp_mppe.c10
-rw-r--r--drivers/net/pppoe.c2
-rw-r--r--drivers/net/pppol2tp.c2
-rw-r--r--drivers/net/r8169.c12
-rw-r--r--drivers/net/rrunner.c8
-rw-r--r--drivers/net/ucc_geth.c15
-rw-r--r--drivers/net/usb/dm9601.c4
-rw-r--r--drivers/net/usb/rndis_host.c18
-rw-r--r--drivers/net/wan/lmc/lmc_main.c55
-rw-r--r--drivers/net/wireless/b43/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/ipw2100.c11
-rw-r--r--drivers/net/wireless/ipw2200.c6
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c56
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c56
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h2
-rw-r--r--drivers/net/wireless/rtl8187_dev.c20
-rw-r--r--drivers/pci/intel-iommu.c13
-rw-r--r--drivers/pci/intel-iommu.h2
-rw-r--r--drivers/rtc/rtc-s3c.c2
-rw-r--r--drivers/s390/scsi/zfcp_aux.c12
-rw-r--r--drivers/s390/scsi/zfcp_def.h6
-rw-r--r--drivers/s390/scsi/zfcp_erp.c7
-rw-r--r--drivers/scsi/Kconfig4
-rw-r--r--drivers/scsi/aacraid/commctrl.c12
-rw-r--r--drivers/scsi/aacraid/comminit.c2
-rw-r--r--drivers/scsi/aacraid/dpcsup.c2
-rw-r--r--drivers/scsi/arcmsr/arcmsr.h39
-rw-r--r--drivers/scsi/arcmsr/arcmsr_attr.c6
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c205
-rw-r--r--drivers/scsi/arm/scsi.h8
-rw-r--r--drivers/scsi/atari_NCR5380.c5
-rw-r--r--drivers/scsi/ipr.c2
-rw-r--r--drivers/scsi/iscsi_tcp.c9
-rw-r--r--drivers/scsi/osst.c6
-rw-r--r--drivers/scsi/sg.c14
-rw-r--r--drivers/scsi/st.c14
-rw-r--r--drivers/scsi/sun3x_esp.c4
-rw-r--r--drivers/serial/serial_core.c3
-rw-r--r--drivers/serial/serial_cs.c2
-rw-r--r--drivers/serial/serial_txx9.c10
-rw-r--r--drivers/sh/maple/maple.c3
-rw-r--r--drivers/spi/spidev.c6
-rw-r--r--drivers/usb/core/message.c10
-rw-r--r--drivers/usb/core/urb.c2
-rw-r--r--drivers/usb/gadget/amd5536udc.c2
-rw-r--r--drivers/usb/host/Kconfig2
-rw-r--r--drivers/usb/host/ohci-hcd.c9
-rw-r--r--drivers/usb/host/uhci-q.c19
-rw-r--r--drivers/usb/misc/cytherm.c4
-rw-r--r--drivers/usb/misc/emi26.c4
-rw-r--r--drivers/usb/misc/emi62.c4
-rw-r--r--drivers/usb/misc/ftdi-elan.c130
-rw-r--r--drivers/usb/misc/idmouse.c45
-rw-r--r--drivers/usb/misc/iowarrior.c11
-rw-r--r--drivers/usb/misc/legousbtower.c14
-rw-r--r--drivers/usb/misc/rio500.c15
-rw-r--r--drivers/usb/misc/usblcd.c11
-rw-r--r--drivers/usb/serial/ark3116.c13
-rw-r--r--drivers/usb/serial/ch341.c8
-rw-r--r--drivers/usb/serial/console.c4
-rw-r--r--drivers/usb/serial/cp2101.c48
-rw-r--r--drivers/usb/serial/digi_acceleport.c16
-rw-r--r--drivers/usb/serial/empeg.c23
-rw-r--r--drivers/usb/serial/ftdi_sio.c33
-rw-r--r--drivers/usb/serial/generic.c7
-rw-r--r--drivers/usb/serial/io_edgeport.c18
-rw-r--r--drivers/usb/serial/ir-usb.c11
-rw-r--r--drivers/usb/serial/keyspan.c16
-rw-r--r--drivers/usb/serial/kobil_sct.c5
-rw-r--r--drivers/usb/serial/mos7840.c23
-rw-r--r--drivers/usb/serial/option.c5
-rw-r--r--drivers/usb/serial/pl2303.c12
-rw-r--r--drivers/usb/serial/pl2303.h1
-rw-r--r--drivers/usb/serial/sierra.c2
-rw-r--r--drivers/usb/serial/usb-serial.c6
-rw-r--r--drivers/usb/serial/whiteheat.c11
-rw-r--r--drivers/usb/storage/Kconfig1
-rw-r--r--drivers/usb/storage/isd200.c105
-rw-r--r--drivers/video/Kconfig8
-rw-r--r--drivers/video/aty/radeon_pm.c4
-rw-r--r--drivers/video/cirrusfb.c3
-rw-r--r--drivers/video/omap/Kconfig2
-rw-r--r--drivers/w1/Kconfig3
-rw-r--r--drivers/watchdog/Kconfig4
-rw-r--r--drivers/watchdog/alim1535_wdt.c4
-rw-r--r--drivers/watchdog/davinci_wdt.c6
-rw-r--r--drivers/watchdog/i6300esb.c4
-rw-r--r--drivers/watchdog/iTCO_wdt.c114
-rw-r--r--drivers/watchdog/ib700wdt.c4
-rw-r--r--drivers/watchdog/machzwd.c7
-rw-r--r--drivers/watchdog/mpc83xx_wdt.c5
-rw-r--r--drivers/watchdog/pc87413_wdt.c4
-rw-r--r--drivers/watchdog/pnx4008_wdt.c6
-rw-r--r--drivers/watchdog/sbc8360.c3
-rw-r--r--drivers/watchdog/sc1200wdt.c3
-rw-r--r--drivers/watchdog/sc520_wdt.c4
-rw-r--r--drivers/watchdog/smsc37b787_wdt.c4
-rw-r--r--drivers/watchdog/w83627hf_wdt.c4
-rw-r--r--drivers/watchdog/w83697hf_wdt.c4
-rw-r--r--drivers/watchdog/w83877f_wdt.c4
-rw-r--r--drivers/watchdog/w83977f_wdt.c4
-rw-r--r--drivers/watchdog/wafer5823wdt.c4
-rw-r--r--drivers/watchdog/wdt.c3
-rw-r--r--drivers/watchdog/wdt977.c4
-rw-r--r--drivers/watchdog/wdt_pci.c6
-rw-r--r--fs/Kconfig6
-rw-r--r--fs/compat_ioctl.c2
-rw-r--r--fs/ecryptfs/crypto.c25
-rw-r--r--fs/jffs2/acl.c2
-rw-r--r--fs/locks.c11
-rw-r--r--fs/mbcache.c2
-rw-r--r--fs/ntfs/aops.c10
-rw-r--r--fs/ntfs/attrib.c5
-rw-r--r--fs/ntfs/compress.c10
-rw-r--r--fs/proc/array.c6
-rw-r--r--fs/proc/proc_net.c2
-rw-r--r--fs/proc/proc_sysctl.c6
-rw-r--r--fs/sysfs/dir.c4
-rw-r--r--fs/sysfs/sysfs.h2
-rw-r--r--fs/ufs/super.c15
-rw-r--r--include/acpi/acpi_bus.h3
-rw-r--r--include/asm-arm/arch-at91/board.h3
-rw-r--r--include/asm-arm/arch-davinci/gpio.h3
-rw-r--r--include/asm-arm/arch-pxa/mfp-pxa300.h2
-rw-r--r--include/asm-arm/arch-pxa/mfp-pxa320.h2
-rw-r--r--include/asm-arm/arch-pxa/mfp.h2
-rw-r--r--include/asm-arm/flat.h3
-rw-r--r--include/asm-arm/plat-s3c/regs-nand.h2
-rw-r--r--include/asm-avr32/dma-mapping.h2
-rw-r--r--include/asm-blackfin/bfin-global.h1
-rw-r--r--include/asm-blackfin/fixed_code.h4
-rw-r--r--include/asm-blackfin/gptimers.h2
-rw-r--r--include/asm-blackfin/mach-bf527/defBF52x_base.h86
-rw-r--r--include/asm-blackfin/mach-bf527/dma.h7
-rw-r--r--include/asm-blackfin/mach-bf548/defBF549.h2
-rw-r--r--include/asm-blackfin/mach-bf548/defBF54x_base.h7
-rw-r--r--include/asm-blackfin/mach-bf548/portmux.h14
-rw-r--r--include/asm-blackfin/mach-bf561/defBF561.h3
-rw-r--r--include/asm-frv/scatterlist.h3
-rw-r--r--include/asm-ia64/percpu.h2
-rw-r--r--include/asm-ia64/smp.h1
-rw-r--r--include/asm-mips/i8253.h17
-rw-r--r--include/asm-mips/ip32/ip32_ints.h4
-rw-r--r--include/asm-mips/jmr3927/jmr3927.h9
-rw-r--r--include/asm-mips/jmr3927/tx3927.h4
-rw-r--r--include/asm-mips/jmr3927/txx927.h37
-rw-r--r--include/asm-mips/mach-au1x00/timex.h13
-rw-r--r--include/asm-mips/mach-cobalt/irq.h3
-rw-r--r--include/asm-mips/mach-generic/timex.h13
-rw-r--r--include/asm-mips/mach-jazz/timex.h16
-rw-r--r--include/asm-mips/mach-qemu/timex.h16
-rw-r--r--include/asm-mips/mach-rm/timex.h13
-rw-r--r--include/asm-mips/time.h20
-rw-r--r--include/asm-mips/timex.h25
-rw-r--r--include/asm-mips/tx4927/tx4927_pci.h3
-rw-r--r--include/asm-mips/tx4938/tx4938.h1
-rw-r--r--include/asm-mips/txx9tmr.h67
-rw-r--r--include/asm-sh/cache.h3
-rw-r--r--include/asm-sh/irq.h2
-rw-r--r--include/asm-sh/page.h1
-rw-r--r--include/asm-sh/pgtable.h2
-rw-r--r--include/asm-sh/processor.h2
-rw-r--r--include/asm-sh/setup.h14
-rw-r--r--include/asm-sh64/dma-mapping.h5
-rw-r--r--include/asm-sh64/pci.h9
-rw-r--r--include/asm-sh64/scatterlist.h9
-rw-r--r--include/asm-sparc/atomic.h4
-rw-r--r--include/asm-sparc/dma.h9
-rw-r--r--include/asm-sparc/floppy.h14
-rw-r--r--include/asm-sparc/ide.h9
-rw-r--r--include/asm-sparc/posix_types.h8
-rw-r--r--include/asm-sparc/system.h6
-rw-r--r--include/asm-sparc64/atomic.h7
-rw-r--r--include/asm-sparc64/backoff.h4
-rw-r--r--include/asm-sparc64/byteorder.h7
-rw-r--r--include/asm-sparc64/fpumacro.h4
-rw-r--r--include/asm-sparc64/futex.h6
-rw-r--r--include/asm-sparc64/io.h29
-rw-r--r--include/asm-sparc64/irq.h11
-rw-r--r--include/asm-sparc64/mostek.h9
-rw-r--r--include/asm-sparc64/ns87303.h5
-rw-r--r--include/asm-sparc64/parport.h21
-rw-r--r--include/asm-sparc64/posix_types.h8
-rw-r--r--include/asm-sparc64/sbus.h4
-rw-r--r--include/asm-sparc64/spitfire.h53
-rw-r--r--include/asm-sparc64/system.h13
-rw-r--r--include/asm-sparc64/uaccess.h6
-rw-r--r--include/asm-sparc64/upa.h17
-rw-r--r--include/asm-sparc64/visasm.h3
-rw-r--r--include/asm-um/unistd.h1
-rw-r--r--include/asm-x86/bitops_32.h7
-rw-r--r--include/asm-x86/bitops_64.h57
-rw-r--r--include/asm-x86/gart.h29
-rw-r--r--include/asm-x86/iommu.h4
-rw-r--r--include/asm-x86/lguest_hcall.h16
-rw-r--r--include/asm-x86/pci_64.h2
-rw-r--r--include/asm-x86/smp_32.h9
-rw-r--r--include/asm-xtensa/dma-mapping.h2
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/ata.h28
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/bootmem.h1
-rw-r--r--include/linux/compiler.h6
-rw-r--r--include/linux/completion.h18
-rw-r--r--include/linux/dccp.h12
-rw-r--r--include/linux/eventpoll.h7
-rw-r--r--include/linux/input.h3
-rw-r--r--include/linux/ipmi_smi.h2
-rw-r--r--include/linux/lguest.h4
-rw-r--r--include/linux/lguest_launcher.h24
-rw-r--r--include/linux/libata.h31
-rw-r--r--include/linux/mv643xx_eth.h3
-rw-r--r--include/linux/netdevice.h14
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/scatterlist.h53
-rw-r--r--include/linux/sched.h10
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--include/linux/string.h12
-rw-r--r--include/linux/sunrpc/rpc_rdma.h32
-rw-r--r--include/linux/types.h2
-rw-r--r--include/net/inet_hashtables.h6
-rw-r--r--include/net/inet_sock.h7
-rw-r--r--include/net/irda/ircomm_tty.h1
-rw-r--r--include/net/net_namespace.h35
-rw-r--r--include/net/sch_generic.h15
-rw-r--r--include/net/sctp/auth.h3
-rw-r--r--include/net/sctp/sctp.h1
-rw-r--r--include/net/sock.h16
-rw-r--r--include/net/tcp.h2
-rw-r--r--include/net/xfrm.h2
-rw-r--r--init/Kconfig1
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/hrtimer.c2
-rw-r--r--kernel/profile.c5
-rw-r--r--kernel/sched.c396
-rw-r--r--kernel/sched_fair.c50
-rw-r--r--kernel/sched_idletask.c18
-rw-r--r--kernel/sched_rt.c32
-rw-r--r--kernel/signal.c4
-rw-r--r--kernel/sys_ni.c4
-rw-r--r--kernel/time/tick-sched.c2
-rw-r--r--kernel/time/timer_list.c6
-rw-r--r--kernel/user.c5
-rw-r--r--lib/Kconfig.debug8
-rw-r--r--lib/kobject.c13
-rw-r--r--mm/filemap.c30
-rw-r--r--mm/nommu.c1
-rw-r--r--mm/shmem.c15
-rw-r--r--mm/slub.c2
-rw-r--r--mm/sparse-vmemmap.c1
-rw-r--r--mm/sparse.c11
-rw-r--r--net/9p/mux.c4
-rw-r--r--net/appletalk/ddp.c2
-rw-r--r--net/atm/common.c2
-rw-r--r--net/ax25/af_ax25.c6
-rw-r--r--net/bluetooth/bnep/sock.c2
-rw-r--r--net/bluetooth/cmtp/sock.c2
-rw-r--r--net/bluetooth/hci_sock.c2
-rw-r--r--net/bluetooth/hidp/sock.c2
-rw-r--r--net/bluetooth/l2cap.c2
-rw-r--r--net/bluetooth/rfcomm/sock.c2
-rw-r--r--net/bluetooth/sco.c2
-rw-r--r--net/core/dev.c169
-rw-r--r--net/core/dev_mcast.c2
-rw-r--r--net/core/flow.c5
-rw-r--r--net/core/net-sysfs.c2
-rw-r--r--net/core/net-sysfs.h8
-rw-r--r--net/core/net_namespace.c164
-rw-r--r--net/core/netpoll.c37
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/core/skbuff.c32
-rw-r--r--net/core/sock.c106
-rw-r--r--net/core/sysctl_net_core.c17
-rw-r--r--net/dccp/ccids/ccid2.c4
-rw-r--r--net/dccp/ccids/ccid3.c15
-rw-r--r--net/dccp/input.c48
-rw-r--r--net/dccp/ipv4.c6
-rw-r--r--net/dccp/ipv6.c4
-rw-r--r--net/dccp/options.c33
-rw-r--r--net/dccp/proto.c33
-rw-r--r--net/decnet/af_decnet.c2
-rw-r--r--net/econet/af_econet.c2
-rw-r--r--net/ethernet/eth.c9
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c11
-rw-r--r--net/ieee80211/ieee80211_crypt_wep.c2
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/cipso_ipv4.c39
-rw-r--r--net/ipv4/esp4.c13
-rw-r--r--net/ipv4/fib_frontend.c12
-rw-r--r--net/ipv4/icmp.c1
-rw-r--r--net/ipv4/ip_gre.c14
-rw-r--r--net/ipv4/ip_output.c2
-rw-r--r--net/ipv4/ipip.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_lblcr.c76
-rw-r--r--net/ipv4/ipvs/ip_vs_sync.c5
-rw-r--r--net/ipv4/ipvs/ip_vs_xmit.c2
-rw-r--r--net/ipv4/netfilter/Kconfig4
-rw-r--r--net/ipv4/proc.c10
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/ipv4/tcp_input.c61
-rw-r--r--net/ipv4/tcp_ipv4.c15
-rw-r--r--net/ipv4/tcp_vegas.c37
-rw-r--r--net/ipv4/udp.c2
-rw-r--r--net/ipv6/addrconf.c4
-rw-r--r--net/ipv6/af_inet6.c2
-rw-r--r--net/ipv6/esp6.c13
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/ip6_tunnel.c2
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/ipv6/sit.c2
-rw-r--r--net/ipv6/tcp_ipv6.c17
-rw-r--r--net/ipx/af_ipx.c2
-rw-r--r--net/irda/af_irda.c2
-rw-r--r--net/irda/ircomm/ircomm_tty.c2
-rw-r--r--net/irda/irnet/irnet_ppp.c10
-rw-r--r--net/iucv/af_iucv.c2
-rw-r--r--net/key/af_key.c6
-rw-r--r--net/llc/llc_conn.c2
-rw-r--r--net/mac80211/ieee80211_sta.c5
-rw-r--r--net/netfilter/Kconfig2
-rw-r--r--net/netfilter/nf_conntrack_core.c2
-rw-r--r--net/netlabel/netlabel_domainhash.c37
-rw-r--r--net/netlabel/netlabel_mgmt.c4
-rw-r--r--net/netlabel/netlabel_unlabeled.c4
-rw-r--r--net/netlink/af_netlink.c20
-rw-r--r--net/netrom/af_netrom.c6
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/rose/af_rose.c6
-rw-r--r--net/rxrpc/af_rxrpc.c2
-rw-r--r--net/rxrpc/rxkad.c61
-rw-r--r--net/sched/act_mirred.c2
-rw-r--r--net/sched/sch_prio.c4
-rw-r--r--net/sctp/auth.c15
-rw-r--r--net/sctp/crc32c.c2
-rw-r--r--net/sctp/ipv6.c2
-rw-r--r--net/sctp/protocol.c3
-rw-r--r--net/sctp/sm_make_chunk.c10
-rw-r--r--net/sctp/ulpqueue.c34
-rw-r--r--net/socket.c5
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_crypto.c46
-rw-r--r--net/sunrpc/auth_gss/gss_spkm3_seal.c2
-rw-r--r--net/sunrpc/sysctl.c3
-rw-r--r--net/sunrpc/xdr.c6
-rw-r--r--net/sunrpc/xprtrdma/rpc_rdma.c34
-rw-r--r--net/tipc/socket.c2
-rw-r--r--net/unix/af_unix.c2
-rw-r--r--net/x25/af_x25.c2
-rw-r--r--net/xfrm/xfrm_algo.c10
-rw-r--r--scripts/kconfig/Makefile35
-rw-r--r--sound/pci/hda/patch_realtek.c1
735 files changed, 11796 insertions, 6914 deletions
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index a30dd4480ad4..681e2b36195c 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -464,8 +464,8 @@ section Linus Computer Science 101.
464Nuff said. If your code deviates too much from this, it is likely 464Nuff said. If your code deviates too much from this, it is likely
465to be rejected without further review, and without comment. 465to be rejected without further review, and without comment.
466 466
467Once significant exception is when moving code from one file to 467One significant exception is when moving code from one file to
468another in this case you should not modify the moved code at all in 468another -- in this case you should not modify the moved code at all in
469the same patch which moves it. This clearly delineates the act of 469the same patch which moves it. This clearly delineates the act of
470moving the code and your changes. This greatly aids review of the 470moving the code and your changes. This greatly aids review of the
471actual differences and allows tools to better track the history of 471actual differences and allows tools to better track the history of
diff --git a/Documentation/i386/boot.txt b/Documentation/i386/boot.txt
index 2f75e750e4f5..fc49b79bc1ab 100644
--- a/Documentation/i386/boot.txt
+++ b/Documentation/i386/boot.txt
@@ -785,3 +785,41 @@ IMPORTANT: All the hooks are required to preserve %esp, %ebp, %esi and
785 After completing your hook, you should jump to the address 785 After completing your hook, you should jump to the address
786 that was in this field before your boot loader overwrote it 786 that was in this field before your boot loader overwrote it
787 (relocated, if appropriate.) 787 (relocated, if appropriate.)
788
789
790**** 32-bit BOOT PROTOCOL
791
792For machine with some new BIOS other than legacy BIOS, such as EFI,
793LinuxBIOS, etc, and kexec, the 16-bit real mode setup code in kernel
794based on legacy BIOS can not be used, so a 32-bit boot protocol needs
795to be defined.
796
797In 32-bit boot protocol, the first step in loading a Linux kernel
798should be to setup the boot parameters (struct boot_params,
799traditionally known as "zero page"). The memory for struct boot_params
800should be allocated and initialized to all zero. Then the setup header
801from offset 0x01f1 of kernel image on should be loaded into struct
802boot_params and examined. The end of setup header can be calculated as
803follow:
804
805 0x0202 + byte value at offset 0x0201
806
807In addition to read/modify/write the setup header of the struct
808boot_params as that of 16-bit boot protocol, the boot loader should
809also fill the additional fields of the struct boot_params as that
810described in zero-page.txt.
811
812After setupping the struct boot_params, the boot loader can load the
81332/64-bit kernel in the same way as that of 16-bit boot protocol.
814
815In 32-bit boot protocol, the kernel is started by jumping to the
81632-bit kernel entry point, which is the start address of loaded
81732/64-bit kernel.
818
819At entry, the CPU must be in 32-bit protected mode with paging
820disabled; a GDT must be loaded with the descriptors for selectors
821__BOOT_CS(0x10) and __BOOT_DS(0x18); both descriptors must be 4G flat
822segment; __BOOS_CS must have execute/read permission, and __BOOT_DS
823must have read/write permission; CS must be __BOOT_CS and DS, ES, SS
824must be __BOOT_DS; interrupt must be disabled; %esi must hold the base
825address of the struct boot_params; %ebp, %edi and %ebx must be zero.
diff --git a/Documentation/i386/zero-page.txt b/Documentation/i386/zero-page.txt
index 6c0817c45683..169ad423a3d1 100644
--- a/Documentation/i386/zero-page.txt
+++ b/Documentation/i386/zero-page.txt
@@ -1,99 +1,31 @@
1--------------------------------------------------------------------------- 1The additional fields in struct boot_params as a part of 32-bit boot
2!!!!!!!!!!!!!!!WARNING!!!!!!!! 2protocol of kernel. These should be filled by bootloader or 16-bit
3The zero page is a kernel internal data structure, not a stable ABI. It might change 3real-mode setup code of the kernel. References/settings to it mainly
4without warning and the kernel has no way to detect old version of it. 4are in:
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 5
11Summary of boot_params layout (kernel point of view) 6 include/asm-x86/bootparam.h
12 ( collected by Hans Lermen and Martin Mares )
13
14The contents of boot_params are used to pass parameters from the
1516-bit realmode code of the kernel to the 32-bit part. References/settings
16to it mainly are in:
17 7
18 arch/i386/boot/setup.S
19 arch/i386/boot/video.S
20 arch/i386/kernel/head.S
21 arch/i386/kernel/setup.c
22
23 8
24Offset Type Description 9Offset Proto Name Meaning
25------ ---- ----------- 10/Size
26 0 32 bytes struct screen_info, SCREEN_INFO
27 ATTENTION, overlaps the following !!!
28 2 unsigned short EXT_MEM_K, extended memory size in Kb (from int 0x15)
29 0x20 unsigned short CL_MAGIC, commandline magic number (=0xA33F)
30 0x22 unsigned short CL_OFFSET, commandline offset
31 Address of commandline is calculated:
32 0x90000 + contents of CL_OFFSET
33 (only taken, when CL_MAGIC = 0xA33F)
34 0x40 20 bytes struct apm_bios_info, APM_BIOS_INFO
35 0x60 16 bytes Intel SpeedStep (IST) BIOS support information
36 0x80 16 bytes hd0-disk-parameter from intvector 0x41
37 0x90 16 bytes hd1-disk-parameter from intvector 0x46
38 11
39 0xa0 16 bytes System description table truncated to 16 bytes. 12000/040 ALL screen_info Text mode or frame buffer information
40 ( struct sys_desc_table_struct ) 13 (struct screen_info)
41 0xb0 - 0x13f Free. Add more parameters here if you really need them. 14040/014 ALL apm_bios_info APM BIOS information (struct apm_bios_info)
42 0x140- 0x1be EDID_INFO Video mode setup 15060/010 ALL ist_info Intel SpeedStep (IST) BIOS support information
43 16 (struct ist_info)
440x1c4 unsigned long EFI system table pointer 17080/010 ALL hd0_info hd0 disk parameter, OBSOLETE!!
450x1c8 unsigned long EFI memory descriptor size 18090/010 ALL hd1_info hd1 disk parameter, OBSOLETE!!
460x1cc unsigned long EFI memory descriptor version 190A0/010 ALL sys_desc_table System description table (struct sys_desc_table)
470x1d0 unsigned long EFI memory descriptor map pointer 20140/080 ALL edid_info Video mode setup (struct edid_info)
480x1d4 unsigned long EFI memory descriptor map size 211C0/020 ALL efi_info EFI 32 information (struct efi_info)
490x1e0 unsigned long ALT_MEM_K, alternative mem check, in Kb 221E0/004 ALL alk_mem_k Alternative mem check, in KB
500x1e4 unsigned long Scratch field for the kernel setup code 231E4/004 ALL scratch Scratch field for the kernel setup code
510x1e8 char number of entries in E820MAP (below) 241E8/001 ALL e820_entries Number of entries in e820_map (below)
520x1e9 unsigned char number of entries in EDDBUF (below) 251E9/001 ALL eddbuf_entries Number of entries in eddbuf (below)
530x1ea unsigned char number of entries in EDD_MBR_SIG_BUFFER (below) 261EA/001 ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer
540x1f1 char size of setup.S, number of sectors 27 (below)
550x1f2 unsigned short MOUNT_ROOT_RDONLY (if !=0) 28290/040 ALL edd_mbr_sig_buffer EDD MBR signatures
560x1f4 unsigned short size of compressed kernel-part in the 292D0/A00 ALL e820_map E820 memory map table
57 (b)zImage-file (in 16 byte units, rounded up) 30 (array of struct e820entry)
580x1f6 unsigned short swap_dev (unused AFAIK) 31D00/1EC ALL eddbuf EDD data (array of struct edd_info)
590x1f8 unsigned short RAMDISK_FLAGS
600x1fa unsigned short VGA-Mode (old one)
610x1fc unsigned short ORIG_ROOT_DEV (high=Major, low=minor)
620x1ff char AUX_DEVICE_INFO
63
640x200 short jump to start of setup code aka "reserved" field.
650x202 4 bytes Signature for SETUP-header, ="HdrS"
660x206 unsigned short Version number of header format
67 Current version is 0x0201...
680x208 8 bytes (used by setup.S for communication with boot loaders,
69 look there)
700x210 char LOADER_TYPE, = 0, old one
71 else it is set by the loader:
72 0xTV: T=0 for LILO
73 1 for Loadlin
74 2 for bootsect-loader
75 3 for SYSLINUX
76 4 for ETHERBOOT
77 5 for ELILO
78 7 for GRuB
79 8 for U-BOOT
80 9 for Xen
81 V = version
820x211 char loadflags:
83 bit0 = 1: kernel is loaded high (bzImage)
84 bit7 = 1: Heap and pointer (see below) set by boot
85 loader.
860x212 unsigned short (setup.S)
870x214 unsigned long KERNEL_START, where the loader started the kernel
880x218 unsigned long INITRD_START, address of loaded ramdisk image
890x21c unsigned long INITRD_SIZE, size in bytes of ramdisk image
900x220 4 bytes (setup.S)
910x224 unsigned short setup.S heap end pointer
920x226 unsigned short zero_pad
930x228 unsigned long cmd_line_ptr
940x22c unsigned long ramdisk_max
950x230 16 bytes trampoline
960x290 - 0x2cf EDD_MBR_SIG_BUFFER (edd.S)
970x2d0 - 0xd00 E820MAP
980xd00 - 0xeff EDDBUF (edd.S) for disk signature read sector
990xd00 - 0xeeb EDDBUF (edd.S) for edd data
diff --git a/Documentation/ja_JP/SubmittingPatches b/Documentation/ja_JP/SubmittingPatches
new file mode 100644
index 000000000000..a9dc1243e859
--- /dev/null
+++ b/Documentation/ja_JP/SubmittingPatches
@@ -0,0 +1,556 @@
1NOTE:
2This is a version of Documentation/SubmittingPatches into Japanese.
3This document is maintained by Keiichi KII <k-keiichi@bx.jp.nec.com>
4and the JF Project team <http://www.linux.or.jp/JF/>.
5If you find any difference between this document and the original file
6or a problem with the translation,
7please contact the maintainer of this file or JF project.
8
9Please also note that the purpose of this file is to be easier to read
10for non English (read: Japanese) speakers and is not intended as a
11fork. So if you have any comments or updates of this file, please try
12to update the original English file first.
13
14Last Updated: 2007/10/24
15==================================
16これは、
17linux-2.6.23/Documentation/SubmittingPatches の和訳
18です。
19翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
20翻訳日: 2007/10/17
21翻訳者: Keiichi Kii <k-keiichi at bx dot jp dot nec dot com>
22校正者: Masanari Kobayashi さん <zap03216 at nifty dot ne dot jp>
23 Matsukura さん <nbh--mats at nifty dot com>
24==================================
25
26 Linux カーネルに変更を加えるための Howto
27 又は
28 かの Linus Torvalds の取り扱い説明書
29
30Linux カーネルに変更を加えたいと思っている個人又は会社にとって、パッ
31チの投稿に関連した仕組みに慣れていなければ、その過程は時々みなさんを
32おじけづかせることもあります。この文章はあなたの変更を大いに受け入れ
33てもらえやすくする提案を集めたものです。
34
35コードを投稿する前に、Documentation/SubmitChecklist の項目リストに目
36を通してチェックしてください。もしあなたがドライバーを投稿しようとし
37ているなら、Documentation/SubmittingDrivers にも目を通してください。
38
39--------------------------------------------
40セクション1 パッチの作り方と送り方
41--------------------------------------------
42
431) 「 diff -up 」
44------------
45
46パッチの作成には「 diff -up 」又は「 diff -uprN 」を使ってください。
47
48Linux カーネルに対する全ての変更は diff(1) コマンドによるパッチの形式で
49生成してください。パッチを作成するときには、diff(1) コマンドに「 -u 」引
50数を指定して、unified 形式のパッチを作成することを確認してください。また、
51変更がどの C 関数で行われたのかを表示する「 -p 」引数を使ってください。
52この引数は生成した差分をずっと読みやすくしてくれます。パッチは Linux
53カーネルソースの中のサブディレクトリではなく Linux カーネルソースのルート
54ディレクトリを基準にしないといけません。
55
561個のファイルについてのパッチを作成するためには、ほとんどの場合、
57以下の作業を行えば十分です。
58
59 SRCTREE= linux-2.6
60 MYFILE= drivers/net/mydriver.c
61
62 cd $SRCTREE
63 cp $MYFILE $MYFILE.orig
64 vi $MYFILE # make your change
65 cd ..
66 diff -up $SRCTREE/$MYFILE{.orig,} > /tmp/patch
67
68複数のファイルについてのパッチを作成するためには、素の( vanilla )、す
69なわち変更を加えてない Linux カーネルを展開し、自分の Linux カーネル
70ソースとの差分を生成しないといけません。例えば、
71
72 MYSRC= /devel/linux-2.6
73
74 tar xvfz linux-2.6.12.tar.gz
75 mv linux-2.6.12 linux-2.6.12-vanilla
76 diff -uprN -X linux-2.6.12-vanilla/Documentation/dontdiff \
77 linux-2.6.12-vanilla $MYSRC > /tmp/patch
78
79dontdiff ファイルには Linux カーネルのビルドプロセスの過程で生成された
80ファイルの一覧がのっています。そして、それらはパッチを生成する diff(1)
81コマンドで無視されるべきです。dontdiff ファイルは 2.6.12 以後のバージョ
82ンの Linux カーネルソースツリーに含まれています。それより前のバージョン
83の Linux カーネルソースツリーに対する dontdiff ファイルは、
84<http://www.xenotime.net/linux/doc/dontdiff>から取得することができます。
85
86投稿するパッチの中に関係のない余分なファイルが含まれていないことを確
87認してください。diff(1) コマンドで生成したパッチがあなたの意図したとお
88りのものであることを確認してください。
89
90もしあなたのパッチが多くの差分を生み出すのであれば、あなたはパッチ
91を意味のあるひとまとまりごとに分けたいと思うかもしれません。
92これは他のカーネル開発者にとってレビューしやすくなるので、あなたの
93パッチを受け入れてもらうためにはとても重要なことです。これを補助でき
94る多くのスクリプトがあります。
95
96Quilt:
97http://savannah.nongnu.org/projects/quilt
98
99Andrew Morton's patch scripts:
100http://www.zip.com.au/~akpm/linux/patches/
101このリンクの先のスクリプトの代わりとして、quilt がパッチマネジメント
102ツールとして推奨されています(上のリンクを見てください)。
103
1042) パッチに対する説明
105
106パッチの中の変更点に対する技術的な詳細について説明してください。
107
108説明はできる限り具体的に。もっとも悪い説明は「ドライバー X を更新」、
109「ドライバー X に対するバグフィックス」あるいは「このパッチはサブシス
110テム X に対する更新を含んでいます。どうか取り入れてください。」などです。
111
112説明が長くなりだしたのであれば、おそらくそれはパッチを分ける必要がある
113という兆候です。次の #3 を見てください。
114
1153) パッチの分割
116
117意味のあるひとまとまりごとに変更を個々のパッチファイルに分けてください。
118
119例えば、もし1つのドライバーに対するバグフィックスとパフォーマンス強
120化の両方の変更を含んでいるのであれば、その変更を2つ以上のパッチに分
121けてください。もし変更箇所に API の更新と、その新しい API を使う新たな
122ドライバーが含まれているなら、2つのパッチに分けてください。
123
124一方で、もしあなたが多数のファイルに対して意味的に同じ1つの変更を加え
125るのであれば、その変更を1つのパッチにまとめてください。言いかえると、
126意味的に同じ1つの変更は1つのパッチの中に含まれます。
127
128あるパッチが変更を完結させるために他のパッチに依存していたとしても、
129それは問題ありません。パッチの説明の中で「このパッチはパッチ X に依存
130している」と簡単に注意書きをつけてください。
131
132もしパッチをより小さなパッチの集合に凝縮することができないなら、まずは
13315かそこらのパッチを送り、そのレビューと統合を待って下さい。
134
1354) パッチのスタイルチェック
136
137あなたのパッチが基本的な( Linux カーネルの)コーディングスタイルに違反し
138ていないかをチェックして下さい。その詳細を Documentation/CodingStyle で
139見つけることができます。コーディングスタイルの違反はレビューする人の
140時間を無駄にするだけなので、恐らくあなたのパッチは読まれることすらなく
141拒否されるでしょう。
142
143あなたはパッチを投稿する前に最低限パッチスタイルチェッカー
144( scripts/patchcheck.pl )を利用してパッチをチェックすべきです。
145もしパッチに違反がのこっているならば、それらの全てについてあなたは正当な
146理由を示せるようにしておく必要があります。
147
1485) 電子メールの宛先の選び方
149
150MAINTAINERS ファイルとソースコードに目を通してください。そして、その変
151更がメンテナのいる特定のサブシステムに加えられるものであることが分か
152れば、その人に電子メールを送ってください。
153
154もし、メンテナが載っていなかったり、メンテナからの応答がないなら、
155LKML ( linux-kernel@vger.kernel.org )へパッチを送ってください。ほとんど
156のカーネル開発者はこのメーリングリストに目を通しており、変更に対して
157コメントを得ることができます。
158
15915個より多くのパッチを同時に vger.kernel.org のメーリングリストへ送らな
160いでください!!!
161
162Linus Torvalds は Linux カーネルに入る全ての変更に対する最終的な意思決定者
163です。電子メールアドレスは torvalds@linux-foundation.org になります。彼は
164多くの電子メールを受け取っているため、できる限り彼に電子メールを送るのは
165避けるべきです。
166
167バグフィックスであったり、自明な変更であったり、話し合いをほとんど
168必要としないパッチは Linus へ電子メールを送るか CC しなければなりません。
169話し合いを必要としたり、明確なアドバンテージがないパッチは、通常まず
170は LKML へ送られるべきです。パッチが議論された後にだけ、そのパッチを
171Linus へ送るべきです。
172
1736) CC (カーボンコピー)先の選び方
174
175特に理由がないなら、LKML にも CC してください。
176
177Linus 以外のカーネル開発者は変更に気づく必要があり、その結果、彼らはそ
178の変更に対してコメントをくれたり、コードに対してレビューや提案をくれ
179るかもしれません。LKML とは Linux カーネル開発者にとって一番中心的なメー
180リングリストです。USB やフレームバッファデバイスや VFS や SCSI サブシステ
181ムなどの特定のサブシステムに関するメーリングリストもあります。あなた
182の変更に、はっきりと関連のあるメーリングリストについて知りたければ
183MAINTAINERS ファイルを参照してください。
184
185VGER.KERNEL.ORG でホスティングされているメーリングリストの一覧が下記の
186サイトに載っています。
187<http://vger.kernel.org/vger-lists.html>
188
189もし、変更がユーザランドのカーネルインタフェースに影響を与え
190るのであれば、MAN-PAGES のメンテナ( MAINTAINERS ファイルに一覧
191があります)に man ページのパッチを送ってください。少なくとも
192情報がマニュアルページの中に入ってくるように、変更が起きたという
193通知を送ってください。
194
195たとえ、メンテナが #4 で反応がなかったとしても、メンテナのコードに変更を
196加えたときには、いつもメンテナに CC するのを忘れないようにしてください。
197
198小さなパッチであれば、Adrian Bunk が管理している Trivial Patch Monkey
199(ちょっとしたパッチを集めている)<trivial@kernel.org>に CC してもいい
200です。ちょっとしたパッチとは以下のルールのどれか1つを満たしていなけ
201ればなりません。
202 ・ドキュメントのスペルミスの修正
203 ・grep(1) コマンドによる検索を困難にしているスペルの修正
204 ・コンパイル時の警告の修正(無駄な警告が散乱することは好ましくないた
205 めです)
206 ・コンパイル問題の修正(それらの修正が本当に正しい場合に限る)
207 ・実行時の問題の修正(それらの修正が本当に問題を修正している場合に限る)
208 ・廃止予定の関数やマクロを使用しているコードの除去(例 check_region )
209 ・問い合わせ先やドキュメントの修正
210 ・移植性のないコードから移植性のあるコードへの置き換え(小さい範囲で
211 あればアーキテクチャ特有のことでも他の人がコピーできます)
212 ・作者やメンテナによる修正(すなわち patch monkey の再転送モード)
213URL: <http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/>
214
2157) MIME やリンクや圧縮ファイルや添付ファイルではなくプレインテキストのみ
216
217Linus や他のカーネル開発者はあなたが投稿した変更を読んで、コメントでき
218る必要があります。カーネル開発者にとって、あなたが書いたコードの特定の
219部分にコメントをするために、標準的な電子メールクライアントで変更が引用
220できることは重要です。
221
222上記の理由で、すべてのパッチは文中に含める形式の電子メールで投稿さ
223れるべきです。警告:あなたがパッチをコピー&ペーストする際には、パッ
224チを改悪するエディターの折り返し機能に注意してください。
225
226パッチを圧縮の有無に関わらず MIME 形式で添付しないでください。多くのポ
227ピュラーな電子メールクライアントは MIME 形式の添付ファイルをプレーンテ
228キストとして送信するとは限らないでしょう。そうなると、電子メールクラ
229イアントがコードに対するコメントを付けることをできなくします。また、
230MIME 形式の添付ファイルは Linus に手間を取らせることになり、その変更を
231受け入れてもらう可能性が低くなってしまいます。
232
233例外:お使いの電子メールクライアントがパッチをめちゃくちゃにするので
234あれば、誰かが MIME 形式のパッチを再送するよう求めるかもしれません。
235
236警告: Mozilla のような特定の電子メールクライアントは電子メールの
237ヘッダに以下のものを付加して送ります。
238---- message header ----
239Content-Type: text/plain; charset=us-ascii; format=flowed
240---- message header ----
241問題は、「 format=flowed 」が付いた電子メールを特定の受信側の電子メール
242クライアントがタブをスペースに置き換えるというような変更をすることです。
243したがって送られてきたパッチは壊れているように見えるでしょう。
244
245これを修正するには、mozilla の defaults/pref/mailnews.js ファイルを
246以下のように修正します。
247pref("mailnews.send_plaintext_flowed", false); // RFC 2646=======
248pref("mailnews.display.disable_format_flowed_support", true);
249
2508) 電子メールのサイズ
251
252パッチを Linus へ送るときは常に #7 の手順に従ってください。
253
254大きなパッチはメーリングリストやメンテナにとって不親切です。パッチが
255未圧縮で 40KB を超えるようであるなら、インターネット上のアクセス可能な
256サーバに保存し、保存場所を示す URL を伝えるほうが適切です。
257
2589) カーネルバージョンの明記
259
260パッチが対象とするカーネルのバージョンをパッチの概要か電子メールの
261サブジェクトに付けることが重要です。
262
263パッチが最新バージョンのカーネルに正しく適用できなければ、Linus は
264そのパッチを採用しないでしょう。
265
26610) がっかりせず再投稿
267
268パッチを投稿した後は、辛抱強く待っていてください。Linus があなたのパッ
269チを気に入って採用すれば、Linus がリリースする次のバージョンのカーネル
270の中で姿を見せるでしょう。
271
272しかし、パッチが次のバージョンのカーネルに入っていないなら、いくつもの
273理由があるのでしょう。その原因を絞り込み、間違っているものを正し、更新
274したパッチを投稿するのはあなたの仕事です。
275
276Linus があなたのパッチに対して何のコメントもなく不採用にすることは極め
277て普通のことです。それは自然な姿です。もし、Linus があなたのパッチを受
278け取っていないのであれば、以下の理由が考えられます。
279* パッチが最新バージョンの Linux カーネルにきちんと適用できなかった
280* パッチが LKML で十分に議論されていなかった
281* スタイルの問題(セクション2を参照)
282* 電子メールフォーマットの問題(このセクションを参照)
283* パッチに対する技術的な問題
284* Linus はたくさんの電子メールを受け取っているので、どさくさに紛れて見
285 失った
286* 不愉快にさせている
287
288判断できない場合は、LKML にコメントを頼んでください。
289
29011) サブジェクトに「 PATCH 」
291
292Linus や LKML への大量の電子メールのために、サブジェクトのプレフィックスに
293「 [PATCH] 」を付けることが慣習となっています。これによって Linus や他の
294カーネル開発者がパッチであるのか、又は、他の議論に関する電子メールであるの
295かをより簡単に識別できます。
296
29712) パッチへの署名
298
299誰が何をしたのかを追いかけやすくするために (特に、パッチが何人かの
300メンテナを経て最終的に Linux カーネルに取り込まれる場合のために)、電子
301メールでやり取りされるパッチに対して「 sign-off 」という手続きを導入し
302ました。
303
304「 sign-off 」とは、パッチがあなたの書いたものであるか、あるいは、
305あなたがそのパッチをオープンソースとして提供する権利を保持している、
306という証明をパッチの説明の末尾に一行記載するというものです。
307ルールはとても単純です。以下の項目を確認して下さい。
308
309 原作者の証明書( DCO ) 1.1
310
311 このプロジェクトに寄与するものとして、以下のことを証明する。
312
313 (a) 本寄与は私が全体又は一部作成したものであり、私がそのファイ
314 ル中に明示されたオープンソースライセンスの下で公開する権利
315 を持っている。もしくは、
316
317 (b) 本寄与は、私が知る限り、適切なオープンソースライセンスでカバ
318 ーされている既存の作品を元にしている。同時に、私はそのライセ
319 ンスの下で、私が全体又は一部作成した修正物を、ファイル中で示
320 される同一のオープンソースライセンスで(異なるライセンスの下で
321 投稿することが許可されている場合を除いて)投稿する権利を持って
322 いる。もしくは、
323
324 (c) 本寄与は(a)、(b)、(c)を証明する第3者から私へ直接提供された
325 ものであり、私はそれに変更を加えていない。
326
327 (d) 私はこのプロジェクトと本寄与が公のものであることに理解及び同意す
328 る。同時に、関与した記録(投稿の際の全ての個人情報と sign-off を
329 含む)が無期限に保全されることと、当該プロジェクト又は関連する
330 オープンソースライセンスに沿った形で再配布されることに理解及び
331 同意する。
332
333もしこれに同意できるなら、以下のような1行を追加してください。
334
335 Signed-off-by: Random J Developer <random@developer.example.org>
336
337実名を使ってください。(残念ですが、偽名や匿名による寄与はできません。)
338
339人によっては sign-off の近くに追加のタグを付加しています。それらは今のところ
340無視されますが、あなたはそのタグを社内の手続きに利用したり、sign-off に特別
341な情報を示したりすることができます。
342
34313) いつ Acked-by: を使うのか
344
345「 Signed-off-by: 」タグはその署名者がパッチの開発に関わっていたことやパッチ
346の伝播パスにいたことを示しています。
347
348ある人が直接パッチの準備や作成に関わっていないけれど、その人のパッチに対す
349る承認を記録し、示したいとします。その場合、その人を示すのに Acked-by: が使
350えます。Acked-by: はパッチのチェンジログにも追加されます。
351
352パッチの影響を受けるコードのメンテナがパッチに関わっていなかったり、パッチ
353の伝播パスにいなかった時にも、メンテナは Acked-by: をしばしば利用します。
354
355Acked-by: は Signed-off-by: のように公式なタグではありません。それはメンテナが
356少なくともパッチをレビューし、同意を示しているという記録です。そのような
357ことからパッチの統合者がメンテナの「うん、良いと思うよ」という発言を
358Acked-by: へ置き換えることがあります。
359
360Acked-by: が必ずしもパッチ全体の承認を示しているわけではありません。例えば、
361あるパッチが複数のサブシステムへ影響を与えており、その中の1つのサブシステム
362のメンテナからの Acked-by: を持っているとします。その場合、Acked-by: は通常
363そのメンテナのコードに影響を与える一部分だけに対する承認を示しています。
364この点は、ご自分で判断してください。(その Acked-by: が)疑わしい場合は、
365メーリングリストアーカイブの中の大元の議論を参照すべきです。
366
36714) 標準的なパッチのフォーマット
368
369標準的なパッチのサブジェクトは以下のとおりです。
370
371 Subject: [PATCH 001/123] subsystem: summary phrase
372
373標準的なパッチの、電子メールのボディは以下の項目を含んでいます。
374
375 - パッチの作成者を明記する「 from 」行
376
377 - 空行
378
379 - 説明本体。これはこのパッチを説明するために無期限のチェンジログ
380 (変更履歴)にコピーされます。
381
382 - 上述した「 Signed-off-by: 」行。これも説明本体と同じくチェン
383 ジログ内にコピーされます。
384
385 - マーカー行は単純に「 --- 」です。
386
387 - 余計なコメントは、チェンジログには不適切です。
388
389 - 実際のパッチ(差分出力)
390
391サブジェクト行のフォーマットは、アルファベット順で電子メールをとても
392ソートしやすいものになっています。(ほとんどの電子メールクライアント
393はソートをサポートしています)パッチのサブジェクトの連番は0詰めであ
394るため、数字でのソートとアルファベットでのソートは同じ結果になります。
395
396電子メールのサブジェクト内のサブシステム表記は、パッチが適用される
397分野またはサブシステムを識別できるようにすべきです。
398
399電子メールのサブジェクトの「概要の言い回し」はそのパッチの概要を正確
400に表現しなければなりません。「概要の言い回し」をファイル名にしてはい
401けません。一連のパッチ中でそれぞれのパッチは同じ「概要の言い回し」を
402使ってはいけません(「一連のパッチ」とは順序付けられた関連のある複数の
403パッチ群です)。
404
405あなたの電子メールの「概要の言い回し」がそのパッチにとって世界で唯
406一の識別子になるように心がけてください。「概要の言い回し」は git の
407チェンジログの中へずっと伝播していきます。「概要の言い回し」は、開
408発者が後でパッチを参照するために議論の中で利用するかもしれません。
409人々はそのパッチに関連した議論を読むために「概要の言い回し」を使って
410google で検索したがるでしょう。
411
412サブジェクトの例を二つ
413
414 Subject: [patch 2/5] ext2: improve scalability of bitmap searching
415 Subject: [PATCHv2 001/207] x86: fix eflags tracking
416
417「 from 」行は電子メールのボディの一番最初の行でなければなりません。
418その形式は以下のとおりです。
419
420 From: Original Author <author@example.com>
421
422「 from 」行はチェンジログの中で、そのパッチの作成者としてクレジットされ
423ている人を特定するものです。「 from 」行がかけていると、電子メールのヘッ
424ダーの「 From: 」が、チェンジログの中でパッチの作成者を決定するために使わ
425れるでしょう。
426
427説明本体は無期限のソースのチェンジログにコミットされます。なので、説明
428本体はそのパッチに至った議論の詳細を忘れているある程度の技量を持っている人
429がその詳細を思い出すことができるものでなければなりません。
430
431「 --- 」マーカー行はパッチ処理ツールに対して、チェンジログメッセージの終端
432部分を認識させるという重要な役目を果たします。
433
434「 --- 」マーカー行の後の追加コメントの良い使用方法の1つに diffstat コマンド
435があります。diffstat コマンドとは何のファイルが変更され、1ファイル当たり何行
436追加され何行消されたかを示すものです。diffstat コマンドは特に大きなパッチに
437おいて役立ちます。その時点でだけ又はメンテナにとってのみ関係のあるコメント
438は無期限に保存されるチェンジログにとって適切ではありません。そのため、この
439ようなコメントもマーカー行の後に書かれるべきです。ファイル名はカーネルソー
440スツリーのトップディレクトリからの表記でリストされるため、横方向のスペース
441をとり過ぎないように、diffstat コマンドにオプション「 -p 1 -w 70 」を指定し
442てください(インデントを含めてちょうど80列に合うでしょう)。
443
444適切なパッチのフォーマットの詳細についてはセクション3の参考文献を参照して
445ください。
446
447------------------------------------
448セクション2 - ヒントとTIPSと小技
449------------------------------------
450
451このセクションは Linux カーネルに変更を適用することに関係のある一般的な
452「お約束」の多くを載せています。物事には例外というものがあります。しか
453し例外を適用するには、本当に妥当な理由が不可欠です。あなたは恐らくこの
454セクションを Linus のコンピュータ・サイエンス101と呼ぶでしょう。
455
4561) Documentation/CodingStyleを参照
457
458言うまでもなく、あなたのコードがこのコーディングスタイルからあまりに
459も逸脱していると、レビューやコメントなしに受け取ってもらえないかもし
460れません。
461
462唯一の特筆すべき例外は、コードをあるファイルから別のファイルに移動
463するときです。この場合、コードを移動するパッチでは、移動されるコード
464に関して移動以外の変更を一切加えるべきではありません。これにより、
465コードの移動とあなたが行ったコードの修正を明確に区別できるようにな
466ります。これは実際に何が変更されたかをレビューする際の大きな助けに
467なるとともに、ツールにコードの履歴を追跡させることも容易になります。
468
469投稿するより前にパッチのスタイルチェッカー( scripts/checkpatch.pl )で
470あなたのパッチをチェックしてください。このスタイルチェッカーは最終結
471論としてではなく、指標としてみるべきです。もし、あなたのコードが違反
472はしているが修正するより良く見えるのであれば、おそらくそのままにする
473のがベストです。
474
475スタイルチェッカーによる3段階のレポート:
476 - エラー: 間違っている可能性が高い
477 - 警告:注意してレビューする必要がある
478 - チェック:考慮する必要がある
479
480あなたはパッチに残っている全ての違反について、それがなぜ必要なのか正当な
481理由を示せるようにしておく必要があります。
482
4832) #ifdefは見苦しい
484
485ifdef が散乱したコードは、読むのもメンテナンスするのも面倒です。コードの中
486で ifdef を使わないでください。代わりに、ヘッダファイルの中に ifdef を入れて、
487条件付きで、コードの中で使われる関数を「 static inline 」関数かマクロで定義し
488てください。後はコンパイラが、何もしない箇所を最適化して取り去ってくれるで
489しょう。
490
491まずいコードの簡単な例
492
493 dev = alloc_etherdev (sizeof(struct funky_private));
494 if (!dev)
495 return -ENODEV;
496 #ifdef CONFIG_NET_FUNKINESS
497 init_funky_net(dev);
498 #endif
499
500クリーンアップしたコードの例
501
502(in header)
503 #ifndef CONFIG_NET_FUNKINESS
504 static inline void init_funky_net (struct net_device *d) {}
505 #endif
506
507(in the code itself)
508 dev = alloc_etherdev (sizeof(struct funky_private));
509 if (!dev)
510 return -ENODEV;
511 init_funky_net(dev);
512
5133) マクロより「 static inline 」を推奨
514
515「 static inline 」関数はマクロよりもずっと推奨されています。それらは、
516型安全性があり、長さにも制限が無く、フォーマットの制限もありません。
517gcc においては、マクロと同じくらい軽いです。
518
519マクロは「 static inline 」が明らかに不適切であると分かる場所(高速化パスの
520いくつかの特定のケース)や「 static inline 」関数を使うことができないような
521場所(マクロの引数の文字列連結のような)にだけ使われるべきです。
522
523「 static inline 」は「 static __inline__ 」や「 extern inline 」や
524「 extern __inline__ 」よりも適切です。
525
5264) 設計に凝りすぎるな
527
528それが有用になるかどうか分からないような不明瞭な将来を見越した設計
529をしないでください。「できる限り簡単に、そして、それ以上簡単になら
530ないような設計をしてください。」
531
532----------------------
533セクション3 参考文献
534----------------------
535
536Andrew Morton, "The perfect patch" (tpp).
537 <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt>
538
539Jeff Garzik, "Linux kernel patch submission format".
540 <http://linux.yyz.us/patch-format.html>
541
542Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer".
543 <http://www.kroah.com/log/2005/03/31/>
544 <http://www.kroah.com/log/2005/07/08/>
545 <http://www.kroah.com/log/2005/10/19/>
546 <http://www.kroah.com/log/2006/01/11/>
547
548NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people!
549 <http://marc.theaimsgroup.com/?l=linux-kernel&m=112112749912944&w=2>
550
551Kernel Documentation/CodingStyle:
552 <http://users.sosdg.org/~qiyong/lxr/source/Documentation/CodingStyle>
553
554Linus Torvalds's mail on the canonical patch format:
555 <http://lkml.org/lkml/2005/4/7/183>
556--
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index a13d69b2217d..33121d6c827c 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -586,11 +586,6 @@ and is between 256 and 4096 characters. It is defined in the file
586 586
587 eata= [HW,SCSI] 587 eata= [HW,SCSI]
588 588
589 ec_intr= [HW,ACPI] ACPI Embedded Controller interrupt mode
590 Format: <int>
591 0: polling mode
592 non-0: interrupt mode (default)
593
594 edd= [EDD] 589 edd= [EDD]
595 Format: {"of[f]" | "sk[ipmbr]"} 590 Format: {"of[f]" | "sk[ipmbr]"}
596 See comment in arch/i386/boot/edd.S 591 See comment in arch/i386/boot/edd.S
@@ -1444,7 +1439,8 @@ and is between 256 and 4096 characters. It is defined in the file
1444 Param: "schedule" - profile schedule points. 1439 Param: "schedule" - profile schedule points.
1445 Param: <number> - step/bucket size as a power of 2 for 1440 Param: <number> - step/bucket size as a power of 2 for
1446 statistical time based profiling. 1441 statistical time based profiling.
1447 Param: "sleep" - profile D-state sleeping (millisecs) 1442 Param: "sleep" - profile D-state sleeping (millisecs).
1443 Requires CONFIG_SCHEDSTATS
1448 Param: "kvm" - profile VM exits. 1444 Param: "kvm" - profile VM exits.
1449 1445
1450 processor.max_cstate= [HW,ACPI] 1446 processor.max_cstate= [HW,ACPI]
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 5bdc37f81842..f2668390e8f7 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -34,25 +34,24 @@
34#include <zlib.h> 34#include <zlib.h>
35#include <assert.h> 35#include <assert.h>
36#include <sched.h> 36#include <sched.h>
37/*L:110 We can ignore the 30 include files we need for this program, but I do
38 * want to draw attention to the use of kernel-style types.
39 *
40 * As Linus said, "C is a Spartan language, and so should your naming be." I
41 * like these abbreviations and the header we need uses them, so we define them
42 * here.
43 */
44typedef unsigned long long u64;
45typedef uint32_t u32;
46typedef uint16_t u16;
47typedef uint8_t u8;
48#include "linux/lguest_launcher.h" 37#include "linux/lguest_launcher.h"
49#include "linux/pci_ids.h"
50#include "linux/virtio_config.h" 38#include "linux/virtio_config.h"
51#include "linux/virtio_net.h" 39#include "linux/virtio_net.h"
52#include "linux/virtio_blk.h" 40#include "linux/virtio_blk.h"
53#include "linux/virtio_console.h" 41#include "linux/virtio_console.h"
54#include "linux/virtio_ring.h" 42#include "linux/virtio_ring.h"
55#include "asm-x86/bootparam.h" 43#include "asm-x86/bootparam.h"
44/*L:110 We can ignore the 38 include files we need for this program, but I do
45 * want to draw attention to the use of kernel-style types.
46 *
47 * As Linus said, "C is a Spartan language, and so should your naming be." I
48 * like these abbreviations, so we define them here. Note that u64 is always
49 * unsigned long long, which works on all Linux systems: this means that we can
50 * use %llu in printf for any u64. */
51typedef unsigned long long u64;
52typedef uint32_t u32;
53typedef uint16_t u16;
54typedef uint8_t u8;
56/*:*/ 55/*:*/
57 56
58#define PAGE_PRESENT 0x7 /* Present, RW, Execute */ 57#define PAGE_PRESENT 0x7 /* Present, RW, Execute */
@@ -361,8 +360,8 @@ static unsigned long load_bzimage(int fd)
361} 360}
362 361
363/*L:140 Loading the kernel is easy when it's a "vmlinux", but most kernels 362/*L:140 Loading the kernel is easy when it's a "vmlinux", but most kernels
364 * come wrapped up in the self-decompressing "bzImage" format. With some funky 363 * come wrapped up in the self-decompressing "bzImage" format. With a little
365 * coding, we can load those, too. */ 364 * work, we can load those, too. */
366static unsigned long load_kernel(int fd) 365static unsigned long load_kernel(int fd)
367{ 366{
368 Elf32_Ehdr hdr; 367 Elf32_Ehdr hdr;
@@ -465,6 +464,7 @@ static unsigned long setup_pagetables(unsigned long mem,
465 * to know where it is. */ 464 * to know where it is. */
466 return to_guest_phys(pgdir); 465 return to_guest_phys(pgdir);
467} 466}
467/*:*/
468 468
469/* Simple routine to roll all the commandline arguments together with spaces 469/* Simple routine to roll all the commandline arguments together with spaces
470 * between them. */ 470 * between them. */
@@ -481,9 +481,9 @@ static void concat(char *dst, char *args[])
481 dst[len] = '\0'; 481 dst[len] = '\0';
482} 482}
483 483
484/* This is where we actually tell the kernel to initialize the Guest. We saw 484/*L:185 This is where we actually tell the kernel to initialize the Guest. We
485 * the arguments it expects when we looked at initialize() in lguest_user.c: 485 * saw the arguments it expects when we looked at initialize() in lguest_user.c:
486 * the base of guest "physical" memory, the top physical page to allow, the 486 * the base of Guest "physical" memory, the top physical page to allow, the
487 * top level pagetable and the entry point for the Guest. */ 487 * top level pagetable and the entry point for the Guest. */
488static int tell_kernel(unsigned long pgdir, unsigned long start) 488static int tell_kernel(unsigned long pgdir, unsigned long start)
489{ 489{
@@ -513,13 +513,14 @@ static void add_device_fd(int fd)
513/*L:200 513/*L:200
514 * The Waker. 514 * The Waker.
515 * 515 *
516 * With a console and network devices, we can have lots of input which we need 516 * With console, block and network devices, we can have lots of input which we
517 * to process. We could try to tell the kernel what file descriptors to watch, 517 * need to process. We could try to tell the kernel what file descriptors to
518 * but handing a file descriptor mask through to the kernel is fairly icky. 518 * watch, but handing a file descriptor mask through to the kernel is fairly
519 * icky.
519 * 520 *
520 * Instead, we fork off a process which watches the file descriptors and writes 521 * Instead, we fork off a process which watches the file descriptors and writes
521 * the LHREQ_BREAK command to the /dev/lguest filedescriptor to tell the Host 522 * the LHREQ_BREAK command to the /dev/lguest file descriptor to tell the Host
522 * loop to stop running the Guest. This causes it to return from the 523 * stop running the Guest. This causes the Launcher to return from the
523 * /dev/lguest read with -EAGAIN, where it will write to /dev/lguest to reset 524 * /dev/lguest read with -EAGAIN, where it will write to /dev/lguest to reset
524 * the LHREQ_BREAK and wake us up again. 525 * the LHREQ_BREAK and wake us up again.
525 * 526 *
@@ -545,7 +546,9 @@ static void wake_parent(int pipefd, int lguest_fd)
545 if (read(pipefd, &fd, sizeof(fd)) == 0) 546 if (read(pipefd, &fd, sizeof(fd)) == 0)
546 exit(0); 547 exit(0);
547 /* Otherwise it's telling us to change what file 548 /* Otherwise it's telling us to change what file
548 * descriptors we're to listen to. */ 549 * descriptors we're to listen to. Positive means
550 * listen to a new one, negative means stop
551 * listening. */
549 if (fd >= 0) 552 if (fd >= 0)
550 FD_SET(fd, &devices.infds); 553 FD_SET(fd, &devices.infds);
551 else 554 else
@@ -560,7 +563,7 @@ static int setup_waker(int lguest_fd)
560{ 563{
561 int pipefd[2], child; 564 int pipefd[2], child;
562 565
563 /* We create a pipe to talk to the waker, and also so it knows when the 566 /* We create a pipe to talk to the Waker, and also so it knows when the
564 * Launcher dies (and closes pipe). */ 567 * Launcher dies (and closes pipe). */
565 pipe(pipefd); 568 pipe(pipefd);
566 child = fork(); 569 child = fork();
@@ -568,7 +571,8 @@ static int setup_waker(int lguest_fd)
568 err(1, "forking"); 571 err(1, "forking");
569 572
570 if (child == 0) { 573 if (child == 0) {
571 /* Close the "writing" end of our copy of the pipe */ 574 /* We are the Waker: close the "writing" end of our copy of the
575 * pipe and start waiting for input. */
572 close(pipefd[1]); 576 close(pipefd[1]);
573 wake_parent(pipefd[0], lguest_fd); 577 wake_parent(pipefd[0], lguest_fd);
574 } 578 }
@@ -579,12 +583,12 @@ static int setup_waker(int lguest_fd)
579 return pipefd[1]; 583 return pipefd[1];
580} 584}
581 585
582/*L:210 586/*
583 * Device Handling. 587 * Device Handling.
584 * 588 *
585 * When the Guest sends DMA to us, it sends us an array of addresses and sizes. 589 * When the Guest gives us a buffer, it sends an array of addresses and sizes.
586 * We need to make sure it's not trying to reach into the Launcher itself, so 590 * We need to make sure it's not trying to reach into the Launcher itself, so
587 * we have a convenient routine which check it and exits with an error message 591 * we have a convenient routine which checks it and exits with an error message
588 * if something funny is going on: 592 * if something funny is going on:
589 */ 593 */
590static void *_check_pointer(unsigned long addr, unsigned int size, 594static void *_check_pointer(unsigned long addr, unsigned int size,
@@ -601,7 +605,9 @@ static void *_check_pointer(unsigned long addr, unsigned int size,
601/* A macro which transparently hands the line number to the real function. */ 605/* A macro which transparently hands the line number to the real function. */
602#define check_pointer(addr,size) _check_pointer(addr, size, __LINE__) 606#define check_pointer(addr,size) _check_pointer(addr, size, __LINE__)
603 607
604/* This function returns the next descriptor in the chain, or vq->vring.num. */ 608/* Each buffer in the virtqueues is actually a chain of descriptors. This
609 * function returns the next descriptor in the chain, or vq->vring.num if we're
610 * at the end. */
605static unsigned next_desc(struct virtqueue *vq, unsigned int i) 611static unsigned next_desc(struct virtqueue *vq, unsigned int i)
606{ 612{
607 unsigned int next; 613 unsigned int next;
@@ -680,13 +686,14 @@ static unsigned get_vq_desc(struct virtqueue *vq,
680 return head; 686 return head;
681} 687}
682 688
683/* Once we've used one of their buffers, we tell them about it. We'll then 689/* After we've used one of their buffers, we tell them about it. We'll then
684 * want to send them an interrupt, using trigger_irq(). */ 690 * want to send them an interrupt, using trigger_irq(). */
685static void add_used(struct virtqueue *vq, unsigned int head, int len) 691static void add_used(struct virtqueue *vq, unsigned int head, int len)
686{ 692{
687 struct vring_used_elem *used; 693 struct vring_used_elem *used;
688 694
689 /* Get a pointer to the next entry in the used ring. */ 695 /* The virtqueue contains a ring of used buffers. Get a pointer to the
696 * next entry in that used ring. */
690 used = &vq->vring.used->ring[vq->vring.used->idx % vq->vring.num]; 697 used = &vq->vring.used->ring[vq->vring.used->idx % vq->vring.num];
691 used->id = head; 698 used->id = head;
692 used->len = len; 699 used->len = len;
@@ -700,6 +707,7 @@ static void trigger_irq(int fd, struct virtqueue *vq)
700{ 707{
701 unsigned long buf[] = { LHREQ_IRQ, vq->config.irq }; 708 unsigned long buf[] = { LHREQ_IRQ, vq->config.irq };
702 709
710 /* If they don't want an interrupt, don't send one. */
703 if (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT) 711 if (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
704 return; 712 return;
705 713
@@ -716,8 +724,11 @@ static void add_used_and_trigger(int fd, struct virtqueue *vq,
716 trigger_irq(fd, vq); 724 trigger_irq(fd, vq);
717} 725}
718 726
719/* Here is the input terminal setting we save, and the routine to restore them 727/*
720 * on exit so the user can see what they type next. */ 728 * The Console
729 *
730 * Here is the input terminal setting we save, and the routine to restore them
731 * on exit so the user gets their terminal back. */
721static struct termios orig_term; 732static struct termios orig_term;
722static void restore_term(void) 733static void restore_term(void)
723{ 734{
@@ -818,7 +829,10 @@ static void handle_console_output(int fd, struct virtqueue *vq)
818 } 829 }
819} 830}
820 831
821/* Handling output for network is also simple: we get all the output buffers 832/*
833 * The Network
834 *
835 * Handling output for network is also simple: we get all the output buffers
822 * and write them (ignoring the first element) to this device's file descriptor 836 * and write them (ignoring the first element) to this device's file descriptor
823 * (stdout). */ 837 * (stdout). */
824static void handle_net_output(int fd, struct virtqueue *vq) 838static void handle_net_output(int fd, struct virtqueue *vq)
@@ -831,8 +845,9 @@ static void handle_net_output(int fd, struct virtqueue *vq)
831 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) { 845 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) {
832 if (in) 846 if (in)
833 errx(1, "Input buffers in output queue?"); 847 errx(1, "Input buffers in output queue?");
834 /* Check header, but otherwise ignore it (we said we supported 848 /* Check header, but otherwise ignore it (we told the Guest we
835 * no features). */ 849 * supported no features, so it shouldn't have anything
850 * interesting). */
836 (void)convert(&iov[0], struct virtio_net_hdr); 851 (void)convert(&iov[0], struct virtio_net_hdr);
837 len = writev(vq->dev->fd, iov+1, out-1); 852 len = writev(vq->dev->fd, iov+1, out-1);
838 add_used_and_trigger(fd, vq, head, len); 853 add_used_and_trigger(fd, vq, head, len);
@@ -883,7 +898,8 @@ static bool handle_tun_input(int fd, struct device *dev)
883 return true; 898 return true;
884} 899}
885 900
886/* This callback ensures we try again, in case we stopped console or net 901/*L:215 This is the callback attached to the network and console input
902 * virtqueues: it ensures we try again, in case we stopped console or net
887 * delivery because Guest didn't have any buffers. */ 903 * delivery because Guest didn't have any buffers. */
888static void enable_fd(int fd, struct virtqueue *vq) 904static void enable_fd(int fd, struct virtqueue *vq)
889{ 905{
@@ -919,7 +935,7 @@ static void handle_output(int fd, unsigned long addr)
919 strnlen(from_guest_phys(addr), guest_limit - addr)); 935 strnlen(from_guest_phys(addr), guest_limit - addr));
920} 936}
921 937
922/* This is called when the waker wakes us up: check for incoming file 938/* This is called when the Waker wakes us up: check for incoming file
923 * descriptors. */ 939 * descriptors. */
924static void handle_input(int fd) 940static void handle_input(int fd)
925{ 941{
@@ -986,8 +1002,7 @@ static struct lguest_device_desc *new_dev_desc(u16 type)
986} 1002}
987 1003
988/* Each device descriptor is followed by some configuration information. 1004/* Each device descriptor is followed by some configuration information.
989 * The first byte is a "status" byte for the Guest to report what's happening. 1005 * Each configuration field looks like: u8 type, u8 len, [... len bytes...].
990 * After that are fields: u8 type, u8 len, [... len bytes...].
991 * 1006 *
992 * This routine adds a new field to an existing device's descriptor. It only 1007 * This routine adds a new field to an existing device's descriptor. It only
993 * works for the last device, but that's OK because that's how we use it. */ 1008 * works for the last device, but that's OK because that's how we use it. */
@@ -1044,14 +1059,17 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
1044 /* Link virtqueue back to device. */ 1059 /* Link virtqueue back to device. */
1045 vq->dev = dev; 1060 vq->dev = dev;
1046 1061
1047 /* Set up handler. */ 1062 /* Set the routine to call when the Guest does something to this
1063 * virtqueue. */
1048 vq->handle_output = handle_output; 1064 vq->handle_output = handle_output;
1065
1066 /* Set the "Don't Notify Me" flag if we don't have a handler */
1049 if (!handle_output) 1067 if (!handle_output)
1050 vq->vring.used->flags = VRING_USED_F_NO_NOTIFY; 1068 vq->vring.used->flags = VRING_USED_F_NO_NOTIFY;
1051} 1069}
1052 1070
1053/* This routine does all the creation and setup of a new device, including 1071/* This routine does all the creation and setup of a new device, including
1054 * caling new_dev_desc() to allocate the descriptor and device memory. */ 1072 * calling new_dev_desc() to allocate the descriptor and device memory. */
1055static struct device *new_device(const char *name, u16 type, int fd, 1073static struct device *new_device(const char *name, u16 type, int fd,
1056 bool (*handle_input)(int, struct device *)) 1074 bool (*handle_input)(int, struct device *))
1057{ 1075{
@@ -1060,7 +1078,7 @@ static struct device *new_device(const char *name, u16 type, int fd,
1060 /* Append to device list. Prepending to a single-linked list is 1078 /* Append to device list. Prepending to a single-linked list is
1061 * easier, but the user expects the devices to be arranged on the bus 1079 * easier, but the user expects the devices to be arranged on the bus
1062 * in command-line order. The first network device on the command line 1080 * in command-line order. The first network device on the command line
1063 * is eth0, the first block device /dev/lgba, etc. */ 1081 * is eth0, the first block device /dev/vda, etc. */
1064 *devices.lastdev = dev; 1082 *devices.lastdev = dev;
1065 dev->next = NULL; 1083 dev->next = NULL;
1066 devices.lastdev = &dev->next; 1084 devices.lastdev = &dev->next;
@@ -1104,7 +1122,7 @@ static void setup_console(void)
1104 /* The console needs two virtqueues: the input then the output. When 1122 /* The console needs two virtqueues: the input then the output. When
1105 * they put something the input queue, we make sure we're listening to 1123 * they put something the input queue, we make sure we're listening to
1106 * stdin. When they put something in the output queue, we write it to 1124 * stdin. When they put something in the output queue, we write it to
1107 * stdout. */ 1125 * stdout. */
1108 add_virtqueue(dev, VIRTQUEUE_NUM, enable_fd); 1126 add_virtqueue(dev, VIRTQUEUE_NUM, enable_fd);
1109 add_virtqueue(dev, VIRTQUEUE_NUM, handle_console_output); 1127 add_virtqueue(dev, VIRTQUEUE_NUM, handle_console_output);
1110 1128
@@ -1252,21 +1270,17 @@ static void setup_tun_net(const char *arg)
1252 verbose("attached to bridge: %s\n", br_name); 1270 verbose("attached to bridge: %s\n", br_name);
1253} 1271}
1254 1272
1255 1273/* Our block (disk) device should be really simple: the Guest asks for a block
1256/* 1274 * number and we read or write that position in the file. Unfortunately, that
1257 * Block device. 1275 * was amazingly slow: the Guest waits until the read is finished before
1276 * running anything else, even if it could have been doing useful work.
1258 * 1277 *
1259 * Serving a block device is really easy: the Guest asks for a block number and 1278 * We could use async I/O, except it's reputed to suck so hard that characters
1260 * we read or write that position in the file. 1279 * actually go missing from your code when you try to use it.
1261 *
1262 * Unfortunately, this is amazingly slow: the Guest waits until the read is
1263 * finished before running anything else, even if it could be doing useful
1264 * work. We could use async I/O, except it's reputed to suck so hard that
1265 * characters actually go missing from your code when you try to use it.
1266 * 1280 *
1267 * So we farm the I/O out to thread, and communicate with it via a pipe. */ 1281 * So we farm the I/O out to thread, and communicate with it via a pipe. */
1268 1282
1269/* This hangs off device->priv, with the data. */ 1283/* This hangs off device->priv. */
1270struct vblk_info 1284struct vblk_info
1271{ 1285{
1272 /* The size of the file. */ 1286 /* The size of the file. */
@@ -1282,8 +1296,14 @@ struct vblk_info
1282 * Launcher triggers interrupt to Guest. */ 1296 * Launcher triggers interrupt to Guest. */
1283 int done_fd; 1297 int done_fd;
1284}; 1298};
1299/*:*/
1285 1300
1286/* This is the core of the I/O thread. It returns true if it did something. */ 1301/*L:210
1302 * The Disk
1303 *
1304 * Remember that the block device is handled by a separate I/O thread. We head
1305 * straight into the core of that thread here:
1306 */
1287static bool service_io(struct device *dev) 1307static bool service_io(struct device *dev)
1288{ 1308{
1289 struct vblk_info *vblk = dev->priv; 1309 struct vblk_info *vblk = dev->priv;
@@ -1294,10 +1314,14 @@ static bool service_io(struct device *dev)
1294 struct iovec iov[dev->vq->vring.num]; 1314 struct iovec iov[dev->vq->vring.num];
1295 off64_t off; 1315 off64_t off;
1296 1316
1317 /* See if there's a request waiting. If not, nothing to do. */
1297 head = get_vq_desc(dev->vq, iov, &out_num, &in_num); 1318 head = get_vq_desc(dev->vq, iov, &out_num, &in_num);
1298 if (head == dev->vq->vring.num) 1319 if (head == dev->vq->vring.num)
1299 return false; 1320 return false;
1300 1321
1322 /* Every block request should contain at least one output buffer
1323 * (detailing the location on disk and the type of request) and one
1324 * input buffer (to hold the result). */
1301 if (out_num == 0 || in_num == 0) 1325 if (out_num == 0 || in_num == 0)
1302 errx(1, "Bad virtblk cmd %u out=%u in=%u", 1326 errx(1, "Bad virtblk cmd %u out=%u in=%u",
1303 head, out_num, in_num); 1327 head, out_num, in_num);
@@ -1306,10 +1330,15 @@ static bool service_io(struct device *dev)
1306 in = convert(&iov[out_num+in_num-1], struct virtio_blk_inhdr); 1330 in = convert(&iov[out_num+in_num-1], struct virtio_blk_inhdr);
1307 off = out->sector * 512; 1331 off = out->sector * 512;
1308 1332
1309 /* This is how we implement barriers. Pretty poor, no? */ 1333 /* The block device implements "barriers", where the Guest indicates
1334 * that it wants all previous writes to occur before this write. We
1335 * don't have a way of asking our kernel to do a barrier, so we just
1336 * synchronize all the data in the file. Pretty poor, no? */
1310 if (out->type & VIRTIO_BLK_T_BARRIER) 1337 if (out->type & VIRTIO_BLK_T_BARRIER)
1311 fdatasync(vblk->fd); 1338 fdatasync(vblk->fd);
1312 1339
1340 /* In general the virtio block driver is allowed to try SCSI commands.
1341 * It'd be nice if we supported eject, for example, but we don't. */
1313 if (out->type & VIRTIO_BLK_T_SCSI_CMD) { 1342 if (out->type & VIRTIO_BLK_T_SCSI_CMD) {
1314 fprintf(stderr, "Scsi commands unsupported\n"); 1343 fprintf(stderr, "Scsi commands unsupported\n");
1315 in->status = VIRTIO_BLK_S_UNSUPP; 1344 in->status = VIRTIO_BLK_S_UNSUPP;
@@ -1375,7 +1404,7 @@ static int io_thread(void *_dev)
1375 1404
1376 /* When this read fails, it means Launcher died, so we follow. */ 1405 /* When this read fails, it means Launcher died, so we follow. */
1377 while (read(vblk->workpipe[0], &c, 1) == 1) { 1406 while (read(vblk->workpipe[0], &c, 1) == 1) {
1378 /* We acknowledge each request immediately, to reduce latency, 1407 /* We acknowledge each request immediately to reduce latency,
1379 * rather than waiting until we've done them all. I haven't 1408 * rather than waiting until we've done them all. I haven't
1380 * measured to see if it makes any difference. */ 1409 * measured to see if it makes any difference. */
1381 while (service_io(dev)) 1410 while (service_io(dev))
@@ -1384,12 +1413,14 @@ static int io_thread(void *_dev)
1384 return 0; 1413 return 0;
1385} 1414}
1386 1415
1387/* When the thread says some I/O is done, we interrupt the Guest. */ 1416/* Now we've seen the I/O thread, we return to the Launcher to see what happens
1417 * when the thread tells us it's completed some I/O. */
1388static bool handle_io_finish(int fd, struct device *dev) 1418static bool handle_io_finish(int fd, struct device *dev)
1389{ 1419{
1390 char c; 1420 char c;
1391 1421
1392 /* If child died, presumably it printed message. */ 1422 /* If the I/O thread died, presumably it printed the error, so we
1423 * simply exit. */
1393 if (read(dev->fd, &c, 1) != 1) 1424 if (read(dev->fd, &c, 1) != 1)
1394 exit(1); 1425 exit(1);
1395 1426
@@ -1398,7 +1429,7 @@ static bool handle_io_finish(int fd, struct device *dev)
1398 return true; 1429 return true;
1399} 1430}
1400 1431
1401/* When the Guest submits some I/O, we wake the I/O thread. */ 1432/* When the Guest submits some I/O, we just need to wake the I/O thread. */
1402static void handle_virtblk_output(int fd, struct virtqueue *vq) 1433static void handle_virtblk_output(int fd, struct virtqueue *vq)
1403{ 1434{
1404 struct vblk_info *vblk = vq->dev->priv; 1435 struct vblk_info *vblk = vq->dev->priv;
@@ -1410,7 +1441,7 @@ static void handle_virtblk_output(int fd, struct virtqueue *vq)
1410 exit(1); 1441 exit(1);
1411} 1442}
1412 1443
1413/* This creates a virtual block device. */ 1444/*L:198 This actually sets up a virtual block device. */
1414static void setup_block_file(const char *filename) 1445static void setup_block_file(const char *filename)
1415{ 1446{
1416 int p[2]; 1447 int p[2];
@@ -1426,7 +1457,7 @@ static void setup_block_file(const char *filename)
1426 /* The device responds to return from I/O thread. */ 1457 /* The device responds to return from I/O thread. */
1427 dev = new_device("block", VIRTIO_ID_BLOCK, p[0], handle_io_finish); 1458 dev = new_device("block", VIRTIO_ID_BLOCK, p[0], handle_io_finish);
1428 1459
1429 /* The device has a virtqueue. */ 1460 /* The device has one virtqueue, where the Guest places requests. */
1430 add_virtqueue(dev, VIRTQUEUE_NUM, handle_virtblk_output); 1461 add_virtqueue(dev, VIRTQUEUE_NUM, handle_virtblk_output);
1431 1462
1432 /* Allocate the room for our own bookkeeping */ 1463 /* Allocate the room for our own bookkeeping */
@@ -1448,7 +1479,8 @@ static void setup_block_file(const char *filename)
1448 /* The I/O thread writes to this end of the pipe when done. */ 1479 /* The I/O thread writes to this end of the pipe when done. */
1449 vblk->done_fd = p[1]; 1480 vblk->done_fd = p[1];
1450 1481
1451 /* This is how we tell the I/O thread about more work. */ 1482 /* This is the second pipe, which is how we tell the I/O thread about
1483 * more work. */
1452 pipe(vblk->workpipe); 1484 pipe(vblk->workpipe);
1453 1485
1454 /* Create stack for thread and run it */ 1486 /* Create stack for thread and run it */
@@ -1487,24 +1519,25 @@ static void __attribute__((noreturn)) run_guest(int lguest_fd)
1487 char reason[1024] = { 0 }; 1519 char reason[1024] = { 0 };
1488 read(lguest_fd, reason, sizeof(reason)-1); 1520 read(lguest_fd, reason, sizeof(reason)-1);
1489 errx(1, "%s", reason); 1521 errx(1, "%s", reason);
1490 /* EAGAIN means the waker wanted us to look at some input. 1522 /* EAGAIN means the Waker wanted us to look at some input.
1491 * Anything else means a bug or incompatible change. */ 1523 * Anything else means a bug or incompatible change. */
1492 } else if (errno != EAGAIN) 1524 } else if (errno != EAGAIN)
1493 err(1, "Running guest failed"); 1525 err(1, "Running guest failed");
1494 1526
1495 /* Service input, then unset the BREAK which releases 1527 /* Service input, then unset the BREAK to release the Waker. */
1496 * the Waker. */
1497 handle_input(lguest_fd); 1528 handle_input(lguest_fd);
1498 if (write(lguest_fd, args, sizeof(args)) < 0) 1529 if (write(lguest_fd, args, sizeof(args)) < 0)
1499 err(1, "Resetting break"); 1530 err(1, "Resetting break");
1500 } 1531 }
1501} 1532}
1502/* 1533/*
1503 * This is the end of the Launcher. 1534 * This is the end of the Launcher. The good news: we are over halfway
1535 * through! The bad news: the most fiendish part of the code still lies ahead
1536 * of us.
1504 * 1537 *
1505 * But wait! We've seen I/O from the Launcher, and we've seen I/O from the 1538 * Are you ready? Take a deep breath and join me in the core of the Host, in
1506 * Drivers. If we were to see the Host kernel I/O code, our understanding 1539 * "make Host".
1507 * would be complete... :*/ 1540 :*/
1508 1541
1509static struct option opts[] = { 1542static struct option opts[] = {
1510 { "verbose", 0, NULL, 'v' }, 1543 { "verbose", 0, NULL, 'v' },
@@ -1527,7 +1560,7 @@ int main(int argc, char *argv[])
1527 /* Memory, top-level pagetable, code startpoint and size of the 1560 /* Memory, top-level pagetable, code startpoint and size of the
1528 * (optional) initrd. */ 1561 * (optional) initrd. */
1529 unsigned long mem = 0, pgdir, start, initrd_size = 0; 1562 unsigned long mem = 0, pgdir, start, initrd_size = 0;
1530 /* A temporary and the /dev/lguest file descriptor. */ 1563 /* Two temporaries and the /dev/lguest file descriptor. */
1531 int i, c, lguest_fd; 1564 int i, c, lguest_fd;
1532 /* The boot information for the Guest. */ 1565 /* The boot information for the Guest. */
1533 struct boot_params *boot; 1566 struct boot_params *boot;
@@ -1622,6 +1655,7 @@ int main(int argc, char *argv[])
1622 /* The boot header contains a command line pointer: we put the command 1655 /* The boot header contains a command line pointer: we put the command
1623 * line after the boot header. */ 1656 * line after the boot header. */
1624 boot->hdr.cmd_line_ptr = to_guest_phys(boot + 1); 1657 boot->hdr.cmd_line_ptr = to_guest_phys(boot + 1);
1658 /* We use a simple helper to copy the arguments separated by spaces. */
1625 concat((char *)(boot + 1), argv+optind+2); 1659 concat((char *)(boot + 1), argv+optind+2);
1626 1660
1627 /* Boot protocol version: 2.07 supports the fields for lguest. */ 1661 /* Boot protocol version: 2.07 supports the fields for lguest. */
diff --git a/Documentation/networking/00-INDEX b/Documentation/networking/00-INDEX
index 153d84d281e6..f5a5e6d3d541 100644
--- a/Documentation/networking/00-INDEX
+++ b/Documentation/networking/00-INDEX
@@ -80,8 +80,6 @@ multicast.txt
80 - Behaviour of cards under Multicast 80 - Behaviour of cards under Multicast
81ncsa-telnet 81ncsa-telnet
82 - notes on how NCSA telnet (DOS) breaks with MTU discovery enabled. 82 - notes on how NCSA telnet (DOS) breaks with MTU discovery enabled.
83net-modules.txt
84 - info and "insmod" parameters for all network driver modules.
85netdevices.txt 83netdevices.txt
86 - info on network device driver functions exported to the kernel. 84 - info on network device driver functions exported to the kernel.
87olympic.txt 85olympic.txt
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 747a5d15d529..6f7872ba1def 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -184,14 +184,14 @@ tcp_frto - INTEGER
184 F-RTO is an enhanced recovery algorithm for TCP retransmission 184 F-RTO is an enhanced recovery algorithm for TCP retransmission
185 timeouts. It is particularly beneficial in wireless environments 185 timeouts. It is particularly beneficial in wireless environments
186 where packet loss is typically due to random radio interference 186 where packet loss is typically due to random radio interference
187 rather than intermediate router congestion. FRTO is sender-side 187 rather than intermediate router congestion. F-RTO is sender-side
188 only modification. Therefore it does not require any support from 188 only modification. Therefore it does not require any support from
189 the peer, but in a typical case, however, where wireless link is 189 the peer, but in a typical case, however, where wireless link is
190 the local access link and most of the data flows downlink, the 190 the local access link and most of the data flows downlink, the
191 faraway servers should have FRTO enabled to take advantage of it. 191 faraway servers should have F-RTO enabled to take advantage of it.
192 If set to 1, basic version is enabled. 2 enables SACK enhanced 192 If set to 1, basic version is enabled. 2 enables SACK enhanced
193 F-RTO if flow uses SACK. The basic version can be used also when 193 F-RTO if flow uses SACK. The basic version can be used also when
194 SACK is in use though scenario(s) with it exists where FRTO 194 SACK is in use though scenario(s) with it exists where F-RTO
195 interacts badly with the packet counting of the SACK enabled TCP 195 interacts badly with the packet counting of the SACK enabled TCP
196 flow. 196 flow.
197 197
diff --git a/Documentation/networking/net-modules.txt b/Documentation/networking/net-modules.txt
deleted file mode 100644
index 98c4392dd0fd..000000000000
--- a/Documentation/networking/net-modules.txt
+++ /dev/null
@@ -1,315 +0,0 @@
1Wed 2-Aug-95 <matti.aarnio@utu.fi>
2
3 Linux network driver modules
4
5 Do not mistake this for "README.modules" at the top-level
6 directory! That document tells about modules in general, while
7 this one tells only about network device driver modules.
8
9 This is a potpourri of INSMOD-time(*) configuration options
10 (if such exists) and their default values of various modules
11 in the Linux network drivers collection.
12
13 Some modules have also hidden (= non-documented) tunable values.
14 The choice of not documenting them is based on general belief, that
15 the less the user needs to know, the better. (There are things that
16 driver developers can use, others should not confuse themselves.)
17
18 In many cases it is highly preferred that insmod:ing is done
19 ONLY with defining an explicit address for the card, AND BY
20 NOT USING AUTO-PROBING!
21
22 Now most cards have some explicitly defined base address that they
23 are compiled with (to avoid auto-probing, among other things).
24 If that compiled value does not match your actual configuration,
25 do use the "io=0xXXX" -parameter for the insmod, and give there
26 a value matching your environment.
27
28 If you are adventurous, you can ask the driver to autoprobe
29 by using the "io=0" parameter, however it is a potentially dangerous
30 thing to do in a live system. (If you don't know where the
31 card is located, you can try autoprobing, and after possible
32 crash recovery, insmod with proper IO-address..)
33
34 --------------------------
35 (*) "INSMOD-time" means when you load module with
36 /sbin/insmod you can feed it optional parameters.
37 See "man insmod".
38 --------------------------
39
40
41 8390 based Network Modules (Paul Gortmaker, Nov 12, 1995)
42 --------------------------
43
44(Includes: smc-ultra, ne, wd, 3c503, hp, hp-plus, e2100 and ac3200)
45
46The 8390 series of network drivers now support multiple card systems without
47reloading the same module multiple times (memory efficient!) This is done by
48specifying multiple comma separated values, such as:
49
50 insmod 3c503.o io=0x280,0x300,0x330,0x350 xcvr=0,1,0,1
51
52The above would have the one module controlling four 3c503 cards, with card 2
53and 4 using external transceivers. The "insmod" manual describes the usage
54of comma separated value lists.
55
56It is *STRONGLY RECOMMENDED* that you supply "io=" instead of autoprobing.
57If an "io=" argument is not supplied, then the ISA drivers will complain
58about autoprobing being not recommended, and begrudgingly autoprobe for
59a *SINGLE CARD ONLY* -- if you want to use multiple cards you *have* to
60supply an "io=0xNNN,0xQQQ,..." argument.
61
62The ne module is an exception to the above. A NE2000 is essentially an
638390 chip, some bus glue and some RAM. Because of this, the ne probe is
64more invasive than the rest, and so at boot we make sure the ne probe is
65done last of all the 8390 cards (so that it won't trip over other 8390 based
66cards) With modules we can't ensure that all other non-ne 8390 cards have
67already been found. Because of this, the ne module REQUIRES an "io=0xNNN"
68argument passed in via insmod. It will refuse to autoprobe.
69
70It is also worth noting that auto-IRQ probably isn't as reliable during
71the flurry of interrupt activity on a running machine. Cards such as the
72ne2000 that can't get the IRQ setting from an EEPROM or configuration
73register are probably best supplied with an "irq=M" argument as well.
74
75
76----------------------------------------------------------------------
77Card/Module List - Configurable Parameters and Default Values
78----------------------------------------------------------------------
79
803c501.c:
81 io = 0x280 IO base address
82 irq = 5 IRQ
83 (Probes ports: 0x280, 0x300)
84
853c503.c:
86 io = 0 (It will complain if you don't supply an "io=0xNNN")
87 irq = 0 (IRQ software selected by driver using autoIRQ)
88 xcvr = 0 (Use xcvr=1 to select external transceiver.)
89 (Probes ports: 0x300, 0x310, 0x330, 0x350, 0x250, 0x280, 0x2A0, 0x2E0)
90
913c505.c:
92 io = 0
93 irq = 0
94 dma = 6 (not autoprobed)
95 (Probes ports: 0x300, 0x280, 0x310)
96
973c507.c:
98 io = 0x300
99 irq = 0
100 (Probes ports: 0x300, 0x320, 0x340, 0x280)
101
1023c509.c:
103 io = 0
104 irq = 0
105 ( Module load-time probing Works reliably only on EISA, ISA ID-PROBE
106 IS NOT RELIABLE! Compile this driver statically into kernel for
107 now, if you need it auto-probing on an ISA-bus machine. )
108
1098390.c:
110 (No public options, several other modules need this one)
111
112a2065.c:
113 Since this is a Zorro board, it supports full autoprobing, even for
114 multiple boards. (m68k/Amiga)
115
116ac3200.c:
117 io = 0 (Checks 0x1000 to 0x8fff in 0x1000 intervals)
118 irq = 0 (Read from config register)
119 (EISA probing..)
120
121apricot.c:
122 io = 0x300 (Can't be altered!)
123 irq = 10
124
125arcnet.c:
126 io = 0
127 irqnum = 0
128 shmem = 0
129 num = 0
130 DO SET THESE MANUALLY AT INSMOD!
131 (When probing, looks at the following possible addresses:
132 Suggested ones:
133 0x300, 0x2E0, 0x2F0, 0x2D0
134 Other ones:
135 0x200, 0x210, 0x220, 0x230, 0x240, 0x250, 0x260, 0x270,
136 0x280, 0x290, 0x2A0, 0x2B0, 0x2C0,
137 0x310, 0x320, 0x330, 0x340, 0x350, 0x360, 0x370,
138 0x380, 0x390, 0x3A0, 0x3E0, 0x3F0 )
139
140ariadne.c:
141 Since this is a Zorro board, it supports full autoprobing, even for
142 multiple boards. (m68k/Amiga)
143
144at1700.c:
145 io = 0x260
146 irq = 0
147 (Probes ports: 0x260, 0x280, 0x2A0, 0x240, 0x340, 0x320, 0x380, 0x300)
148
149atarilance.c:
150 Supports full autoprobing. (m68k/Atari)
151
152atp.c: *Not modularized*
153 (Probes ports: 0x378, 0x278, 0x3BC;
154 fixed IRQs: 5 and 7 )
155
156cops.c:
157 io = 0x240
158 irq = 5
159 nodeid = 0 (AutoSelect = 0, NodeID 1-254 is hand selected.)
160 (Probes ports: 0x240, 0x340, 0x200, 0x210, 0x220, 0x230, 0x260,
161 0x2A0, 0x300, 0x310, 0x320, 0x330, 0x350, 0x360)
162
163de4x5.c:
164 io = 0x000b
165 irq = 10
166 is_not_dec = 0 -- For non-DEC card using DEC 21040/21041/21140 chip, set this to 1
167 (EISA, and PCI probing)
168
169de600.c:
170 de600_debug = 0
171 (On port 0x378, irq 7 -- lpt1; compile time configurable)
172
173de620.c:
174 bnc = 0, utp = 0 <-- Force media by setting either.
175 io = 0x378 (also compile-time configurable)
176 irq = 7
177
178depca.c:
179 io = 0x200
180 irq = 7
181 (Probes ports: ISA: 0x300, 0x200;
182 EISA: 0x0c00 )
183
184dummy.c:
185 No options
186
187e2100.c:
188 io = 0 (It will complain if you don't supply an "io=0xNNN")
189 irq = 0 (IRQ software selected by driver)
190 mem = 0 (Override default shared memory start of 0xd0000)
191 xcvr = 0 (Use xcvr=1 to select external transceiver.)
192 (Probes ports: 0x300, 0x280, 0x380, 0x220)
193
194eepro.c:
195 io = 0x200
196 irq = 0
197 (Probes ports: 0x200, 0x240, 0x280, 0x2C0, 0x300, 0x320, 0x340, 0x360)
198
199eexpress.c:
200 io = 0x300
201 irq = 0 (IRQ value read from EEPROM)
202 (Probes ports: 0x300, 0x270, 0x320, 0x340)
203
204eql.c:
205 (No parameters)
206
207ewrk3.c:
208 io = 0x300
209 irq = 5
210 (With module no autoprobing!
211 On EISA-bus does EISA probing.
212 Static linkage probes ports on ISA bus:
213 0x100, 0x120, 0x140, 0x160, 0x180, 0x1A0, 0x1C0,
214 0x200, 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x2E0,
215 0x300, 0x340, 0x360, 0x380, 0x3A0, 0x3C0)
216
217hp-plus.c:
218 io = 0 (It will complain if you don't supply an "io=0xNNN")
219 irq = 0 (IRQ read from configuration register)
220 (Probes ports: 0x200, 0x240, 0x280, 0x2C0, 0x300, 0x320, 0x340)
221
222hp.c:
223 io = 0 (It will complain if you don't supply an "io=0xNNN")
224 irq = 0 (IRQ software selected by driver using autoIRQ)
225 (Probes ports: 0x300, 0x320, 0x340, 0x280, 0x2C0, 0x200, 0x240)
226
227hp100.c:
228 hp100_port = 0 (IO-base address)
229 (Does EISA-probing, if on EISA-slot;
230 On ISA-bus probes all ports from 0x100 thru to 0x3E0
231 in increments of 0x020)
232
233hydra.c:
234 Since this is a Zorro board, it supports full autoprobing, even for
235 multiple boards. (m68k/Amiga)
236
237ibmtr.c:
238 io = 0xa20, 0xa24 (autoprobed by default)
239 irq = 0 (driver cannot select irq - read from hardware)
240 mem = 0 (shared memory base set at 0xd0000 and not yet
241 able to override thru mem= parameter.)
242
243lance.c: *Not modularized*
244 (PCI, and ISA probing; "CONFIG_PCI" needed for PCI support)
245 (Probes ISA ports: 0x300, 0x320, 0x340, 0x360)
246
247loopback.c: *Static kernel component*
248
249ne.c:
250 io = 0 (Explicitly *requires* an "io=0xNNN" value)
251 irq = 0 (Tries to determine configured IRQ via autoIRQ)
252 (Probes ports: 0x300, 0x280, 0x320, 0x340, 0x360)
253
254net_init.c: *Static kernel component*
255
256ni52.c: *Not modularized*
257 (Probes ports: 0x300, 0x280, 0x360, 0x320, 0x340
258 mems: 0xD0000, 0xD2000, 0xC8000, 0xCA000,
259 0xD4000, 0xD6000, 0xD8000 )
260
261ni65.c: *Not modularized* **16MB MEMORY BARRIER BUG**
262 (Probes ports: 0x300, 0x320, 0x340, 0x360)
263
264pi2.c: *Not modularized* (well, NON-STANDARD modularization!)
265 Only one card supported at this time.
266 (Probes ports: 0x380, 0x300, 0x320, 0x340, 0x360, 0x3A0)
267
268plip.c:
269 io = 0
270 irq = 0 (by default, uses IRQ 5 for port at 0x3bc, IRQ 7
271 for port at 0x378, and IRQ 2 for port at 0x278)
272 (Probes ports: 0x278, 0x378, 0x3bc)
273
274ppp.c:
275 No options (ppp-2.2+ has some, this is based on non-dynamic
276 version from ppp-2.1.2d)
277
278seeq8005.c: *Not modularized*
279 (Probes ports: 0x300, 0x320, 0x340, 0x360)
280
281skeleton.c: *Skeleton*
282
283slhc.c:
284 No configuration parameters
285
286slip.c:
287 slip_maxdev = 256 (default value from SL_NRUNIT on slip.h)
288
289
290smc-ultra.c:
291 io = 0 (It will complain if you don't supply an "io=0xNNN")
292 irq = 0 (IRQ val. read from EEPROM)
293 (Probes ports: 0x200, 0x220, 0x240, 0x280, 0x300, 0x340, 0x380)
294
295tulip.c: *Partial modularization*
296 (init-time memory allocation makes problems..)
297
298tunnel.c:
299 No insmod parameters
300
301wavelan.c:
302 io = 0x390 (Settable, but change not recommended)
303 irq = 0 (Not honoured, if changed..)
304
305wd.c:
306 io = 0 (It will complain if you don't supply an "io=0xNNN")
307 irq = 0 (IRQ val. read from EEPROM, ancient cards use autoIRQ)
308 mem = 0 (Force shared-memory on address 0xC8000, or whatever..)
309 mem_end = 0 (Force non-std. mem. size via supplying mem_end val.)
310 (eg. for 32k WD8003EBT, use mem=0xd0000 mem_end=0xd8000)
311 (Probes ports: 0x300, 0x280, 0x380, 0x240)
312
313znet.c: *Not modularized*
314 (Only one device on Zenith Z-Note (notebook?) systems,
315 configuration information from (EE)PROM)
diff --git a/Documentation/networking/tc-actions-env-rules.txt b/Documentation/networking/tc-actions-env-rules.txt
new file mode 100644
index 000000000000..01e716d185f4
--- /dev/null
+++ b/Documentation/networking/tc-actions-env-rules.txt
@@ -0,0 +1,29 @@
1
2The "enviromental" rules for authors of any new tc actions are:
3
41) If you stealeth or borroweth any packet thou shalt be branching
5from the righteous path and thou shalt cloneth.
6
7For example if your action queues a packet to be processed later
8or intentionaly branches by redirecting a packet then you need to
9clone the packet.
10There are certain fields in the skb tc_verd that need to be reset so we
11avoid loops etc. A few are generic enough so much so that skb_act_clone()
12resets them for you. So invoke skb_act_clone() rather than skb_clone()
13
142) If you munge any packet thou shalt call pskb_expand_head in the case
15someone else is referencing the skb. After that you "own" the skb.
16You must also tell us if it is ok to munge the packet (TC_OK2MUNGE),
17this way any action downstream can stomp on the packet.
18
193) dropping packets you dont own is a nono. You simply return
20TC_ACT_SHOT to the caller and they will drop it.
21
22The "enviromental" rules for callers of actions (qdiscs etc) are:
23
24*) thou art responsible for freeing anything returned as being
25TC_ACT_SHOT/STOLEN/QUEUED. If none of TC_ACT_SHOT/STOLEN/QUEUED is
26returned then all is great and you dont need to do anything.
27
28Post on netdev if something is unclear.
29
diff --git a/Documentation/scsi/link_power_management_policy.txt b/Documentation/scsi/link_power_management_policy.txt
new file mode 100644
index 000000000000..d18993d01884
--- /dev/null
+++ b/Documentation/scsi/link_power_management_policy.txt
@@ -0,0 +1,19 @@
1This parameter allows the user to set the link (interface) power management.
2There are 3 possible options:
3
4Value Effect
5----------------------------------------------------------------------------
6min_power Tell the controller to try to make the link use the
7 least possible power when possible. This may
8 sacrifice some performance due to increased latency
9 when coming out of lower power states.
10
11max_performance Generally, this means no power management. Tell
12 the controller to have performance be a priority
13 over power management.
14
15medium_power Tell the controller to enter a lower power state
16 when possible, but do not enter the lowest power
17 state, thus improving latency over min_power setting.
18
19
diff --git a/MAINTAINERS b/MAINTAINERS
index 76b857157866..6c0e44bbf601 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -216,7 +216,7 @@ P: Len Brown
216M: len.brown@intel.com 216M: len.brown@intel.com
217M: lenb@kernel.org 217M: lenb@kernel.org
218L: linux-acpi@vger.kernel.org 218L: linux-acpi@vger.kernel.org
219W: http://acpi.sourceforge.net/ 219W: http://www.lesswatts.org/projects/acpi/
220T: git kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git 220T: git kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
221S: Supported 221S: Supported
222 222
@@ -235,8 +235,8 @@ W: http://acpi.sourceforge.net/
235S: Supported 235S: Supported
236 236
237ACPI FAN DRIVER 237ACPI FAN DRIVER
238P: Konstantin A. Karasyov 238P: Len Brown
239M: konstantin.a.karasyov@intel.com 239M: len.brown@intel.com
240L: linux-acpi@vger.kernel.org 240L: linux-acpi@vger.kernel.org
241W: http://acpi.sourceforge.net/ 241W: http://acpi.sourceforge.net/
242S: Supported 242S: Supported
@@ -248,15 +248,15 @@ L: pcihpd-discuss@lists.sourceforge.net
248S: Supported 248S: Supported
249 249
250ACPI THERMAL DRIVER 250ACPI THERMAL DRIVER
251P: Konstantin A. Karasyov 251P: Len Brown
252M: konstantin.a.karasyov@intel.com 252M: len.brown@intel.com
253L: linux-acpi@vger.kernel.org 253L: linux-acpi@vger.kernel.org
254W: http://acpi.sourceforge.net/ 254W: http://acpi.sourceforge.net/
255S: Supported 255S: Supported
256 256
257ACPI VIDEO DRIVER 257ACPI VIDEO DRIVER
258P: Luming Yu 258P: Rui Zhang
259M: luming.yu@intel.com 259M: rui.zhang@intel.com
260L: linux-acpi@vger.kernel.org 260L: linux-acpi@vger.kernel.org
261W: http://acpi.sourceforge.net/ 261W: http://acpi.sourceforge.net/
262S: Supported 262S: Supported
@@ -398,6 +398,12 @@ P: Arnaldo Carvalho de Melo
398M: acme@ghostprotocols.net 398M: acme@ghostprotocols.net
399S: Maintained 399S: Maintained
400 400
401APPLETOUCH TOUCHPAD DRIVER
402P: Johannes Berg
403M: johannes@sipsolutions.net
404L: linux-input@vger.kernel.org
405S: Maintained
406
401ARC FRAMEBUFFER DRIVER 407ARC FRAMEBUFFER DRIVER
402P: Jaya Kumar 408P: Jaya Kumar
403M: jayalk@intworks.biz 409M: jayalk@intworks.biz
@@ -1701,7 +1707,7 @@ S: Maintained
1701HID CORE LAYER 1707HID CORE LAYER
1702P: Jiri Kosina 1708P: Jiri Kosina
1703M: jkosina@suse.cz 1709M: jkosina@suse.cz
1704L: linux-input@atrey.karlin.mff.cuni.cz 1710L: linux-input@vger.kernel.org
1705T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git 1711T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git
1706S: Maintained 1712S: Maintained
1707 1713
@@ -1927,8 +1933,7 @@ INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS
1927P: Dmitry Torokhov 1933P: Dmitry Torokhov
1928M: dmitry.torokhov@gmail.com 1934M: dmitry.torokhov@gmail.com
1929M: dtor@mail.ru 1935M: dtor@mail.ru
1930L: linux-input@atrey.karlin.mff.cuni.cz 1936L: linux-input@vger.kernel.org
1931L: linux-joystick@atrey.karlin.mff.cuni.cz
1932T: git kernel.org:/pub/scm/linux/kernel/git/dtor/input.git 1937T: git kernel.org:/pub/scm/linux/kernel/git/dtor/input.git
1933S: Maintained 1938S: Maintained
1934 1939
@@ -2129,8 +2134,8 @@ S: Maintained
2129JOURNALLING FLASH FILE SYSTEM V2 (JFFS2) 2134JOURNALLING FLASH FILE SYSTEM V2 (JFFS2)
2130P: David Woodhouse 2135P: David Woodhouse
2131M: dwmw2@infradead.org 2136M: dwmw2@infradead.org
2132L: jffs-dev@axis.com 2137L: linux-mtd@lists.infradead.org
2133W: http://sources.redhat.com/jffs2/ 2138W: http://www.linux-mtd.infradead.org/doc/jffs2.html
2134S: Maintained 2139S: Maintained
2135 2140
2136JFS FILESYSTEM 2141JFS FILESYSTEM
@@ -2259,6 +2264,13 @@ L: legousb-devel@lists.sourceforge.net
2259W: http://legousb.sourceforge.net/ 2264W: http://legousb.sourceforge.net/
2260S: Maintained 2265S: Maintained
2261 2266
2267LGUEST
2268P: Rusty Russell
2269M: rusty@rustcorp.com.au
2270L: lguest@ozlabs.org
2271W: http://lguest.ozlabs.org/
2272S: Maintained
2273
2262LINUX FOR IBM pSERIES (RS/6000) 2274LINUX FOR IBM pSERIES (RS/6000)
2263P: Paul Mackerras 2275P: Paul Mackerras
2264M: paulus@au.ibm.com 2276M: paulus@au.ibm.com
@@ -2442,13 +2454,15 @@ W: http://www.tazenda.demon.co.uk/phil/linux-hp
2442S: Maintained 2454S: Maintained
2443 2455
2444MAC80211 2456MAC80211
2445P: Jiri Benc
2446M: jbenc@suse.cz
2447P: Michael Wu 2457P: Michael Wu
2448M: flamingice@sourmilk.net 2458M: flamingice@sourmilk.net
2459P: Johannes Berg
2460M: johannes@sipsolutions.net
2461P: Jiri Benc
2462M: jbenc@suse.cz
2449L: linux-wireless@vger.kernel.org 2463L: linux-wireless@vger.kernel.org
2450W: http://linuxwireless.org/ 2464W: http://linuxwireless.org/
2451T: git kernel.org:/pub/scm/linux/kernel/git/jbenc/mac80211.git 2465T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
2452S: Maintained 2466S: Maintained
2453 2467
2454MACVLAN DRIVER 2468MACVLAN DRIVER
@@ -3463,12 +3477,14 @@ L: linux-pm@lists.linux-foundation.org
3463S: Supported 3477S: Supported
3464 3478
3465SUSPEND TO RAM: 3479SUSPEND TO RAM:
3480P: Len Brown
3481M: len.brown@intel.com
3466P: Pavel Machek 3482P: Pavel Machek
3467M: pavel@suse.cz 3483M: pavel@suse.cz
3468P: Rafael J. Wysocki 3484P: Rafael J. Wysocki
3469M: rjw@sisk.pl 3485M: rjw@sisk.pl
3470L: linux-pm@lists.linux-foundation.org 3486L: linux-pm@lists.linux-foundation.org
3471S: Maintained 3487S: Supported
3472 3488
3473SONIC NETWORK DRIVER 3489SONIC NETWORK DRIVER
3474P: Thomas Bogendoerfer 3490P: Thomas Bogendoerfer
@@ -4141,6 +4157,12 @@ W: http://linuxtv.org
4141T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git 4157T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
4142S: Maintained 4158S: Maintained
4143 4159
4160VLAN (802.1Q)
4161P: Patrick McHardy
4162M: kaber@trash.net
4163L: netdev@vger.kernel.org
4164S: Maintained
4165
4144VT1211 HARDWARE MONITOR DRIVER 4166VT1211 HARDWARE MONITOR DRIVER
4145P: Juerg Haefliger 4167P: Juerg Haefliger
4146M: juergh@gmail.com 4168M: juergh@gmail.com
diff --git a/Makefile b/Makefile
index 2a4729024dfb..188c3b6b3fa9 100644
--- a/Makefile
+++ b/Makefile
@@ -168,7 +168,8 @@ export srctree objtree VPATH TOPDIR
168SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ 168SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
169 -e s/arm.*/arm/ -e s/sa110/arm/ \ 169 -e s/arm.*/arm/ -e s/sa110/arm/ \
170 -e s/s390x/s390/ -e s/parisc64/parisc/ \ 170 -e s/s390x/s390/ -e s/parisc64/parisc/ \
171 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ ) 171 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
172 -e s/sh[234].*/sh/ )
172 173
173# Cross compiling and selecting different set of gcc/bin-utils 174# Cross compiling and selecting different set of gcc/bin-utils
174# --------------------------------------------------------------------------- 175# ---------------------------------------------------------------------------
@@ -196,6 +197,9 @@ CROSS_COMPILE ?=
196UTS_MACHINE := $(ARCH) 197UTS_MACHINE := $(ARCH)
197SRCARCH := $(ARCH) 198SRCARCH := $(ARCH)
198 199
200# for i386 and x86_64 we use SRCARCH equal to x86
201SRCARCH := $(if $(filter x86_64 i386,$(SRCARCH)),x86,$(SRCARCH))
202
199KCONFIG_CONFIG ?= .config 203KCONFIG_CONFIG ?= .config
200 204
201# SHELL used by kbuild 205# SHELL used by kbuild
@@ -418,7 +422,7 @@ ifeq ($(config-targets),1)
418# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed. 422# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
419# KBUILD_DEFCONFIG may point out an alternative default configuration 423# KBUILD_DEFCONFIG may point out an alternative default configuration
420# used for 'make defconfig' 424# used for 'make defconfig'
421include $(srctree)/arch/$(ARCH)/Makefile 425include $(srctree)/arch/$(SRCARCH)/Makefile
422export KBUILD_DEFCONFIG 426export KBUILD_DEFCONFIG
423 427
424config %config: scripts_basic outputmakefile FORCE 428config %config: scripts_basic outputmakefile FORCE
@@ -497,7 +501,7 @@ else
497KBUILD_CFLAGS += -O2 501KBUILD_CFLAGS += -O2
498endif 502endif
499 503
500include $(srctree)/arch/$(ARCH)/Makefile 504include $(srctree)/arch/$(SRCARCH)/Makefile
501 505
502ifdef CONFIG_FRAME_POINTER 506ifdef CONFIG_FRAME_POINTER
503KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls 507KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
diff --git a/arch/arm/configs/zylonite_defconfig b/arch/arm/configs/zylonite_defconfig
new file mode 100644
index 000000000000..7949d04a3602
--- /dev/null
+++ b/arch/arm/configs/zylonite_defconfig
@@ -0,0 +1,736 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23
4# Tue Oct 23 13:33:20 2007
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
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
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
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
25CONFIG_ARCH_MTD_XIP=y
26CONFIG_VECTORS_BASE=0xffff0000
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
28
29#
30# General setup
31#
32CONFIG_EXPERIMENTAL=y
33CONFIG_BROKEN_ON_SMP=y
34CONFIG_INIT_ENV_ARG_LIMIT=32
35CONFIG_LOCALVERSION=""
36CONFIG_LOCALVERSION_AUTO=y
37CONFIG_SWAP=y
38CONFIG_SYSVIPC=y
39CONFIG_SYSVIPC_SYSCTL=y
40# CONFIG_POSIX_MQUEUE is not set
41# CONFIG_BSD_PROCESS_ACCT is not set
42# CONFIG_TASKSTATS is not set
43# CONFIG_USER_NS is not set
44# CONFIG_AUDIT is not set
45# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=18
47# CONFIG_CGROUPS is not set
48CONFIG_FAIR_GROUP_SCHED=y
49CONFIG_FAIR_USER_SCHED=y
50# CONFIG_FAIR_CGROUP_SCHED is not set
51CONFIG_SYSFS_DEPRECATED=y
52# CONFIG_RELAY is not set
53# CONFIG_BLK_DEV_INITRD is not set
54# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
55CONFIG_SYSCTL=y
56# CONFIG_EMBEDDED is not set
57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_KALLSYMS=y
60# CONFIG_KALLSYMS_EXTRA_PASS is not set
61CONFIG_HOTPLUG=y
62CONFIG_PRINTK=y
63CONFIG_BUG=y
64CONFIG_ELF_CORE=y
65CONFIG_BASE_FULL=y
66CONFIG_FUTEX=y
67CONFIG_ANON_INODES=y
68CONFIG_EPOLL=y
69CONFIG_SIGNALFD=y
70CONFIG_EVENTFD=y
71CONFIG_SHMEM=y
72CONFIG_VM_EVENT_COUNTERS=y
73CONFIG_SLUB_DEBUG=y
74# CONFIG_SLAB is not set
75CONFIG_SLUB=y
76# CONFIG_SLOB is not set
77CONFIG_RT_MUTEXES=y
78# CONFIG_TINY_SHMEM is not set
79CONFIG_BASE_SMALL=0
80CONFIG_MODULES=y
81# CONFIG_MODULE_UNLOAD is not set
82# CONFIG_MODVERSIONS is not set
83# CONFIG_MODULE_SRCVERSION_ALL is not set
84# CONFIG_KMOD is not set
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"
103
104#
105# System Type
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
112# CONFIG_ARCH_CLPS7500 is not set
113# CONFIG_ARCH_CLPS711X is not set
114# CONFIG_ARCH_CO285 is not set
115# CONFIG_ARCH_EBSA110 is not set
116# CONFIG_ARCH_EP93XX is not set
117# CONFIG_ARCH_FOOTBRIDGE is not set
118# CONFIG_ARCH_NETX is not set
119# CONFIG_ARCH_H720X 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
125# CONFIG_ARCH_IXP2000 is not set
126# CONFIG_ARCH_IXP4XX 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
132CONFIG_ARCH_PXA=y
133# CONFIG_ARCH_RPC is not set
134# CONFIG_ARCH_SA1100 is not set
135# CONFIG_ARCH_S3C2410 is not set
136# CONFIG_ARCH_SHARK is not set
137# CONFIG_ARCH_LH7A40X is not set
138# CONFIG_ARCH_DAVINCI is not set
139# CONFIG_ARCH_OMAP is not set
140
141#
142# Intel PXA2xx/PXA3xx Implementations
143#
144
145#
146# Supported PXA3xx Processor Variants
147#
148CONFIG_CPU_PXA300=y
149CONFIG_CPU_PXA310=y
150CONFIG_CPU_PXA320=y
151# CONFIG_ARCH_LUBBOCK is not set
152# CONFIG_MACH_LOGICPD_PXA270 is not set
153# CONFIG_MACH_MAINSTONE is not set
154# CONFIG_ARCH_PXA_IDP is not set
155# CONFIG_PXA_SHARPSL is not set
156# CONFIG_MACH_TRIZEPS4 is not set
157# CONFIG_MACH_EM_X270 is not set
158CONFIG_MACH_ZYLONITE=y
159# CONFIG_MACH_ARMCORE is not set
160CONFIG_PXA3xx=y
161
162#
163# Boot options
164#
165
166#
167# Power management
168#
169
170#
171# Processor Type
172#
173CONFIG_CPU_32=y
174CONFIG_CPU_XSC3=y
175CONFIG_CPU_32v5=y
176CONFIG_CPU_ABRT_EV5T=y
177CONFIG_CPU_CACHE_VIVT=y
178CONFIG_CPU_TLB_V4WBI=y
179CONFIG_CPU_CP15=y
180CONFIG_CPU_CP15_MMU=y
181CONFIG_IO_36=y
182
183#
184# Processor Features
185#
186# CONFIG_ARM_THUMB is not set
187# CONFIG_CPU_DCACHE_DISABLE is not set
188# CONFIG_CPU_BPREDICT_DISABLE is not set
189# CONFIG_OUTER_CACHE is not set
190CONFIG_IWMMXT=y
191
192#
193# Bus support
194#
195# CONFIG_PCI_SYSCALL is not set
196# CONFIG_ARCH_SUPPORTS_MSI is not set
197# CONFIG_PCCARD is not set
198
199#
200# Kernel Features
201#
202# CONFIG_TICK_ONESHOT is not set
203# CONFIG_NO_HZ is not set
204# CONFIG_HIGH_RES_TIMERS is not set
205CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
206# CONFIG_PREEMPT is not set
207CONFIG_HZ=100
208CONFIG_AEABI=y
209CONFIG_OABI_COMPAT=y
210# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
211CONFIG_SELECT_MEMORY_MODEL=y
212CONFIG_FLATMEM_MANUAL=y
213# CONFIG_DISCONTIGMEM_MANUAL is not set
214# CONFIG_SPARSEMEM_MANUAL is not set
215CONFIG_FLATMEM=y
216CONFIG_FLAT_NODE_MEM_MAP=y
217# CONFIG_SPARSEMEM_STATIC is not set
218# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
219CONFIG_SPLIT_PTLOCK_CPUS=4096
220# CONFIG_RESOURCES_64BIT is not set
221CONFIG_ZONE_DMA_FLAG=1
222CONFIG_BOUNCE=y
223CONFIG_VIRT_TO_BUS=y
224CONFIG_ALIGNMENT_TRAP=y
225
226#
227# Boot options
228#
229CONFIG_ZBOOT_ROM_TEXT=0x0
230CONFIG_ZBOOT_ROM_BSS=0x0
231CONFIG_CMDLINE="root=/dev/nfs rootfstype=nfs nfsroot=192.168.1.100:/nfs/rootfs/ ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on console=ttyS0,38400 mem=64M debug"
232# CONFIG_XIP_KERNEL is not set
233# CONFIG_KEXEC is not set
234
235#
236# Floating point emulation
237#
238
239#
240# At least one emulation must be selected
241#
242CONFIG_FPE_NWFPE=y
243# CONFIG_FPE_NWFPE_XP is not set
244# CONFIG_FPE_FASTFPE is not set
245
246#
247# Userspace binary formats
248#
249CONFIG_BINFMT_ELF=y
250# CONFIG_BINFMT_AOUT is not set
251# CONFIG_BINFMT_MISC is not set
252
253#
254# Power management options
255#
256# CONFIG_PM is not set
257CONFIG_SUSPEND_UP_POSSIBLE=y
258
259#
260# Networking
261#
262CONFIG_NET=y
263
264#
265# Networking options
266#
267CONFIG_PACKET=y
268# CONFIG_PACKET_MMAP is not set
269CONFIG_UNIX=y
270# CONFIG_NET_KEY is not set
271CONFIG_INET=y
272# CONFIG_IP_MULTICAST is not set
273# CONFIG_IP_ADVANCED_ROUTER is not set
274CONFIG_IP_FIB_HASH=y
275CONFIG_IP_PNP=y
276CONFIG_IP_PNP_DHCP=y
277CONFIG_IP_PNP_BOOTP=y
278CONFIG_IP_PNP_RARP=y
279# CONFIG_NET_IPIP is not set
280# CONFIG_NET_IPGRE is not set
281# CONFIG_ARPD is not set
282# CONFIG_SYN_COOKIES is not set
283# CONFIG_INET_AH is not set
284# CONFIG_INET_ESP is not set
285# CONFIG_INET_IPCOMP is not set
286# CONFIG_INET_XFRM_TUNNEL is not set
287# CONFIG_INET_TUNNEL is not set
288# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
289# CONFIG_INET_XFRM_MODE_TUNNEL is not set
290# CONFIG_INET_XFRM_MODE_BEET is not set
291# CONFIG_INET_LRO is not set
292# CONFIG_INET_DIAG is not set
293# CONFIG_TCP_CONG_ADVANCED is not set
294CONFIG_TCP_CONG_CUBIC=y
295CONFIG_DEFAULT_TCP_CONG="cubic"
296# CONFIG_TCP_MD5SIG is not set
297# CONFIG_IPV6 is not set
298# CONFIG_INET6_XFRM_TUNNEL is not set
299# CONFIG_INET6_TUNNEL is not set
300# CONFIG_NETWORK_SECMARK is not set
301# CONFIG_NETFILTER is not set
302# CONFIG_IP_DCCP is not set
303# CONFIG_IP_SCTP is not set
304# CONFIG_TIPC is not set
305# CONFIG_ATM is not set
306# CONFIG_BRIDGE is not set
307# CONFIG_VLAN_8021Q is not set
308# CONFIG_DECNET is not set
309# CONFIG_LLC2 is not set
310# CONFIG_IPX is not set
311# CONFIG_ATALK is not set
312# CONFIG_X25 is not set
313# CONFIG_LAPB is not set
314# CONFIG_ECONET is not set
315# CONFIG_WAN_ROUTER is not set
316# CONFIG_NET_SCHED is not set
317
318#
319# Network testing
320#
321# CONFIG_NET_PKTGEN is not set
322# CONFIG_HAMRADIO is not set
323# CONFIG_IRDA is not set
324# CONFIG_BT is not set
325# CONFIG_AF_RXRPC is not set
326
327#
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
336
337#
338# Device Drivers
339#
340
341#
342# Generic Driver Options
343#
344CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
345CONFIG_STANDALONE=y
346CONFIG_PREVENT_FIRMWARE_BUILD=y
347CONFIG_FW_LOADER=y
348# CONFIG_SYS_HYPERVISOR is not set
349# CONFIG_CONNECTOR is not set
350# CONFIG_MTD is not set
351# CONFIG_PARPORT is not set
352# CONFIG_BLK_DEV is not set
353# CONFIG_MISC_DEVICES is not set
354# CONFIG_IDE is not set
355
356#
357# SCSI device support
358#
359# CONFIG_RAID_ATTRS is not set
360# CONFIG_SCSI is not set
361# CONFIG_SCSI_DMA is not set
362# CONFIG_SCSI_NETLINK is not set
363# CONFIG_ATA is not set
364# CONFIG_MD is not set
365CONFIG_NETDEVICES=y
366# CONFIG_NETDEVICES_MULTIQUEUE is not set
367# CONFIG_DUMMY is not set
368# CONFIG_BONDING is not set
369# CONFIG_MACVLAN is not set
370# CONFIG_EQUALIZER is not set
371# CONFIG_TUN is not set
372# CONFIG_VETH is not set
373# CONFIG_PHYLIB is not set
374CONFIG_NET_ETHERNET=y
375CONFIG_MII=y
376# CONFIG_AX88796 is not set
377CONFIG_SMC91X=y
378# CONFIG_DM9000 is not set
379# CONFIG_SMC911X is not set
380# CONFIG_IBM_NEW_EMAC_ZMII is not set
381# CONFIG_IBM_NEW_EMAC_RGMII is not set
382# CONFIG_IBM_NEW_EMAC_TAH is not set
383# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
384# CONFIG_B44 is not set
385# CONFIG_NETDEV_1000 is not set
386# CONFIG_NETDEV_10000 is not set
387
388#
389# Wireless LAN
390#
391# CONFIG_WLAN_PRE80211 is not set
392# CONFIG_WLAN_80211 is not set
393# CONFIG_WAN is not set
394# CONFIG_PPP is not set
395# CONFIG_SLIP is not set
396# CONFIG_SHAPER is not set
397# CONFIG_NETCONSOLE is not set
398# CONFIG_NETPOLL is not set
399# CONFIG_NET_POLL_CONTROLLER is not set
400# CONFIG_ISDN is not set
401
402#
403# Input device support
404#
405CONFIG_INPUT=y
406# CONFIG_INPUT_FF_MEMLESS is not set
407# CONFIG_INPUT_POLLDEV is not set
408
409#
410# Userland interfaces
411#
412CONFIG_INPUT_MOUSEDEV=y
413# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
414CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
415CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
416# CONFIG_INPUT_JOYDEV is not set
417# CONFIG_INPUT_EVDEV is not set
418# CONFIG_INPUT_EVBUG is not set
419
420#
421# Input Device Drivers
422#
423# CONFIG_INPUT_KEYBOARD is not set
424# CONFIG_INPUT_MOUSE is not set
425# CONFIG_INPUT_JOYSTICK is not set
426# CONFIG_INPUT_TABLET is not set
427# CONFIG_INPUT_TOUCHSCREEN is not set
428# CONFIG_INPUT_MISC is not set
429
430#
431# Hardware I/O ports
432#
433# CONFIG_SERIO is not set
434# CONFIG_GAMEPORT is not set
435
436#
437# Character devices
438#
439CONFIG_VT=y
440CONFIG_VT_CONSOLE=y
441CONFIG_HW_CONSOLE=y
442# CONFIG_VT_HW_CONSOLE_BINDING is not set
443# CONFIG_SERIAL_NONSTANDARD is not set
444
445#
446# Serial drivers
447#
448# CONFIG_SERIAL_8250 is not set
449
450#
451# Non-8250 serial port support
452#
453CONFIG_SERIAL_PXA=y
454CONFIG_SERIAL_PXA_CONSOLE=y
455CONFIG_SERIAL_CORE=y
456CONFIG_SERIAL_CORE_CONSOLE=y
457CONFIG_UNIX98_PTYS=y
458# CONFIG_LEGACY_PTYS is not set
459# CONFIG_IPMI_HANDLER is not set
460# CONFIG_HW_RANDOM is not set
461# CONFIG_NVRAM is not set
462# CONFIG_R3964 is not set
463# CONFIG_RAW_DRIVER is not set
464# CONFIG_TCG_TPM is not set
465# CONFIG_I2C is not set
466
467#
468# SPI support
469#
470# CONFIG_SPI is not set
471# CONFIG_SPI_MASTER is not set
472# CONFIG_W1 is not set
473# CONFIG_POWER_SUPPLY is not set
474# CONFIG_HWMON is not set
475
476#
477# Sonics Silicon Backplane
478#
479CONFIG_SSB_POSSIBLE=y
480# CONFIG_SSB is not set
481
482#
483# Multifunction device drivers
484#
485# CONFIG_MFD_SM501 is not set
486
487#
488# Multimedia devices
489#
490# CONFIG_VIDEO_DEV is not set
491# CONFIG_DVB_CORE is not set
492# CONFIG_DAB is not set
493
494#
495# Graphics support
496#
497# CONFIG_VGASTATE is not set
498# CONFIG_VIDEO_OUTPUT_CONTROL is not set
499CONFIG_FB=y
500# CONFIG_FIRMWARE_EDID is not set
501# CONFIG_FB_DDC is not set
502CONFIG_FB_CFB_FILLRECT=y
503CONFIG_FB_CFB_COPYAREA=y
504CONFIG_FB_CFB_IMAGEBLIT=y
505# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
506# CONFIG_FB_SYS_FILLRECT is not set
507# CONFIG_FB_SYS_COPYAREA is not set
508# CONFIG_FB_SYS_IMAGEBLIT is not set
509# CONFIG_FB_SYS_FOPS is not set
510CONFIG_FB_DEFERRED_IO=y
511# CONFIG_FB_SVGALIB is not set
512# CONFIG_FB_MACMODES is not set
513# CONFIG_FB_BACKLIGHT is not set
514# CONFIG_FB_MODE_HELPERS is not set
515# CONFIG_FB_TILEBLITTING is not set
516
517#
518# Frame buffer hardware drivers
519#
520# CONFIG_FB_S1D13XXX is not set
521CONFIG_FB_PXA=y
522# CONFIG_FB_PXA_PARAMETERS is not set
523# CONFIG_FB_MBX is not set
524# CONFIG_FB_VIRTUAL is not set
525# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
526
527#
528# Display device support
529#
530# CONFIG_DISPLAY_SUPPORT is not set
531
532#
533# Console display driver support
534#
535# CONFIG_VGA_CONSOLE is not set
536CONFIG_DUMMY_CONSOLE=y
537CONFIG_FRAMEBUFFER_CONSOLE=y
538CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
539# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
540CONFIG_FONTS=y
541# CONFIG_FONT_8x8 is not set
542# CONFIG_FONT_8x16 is not set
543CONFIG_FONT_6x11=y
544# CONFIG_FONT_7x14 is not set
545# CONFIG_FONT_PEARL_8x8 is not set
546# CONFIG_FONT_ACORN_8x8 is not set
547# CONFIG_FONT_MINI_4x6 is not set
548# CONFIG_FONT_SUN8x16 is not set
549# CONFIG_FONT_SUN12x22 is not set
550# CONFIG_FONT_10x18 is not set
551CONFIG_LOGO=y
552CONFIG_LOGO_LINUX_MONO=y
553CONFIG_LOGO_LINUX_VGA16=y
554CONFIG_LOGO_LINUX_CLUT224=y
555
556#
557# Sound
558#
559# CONFIG_SOUND is not set
560# CONFIG_HID_SUPPORT is not set
561# CONFIG_USB_SUPPORT is not set
562# CONFIG_MMC is not set
563# CONFIG_NEW_LEDS is not set
564CONFIG_RTC_LIB=y
565# CONFIG_RTC_CLASS is not set
566
567#
568# File systems
569#
570# CONFIG_EXT2_FS is not set
571# CONFIG_EXT3_FS is not set
572# CONFIG_EXT4DEV_FS is not set
573# CONFIG_REISERFS_FS is not set
574# CONFIG_JFS_FS is not set
575CONFIG_FS_POSIX_ACL=y
576# CONFIG_XFS_FS is not set
577# CONFIG_GFS2_FS is not set
578# CONFIG_OCFS2_FS is not set
579# CONFIG_MINIX_FS is not set
580# CONFIG_ROMFS_FS is not set
581# CONFIG_INOTIFY is not set
582# CONFIG_QUOTA is not set
583CONFIG_DNOTIFY=y
584# CONFIG_AUTOFS_FS is not set
585# CONFIG_AUTOFS4_FS is not set
586# CONFIG_FUSE_FS is not set
587
588#
589# CD-ROM/DVD Filesystems
590#
591# CONFIG_ISO9660_FS is not set
592# CONFIG_UDF_FS is not set
593
594#
595# DOS/FAT/NT Filesystems
596#
597# CONFIG_MSDOS_FS is not set
598# CONFIG_VFAT_FS is not set
599# CONFIG_NTFS_FS is not set
600
601#
602# Pseudo filesystems
603#
604CONFIG_PROC_FS=y
605CONFIG_PROC_SYSCTL=y
606CONFIG_SYSFS=y
607# CONFIG_TMPFS is not set
608# CONFIG_HUGETLB_PAGE is not set
609# CONFIG_CONFIGFS_FS is not set
610
611#
612# Miscellaneous filesystems
613#
614# CONFIG_ADFS_FS is not set
615# CONFIG_AFFS_FS is not set
616# CONFIG_HFS_FS is not set
617# CONFIG_HFSPLUS_FS is not set
618# CONFIG_BEFS_FS is not set
619# CONFIG_BFS_FS is not set
620# CONFIG_EFS_FS is not set
621# CONFIG_CRAMFS is not set
622# CONFIG_VXFS_FS is not set
623# CONFIG_HPFS_FS is not set
624# CONFIG_QNX4FS_FS is not set
625# CONFIG_SYSV_FS is not set
626# CONFIG_UFS_FS is not set
627CONFIG_NETWORK_FILESYSTEMS=y
628CONFIG_NFS_FS=y
629CONFIG_NFS_V3=y
630CONFIG_NFS_V3_ACL=y
631CONFIG_NFS_V4=y
632CONFIG_NFS_DIRECTIO=y
633# CONFIG_NFSD is not set
634CONFIG_ROOT_NFS=y
635CONFIG_LOCKD=y
636CONFIG_LOCKD_V4=y
637CONFIG_NFS_ACL_SUPPORT=y
638CONFIG_NFS_COMMON=y
639CONFIG_SUNRPC=y
640CONFIG_SUNRPC_GSS=y
641# CONFIG_SUNRPC_BIND34 is not set
642CONFIG_RPCSEC_GSS_KRB5=y
643# CONFIG_RPCSEC_GSS_SPKM3 is not set
644# CONFIG_SMB_FS is not set
645# CONFIG_CIFS is not set
646# CONFIG_NCP_FS is not set
647# CONFIG_CODA_FS is not set
648# CONFIG_AFS_FS is not set
649
650#
651# Partition Types
652#
653# CONFIG_PARTITION_ADVANCED is not set
654CONFIG_MSDOS_PARTITION=y
655# CONFIG_NLS is not set
656# CONFIG_DLM is not set
657# CONFIG_INSTRUMENTATION is not set
658
659#
660# Kernel hacking
661#
662# CONFIG_PRINTK_TIME is not set
663CONFIG_ENABLE_MUST_CHECK=y
664# CONFIG_MAGIC_SYSRQ is not set
665# CONFIG_UNUSED_SYMBOLS is not set
666# CONFIG_DEBUG_FS is not set
667# CONFIG_HEADERS_CHECK is not set
668# CONFIG_DEBUG_KERNEL is not set
669# CONFIG_SLUB_DEBUG_ON is not set
670CONFIG_DEBUG_BUGVERBOSE=y
671CONFIG_FRAME_POINTER=y
672# CONFIG_SAMPLES is not set
673CONFIG_DEBUG_USER=y
674
675#
676# Security options
677#
678# CONFIG_KEYS is not set
679# CONFIG_SECURITY is not set
680# CONFIG_SECURITY_FILE_CAPABILITIES is not set
681CONFIG_CRYPTO=y
682CONFIG_CRYPTO_ALGAPI=y
683CONFIG_CRYPTO_BLKCIPHER=y
684CONFIG_CRYPTO_MANAGER=y
685# CONFIG_CRYPTO_HMAC is not set
686# CONFIG_CRYPTO_XCBC is not set
687# CONFIG_CRYPTO_NULL is not set
688# CONFIG_CRYPTO_MD4 is not set
689CONFIG_CRYPTO_MD5=y
690# CONFIG_CRYPTO_SHA1 is not set
691# CONFIG_CRYPTO_SHA256 is not set
692# CONFIG_CRYPTO_SHA512 is not set
693# CONFIG_CRYPTO_WP512 is not set
694# CONFIG_CRYPTO_TGR192 is not set
695# CONFIG_CRYPTO_GF128MUL is not set
696# CONFIG_CRYPTO_ECB is not set
697CONFIG_CRYPTO_CBC=y
698# CONFIG_CRYPTO_PCBC is not set
699# CONFIG_CRYPTO_LRW is not set
700# CONFIG_CRYPTO_XTS is not set
701# CONFIG_CRYPTO_CRYPTD is not set
702CONFIG_CRYPTO_DES=y
703# CONFIG_CRYPTO_FCRYPT is not set
704# CONFIG_CRYPTO_BLOWFISH is not set
705# CONFIG_CRYPTO_TWOFISH is not set
706# CONFIG_CRYPTO_SERPENT is not set
707# CONFIG_CRYPTO_AES is not set
708# CONFIG_CRYPTO_CAST5 is not set
709# CONFIG_CRYPTO_CAST6 is not set
710# CONFIG_CRYPTO_TEA is not set
711# CONFIG_CRYPTO_ARC4 is not set
712# CONFIG_CRYPTO_KHAZAD is not set
713# CONFIG_CRYPTO_ANUBIS is not set
714# CONFIG_CRYPTO_SEED is not set
715# CONFIG_CRYPTO_DEFLATE is not set
716# CONFIG_CRYPTO_MICHAEL_MIC is not set
717# CONFIG_CRYPTO_CRC32C is not set
718# CONFIG_CRYPTO_CAMELLIA is not set
719# CONFIG_CRYPTO_TEST is not set
720# CONFIG_CRYPTO_AUTHENC is not set
721# CONFIG_CRYPTO_HW is not set
722
723#
724# Library routines
725#
726CONFIG_BITREVERSE=y
727# CONFIG_CRC_CCITT is not set
728# CONFIG_CRC16 is not set
729# CONFIG_CRC_ITU_T is not set
730CONFIG_CRC32=y
731# CONFIG_CRC7 is not set
732# CONFIG_LIBCRC32C is not set
733CONFIG_PLIST=y
734CONFIG_HAS_IOMEM=y
735CONFIG_HAS_IOPORT=y
736CONFIG_HAS_DMA=y
diff --git a/arch/arm/mach-ixp2000/Kconfig b/arch/arm/mach-ixp2000/Kconfig
index 86f53f8ccbf5..08d2707f6ca8 100644
--- a/arch/arm/mach-ixp2000/Kconfig
+++ b/arch/arm/mach-ixp2000/Kconfig
@@ -14,7 +14,7 @@ config ARCH_ENP2611
14 help 14 help
15 Say 'Y' here if you want your kernel to support the Radisys 15 Say 'Y' here if you want your kernel to support the Radisys
16 ENP2611 PCI network processing card. For more information on 16 ENP2611 PCI network processing card. For more information on
17 this card, see <file:Documentation/arm/ENP2611>. 17 this card, see <file:Documentation/arm/IXP2000>.
18 18
19config ARCH_IXDP2400 19config ARCH_IXDP2400
20 bool "Support Intel IXDP2400" 20 bool "Support Intel IXDP2400"
diff --git a/arch/arm/mach-netx/xc.c b/arch/arm/mach-netx/xc.c
index 172a058ddd66..bd5184fe177c 100644
--- a/arch/arm/mach-netx/xc.c
+++ b/arch/arm/mach-netx/xc.c
@@ -190,15 +190,15 @@ struct xc *request_xc(int xcno, struct device *dev)
190 goto exit; 190 goto exit;
191 191
192 if (!request_mem_region 192 if (!request_mem_region
193 (NETX_PA_XPEC(xcno), XPEC_MEM_SIZE, dev->kobj.name)) 193 (NETX_PA_XPEC(xcno), XPEC_MEM_SIZE, kobject_name(dev->kobj)))
194 goto exit_free; 194 goto exit_free;
195 195
196 if (!request_mem_region 196 if (!request_mem_region
197 (NETX_PA_XMAC(xcno), XMAC_MEM_SIZE, dev->kobj.name)) 197 (NETX_PA_XMAC(xcno), XMAC_MEM_SIZE, kobject_name(dev->kobj)))
198 goto exit_release_1; 198 goto exit_release_1;
199 199
200 if (!request_mem_region 200 if (!request_mem_region
201 (SRAM_INTERNAL_PHYS(xcno), SRAM_MEM_SIZE, dev->kobj.name)) 201 (SRAM_INTERNAL_PHYS(xcno), SRAM_MEM_SIZE, kobject_name(dev->kobj)))
202 goto exit_release_2; 202 goto exit_release_2;
203 203
204 x->xpec_base = (void * __iomem)io_p2v(NETX_PA_XPEC(xcno)); 204 x->xpec_base = (void * __iomem)io_p2v(NETX_PA_XPEC(xcno));
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index b0921622566f..130681201c19 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -343,6 +343,7 @@ static struct platform_device *h2_devices[] __initdata = {
343 &h2_mcbsp1_device, 343 &h2_mcbsp1_device,
344}; 344};
345 345
346#ifdef CONFIG_I2C_BOARDINFO
346static struct i2c_board_info __initdata h2_i2c_board_info[] = { 347static struct i2c_board_info __initdata h2_i2c_board_info[] = {
347 { 348 {
348 I2C_BOARD_INFO("tps65010", 0x48), 349 I2C_BOARD_INFO("tps65010", 0x48),
@@ -356,6 +357,7 @@ static struct i2c_board_info __initdata h2_i2c_board_info[] = {
356 * - ... etc 357 * - ... etc
357 */ 358 */
358}; 359};
360#endif
359 361
360static void __init h2_init_smc91x(void) 362static void __init h2_init_smc91x(void)
361{ 363{
@@ -467,8 +469,10 @@ static void __init h2_init(void)
467 if (gpio_request(58, "tps65010") == 0) 469 if (gpio_request(58, "tps65010") == 0)
468 gpio_direction_input(58); 470 gpio_direction_input(58);
469 471
472#ifdef CONFIG_I2C_BOARDINFO
470 i2c_register_board_info(1, h2_i2c_board_info, 473 i2c_register_board_info(1, h2_i2c_board_info,
471 ARRAY_SIZE(h2_i2c_board_info)); 474 ARRAY_SIZE(h2_i2c_board_info));
475#endif
472} 476}
473 477
474static void __init h2_map_io(void) 478static void __init h2_map_io(void)
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index d9af4367f8bb..e6e85b7b097b 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -651,7 +651,7 @@ static u32 omap2_get_clksel(u32 *div_sel, u32 *field_mask,
651 break; 651 break;
652 case CM_SYSCLKOUT_SEL1: 652 case CM_SYSCLKOUT_SEL1:
653 div_addr = (u32)&PRCM_CLKOUT_CTRL; 653 div_addr = (u32)&PRCM_CLKOUT_CTRL;
654 if ((div_off == 3) || (div_off = 11)) 654 if ((div_off == 3) || (div_off == 11))
655 mask= 0x3; 655 mask= 0x3;
656 break; 656 break;
657 case CM_CORE_SEL1: 657 case CM_CORE_SEL1:
diff --git a/arch/arm/mach-pxa/mfp.c b/arch/arm/mach-pxa/mfp.c
index 5cd3cadbbd10..436f96574964 100644
--- a/arch/arm/mach-pxa/mfp.c
+++ b/arch/arm/mach-pxa/mfp.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2007 Marvell Internation Ltd. 6 * Copyright (C) 2007 Marvell Internation Ltd.
7 * 7 *
8 * 2007-08-21: eric miao <eric.y.miao@gmail.com> 8 * 2007-08-21: eric miao <eric.miao@marvell.com>
9 * initial version 9 * initial version
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c
index 7a34231f3172..0a0d3877f212 100644
--- a/arch/arm/mach-pxa/pxa300.c
+++ b/arch/arm/mach-pxa/pxa300.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2007 Marvell Internation Ltd. 6 * Copyright (C) 2007 Marvell Internation Ltd.
7 * 7 *
8 * 2007-08-21: eric miao <eric.y.miao@gmail.com> 8 * 2007-08-21: eric miao <eric.miao@marvell.com>
9 * initial version 9 * initial version
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index cd9eba5b3df9..1010f77d977a 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2007 Marvell Internation Ltd. 6 * Copyright (C) 2007 Marvell Internation Ltd.
7 * 7 *
8 * 2007-08-21: eric miao <eric.y.miao@gmail.com> 8 * 2007-08-21: eric miao <eric.miao@marvell.com>
9 * initial version 9 * initial version
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 39f0de8c189e..5da798282a54 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2006 Marvell International Ltd. 6 * Copyright (C) 2006 Marvell International Ltd.
7 * 7 *
8 * 2007-09-02: eric miao <eric.y.miao@gmail.com> 8 * 2007-09-02: eric miao <eric.miao@marvell.com>
9 * initial version 9 * initial version
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index ec4286c7931c..a2d45d742ce4 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -151,6 +151,9 @@ pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev)
151 OIER &= ~OIER_E0; 151 OIER &= ~OIER_E0;
152 raw_local_irq_restore(irqflags); 152 raw_local_irq_restore(irqflags);
153 break; 153 break;
154
155 case CLOCK_EVT_MODE_RESUME:
156 break;
154 } 157 }
155} 158}
156 159
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 3f18d760dd1b..743a87b2faa1 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2006 Marvell International Ltd. 6 * Copyright (C) 2006 Marvell International Ltd.
7 * 7 *
8 * 2007-09-04: eric miao <eric.y.miao@gmail.com> 8 * 2007-09-04: eric miao <eric.miao@marvell.com>
9 * rewrite to align with latest kernel 9 * rewrite to align with latest kernel
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
index b5fbd2f4c693..1832bc316501 100644
--- a/arch/arm/mach-pxa/zylonite_pxa300.c
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c
@@ -5,7 +5,7 @@
5 * PXA3xx Development Platform (aka Zylonite) 5 * PXA3xx Development Platform (aka Zylonite)
6 * 6 *
7 * Copyright (C) 2007 Marvell Internation Ltd. 7 * Copyright (C) 2007 Marvell Internation Ltd.
8 * 2007-08-21: eric miao <eric.y.miao@gmail.com> 8 * 2007-08-21: eric miao <eric.miao@marvell.com>
9 * initial version 9 * initial version
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
index 63cb36be086b..94c715808b59 100644
--- a/arch/arm/mach-pxa/zylonite_pxa320.c
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c
@@ -5,7 +5,7 @@
5 * PXA3xx Development Platform (aka Zylonite) 5 * PXA3xx Development Platform (aka Zylonite)
6 * 6 *
7 * Copyright (C) 2007 Marvell Internation Ltd. 7 * Copyright (C) 2007 Marvell Internation Ltd.
8 * 2007-08-21: eric miao <eric.y.miao@gmail.com> 8 * 2007-08-21: eric miao <eric.miao@marvell.com>
9 * initial version 9 * initial version
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 5b80b6bdd0cb..194ef48968e6 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -105,9 +105,13 @@ ENTRY(cpu_arm926_do_idle)
105 mrc p15, 0, r1, c1, c0, 0 @ Read control register 105 mrc p15, 0, r1, c1, c0, 0 @ Read control register
106 mcr p15, 0, r0, c7, c10, 4 @ Drain write buffer 106 mcr p15, 0, r0, c7, c10, 4 @ Drain write buffer
107 bic r2, r1, #1 << 12 107 bic r2, r1, #1 << 12
108 mrs r3, cpsr @ Disable FIQs while Icache
109 orr ip, r3, #PSR_F_BIT @ is disabled
110 msr cpsr_c, ip
108 mcr p15, 0, r2, c1, c0, 0 @ Disable I cache 111 mcr p15, 0, r2, c1, c0, 0 @ Disable I cache
109 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 112 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
110 mcr p15, 0, r1, c1, c0, 0 @ Restore ICache enable 113 mcr p15, 0, r1, c1, c0, 0 @ Restore ICache enable
114 msr cpsr_c, r3 @ Restore FIQ state
111 mov pc, lr 115 mov pc, lr
112 116
113/* 117/*
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 7888551ed939..9f9de3e95826 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -295,6 +295,12 @@ config PNAV10
295 help 295 help
296 PNAV 1.0 board Support. 296 PNAV 1.0 board Support.
297 297
298config H8606_HVSISTEMAS
299 bool "HV Sistemas H8606"
300 depends on (BF532)
301 help
302 HV Sistemas H8606 board support.
303
298config GENERIC_BOARD 304config GENERIC_BOARD
299 bool "Custom" 305 bool "Custom"
300 depends on (BF537 || BF536 \ 306 depends on (BF537 || BF536 \
@@ -317,7 +323,8 @@ config MEM_MT48LC64M4A2FB_7E
317config MEM_MT48LC16M16A2TG_75 323config MEM_MT48LC16M16A2TG_75
318 bool 324 bool
319 depends on (BFIN533_EZKIT || BFIN561_EZKIT \ 325 depends on (BFIN533_EZKIT || BFIN561_EZKIT \
320 || BFIN533_BLUETECHNIX_CM || BFIN537_BLUETECHNIX_CM) 326 || BFIN533_BLUETECHNIX_CM || BFIN537_BLUETECHNIX_CM \
327 || H8606_HVSISTEMAS)
321 default y 328 default y
322 329
323config MEM_MT48LC32M8A2_75 330config MEM_MT48LC32M8A2_75
@@ -366,7 +373,7 @@ config CLKIN_HZ
366 int "Crystal Frequency in Hz" 373 int "Crystal Frequency in Hz"
367 default "11059200" if BFIN533_STAMP 374 default "11059200" if BFIN533_STAMP
368 default "27000000" if BFIN533_EZKIT 375 default "27000000" if BFIN533_EZKIT
369 default "25000000" if (BFIN537_STAMP || BFIN527_EZKIT) 376 default "25000000" if (BFIN537_STAMP || BFIN527_EZKIT || H8606_HVSISTEMAS)
370 default "30000000" if BFIN561_EZKIT 377 default "30000000" if BFIN561_EZKIT
371 default "24576000" if PNAV10 378 default "24576000" if PNAV10
372 help 379 help
@@ -404,6 +411,7 @@ config VCO_MULT
404 default "20" if BFIN537_BLUETECHNIX_CM 411 default "20" if BFIN537_BLUETECHNIX_CM
405 default "20" if BFIN561_BLUETECHNIX_CM 412 default "20" if BFIN561_BLUETECHNIX_CM
406 default "20" if BFIN561_EZKIT 413 default "20" if BFIN561_EZKIT
414 default "16" if H8606_HVSISTEMAS
407 help 415 help
408 This controls the frequency of the on-chip PLL. This can be between 1 and 64. 416 This controls the frequency of the on-chip PLL. This can be between 1 and 64.
409 PLL Frequency = (Crystal Frequency) * (this setting) 417 PLL Frequency = (Crystal Frequency) * (this setting)
@@ -440,6 +448,7 @@ config SCLK_DIV
440 default 4 if BFIN537_BLUETECHNIX_CM 448 default 4 if BFIN537_BLUETECHNIX_CM
441 default 4 if BFIN561_BLUETECHNIX_CM 449 default 4 if BFIN561_BLUETECHNIX_CM
442 default 5 if BFIN561_EZKIT 450 default 5 if BFIN561_EZKIT
451 default 3 if H8606_HVSISTEMAS
443 help 452 help
444 This sets the frequency of the system clock (including SDRAM or DDR). 453 This sets the frequency of the system clock (including SDRAM or DDR).
445 This can be between 1 and 15 454 This can be between 1 and 15
@@ -492,11 +501,13 @@ config MEM_SIZE
492 default 64 if BFIN561_EZKIT 501 default 64 if BFIN561_EZKIT
493 default 128 if BFIN533_STAMP 502 default 128 if BFIN533_STAMP
494 default 64 if PNAV10 503 default 64 if PNAV10
504 default 32 if H8606_HVSISTEMAS
495 505
496config MEM_ADD_WIDTH 506config MEM_ADD_WIDTH
497 int "SDRAM Memory Address Width" 507 int "SDRAM Memory Address Width"
498 default 9 if BFIN533_EZKIT 508 default 9 if BFIN533_EZKIT
499 default 9 if BFIN561_EZKIT 509 default 9 if BFIN561_EZKIT
510 default 9 if H8606_HVSISTEMAS
500 default 10 if BFIN527_EZKIT 511 default 10 if BFIN527_EZKIT
501 default 10 if BFIN537_STAMP 512 default 10 if BFIN537_STAMP
502 default 11 if BFIN533_STAMP 513 default 11 if BFIN533_STAMP
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index df974e785ee2..1f6a93df6b32 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -244,7 +244,7 @@ CONFIG_CLKIN_HZ=25000000
244# CONFIG_BFIN_KERNEL_CLOCK is not set 244# CONFIG_BFIN_KERNEL_CLOCK is not set
245CONFIG_MAX_VCO_HZ=600000000 245CONFIG_MAX_VCO_HZ=600000000
246CONFIG_MIN_VCO_HZ=50000000 246CONFIG_MIN_VCO_HZ=50000000
247CONFIG_MAX_SCLK_HZ=133000000 247CONFIG_MAX_SCLK_HZ=133333333
248CONFIG_MIN_SCLK_HZ=27000000 248CONFIG_MIN_SCLK_HZ=27000000
249 249
250# 250#
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index 57f58d5cd47a..9e9b420342d1 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -198,7 +198,7 @@ CONFIG_CLKIN_HZ=27000000
198# CONFIG_BFIN_KERNEL_CLOCK is not set 198# CONFIG_BFIN_KERNEL_CLOCK is not set
199CONFIG_MAX_VCO_HZ=750000000 199CONFIG_MAX_VCO_HZ=750000000
200CONFIG_MIN_VCO_HZ=50000000 200CONFIG_MIN_VCO_HZ=50000000
201CONFIG_MAX_SCLK_HZ=133000000 201CONFIG_MAX_SCLK_HZ=133333333
202CONFIG_MIN_SCLK_HZ=27000000 202CONFIG_MIN_SCLK_HZ=27000000
203 203
204# 204#
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index 306302baff06..f59ade980109 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -199,7 +199,7 @@ CONFIG_CLKIN_HZ=11059200
199# CONFIG_BFIN_KERNEL_CLOCK is not set 199# CONFIG_BFIN_KERNEL_CLOCK is not set
200CONFIG_MAX_VCO_HZ=750000000 200CONFIG_MAX_VCO_HZ=750000000
201CONFIG_MIN_VCO_HZ=50000000 201CONFIG_MIN_VCO_HZ=50000000
202CONFIG_MAX_SCLK_HZ=133000000 202CONFIG_MAX_SCLK_HZ=133333333
203CONFIG_MIN_SCLK_HZ=27000000 203CONFIG_MIN_SCLK_HZ=27000000
204 204
205# 205#
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index 828b604438eb..07eb63dc25e0 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -206,7 +206,7 @@ CONFIG_CLKIN_HZ=25000000
206# CONFIG_BFIN_KERNEL_CLOCK is not set 206# CONFIG_BFIN_KERNEL_CLOCK is not set
207CONFIG_MAX_VCO_HZ=600000000 207CONFIG_MAX_VCO_HZ=600000000
208CONFIG_MIN_VCO_HZ=50000000 208CONFIG_MIN_VCO_HZ=50000000
209CONFIG_MAX_SCLK_HZ=133000000 209CONFIG_MAX_SCLK_HZ=133333333
210CONFIG_MIN_SCLK_HZ=27000000 210CONFIG_MIN_SCLK_HZ=27000000
211 211
212# 212#
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index d8569888a1c8..0dd3d2253dc2 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -1,6 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.6 3# Linux kernel version: 2.6.22.10
4# Sat Oct 27 02:34:07 2007
4# 5#
5# CONFIG_MMU is not set 6# CONFIG_MMU is not set
6# CONFIG_FPU is not set 7# CONFIG_FPU is not set
@@ -64,7 +65,6 @@ CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 66CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y 67CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y 68CONFIG_EVENTFD=y
69CONFIG_VM_EVENT_COUNTERS=y 69CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 70CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
@@ -117,6 +117,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# 117#
118# Processor and Board Settings 118# Processor and Board Settings
119# 119#
120# CONFIG_BF522 is not set
121# CONFIG_BF525 is not set
122# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 123# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 124# CONFIG_BF532 is not set
122# CONFIG_BF533 is not set 125# CONFIG_BF533 is not set
@@ -129,6 +132,7 @@ CONFIG_PREEMPT_VOLUNTARY=y
129CONFIG_BF549=y 132CONFIG_BF549=y
130# CONFIG_BF561 is not set 133# CONFIG_BF561 is not set
131CONFIG_BF_REV_0_0=y 134CONFIG_BF_REV_0_0=y
135# CONFIG_BF_REV_0_1 is not set
132# CONFIG_BF_REV_0_2 is not set 136# CONFIG_BF_REV_0_2 is not set
133# CONFIG_BF_REV_0_3 is not set 137# CONFIG_BF_REV_0_3 is not set
134# CONFIG_BF_REV_0_4 is not set 138# CONFIG_BF_REV_0_4 is not set
@@ -137,6 +141,7 @@ CONFIG_BF_REV_0_0=y
137# CONFIG_BF_REV_NONE is not set 141# CONFIG_BF_REV_NONE is not set
138CONFIG_BF54x=y 142CONFIG_BF54x=y
139CONFIG_BFIN_SINGLE_CORE=y 143CONFIG_BFIN_SINGLE_CORE=y
144# CONFIG_BFIN527_EZKIT is not set
140# CONFIG_BFIN533_EZKIT is not set 145# CONFIG_BFIN533_EZKIT is not set
141# CONFIG_BFIN533_STAMP is not set 146# CONFIG_BFIN533_STAMP is not set
142# CONFIG_BFIN537_STAMP is not set 147# CONFIG_BFIN537_STAMP is not set
@@ -147,8 +152,23 @@ CONFIG_BFIN548_EZKIT=y
147# CONFIG_BFIN561_EZKIT is not set 152# CONFIG_BFIN561_EZKIT is not set
148# CONFIG_BFIN561_TEPLA is not set 153# CONFIG_BFIN561_TEPLA is not set
149# CONFIG_PNAV10 is not set 154# CONFIG_PNAV10 is not set
155# CONFIG_H8606_HVSISTEMAS is not set
150# CONFIG_GENERIC_BOARD is not set 156# CONFIG_GENERIC_BOARD is not set
151CONFIG_IRQ_PLL_WAKEUP=7 157CONFIG_IRQ_PLL_WAKEUP=7
158CONFIG_IRQ_RTC=8
159CONFIG_IRQ_SPORT0_RX=9
160CONFIG_IRQ_SPORT0_TX=9
161CONFIG_IRQ_SPORT1_RX=9
162CONFIG_IRQ_SPORT1_TX=9
163CONFIG_IRQ_UART0_RX=10
164CONFIG_IRQ_UART0_TX=10
165CONFIG_IRQ_UART1_RX=10
166CONFIG_IRQ_UART1_TX=10
167CONFIG_IRQ_CNT=8
168CONFIG_IRQ_USB_INT0=11
169CONFIG_IRQ_USB_INT1=11
170CONFIG_IRQ_USB_INT2=11
171CONFIG_IRQ_USB_DMA=11
152CONFIG_IRQ_TIMER0=11 172CONFIG_IRQ_TIMER0=11
153CONFIG_IRQ_TIMER1=11 173CONFIG_IRQ_TIMER1=11
154CONFIG_IRQ_TIMER2=11 174CONFIG_IRQ_TIMER2=11
@@ -160,15 +180,6 @@ CONFIG_IRQ_TIMER7=11
160CONFIG_IRQ_TIMER8=11 180CONFIG_IRQ_TIMER8=11
161CONFIG_IRQ_TIMER9=11 181CONFIG_IRQ_TIMER9=11
162CONFIG_IRQ_TIMER10=11 182CONFIG_IRQ_TIMER10=11
163CONFIG_IRQ_RTC=8
164CONFIG_IRQ_SPORT0_RX=9
165CONFIG_IRQ_SPORT0_TX=9
166CONFIG_IRQ_SPORT1_RX=9
167CONFIG_IRQ_SPORT1_TX=9
168CONFIG_IRQ_UART0_RX=10
169CONFIG_IRQ_UART0_TX=10
170CONFIG_IRQ_UART1_RX=10
171CONFIG_IRQ_UART1_TX=10
172 183
173# 184#
174# BF548 Specific Configuration 185# BF548 Specific Configuration
@@ -236,16 +247,11 @@ CONFIG_IRQ_PIXC_IN0=8
236CONFIG_IRQ_PIXC_IN1=8 247CONFIG_IRQ_PIXC_IN1=8
237CONFIG_IRQ_PIXC_OUT=8 248CONFIG_IRQ_PIXC_OUT=8
238CONFIG_IRQ_SDH=8 249CONFIG_IRQ_SDH=8
239CONFIG_IRQ_CNT=8
240CONFIG_IRQ_KEY=8 250CONFIG_IRQ_KEY=8
241CONFIG_IRQ_CAN1_RX=11 251CONFIG_IRQ_CAN1_RX=11
242CONFIG_IRQ_CAN1_TX=11 252CONFIG_IRQ_CAN1_TX=11
243CONFIG_IRQ_SDH_MASK0=11 253CONFIG_IRQ_SDH_MASK0=11
244CONFIG_IRQ_SDH_MASK1=11 254CONFIG_IRQ_SDH_MASK1=11
245CONFIG_IRQ_USB_INT0=11
246CONFIG_IRQ_USB_INT1=11
247CONFIG_IRQ_USB_INT2=11
248CONFIG_IRQ_USB_DMA=11
249CONFIG_IRQ_OTPSEC=11 255CONFIG_IRQ_OTPSEC=11
250CONFIG_IRQ_PINT2=11 256CONFIG_IRQ_PINT2=11
251CONFIG_IRQ_PINT3=11 257CONFIG_IRQ_PINT3=11
@@ -273,9 +279,9 @@ CONFIG_PINT3_ASSIGN=0x02020303
273# 279#
274CONFIG_CLKIN_HZ=25000000 280CONFIG_CLKIN_HZ=25000000
275# CONFIG_BFIN_KERNEL_CLOCK is not set 281# CONFIG_BFIN_KERNEL_CLOCK is not set
276CONFIG_MAX_VCO_HZ=533000000 282CONFIG_MAX_VCO_HZ=533333333
277CONFIG_MIN_VCO_HZ=50000000 283CONFIG_MIN_VCO_HZ=50000000
278CONFIG_MAX_SCLK_HZ=133000000 284CONFIG_MAX_SCLK_HZ=133333333
279CONFIG_MIN_SCLK_HZ=27000000 285CONFIG_MIN_SCLK_HZ=27000000
280 286
281# 287#
@@ -332,9 +338,10 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
332# CONFIG_RESOURCES_64BIT is not set 338# CONFIG_RESOURCES_64BIT is not set
333CONFIG_ZONE_DMA_FLAG=1 339CONFIG_ZONE_DMA_FLAG=1
334CONFIG_LARGE_ALLOCS=y 340CONFIG_LARGE_ALLOCS=y
341# CONFIG_BFIN_GPTIMERS is not set
335CONFIG_BFIN_DMA_5XX=y 342CONFIG_BFIN_DMA_5XX=y
336# CONFIG_DMA_UNCACHED_2M is not set 343CONFIG_DMA_UNCACHED_2M=y
337CONFIG_DMA_UNCACHED_1M=y 344# CONFIG_DMA_UNCACHED_1M is not set
338# CONFIG_DMA_UNCACHED_NONE is not set 345# CONFIG_DMA_UNCACHED_NONE is not set
339 346
340# 347#
@@ -353,7 +360,7 @@ CONFIG_L1_MAX_PIECE=16
353# 360#
354 361
355# 362#
356# EBIU_AMBCTL Global Control 363# EBIU_AMGCTL Global Control
357# 364#
358CONFIG_C_AMCKEN=y 365CONFIG_C_AMCKEN=y
359# CONFIG_C_AMBEN is not set 366# CONFIG_C_AMBEN is not set
@@ -722,7 +729,7 @@ CONFIG_NETDEV_10000=y
722# 729#
723# Input device support 730# Input device support
724# 731#
725CONFIG_INPUT=y 732CONFIG_INPUT=m
726# CONFIG_INPUT_FF_MEMLESS is not set 733# CONFIG_INPUT_FF_MEMLESS is not set
727# CONFIG_INPUT_POLLDEV is not set 734# CONFIG_INPUT_POLLDEV is not set
728 735
@@ -731,18 +738,39 @@ CONFIG_INPUT=y
731# 738#
732# CONFIG_INPUT_MOUSEDEV is not set 739# CONFIG_INPUT_MOUSEDEV is not set
733# CONFIG_INPUT_JOYDEV is not set 740# CONFIG_INPUT_JOYDEV is not set
734# CONFIG_INPUT_TSDEV is not set 741CONFIG_INPUT_TSDEV=m
735# CONFIG_INPUT_EVDEV is not set 742CONFIG_INPUT_TSDEV_SCREEN_X=240
736# CONFIG_INPUT_EVBUG is not set 743CONFIG_INPUT_TSDEV_SCREEN_Y=320
744CONFIG_INPUT_EVDEV=m
745CONFIG_INPUT_EVBUG=m
737 746
738# 747#
739# Input Device Drivers 748# Input Device Drivers
740# 749#
741# CONFIG_INPUT_KEYBOARD is not set 750CONFIG_INPUT_KEYBOARD=y
751# CONFIG_KEYBOARD_ATKBD is not set
752# CONFIG_KEYBOARD_SUNKBD is not set
753# CONFIG_KEYBOARD_LKKBD is not set
754# CONFIG_KEYBOARD_XTKBD is not set
755# CONFIG_KEYBOARD_NEWTON is not set
756# CONFIG_KEYBOARD_STOWAWAY is not set
757# CONFIG_KEYBOARD_GPIO is not set
758CONFIG_KEYBOARD_BFIN=m
742# CONFIG_INPUT_MOUSE is not set 759# CONFIG_INPUT_MOUSE is not set
743# CONFIG_INPUT_JOYSTICK is not set 760# CONFIG_INPUT_JOYSTICK is not set
744# CONFIG_INPUT_TABLET is not set 761# CONFIG_INPUT_TABLET is not set
745# CONFIG_INPUT_TOUCHSCREEN is not set 762CONFIG_INPUT_TOUCHSCREEN=y
763# CONFIG_TOUCHSCREEN_ADS7846 is not set
764CONFIG_TOUCHSCREEN_AD7877=m
765# CONFIG_TOUCHSCREEN_GUNZE is not set
766# CONFIG_TOUCHSCREEN_ELO is not set
767# CONFIG_TOUCHSCREEN_MTOUCH is not set
768# CONFIG_TOUCHSCREEN_MK712 is not set
769# CONFIG_TOUCHSCREEN_PENMOUNT is not set
770# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
771# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
772# CONFIG_TOUCHSCREEN_UCB1400 is not set
773# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
746CONFIG_INPUT_MISC=y 774CONFIG_INPUT_MISC=y
747# CONFIG_INPUT_ATI_REMOTE is not set 775# CONFIG_INPUT_ATI_REMOTE is not set
748# CONFIG_INPUT_ATI_REMOTE2 is not set 776# CONFIG_INPUT_ATI_REMOTE2 is not set
@@ -764,9 +792,9 @@ CONFIG_INPUT_MISC=y
764# 792#
765# CONFIG_AD9960 is not set 793# CONFIG_AD9960 is not set
766# CONFIG_SPI_ADC_BF533 is not set 794# CONFIG_SPI_ADC_BF533 is not set
767# CONFIG_BFIN_PFLAGS is not set 795# CONFIG_BF5xx_PFLAGS is not set
768# CONFIG_BF5xx_PPIFCD is not set 796# CONFIG_BF5xx_PPIFCD is not set
769# CONFIG_BF5xx_TIMERS is not set 797# CONFIG_BFIN_SIMPLE_TIMER is not set
770# CONFIG_BF5xx_PPI is not set 798# CONFIG_BF5xx_PPI is not set
771# CONFIG_BFIN_SPORT is not set 799# CONFIG_BFIN_SPORT is not set
772# CONFIG_BFIN_TIMER_LATENCY is not set 800# CONFIG_BFIN_TIMER_LATENCY is not set
@@ -958,17 +986,92 @@ CONFIG_DAB=y
958# 986#
959# CONFIG_DISPLAY_SUPPORT is not set 987# CONFIG_DISPLAY_SUPPORT is not set
960# CONFIG_VGASTATE is not set 988# CONFIG_VGASTATE is not set
961# CONFIG_FB is not set 989CONFIG_FB=m
990CONFIG_FIRMWARE_EDID=y
991# CONFIG_FB_DDC is not set
992CONFIG_FB_CFB_FILLRECT=m
993CONFIG_FB_CFB_COPYAREA=m
994CONFIG_FB_CFB_IMAGEBLIT=m
995# CONFIG_FB_SYS_FILLRECT is not set
996# CONFIG_FB_SYS_COPYAREA is not set
997# CONFIG_FB_SYS_IMAGEBLIT is not set
998# CONFIG_FB_SYS_FOPS is not set
999CONFIG_FB_DEFERRED_IO=y
1000# CONFIG_FB_SVGALIB is not set
1001# CONFIG_FB_MACMODES is not set
1002# CONFIG_FB_BACKLIGHT is not set
1003# CONFIG_FB_MODE_HELPERS is not set
1004# CONFIG_FB_TILEBLITTING is not set
1005
1006#
1007# Frame buffer hardware drivers
1008#
1009# CONFIG_FB_BFIN_7171 is not set
1010# CONFIG_FB_BFIN_7393 is not set
1011CONFIG_FB_BF54X_LQ043=m
1012# CONFIG_FB_BFIN_T350MCQB is not set
1013# CONFIG_FB_S1D13XXX is not set
1014# CONFIG_FB_VIRTUAL is not set
1015# CONFIG_LOGO is not set
962 1016
963# 1017#
964# Sound 1018# Sound
965# 1019#
966# CONFIG_SOUND is not set 1020CONFIG_SOUND=y
1021
1022#
1023# Advanced Linux Sound Architecture
1024#
1025CONFIG_SND=y
1026CONFIG_SND_TIMER=y
1027CONFIG_SND_PCM=y
1028# CONFIG_SND_SEQUENCER is not set
1029CONFIG_SND_OSSEMUL=y
1030CONFIG_SND_MIXER_OSS=y
1031CONFIG_SND_PCM_OSS=y
1032CONFIG_SND_PCM_OSS_PLUGINS=y
1033# CONFIG_SND_DYNAMIC_MINORS is not set
1034CONFIG_SND_SUPPORT_OLD_API=y
1035CONFIG_SND_VERBOSE_PROCFS=y
1036# CONFIG_SND_VERBOSE_PRINTK is not set
1037# CONFIG_SND_DEBUG is not set
1038
1039#
1040# Generic devices
1041#
1042# CONFIG_SND_DUMMY is not set
1043# CONFIG_SND_MTPAV is not set
1044# CONFIG_SND_SERIAL_U16550 is not set
1045# CONFIG_SND_MPU401 is not set
1046
1047#
1048# ALSA Blackfin devices
1049#
1050# CONFIG_SND_BLACKFIN_AD1836 is not set
1051# CONFIG_SND_BFIN_AD73311 is not set
1052
1053#
1054# System on Chip audio support
1055#
1056CONFIG_SND_SOC_AC97_BUS=y
1057CONFIG_SND_SOC=y
1058CONFIG_SND_BF5XX_SOC=y
1059CONFIG_SND_BF5XX_SOC_AC97=y
1060CONFIG_SND_BF5XX_SOC_BF548_EZKIT=y
1061CONFIG_SND_BF5XX_SPORT_NUM=0
1062# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
1063CONFIG_SND_SOC_AD1980=y
1064
1065#
1066# Open Sound System
1067#
1068# CONFIG_SOUND_PRIME is not set
1069CONFIG_AC97_BUS=y
967 1070
968# 1071#
969# HID Devices 1072# HID Devices
970# 1073#
971CONFIG_HID=y 1074CONFIG_HID=m
972# CONFIG_HID_DEBUG is not set 1075# CONFIG_HID_DEBUG is not set
973 1076
974# 1077#
@@ -1101,8 +1204,13 @@ CONFIG_EXT2_FS=y
1101CONFIG_EXT2_FS_XATTR=y 1204CONFIG_EXT2_FS_XATTR=y
1102# CONFIG_EXT2_FS_POSIX_ACL is not set 1205# CONFIG_EXT2_FS_POSIX_ACL is not set
1103# CONFIG_EXT2_FS_SECURITY is not set 1206# CONFIG_EXT2_FS_SECURITY is not set
1104# CONFIG_EXT3_FS is not set 1207CONFIG_EXT3_FS=y
1208CONFIG_EXT3_FS_XATTR=y
1209# CONFIG_EXT3_FS_POSIX_ACL is not set
1210# CONFIG_EXT3_FS_SECURITY is not set
1105# CONFIG_EXT4DEV_FS is not set 1211# CONFIG_EXT4DEV_FS is not set
1212CONFIG_JBD=y
1213# CONFIG_JBD_DEBUG is not set
1106CONFIG_FS_MBCACHE=y 1214CONFIG_FS_MBCACHE=y
1107# CONFIG_REISERFS_FS is not set 1215# CONFIG_REISERFS_FS is not set
1108# CONFIG_JFS_FS is not set 1216# CONFIG_JFS_FS is not set
@@ -1123,15 +1231,22 @@ CONFIG_DNOTIFY=y
1123# 1231#
1124# CD-ROM/DVD Filesystems 1232# CD-ROM/DVD Filesystems
1125# 1233#
1126# CONFIG_ISO9660_FS is not set 1234CONFIG_ISO9660_FS=m
1235CONFIG_JOLIET=y
1236CONFIG_ZISOFS=y
1127# CONFIG_UDF_FS is not set 1237# CONFIG_UDF_FS is not set
1128 1238
1129# 1239#
1130# DOS/FAT/NT Filesystems 1240# DOS/FAT/NT Filesystems
1131# 1241#
1132# CONFIG_MSDOS_FS is not set 1242CONFIG_FAT_FS=m
1133# CONFIG_VFAT_FS is not set 1243CONFIG_MSDOS_FS=m
1134# CONFIG_NTFS_FS is not set 1244CONFIG_VFAT_FS=m
1245CONFIG_FAT_DEFAULT_CODEPAGE=437
1246CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1247CONFIG_NTFS_FS=m
1248# CONFIG_NTFS_DEBUG is not set
1249CONFIG_NTFS_RW=y
1135 1250
1136# 1251#
1137# Pseudo filesystems 1252# Pseudo filesystems
@@ -1183,10 +1298,33 @@ CONFIG_JFFS2_RTIME=y
1183# 1298#
1184# Network File Systems 1299# Network File Systems
1185# 1300#
1186# CONFIG_NFS_FS is not set 1301CONFIG_NFS_FS=m
1187# CONFIG_NFSD is not set 1302CONFIG_NFS_V3=y
1188# CONFIG_SMB_FS is not set 1303# CONFIG_NFS_V3_ACL is not set
1189# CONFIG_CIFS is not set 1304# CONFIG_NFS_V4 is not set
1305# CONFIG_NFS_DIRECTIO is not set
1306CONFIG_NFSD=m
1307CONFIG_NFSD_V3=y
1308# CONFIG_NFSD_V3_ACL is not set
1309# CONFIG_NFSD_V4 is not set
1310CONFIG_NFSD_TCP=y
1311CONFIG_LOCKD=m
1312CONFIG_LOCKD_V4=y
1313CONFIG_EXPORTFS=m
1314CONFIG_NFS_COMMON=y
1315CONFIG_SUNRPC=m
1316# CONFIG_SUNRPC_BIND34 is not set
1317# CONFIG_RPCSEC_GSS_KRB5 is not set
1318# CONFIG_RPCSEC_GSS_SPKM3 is not set
1319CONFIG_SMB_FS=m
1320CONFIG_SMB_NLS_DEFAULT=y
1321CONFIG_SMB_NLS_REMOTE="cp437"
1322CONFIG_CIFS=y
1323# CONFIG_CIFS_STATS is not set
1324# CONFIG_CIFS_WEAK_PW_HASH is not set
1325# CONFIG_CIFS_XATTR is not set
1326# CONFIG_CIFS_DEBUG2 is not set
1327# CONFIG_CIFS_EXPERIMENTAL is not set
1190# CONFIG_NCP_FS is not set 1328# CONFIG_NCP_FS is not set
1191# CONFIG_CODA_FS is not set 1329# CONFIG_CODA_FS is not set
1192# CONFIG_AFS_FS is not set 1330# CONFIG_AFS_FS is not set
@@ -1195,13 +1333,68 @@ CONFIG_JFFS2_RTIME=y
1195# 1333#
1196# Partition Types 1334# Partition Types
1197# 1335#
1198# CONFIG_PARTITION_ADVANCED is not set 1336CONFIG_PARTITION_ADVANCED=y
1337# CONFIG_ACORN_PARTITION is not set
1338# CONFIG_OSF_PARTITION is not set
1339# CONFIG_AMIGA_PARTITION is not set
1340# CONFIG_ATARI_PARTITION is not set
1341# CONFIG_MAC_PARTITION is not set
1199CONFIG_MSDOS_PARTITION=y 1342CONFIG_MSDOS_PARTITION=y
1343# CONFIG_BSD_DISKLABEL is not set
1344# CONFIG_MINIX_SUBPARTITION is not set
1345# CONFIG_SOLARIS_X86_PARTITION is not set
1346# CONFIG_UNIXWARE_DISKLABEL is not set
1347# CONFIG_LDM_PARTITION is not set
1348# CONFIG_SGI_PARTITION is not set
1349# CONFIG_ULTRIX_PARTITION is not set
1350# CONFIG_SUN_PARTITION is not set
1351# CONFIG_KARMA_PARTITION is not set
1352# CONFIG_EFI_PARTITION is not set
1353# CONFIG_SYSV68_PARTITION is not set
1200 1354
1201# 1355#
1202# Native Language Support 1356# Native Language Support
1203# 1357#
1204# CONFIG_NLS is not set 1358CONFIG_NLS=y
1359CONFIG_NLS_DEFAULT="iso8859-1"
1360CONFIG_NLS_CODEPAGE_437=m
1361CONFIG_NLS_CODEPAGE_737=m
1362CONFIG_NLS_CODEPAGE_775=m
1363CONFIG_NLS_CODEPAGE_850=m
1364CONFIG_NLS_CODEPAGE_852=m
1365CONFIG_NLS_CODEPAGE_855=m
1366CONFIG_NLS_CODEPAGE_857=m
1367CONFIG_NLS_CODEPAGE_860=m
1368CONFIG_NLS_CODEPAGE_861=m
1369CONFIG_NLS_CODEPAGE_862=m
1370CONFIG_NLS_CODEPAGE_863=m
1371CONFIG_NLS_CODEPAGE_864=m
1372CONFIG_NLS_CODEPAGE_865=m
1373CONFIG_NLS_CODEPAGE_866=m
1374CONFIG_NLS_CODEPAGE_869=m
1375CONFIG_NLS_CODEPAGE_936=m
1376CONFIG_NLS_CODEPAGE_950=m
1377CONFIG_NLS_CODEPAGE_932=m
1378CONFIG_NLS_CODEPAGE_949=m
1379CONFIG_NLS_CODEPAGE_874=m
1380CONFIG_NLS_ISO8859_8=m
1381CONFIG_NLS_CODEPAGE_1250=m
1382CONFIG_NLS_CODEPAGE_1251=m
1383CONFIG_NLS_ASCII=m
1384CONFIG_NLS_ISO8859_1=m
1385CONFIG_NLS_ISO8859_2=m
1386CONFIG_NLS_ISO8859_3=m
1387CONFIG_NLS_ISO8859_4=m
1388CONFIG_NLS_ISO8859_5=m
1389CONFIG_NLS_ISO8859_6=m
1390CONFIG_NLS_ISO8859_7=m
1391CONFIG_NLS_ISO8859_9=m
1392CONFIG_NLS_ISO8859_13=m
1393CONFIG_NLS_ISO8859_14=m
1394CONFIG_NLS_ISO8859_15=m
1395CONFIG_NLS_KOI8_R=m
1396CONFIG_NLS_KOI8_U=m
1397CONFIG_NLS_UTF8=m
1205 1398
1206# 1399#
1207# Distributed Lock Manager 1400# Distributed Lock Manager
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index 85e647f87759..277d72dac0f9 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -243,7 +243,7 @@ CONFIG_CLKIN_HZ=30000000
243# CONFIG_BFIN_KERNEL_CLOCK is not set 243# CONFIG_BFIN_KERNEL_CLOCK is not set
244CONFIG_MAX_VCO_HZ=600000000 244CONFIG_MAX_VCO_HZ=600000000
245CONFIG_MIN_VCO_HZ=50000000 245CONFIG_MIN_VCO_HZ=50000000
246CONFIG_MAX_SCLK_HZ=133000000 246CONFIG_MAX_SCLK_HZ=133333333
247CONFIG_MIN_SCLK_HZ=27000000 247CONFIG_MIN_SCLK_HZ=27000000
248 248
249# 249#
diff --git a/arch/blackfin/configs/PNAV-10_defconfig b/arch/blackfin/configs/PNAV-10_defconfig
index 15e36aaf2186..3d403e0b82c2 100644
--- a/arch/blackfin/configs/PNAV-10_defconfig
+++ b/arch/blackfin/configs/PNAV-10_defconfig
@@ -204,7 +204,7 @@ CONFIG_CLKIN_HZ=24576000
204# CONFIG_BFIN_KERNEL_CLOCK is not set 204# CONFIG_BFIN_KERNEL_CLOCK is not set
205CONFIG_MAX_VCO_HZ=600000000 205CONFIG_MAX_VCO_HZ=600000000
206CONFIG_MIN_VCO_HZ=50000000 206CONFIG_MIN_VCO_HZ=50000000
207CONFIG_MAX_SCLK_HZ=133000000 207CONFIG_MAX_SCLK_HZ=133333333
208CONFIG_MIN_SCLK_HZ=27000000 208CONFIG_MIN_SCLK_HZ=27000000
209 209
210# 210#
diff --git a/arch/blackfin/kernel/dma-mapping.c b/arch/blackfin/kernel/dma-mapping.c
index a16cb03c5291..d6b61d56b656 100644
--- a/arch/blackfin/kernel/dma-mapping.c
+++ b/arch/blackfin/kernel/dma-mapping.c
@@ -35,6 +35,7 @@
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
37#include <linux/io.h> 37#include <linux/io.h>
38#include <linux/scatterlist.h>
38#include <asm/cacheflush.h> 39#include <asm/cacheflush.h>
39#include <asm/bfin-global.h> 40#include <asm/bfin-global.h>
40 41
diff --git a/arch/blackfin/kernel/entry.S b/arch/blackfin/kernel/entry.S
index 65c5ba4260b0..65f4e67a65c4 100644
--- a/arch/blackfin/kernel/entry.S
+++ b/arch/blackfin/kernel/entry.S
@@ -54,9 +54,11 @@ ENTRY(_ret_from_fork)
54 [sp + PT_IPEND] = r0; 54 [sp + PT_IPEND] = r0;
55 /* do a 'fake' RTI by jumping to [RETI] 55 /* do a 'fake' RTI by jumping to [RETI]
56 * to avoid clearing supervisor mode in child 56 * to avoid clearing supervisor mode in child
57 */ 57 */
58 r0 = [sp + PT_PC];
59 [sp + PT_P0] = r0;
60
58 RESTORE_ALL_SYS 61 RESTORE_ALL_SYS
59 p0 = reti;
60 jump (p0); 62 jump (p0);
61ENDPROC(_ret_from_fork) 63ENDPROC(_ret_from_fork)
62 64
diff --git a/arch/blackfin/kernel/fixed_code.S b/arch/blackfin/kernel/fixed_code.S
index d8b1ebc70996..90262691b11a 100644
--- a/arch/blackfin/kernel/fixed_code.S
+++ b/arch/blackfin/kernel/fixed_code.S
@@ -129,4 +129,18 @@ ENTRY(_atomic_xor32)
129 rts; 129 rts;
130ENDPROC (_atomic_ior32) 130ENDPROC (_atomic_ior32)
131 131
132.align 16
133 /*
134 * safe_user_instruction
135 * Four NOPS are enough to allow the pipeline to speculativily load
136 * execute anything it wants. After that, things have gone bad, and
137 * we are stuck - so panic. Since we might be in user space, we can't
138 * call panic, so just cause a unhandled exception, this should cause
139 * a dump of the trace buffer so we can tell were we are, and a reboot
140 */
141ENTRY(_safe_user_instruction)
142 NOP; NOP; NOP; NOP;
143 EXCPT 0x4;
144ENDPROC(_safe_user_instruction)
145
132ENTRY(_fixed_code_end) 146ENTRY(_fixed_code_end)
diff --git a/arch/blackfin/kernel/gptimers.c b/arch/blackfin/kernel/gptimers.c
index cb7ba9bfc79c..5cf4bdb1df3b 100644
--- a/arch/blackfin/kernel/gptimers.c
+++ b/arch/blackfin/kernel/gptimers.c
@@ -20,8 +20,7 @@
20#else 20#else
21# define tassert(expr) \ 21# define tassert(expr) \
22 if (!(expr)) \ 22 if (!(expr)) \
23 printk(KERN_DEBUG "%s:%s:%i: Assertion failed: " #expr "\n", \ 23 printk(KERN_DEBUG "%s:%s:%i: Assertion failed: " #expr "\n", __FILE__, __func__, __LINE__);
24 __FILE__, __func__, __LINE__);
25#endif 24#endif
26 25
27#define BFIN_TIMER_NUM_GROUP (BFIN_TIMER_OCTET(MAX_BLACKFIN_GPTIMERS - 1) + 1) 26#define BFIN_TIMER_NUM_GROUP (BFIN_TIMER_OCTET(MAX_BLACKFIN_GPTIMERS - 1) + 1)
@@ -70,7 +69,7 @@ static volatile GPTIMER_group_regs *const group_regs[BFIN_TIMER_NUM_GROUP] =
70#endif 69#endif
71}; 70};
72 71
73static uint32_t const dis_mask[MAX_BLACKFIN_GPTIMERS] = 72static uint32_t const trun_mask[MAX_BLACKFIN_GPTIMERS] =
74{ 73{
75 TIMER_STATUS_TRUN0, 74 TIMER_STATUS_TRUN0,
76 TIMER_STATUS_TRUN1, 75 TIMER_STATUS_TRUN1,
@@ -90,7 +89,27 @@ static uint32_t const dis_mask[MAX_BLACKFIN_GPTIMERS] =
90#endif 89#endif
91}; 90};
92 91
93static uint32_t const irq_mask[MAX_BLACKFIN_GPTIMERS] = 92static uint32_t const tovf_mask[MAX_BLACKFIN_GPTIMERS] =
93{
94 TIMER_STATUS_TOVF0,
95 TIMER_STATUS_TOVF1,
96 TIMER_STATUS_TOVF2,
97#if (MAX_BLACKFIN_GPTIMERS > 3)
98 TIMER_STATUS_TOVF3,
99 TIMER_STATUS_TOVF4,
100 TIMER_STATUS_TOVF5,
101 TIMER_STATUS_TOVF6,
102 TIMER_STATUS_TOVF7,
103#endif
104#if (MAX_BLACKFIN_GPTIMERS > 8)
105 TIMER_STATUS_TOVF8,
106 TIMER_STATUS_TOVF9,
107 TIMER_STATUS_TOVF10,
108 TIMER_STATUS_TOVF11,
109#endif
110};
111
112static uint32_t const timil_mask[MAX_BLACKFIN_GPTIMERS] =
94{ 113{
95 TIMER_STATUS_TIMIL0, 114 TIMER_STATUS_TIMIL0,
96 TIMER_STATUS_TIMIL1, 115 TIMER_STATUS_TIMIL1,
@@ -165,17 +184,31 @@ EXPORT_SYMBOL(set_gptimer_status);
165uint16_t get_gptimer_intr(int timer_id) 184uint16_t get_gptimer_intr(int timer_id)
166{ 185{
167 tassert(timer_id < MAX_BLACKFIN_GPTIMERS); 186 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
168 return (group_regs[BFIN_TIMER_OCTET(timer_id)]->status & irq_mask[timer_id]) ? 1 : 0; 187 return (group_regs[BFIN_TIMER_OCTET(timer_id)]->status & timil_mask[timer_id]) ? 1 : 0;
169} 188}
170EXPORT_SYMBOL(get_gptimer_intr); 189EXPORT_SYMBOL(get_gptimer_intr);
171 190
172void clear_gptimer_intr(int timer_id) 191void clear_gptimer_intr(int timer_id)
173{ 192{
174 tassert(timer_id < MAX_BLACKFIN_GPTIMERS); 193 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
175 group_regs[BFIN_TIMER_OCTET(timer_id)]->status = irq_mask[timer_id]; 194 group_regs[BFIN_TIMER_OCTET(timer_id)]->status = timil_mask[timer_id];
176} 195}
177EXPORT_SYMBOL(clear_gptimer_intr); 196EXPORT_SYMBOL(clear_gptimer_intr);
178 197
198uint16_t get_gptimer_over(int timer_id)
199{
200 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
201 return (group_regs[BFIN_TIMER_OCTET(timer_id)]->status & tovf_mask[timer_id]) ? 1 : 0;
202}
203EXPORT_SYMBOL(get_gptimer_over);
204
205void clear_gptimer_over(int timer_id)
206{
207 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
208 group_regs[BFIN_TIMER_OCTET(timer_id)]->status = tovf_mask[timer_id];
209}
210EXPORT_SYMBOL(clear_gptimer_over);
211
179void set_gptimer_config(int timer_id, uint16_t config) 212void set_gptimer_config(int timer_id, uint16_t config)
180{ 213{
181 tassert(timer_id < MAX_BLACKFIN_GPTIMERS); 214 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
@@ -214,7 +247,7 @@ void disable_gptimers(uint16_t mask)
214 } 247 }
215 for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i) 248 for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i)
216 if (mask & (1 << i)) 249 if (mask & (1 << i))
217 group_regs[BFIN_TIMER_OCTET(i)]->status |= dis_mask[i]; 250 group_regs[BFIN_TIMER_OCTET(i)]->status |= trun_mask[i];
218 SSYNC(); 251 SSYNC();
219} 252}
220EXPORT_SYMBOL(disable_gptimers); 253EXPORT_SYMBOL(disable_gptimers);
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index f1b059e5a06c..934234f43839 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -316,6 +316,15 @@ void __init setup_arch(char **cmdline_p)
316 316
317 init_leds(); 317 init_leds();
318 318
319 _bfin_swrst = bfin_read_SWRST();
320
321 if (_bfin_swrst & RESET_DOUBLE)
322 printk(KERN_INFO "Recovering from Double Fault event\n");
323 else if (_bfin_swrst & RESET_WDOG)
324 printk(KERN_INFO "Recovering from Watchdog event\n");
325 else if (_bfin_swrst & RESET_SOFTWARE)
326 printk(KERN_NOTICE "Reset caused by Software reset\n");
327
319 printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n"); 328 printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n");
320 if (bfin_compiled_revid() == 0xffff) 329 if (bfin_compiled_revid() == 0xffff)
321 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU); 330 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
@@ -402,8 +411,6 @@ void __init setup_arch(char **cmdline_p)
402 if (l1_length > L1_DATA_A_LENGTH) 411 if (l1_length > L1_DATA_A_LENGTH)
403 panic("L1 data memory overflow\n"); 412 panic("L1 data memory overflow\n");
404 413
405 _bfin_swrst = bfin_read_SWRST();
406
407 /* Copy atomic sequences to their fixed location, and sanity check that 414 /* Copy atomic sequences to their fixed location, and sanity check that
408 these locations are the ones that we advertise to userspace. */ 415 these locations are the ones that we advertise to userspace. */
409 memcpy((void *)FIXED_CODE_START, &fixed_code_start, 416 memcpy((void *)FIXED_CODE_START, &fixed_code_start,
@@ -424,6 +431,8 @@ void __init setup_arch(char **cmdline_p)
424 != ATOMIC_AND32 - FIXED_CODE_START); 431 != ATOMIC_AND32 - FIXED_CODE_START);
425 BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start 432 BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
426 != ATOMIC_XOR32 - FIXED_CODE_START); 433 != ATOMIC_XOR32 - FIXED_CODE_START);
434 BUG_ON((char *)&safe_user_instruction - (char *)&fixed_code_start
435 != SAFE_USER_INSTRUCTION - FIXED_CODE_START);
427 436
428 init_exception_vectors(); 437 init_exception_vectors();
429 bf53x_cache_init(); 438 bf53x_cache_init();
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index afd044e78af6..cfa05436c972 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -37,10 +37,24 @@
37#include <asm/blackfin.h> 37#include <asm/blackfin.h>
38#include <asm/irq_handler.h> 38#include <asm/irq_handler.h>
39#include <asm/trace.h> 39#include <asm/trace.h>
40#include <asm/fixed_code.h>
40 41
41#ifdef CONFIG_KGDB 42#ifdef CONFIG_KGDB
42# include <linux/debugger.h> 43# include <linux/debugger.h>
43# include <linux/kgdb.h> 44# include <linux/kgdb.h>
45
46# define CHK_DEBUGGER_TRAP() \
47 do { \
48 CHK_DEBUGGER(trapnr, sig, info.si_code, fp, ); \
49 } while (0)
50# define CHK_DEBUGGER_TRAP_MAYBE() \
51 do { \
52 if (kgdb_connected) \
53 CHK_DEBUGGER_TRAP(); \
54 } while (0)
55#else
56# define CHK_DEBUGGER_TRAP() do { } while (0)
57# define CHK_DEBUGGER_TRAP_MAYBE() do { } while (0)
44#endif 58#endif
45 59
46/* Initiate the event table handler */ 60/* Initiate the event table handler */
@@ -53,13 +67,13 @@ void __init trap_init(void)
53 67
54int kstack_depth_to_print = 48; 68int kstack_depth_to_print = 48;
55 69
56#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON 70static void decode_address(char *buf, unsigned long address)
57static int printk_address(unsigned long address)
58{ 71{
59 struct vm_list_struct *vml; 72 struct vm_list_struct *vml;
60 struct task_struct *p; 73 struct task_struct *p;
61 struct mm_struct *mm; 74 struct mm_struct *mm;
62 unsigned long offset; 75 unsigned long flags, offset;
76 unsigned int in_exception = bfin_read_IPEND() & 0x10;
63 77
64#ifdef CONFIG_KALLSYMS 78#ifdef CONFIG_KALLSYMS
65 unsigned long symsize; 79 unsigned long symsize;
@@ -75,20 +89,33 @@ static int printk_address(unsigned long address)
75 /* yeah! kernel space! */ 89 /* yeah! kernel space! */
76 if (!modname) 90 if (!modname)
77 modname = delim = ""; 91 modname = delim = "";
78 return printk("<0x%p> { %s%s%s%s + 0x%lx }", 92 sprintf(buf, "<0x%p> { %s%s%s%s + 0x%lx }",
79 (void *)address, delim, modname, delim, symname, 93 (void *)address, delim, modname, delim, symname,
80 (unsigned long)offset); 94 (unsigned long)offset);
95 return;
81 96
82 } 97 }
83#endif 98#endif
84 99
100 /* Problem in fixed code section? */
101 if (address >= FIXED_CODE_START && address < FIXED_CODE_END) {
102 sprintf(buf, "<0x%p> /* Maybe fixed code section */", (void *)address);
103 return;
104 }
105
106 /* Problem somewhere before the kernel start address */
107 if (address < CONFIG_BOOT_LOAD) {
108 sprintf(buf, "<0x%p> /* Maybe null pointer? */", (void *)address);
109 return;
110 }
111
85 /* looks like we're off in user-land, so let's walk all the 112 /* looks like we're off in user-land, so let's walk all the
86 * mappings of all our processes and see if we can't be a whee 113 * mappings of all our processes and see if we can't be a whee
87 * bit more specific 114 * bit more specific
88 */ 115 */
89 write_lock_irq(&tasklist_lock); 116 write_lock_irqsave(&tasklist_lock, flags);
90 for_each_process(p) { 117 for_each_process(p) {
91 mm = get_task_mm(p); 118 mm = (in_exception ? p->mm : get_task_mm(p));
92 if (!mm) 119 if (!mm)
93 continue; 120 continue;
94 121
@@ -117,25 +144,30 @@ static int printk_address(unsigned long address)
117 else 144 else
118 offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT); 145 offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT);
119 146
120 write_unlock_irq(&tasklist_lock); 147 sprintf(buf, "<0x%p> [ %s + 0x%lx ]",
121 mmput(mm); 148 (void *)address, name, offset);
122 return printk("<0x%p> [ %s + 0x%lx ]", 149 if (!in_exception)
123 (void *)address, name, offset); 150 mmput(mm);
151 goto done;
124 } 152 }
125 153
126 vml = vml->next; 154 vml = vml->next;
127 } 155 }
128 mmput(mm); 156 if (!in_exception)
157 mmput(mm);
129 } 158 }
130 write_unlock_irq(&tasklist_lock);
131 159
132 /* we were unable to find this address anywhere */ 160 /* we were unable to find this address anywhere */
133 return printk("[<0x%p>]", (void *)address); 161 sprintf(buf, "[<0x%p>]", (void *)address);
162
163done:
164 write_unlock_irqrestore(&tasklist_lock, flags);
134} 165}
135#endif
136 166
137asmlinkage void double_fault_c(struct pt_regs *fp) 167asmlinkage void double_fault_c(struct pt_regs *fp)
138{ 168{
169 console_verbose();
170 oops_in_progress = 1;
139 printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n"); 171 printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n");
140 dump_bfin_regs(fp, (void *)fp->retx); 172 dump_bfin_regs(fp, (void *)fp->retx);
141 panic("Double Fault - unrecoverable event\n"); 173 panic("Double Fault - unrecoverable event\n");
@@ -151,22 +183,29 @@ asmlinkage void trap_c(struct pt_regs *fp)
151 siginfo_t info; 183 siginfo_t info;
152 unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE; 184 unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE;
153 185
186 trace_buffer_save(j);
187
188 /* Important - be very careful dereferncing pointers - will lead to
189 * double faults if the stack has become corrupt
190 */
191
192 /* If the fault was caused by a kernel thread, or interrupt handler
193 * we will kernel panic, so the system reboots.
194 * If KGDB is enabled, don't set this for kernel breakpoints
195 */
196 if ((bfin_read_IPEND() & 0xFFC0)
154#ifdef CONFIG_KGDB 197#ifdef CONFIG_KGDB
155# define CHK_DEBUGGER_TRAP() \ 198 && trapnr != VEC_EXCPT02
156 do { \
157 CHK_DEBUGGER(trapnr, sig, info.si_code, fp, ); \
158 } while (0)
159# define CHK_DEBUGGER_TRAP_MAYBE() \
160 do { \
161 if (kgdb_connected) \
162 CHK_DEBUGGER_TRAP(); \
163 } while (0)
164#else
165# define CHK_DEBUGGER_TRAP() do { } while (0)
166# define CHK_DEBUGGER_TRAP_MAYBE() do { } while (0)
167#endif 199#endif
168 200 ){
169 trace_buffer_save(j); 201 console_verbose();
202 oops_in_progress = 1;
203 } else if (current) {
204 if (current->mm == NULL) {
205 console_verbose();
206 oops_in_progress = 1;
207 }
208 }
170 209
171 /* trap_c() will be called for exceptions. During exceptions 210 /* trap_c() will be called for exceptions. During exceptions
172 * processing, the pc value should be set with retx value. 211 * processing, the pc value should be set with retx value.
@@ -211,7 +250,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
211 case VEC_EXCPT03: 250 case VEC_EXCPT03:
212 info.si_code = SEGV_STACKFLOW; 251 info.si_code = SEGV_STACKFLOW;
213 sig = SIGSEGV; 252 sig = SIGSEGV;
214 printk(KERN_EMERG EXC_0x03); 253 printk(KERN_NOTICE EXC_0x03);
215 CHK_DEBUGGER_TRAP(); 254 CHK_DEBUGGER_TRAP();
216 break; 255 break;
217 /* 0x04 - User Defined, Caught by default */ 256 /* 0x04 - User Defined, Caught by default */
@@ -240,7 +279,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
240 case VEC_OVFLOW: 279 case VEC_OVFLOW:
241 info.si_code = TRAP_TRACEFLOW; 280 info.si_code = TRAP_TRACEFLOW;
242 sig = SIGTRAP; 281 sig = SIGTRAP;
243 printk(KERN_EMERG EXC_0x11); 282 printk(KERN_NOTICE EXC_0x11);
244 CHK_DEBUGGER_TRAP(); 283 CHK_DEBUGGER_TRAP();
245 break; 284 break;
246 /* 0x12 - Reserved, Caught by default */ 285 /* 0x12 - Reserved, Caught by default */
@@ -262,14 +301,14 @@ asmlinkage void trap_c(struct pt_regs *fp)
262 case VEC_UNDEF_I: 301 case VEC_UNDEF_I:
263 info.si_code = ILL_ILLOPC; 302 info.si_code = ILL_ILLOPC;
264 sig = SIGILL; 303 sig = SIGILL;
265 printk(KERN_EMERG EXC_0x21); 304 printk(KERN_NOTICE EXC_0x21);
266 CHK_DEBUGGER_TRAP(); 305 CHK_DEBUGGER_TRAP();
267 break; 306 break;
268 /* 0x22 - Illegal Instruction Combination, handled here */ 307 /* 0x22 - Illegal Instruction Combination, handled here */
269 case VEC_ILGAL_I: 308 case VEC_ILGAL_I:
270 info.si_code = ILL_ILLPARAOP; 309 info.si_code = ILL_ILLPARAOP;
271 sig = SIGILL; 310 sig = SIGILL;
272 printk(KERN_EMERG EXC_0x22); 311 printk(KERN_NOTICE EXC_0x22);
273 CHK_DEBUGGER_TRAP(); 312 CHK_DEBUGGER_TRAP();
274 break; 313 break;
275 /* 0x23 - Data CPLB Protection Violation, 314 /* 0x23 - Data CPLB Protection Violation,
@@ -277,21 +316,21 @@ asmlinkage void trap_c(struct pt_regs *fp)
277 case VEC_CPLB_VL: 316 case VEC_CPLB_VL:
278 info.si_code = ILL_CPLB_VI; 317 info.si_code = ILL_CPLB_VI;
279 sig = SIGILL; 318 sig = SIGILL;
280 printk(KERN_EMERG EXC_0x23); 319 printk(KERN_NOTICE EXC_0x23);
281 CHK_DEBUGGER_TRAP(); 320 CHK_DEBUGGER_TRAP();
282 break; 321 break;
283 /* 0x24 - Data access misaligned, handled here */ 322 /* 0x24 - Data access misaligned, handled here */
284 case VEC_MISALI_D: 323 case VEC_MISALI_D:
285 info.si_code = BUS_ADRALN; 324 info.si_code = BUS_ADRALN;
286 sig = SIGBUS; 325 sig = SIGBUS;
287 printk(KERN_EMERG EXC_0x24); 326 printk(KERN_NOTICE EXC_0x24);
288 CHK_DEBUGGER_TRAP(); 327 CHK_DEBUGGER_TRAP();
289 break; 328 break;
290 /* 0x25 - Unrecoverable Event, handled here */ 329 /* 0x25 - Unrecoverable Event, handled here */
291 case VEC_UNCOV: 330 case VEC_UNCOV:
292 info.si_code = ILL_ILLEXCPT; 331 info.si_code = ILL_ILLEXCPT;
293 sig = SIGILL; 332 sig = SIGILL;
294 printk(KERN_EMERG EXC_0x25); 333 printk(KERN_NOTICE EXC_0x25);
295 CHK_DEBUGGER_TRAP(); 334 CHK_DEBUGGER_TRAP();
296 break; 335 break;
297 /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr, 336 /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr,
@@ -299,7 +338,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
299 case VEC_CPLB_M: 338 case VEC_CPLB_M:
300 info.si_code = BUS_ADRALN; 339 info.si_code = BUS_ADRALN;
301 sig = SIGBUS; 340 sig = SIGBUS;
302 printk(KERN_EMERG EXC_0x26); 341 printk(KERN_NOTICE EXC_0x26);
303 CHK_DEBUGGER_TRAP(); 342 CHK_DEBUGGER_TRAP();
304 break; 343 break;
305 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */ 344 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */
@@ -307,11 +346,10 @@ asmlinkage void trap_c(struct pt_regs *fp)
307 info.si_code = ILL_CPLB_MULHIT; 346 info.si_code = ILL_CPLB_MULHIT;
308#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO 347#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
309 sig = SIGSEGV; 348 sig = SIGSEGV;
310 printk(KERN_EMERG "\n" 349 printk(KERN_NOTICE "NULL pointer access (probably)\n");
311 KERN_EMERG "NULL pointer access (probably)\n");
312#else 350#else
313 sig = SIGILL; 351 sig = SIGILL;
314 printk(KERN_EMERG EXC_0x27); 352 printk(KERN_NOTICE EXC_0x27);
315#endif 353#endif
316 CHK_DEBUGGER_TRAP(); 354 CHK_DEBUGGER_TRAP();
317 break; 355 break;
@@ -331,7 +369,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
331 case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */ 369 case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */
332 info.si_code = BUS_OPFETCH; 370 info.si_code = BUS_OPFETCH;
333 sig = SIGBUS; 371 sig = SIGBUS;
334 printk(KERN_EMERG "BF535: VEC_ISTRU_VL\n"); 372 printk(KERN_NOTICE "BF535: VEC_ISTRU_VL\n");
335 CHK_DEBUGGER_TRAP(); 373 CHK_DEBUGGER_TRAP();
336 break; 374 break;
337#else 375#else
@@ -341,7 +379,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
341 case VEC_MISALI_I: 379 case VEC_MISALI_I:
342 info.si_code = BUS_ADRALN; 380 info.si_code = BUS_ADRALN;
343 sig = SIGBUS; 381 sig = SIGBUS;
344 printk(KERN_EMERG EXC_0x2A); 382 printk(KERN_NOTICE EXC_0x2A);
345 CHK_DEBUGGER_TRAP(); 383 CHK_DEBUGGER_TRAP();
346 break; 384 break;
347 /* 0x2B - Instruction CPLB protection Violation, 385 /* 0x2B - Instruction CPLB protection Violation,
@@ -349,14 +387,14 @@ asmlinkage void trap_c(struct pt_regs *fp)
349 case VEC_CPLB_I_VL: 387 case VEC_CPLB_I_VL:
350 info.si_code = ILL_CPLB_VI; 388 info.si_code = ILL_CPLB_VI;
351 sig = SIGILL; 389 sig = SIGILL;
352 printk(KERN_EMERG EXC_0x2B); 390 printk(KERN_NOTICE EXC_0x2B);
353 CHK_DEBUGGER_TRAP(); 391 CHK_DEBUGGER_TRAP();
354 break; 392 break;
355 /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */ 393 /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */
356 case VEC_CPLB_I_M: 394 case VEC_CPLB_I_M:
357 info.si_code = ILL_CPLB_MISS; 395 info.si_code = ILL_CPLB_MISS;
358 sig = SIGBUS; 396 sig = SIGBUS;
359 printk(KERN_EMERG EXC_0x2C); 397 printk(KERN_NOTICE EXC_0x2C);
360 CHK_DEBUGGER_TRAP(); 398 CHK_DEBUGGER_TRAP();
361 break; 399 break;
362 /* 0x2D - Instruction CPLB Multiple Hits, handled here */ 400 /* 0x2D - Instruction CPLB Multiple Hits, handled here */
@@ -364,10 +402,10 @@ asmlinkage void trap_c(struct pt_regs *fp)
364 info.si_code = ILL_CPLB_MULHIT; 402 info.si_code = ILL_CPLB_MULHIT;
365#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO 403#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
366 sig = SIGSEGV; 404 sig = SIGSEGV;
367 printk(KERN_EMERG "\n\nJump to address 0 - 0x0fff\n"); 405 printk(KERN_NOTICE "Jump to address 0 - 0x0fff\n");
368#else 406#else
369 sig = SIGILL; 407 sig = SIGILL;
370 printk(KERN_EMERG EXC_0x2D); 408 printk(KERN_NOTICE EXC_0x2D);
371#endif 409#endif
372 CHK_DEBUGGER_TRAP(); 410 CHK_DEBUGGER_TRAP();
373 break; 411 break;
@@ -375,7 +413,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
375 case VEC_ILL_RES: 413 case VEC_ILL_RES:
376 info.si_code = ILL_PRVOPC; 414 info.si_code = ILL_PRVOPC;
377 sig = SIGILL; 415 sig = SIGILL;
378 printk(KERN_EMERG EXC_0x2E); 416 printk(KERN_NOTICE EXC_0x2E);
379 CHK_DEBUGGER_TRAP(); 417 CHK_DEBUGGER_TRAP();
380 break; 418 break;
381 /* 0x2F - Reserved, Caught by default */ 419 /* 0x2F - Reserved, Caught by default */
@@ -404,38 +442,40 @@ asmlinkage void trap_c(struct pt_regs *fp)
404 break; 442 break;
405 } 443 }
406 444
407 if (sig != 0 && sig != SIGTRAP) { 445 BUG_ON(sig == 0);
446
447 if (sig != SIGTRAP) {
408 unsigned long stack; 448 unsigned long stack;
409 dump_bfin_regs(fp, (void *)fp->retx); 449 dump_bfin_regs(fp, (void *)fp->retx);
410 dump_bfin_trace_buffer(); 450
451 /* Print out the trace buffer if it makes sense */
452#ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
453 if (trapnr == VEC_CPLB_I_M || trapnr == VEC_CPLB_M)
454 printk(KERN_NOTICE "No trace since you do not have "
455 "CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled\n"
456 KERN_NOTICE "\n");
457 else
458#endif
459 dump_bfin_trace_buffer();
411 show_stack(current, &stack); 460 show_stack(current, &stack);
412 if (current->mm == NULL) 461 if (oops_in_progress) {
462#ifndef CONFIG_ACCESS_CHECK
463 printk(KERN_EMERG "Hey - dork - please turn on "
464 "CONFIG_ACCESS_CHECK\n");
465#endif
413 panic("Kernel exception"); 466 panic("Kernel exception");
467 }
468
469 /* Ensure that bad return addresses don't end up in an infinite
470 * loop, due to speculative loads/reads
471 */
472 fp->pc = SAFE_USER_INSTRUCTION;
414 } 473 }
415 info.si_signo = sig; 474 info.si_signo = sig;
416 info.si_errno = 0; 475 info.si_errno = 0;
417 info.si_addr = (void *)fp->pc; 476 info.si_addr = (void *)fp->pc;
418 force_sig_info(sig, &info, current); 477 force_sig_info(sig, &info, current);
419 478
420 /* if the address that we are about to return to is not valid, set it
421 * to a valid address, if we have a current application or panic
422 */
423 if (!(fp->pc <= physical_mem_end
424#if L1_CODE_LENGTH != 0
425 || (fp->pc >= L1_CODE_START &&
426 fp->pc <= (L1_CODE_START + L1_CODE_LENGTH))
427#endif
428 )) {
429 if (current->mm) {
430 fp->pc = current->mm->start_code;
431 } else {
432 printk(KERN_EMERG
433 "I can't return to memory that doesn't exist"
434 " - bad things happen\n");
435 panic("Help - I've fallen and can't get up\n");
436 }
437 }
438
439 trace_buffer_restore(j); 479 trace_buffer_restore(j);
440 return; 480 return;
441} 481}
@@ -448,21 +488,21 @@ void dump_bfin_trace_buffer(void)
448{ 488{
449#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON 489#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
450 int tflags, i = 0; 490 int tflags, i = 0;
491 char buf[150];
451#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND 492#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
452 int j, index; 493 int j, index;
453#endif 494#endif
454 495
455 trace_buffer_save(tflags); 496 trace_buffer_save(tflags);
456 497
457 printk(KERN_EMERG "Hardware Trace:\n"); 498 printk(KERN_NOTICE "Hardware Trace:\n");
458 499
459 if (likely(bfin_read_TBUFSTAT() & TBUFCNT)) { 500 if (likely(bfin_read_TBUFSTAT() & TBUFCNT)) {
460 for (; bfin_read_TBUFSTAT() & TBUFCNT; i++) { 501 for (; bfin_read_TBUFSTAT() & TBUFCNT; i++) {
461 printk(KERN_EMERG "%4i Target : ", i); 502 decode_address(buf, (unsigned long)bfin_read_TBUF());
462 printk_address((unsigned long)bfin_read_TBUF()); 503 printk(KERN_NOTICE "%4i Target : %s\n", i, buf);
463 printk("\n" KERN_EMERG " Source : "); 504 decode_address(buf, (unsigned long)bfin_read_TBUF());
464 printk_address((unsigned long)bfin_read_TBUF()); 505 printk(KERN_NOTICE " Source : %s\n", buf);
465 printk("\n");
466 } 506 }
467 } 507 }
468 508
@@ -474,17 +514,16 @@ void dump_bfin_trace_buffer(void)
474 514
475 j = (1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 128; 515 j = (1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 128;
476 while (j) { 516 while (j) {
477 printk(KERN_EMERG "%4i Target : ", i); 517 decode_address(buf, software_trace_buff[index]);
478 printk_address(software_trace_buff[index]); 518 printk(KERN_NOTICE "%4i Target : %s\n", i, buf);
479 index -= 1; 519 index -= 1;
480 if (index < 0 ) 520 if (index < 0 )
481 index = EXPAND_LEN; 521 index = EXPAND_LEN;
482 printk("\n" KERN_EMERG " Source : "); 522 decode_address(buf, software_trace_buff[index]);
483 printk_address(software_trace_buff[index]); 523 printk(KERN_NOTICE " Source : %s\n", buf);
484 index -= 1; 524 index -= 1;
485 if (index < 0) 525 if (index < 0)
486 index = EXPAND_LEN; 526 index = EXPAND_LEN;
487 printk("\n");
488 j--; 527 j--;
489 i++; 528 i++;
490 } 529 }
@@ -499,10 +538,7 @@ static void show_trace(struct task_struct *tsk, unsigned long *sp)
499{ 538{
500 unsigned long addr; 539 unsigned long addr;
501 540
502 printk("\nCall Trace:"); 541 printk(KERN_NOTICE "\n" KERN_NOTICE "Call Trace:\n");
503#ifdef CONFIG_KALLSYMS
504 printk("\n");
505#endif
506 542
507 while (!kstack_end(sp)) { 543 while (!kstack_end(sp)) {
508 addr = *sp++; 544 addr = *sp++;
@@ -518,7 +554,7 @@ static void show_trace(struct task_struct *tsk, unsigned long *sp)
518 print_ip_sym(addr); 554 print_ip_sym(addr);
519 } 555 }
520 556
521 printk("\n"); 557 printk(KERN_NOTICE "\n");
522} 558}
523 559
524void show_stack(struct task_struct *task, unsigned long *stack) 560void show_stack(struct task_struct *task, unsigned long *stack)
@@ -540,14 +576,15 @@ void show_stack(struct task_struct *task, unsigned long *stack)
540 addr = (unsigned long)stack; 576 addr = (unsigned long)stack;
541 endstack = (unsigned long *)PAGE_ALIGN(addr); 577 endstack = (unsigned long *)PAGE_ALIGN(addr);
542 578
543 printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack); 579 printk(KERN_NOTICE "Stack from %08lx:", (unsigned long)stack);
544 for (i = 0; i < kstack_depth_to_print; i++) { 580 for (i = 0; i < kstack_depth_to_print; i++) {
545 if (stack + 1 > endstack) 581 if (stack + 1 > endstack)
546 break; 582 break;
547 if (i % 8 == 0) 583 if (i % 8 == 0)
548 printk("\n" KERN_EMERG " "); 584 printk("\n" KERN_NOTICE " ");
549 printk(" %08lx", *stack++); 585 printk(" %08lx", *stack++);
550 } 586 }
587 printk("\n");
551 588
552 show_trace(task, stack); 589 show_trace(task, stack);
553} 590}
@@ -568,33 +605,34 @@ EXPORT_SYMBOL(dump_stack);
568 605
569void dump_bfin_regs(struct pt_regs *fp, void *retaddr) 606void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
570{ 607{
571 if (current->pid) { 608 char buf [150];
572 printk(KERN_EMERG "\n" KERN_EMERG "CURRENT PROCESS:\n" 609
573 KERN_EMERG "\n"); 610 if (!oops_in_progress) {
574 printk(KERN_EMERG "COMM=%s PID=%d\n", 611 if (current->pid && current->mm) {
575 current->comm, current->pid); 612 printk(KERN_NOTICE "\n" KERN_NOTICE "CURRENT PROCESS:\n");
613 printk(KERN_NOTICE "COMM=%s PID=%d\n",
614 current->comm, current->pid);
615
616 printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n"
617 KERN_NOTICE "BSS = 0x%p-0x%p USER-STACK = 0x%p\n"
618 KERN_NOTICE "\n",
619 (void *)current->mm->start_code,
620 (void *)current->mm->end_code,
621 (void *)current->mm->start_data,
622 (void *)current->mm->end_data,
623 (void *)current->mm->end_data,
624 (void *)current->mm->brk,
625 (void *)current->mm->start_stack);
626 } else {
627 printk (KERN_NOTICE "\n" KERN_NOTICE
628 "No Valid pid - Either things are really messed up,"
629 " or you are in the kernel\n");
630 }
576 } else { 631 } else {
577 printk 632 printk(KERN_NOTICE "Kernel or interrupt exception\n");
578 (KERN_EMERG "\n" KERN_EMERG
579 "No Valid pid - Either things are really messed up,"
580 " or you are in the kernel\n");
581 }
582
583 if (current->mm) {
584 printk(KERN_EMERG "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n"
585 KERN_EMERG "BSS = 0x%p-0x%p USER-STACK = 0x%p\n"
586 KERN_EMERG "\n",
587 (void *)current->mm->start_code,
588 (void *)current->mm->end_code,
589 (void *)current->mm->start_data,
590 (void *)current->mm->end_data,
591 (void *)current->mm->end_data,
592 (void *)current->mm->brk,
593 (void *)current->mm->start_stack);
594 } 633 }
595 634
596 printk(KERN_EMERG "return address: [0x%p]; contents of:", retaddr); 635 if (retaddr >= (void *)FIXED_CODE_START && retaddr < (void *)physical_mem_end
597 if (retaddr != 0 && retaddr <= (void *)physical_mem_end
598#if L1_CODE_LENGTH != 0 636#if L1_CODE_LENGTH != 0
599 /* FIXME: Copy the code out of L1 Instruction SRAM through dma 637 /* FIXME: Copy the code out of L1 Instruction SRAM through dma
600 memcpy. */ 638 memcpy. */
@@ -604,18 +642,20 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
604 ) { 642 ) {
605 int i = ((unsigned int)retaddr & 0xFFFFFFF0) - 32; 643 int i = ((unsigned int)retaddr & 0xFFFFFFF0) - 32;
606 unsigned short x = 0; 644 unsigned short x = 0;
645 printk(KERN_NOTICE "return address: [0x%p]; contents of:", retaddr);
607 for (; i < ((unsigned int)retaddr & 0xFFFFFFF0) + 32; i += 2) { 646 for (; i < ((unsigned int)retaddr & 0xFFFFFFF0) + 32; i += 2) {
608 if (!(i & 0xF)) 647 if (!(i & 0xF))
609 printk("\n" KERN_EMERG "0x%08x: ", i); 648 printk("\n" KERN_NOTICE "0x%08x: ", i);
610 649
611 if (get_user(x, (unsigned short *)i)) 650 if (get_user(x, (unsigned short *)i))
612 break; 651 break;
613#ifndef CONFIG_DEBUG_HWERR 652#ifndef CONFIG_DEBUG_HWERR
614 /* If one of the last few instructions was a STI 653 /* If one of the last few instructions was a STI
615 * it is likely that the error occured awhile ago 654 * it is likely that the error occured awhile ago
616 * and we just noticed 655 * and we just noticed. This only happens in kernel
656 * context, which should mean an oops is happening
617 */ 657 */
618 if (x >= 0x0040 && x <= 0x0047 && i <= 0) 658 if (oops_in_progress && x >= 0x0040 && x <= 0x0047 && i <= 0)
619 panic("\n\nWARNING : You should reconfigure" 659 panic("\n\nWARNING : You should reconfigure"
620 " the kernel to turn on\n" 660 " the kernel to turn on\n"
621 " 'Hardware error interrupt" 661 " 'Hardware error interrupt"
@@ -628,56 +668,60 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
628 else 668 else
629 printk(" %04x ", x); 669 printk(" %04x ", x);
630 } 670 }
631 printk("\n" KERN_EMERG "\n"); 671 printk("\n");
632 } else 672 } else
633 printk(KERN_EMERG 673 printk("\n" KERN_NOTICE
634 "Cannot look at the [PC] for it is" 674 "Cannot look at the [PC] for it is"
635 "in unreadable L1 SRAM - sorry\n"); 675 " in unreadable memory - sorry\n");
676
677 printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\n");
678 printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n",
679 (long)fp->seqstat, fp->ipend, fp->syscfg);
636 680
681 decode_address(buf, fp->rete);
682 printk(KERN_NOTICE " RETE: %s\n", buf);
683 decode_address(buf, fp->retn);
684 printk(KERN_NOTICE " RETN: %s\n", buf);
685 decode_address(buf, fp->retx);
686 printk(KERN_NOTICE " RETX: %s\n", buf);
687 decode_address(buf, fp->rets);
688 printk(KERN_NOTICE " RETS: %s\n", buf);
637 689
638 printk(KERN_EMERG 690 if ((long)fp->seqstat & SEQSTAT_EXCAUSE) {
639 "RETE: %08lx RETN: %08lx RETX: %08lx RETS: %08lx\n", 691 decode_address(buf, bfin_read_DCPLB_FAULT_ADDR());
640 fp->rete, fp->retn, fp->retx, fp->rets); 692 printk(KERN_NOTICE "DCPLB_FAULT_ADDR: %s\n", buf);
641 printk(KERN_EMERG "IPEND: %04lx SYSCFG: %04lx\n", 693 decode_address(buf, bfin_read_ICPLB_FAULT_ADDR());
642 fp->ipend, fp->syscfg); 694 printk(KERN_NOTICE "ICPLB_FAULT_ADDR: %s\n", buf);
643 printk(KERN_EMERG "SEQSTAT: %08lx SP: %08lx\n", 695 }
644 (long)fp->seqstat, (long)fp); 696
645 printk(KERN_EMERG "R0: %08lx R1: %08lx R2: %08lx R3: %08lx\n", 697 printk(KERN_NOTICE "\n" KERN_NOTICE "PROCESSOR STATE:\n");
698 printk(KERN_NOTICE " R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n",
646 fp->r0, fp->r1, fp->r2, fp->r3); 699 fp->r0, fp->r1, fp->r2, fp->r3);
647 printk(KERN_EMERG "R4: %08lx R5: %08lx R6: %08lx R7: %08lx\n", 700 printk(KERN_NOTICE " R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n",
648 fp->r4, fp->r5, fp->r6, fp->r7); 701 fp->r4, fp->r5, fp->r6, fp->r7);
649 printk(KERN_EMERG "P0: %08lx P1: %08lx P2: %08lx P3: %08lx\n", 702 printk(KERN_NOTICE " P0 : %08lx P1 : %08lx P2 : %08lx P3 : %08lx\n",
650 fp->p0, fp->p1, fp->p2, fp->p3); 703 fp->p0, fp->p1, fp->p2, fp->p3);
651 printk(KERN_EMERG 704 printk(KERN_NOTICE " P4 : %08lx P5 : %08lx FP : %08lx SP : %08lx\n",
652 "P4: %08lx P5: %08lx FP: %08lx\n", 705 fp->p4, fp->p5, fp->fp, (long)fp);
653 fp->p4, fp->p5, fp->fp); 706 printk(KERN_NOTICE " LB0: %08lx LT0: %08lx LC0: %08lx\n",
654 printk(KERN_EMERG
655 "A0.w: %08lx A0.x: %08lx A1.w: %08lx A1.x: %08lx\n",
656 fp->a0w, fp->a0x, fp->a1w, fp->a1x);
657
658 printk(KERN_EMERG "LB0: %08lx LT0: %08lx LC0: %08lx\n",
659 fp->lb0, fp->lt0, fp->lc0); 707 fp->lb0, fp->lt0, fp->lc0);
660 printk(KERN_EMERG "LB1: %08lx LT1: %08lx LC1: %08lx\n", 708 printk(KERN_NOTICE " LB1: %08lx LT1: %08lx LC1: %08lx\n",
661 fp->lb1, fp->lt1, fp->lc1); 709 fp->lb1, fp->lt1, fp->lc1);
662 printk(KERN_EMERG "B0: %08lx L0: %08lx M0: %08lx I0: %08lx\n", 710 printk(KERN_NOTICE " B0 : %08lx L0 : %08lx M0 : %08lx I0 : %08lx\n",
663 fp->b0, fp->l0, fp->m0, fp->i0); 711 fp->b0, fp->l0, fp->m0, fp->i0);
664 printk(KERN_EMERG "B1: %08lx L1: %08lx M1: %08lx I1: %08lx\n", 712 printk(KERN_NOTICE " B1 : %08lx L1 : %08lx M1 : %08lx I1 : %08lx\n",
665 fp->b1, fp->l1, fp->m1, fp->i1); 713 fp->b1, fp->l1, fp->m1, fp->i1);
666 printk(KERN_EMERG "B2: %08lx L2: %08lx M2: %08lx I2: %08lx\n", 714 printk(KERN_NOTICE " B2 : %08lx L2 : %08lx M2 : %08lx I2 : %08lx\n",
667 fp->b2, fp->l2, fp->m2, fp->i2); 715 fp->b2, fp->l2, fp->m2, fp->i2);
668 printk(KERN_EMERG "B3: %08lx L3: %08lx M3: %08lx I3: %08lx\n", 716 printk(KERN_NOTICE " B3 : %08lx L3 : %08lx M3 : %08lx I3 : %08lx\n",
669 fp->b3, fp->l3, fp->m3, fp->i3); 717 fp->b3, fp->l3, fp->m3, fp->i3);
718 printk(KERN_NOTICE "A0.w: %08lx A0.x: %08lx A1.w: %08lx A1.x: %08lx\n",
719 fp->a0w, fp->a0x, fp->a1w, fp->a1x);
670 720
671 printk(KERN_EMERG "\n" KERN_EMERG "USP: %08lx ASTAT: %08lx\n", 721 printk(KERN_NOTICE "USP : %08lx ASTAT: %08lx\n",
672 rdusp(), fp->astat); 722 rdusp(), fp->astat);
673 if ((long)fp->seqstat & SEQSTAT_EXCAUSE) {
674 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n",
675 (void *)bfin_read_DCPLB_FAULT_ADDR());
676 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n",
677 (void *)bfin_read_ICPLB_FAULT_ADDR());
678 }
679 723
680 printk("\n\n"); 724 printk(KERN_NOTICE "\n");
681} 725}
682 726
683#ifdef CONFIG_SYS_BFIN_SPINLOCK_L1 727#ifdef CONFIG_SYS_BFIN_SPINLOCK_L1
@@ -752,6 +796,8 @@ void panic_cplb_error(int cplb_panic, struct pt_regs *fp)
752 break; 796 break;
753 } 797 }
754 798
799 oops_in_progress = 1;
800
755 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR()); 801 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR());
756 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR()); 802 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR());
757 dump_bfin_regs(fp, (void *)fp->retx); 803 dump_bfin_regs(fp, (void *)fp->retx);
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index eec43674a465..9b75bc83c71f 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -172,9 +172,14 @@ SECTIONS
172 __ebss_b_l1 = .; 172 __ebss_b_l1 = .;
173 } 173 }
174 174
175 ___init_end = LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1); 175 /* Force trailing alignment of our init section so that when we
176 176 * free our init memory, we don't leave behind a partial page.
177 .bss LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1) : 177 */
178 . = LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1);
179 . = ALIGN(PAGE_SIZE);
180 ___init_end = .;
181
182 .bss :
178 { 183 {
179 . = ALIGN(4); 184 . = ALIGN(4);
180 ___bss_start = .; 185 ___bss_start = .;
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 3e884f3a8182..bf1bedcc8868 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -41,9 +41,11 @@
41#include <linux/irq.h> 41#include <linux/irq.h>
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43#include <linux/usb_sl811.h> 43#include <linux/usb_sl811.h>
44#include <asm/cplb.h>
44#include <asm/dma.h> 45#include <asm/dma.h>
45#include <asm/bfin5xx_spi.h> 46#include <asm/bfin5xx_spi.h>
46#include <asm/reboot.h> 47#include <asm/reboot.h>
48#include <asm/nand.h>
47#include <linux/spi/ad7877.h> 49#include <linux/spi/ad7877.h>
48 50
49/* 51/*
@@ -102,6 +104,53 @@ void __exit bfin_isp1761_exit(void)
102arch_initcall(bfin_isp1761_init); 104arch_initcall(bfin_isp1761_init);
103#endif 105#endif
104 106
107#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
108static struct mtd_partition partition_info[] = {
109 {
110 .name = "Linux Kernel",
111 .offset = 0,
112 .size = 4 * SIZE_1M,
113 },
114 {
115 .name = "File System",
116 .offset = 4 * SIZE_1M,
117 .size = (256 - 4) * SIZE_1M,
118 },
119};
120
121static struct bf5xx_nand_platform bf5xx_nand_platform = {
122 .page_size = NFC_PG_SIZE_256,
123 .data_width = NFC_NWIDTH_8,
124 .partitions = partition_info,
125 .nr_partitions = ARRAY_SIZE(partition_info),
126 .rd_dly = 3,
127 .wr_dly = 3,
128};
129
130static struct resource bf5xx_nand_resources[] = {
131 {
132 .start = NFC_CTL,
133 .end = NFC_DATA_RD + 2,
134 .flags = IORESOURCE_MEM,
135 },
136 {
137 .start = CH_NFC,
138 .end = CH_NFC,
139 .flags = IORESOURCE_IRQ,
140 },
141};
142
143static struct platform_device bf5xx_nand_device = {
144 .name = "bf5xx-nand",
145 .id = 0,
146 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
147 .resource = bf5xx_nand_resources,
148 .dev = {
149 .platform_data = &bf5xx_nand_platform,
150 },
151};
152#endif
153
105#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) 154#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
106static struct resource bfin_pcmcia_cf_resources[] = { 155static struct resource bfin_pcmcia_cf_resources[] = {
107 { 156 {
@@ -650,6 +699,10 @@ static struct platform_device bfin_pata_device = {
650#endif 699#endif
651 700
652static struct platform_device *stamp_devices[] __initdata = { 701static struct platform_device *stamp_devices[] __initdata = {
702#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
703 &bf5xx_nand_device,
704#endif
705
653#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) 706#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
654 &bfin_pcmcia_cf_device, 707 &bfin_pcmcia_cf_device,
655#endif 708#endif
diff --git a/arch/blackfin/mach-bf533/boards/H8606.c b/arch/blackfin/mach-bf533/boards/H8606.c
new file mode 100644
index 000000000000..b941550f9568
--- /dev/null
+++ b/arch/blackfin/mach-bf533/boards/H8606.c
@@ -0,0 +1,345 @@
1/*
2 * File: arch/blackfin/mach-bf533/H8606.c
3 * Based on: arch/blackfin/mach-bf533/stamp.c
4 * Author: Javier Herrero <jherrero@hvsistemas.es>
5 *
6 * Created: 2007
7 * Description: Board Info File for the HV Sistemas H8606 board
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc
12 * Copyright 2007 HV Sistemas S.L.
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, see the file COPYING, or write
28 * to the Free Software Foundation, Inc.,
29 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 */
31
32#include <linux/device.h>
33#include <linux/platform_device.h>
34#include <linux/mtd/mtd.h>
35#include <linux/mtd/partitions.h>
36#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39#include <linux/usb_isp1362.h>
40#endif
41#include <linux/pata_platform.h>
42#include <linux/irq.h>
43#include <asm/dma.h>
44#include <asm/bfin5xx_spi.h>
45#include <asm/reboot.h>
46
47/*
48 * Name the Board for the /proc/cpuinfo
49 */
50const char bfin_board_name[] = "HV Sistemas H8606";
51
52#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_BFIN_MODULE)
53static struct platform_device rtc_device = {
54 .name = "rtc-bfin",
55 .id = -1,
56};
57#endif
58
59/*
60* Driver needs to know address, irq and flag pin.
61 */
62 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
63static struct resource dm9000_resources[] = {
64 [0] = {
65 .start = 0x20300000,
66 .end = 0x20300000 + 8,
67 .flags = IORESOURCE_MEM,
68 },
69 [1] = {
70 .start = IRQ_PF10,
71 .end = IRQ_PF10,
72 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
73 },
74};
75
76static struct platform_device dm9000_device = {
77 .id = 0,
78 .name = "dm9000",
79 .resource = dm9000_resources,
80 .num_resources = ARRAY_SIZE(dm9000_resources),
81};
82#endif
83
84#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
85static struct resource smc91x_resources[] = {
86 {
87 .name = "smc91x-regs",
88 .start = 0x20300300,
89 .end = 0x20300300 + 16,
90 .flags = IORESOURCE_MEM,
91 }, {
92 .start = IRQ_PROG_INTB,
93 .end = IRQ_PROG_INTB,
94 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
95 }, {
96 /*
97 * denotes the flag pin and is used directly if
98 * CONFIG_IRQCHIP_DEMUX_GPIO is defined.
99 */
100 .start = IRQ_PF7,
101 .end = IRQ_PF7,
102 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
103 },
104};
105
106static struct platform_device smc91x_device = {
107 .name = "smc91x",
108 .id = 0,
109 .num_resources = ARRAY_SIZE(smc91x_resources),
110 .resource = smc91x_resources,
111};
112#endif
113
114#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
115static struct resource net2272_bfin_resources[] = {
116 {
117 .start = 0x20300000,
118 .end = 0x20300000 + 0x100,
119 .flags = IORESOURCE_MEM,
120 }, {
121 .start = IRQ_PF10,
122 .end = IRQ_PF10,
123 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
124 },
125};
126
127static struct platform_device net2272_bfin_device = {
128 .name = "net2272",
129 .id = -1,
130 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
131 .resource = net2272_bfin_resources,
132};
133#endif
134
135#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
136/* all SPI peripherals info goes here */
137
138#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
139static struct mtd_partition bfin_spi_flash_partitions[] = {
140 {
141 .name = "bootloader",
142 .size = 0x00060000,
143 .offset = 0,
144 .mask_flags = MTD_CAP_ROM
145 }, {
146 .name = "kernel",
147 .size = 0x100000,
148 .offset = 0x60000
149 }, {
150 .name = "file system",
151 .size = 0x6a0000,
152 .offset = 0x00160000,
153 }
154};
155
156static struct flash_platform_data bfin_spi_flash_data = {
157 .name = "m25p80",
158 .parts = bfin_spi_flash_partitions,
159 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
160 .type = "m25p64",
161};
162
163/* SPI flash chip (m25p64) */
164static struct bfin5xx_spi_chip spi_flash_chip_info = {
165 .enable_dma = 0, /* use dma transfer with this chip*/
166 .bits_per_word = 8,
167};
168#endif
169
170#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
171/* SPI ADC chip */
172static struct bfin5xx_spi_chip spi_adc_chip_info = {
173 .ctl_reg = 0x1000,
174 .enable_dma = 1, /* use dma transfer with this chip*/
175 .bits_per_word = 16,
176};
177#endif
178
179#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
180static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
181 .ctl_reg = 0x1000,
182 .enable_dma = 0,
183 .bits_per_word = 16,
184};
185#endif
186
187#if defined(CONFIG_PBX)
188static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
189 .ctl_reg = 0x1c04,
190 .enable_dma = 0,
191 .bits_per_word = 8,
192 .cs_change_per_word = 1,
193};
194#endif
195
196/* Notice: for blackfin, the speed_hz is the value of register
197 * SPI_BAUD, not the real baudrate */
198static struct spi_board_info bfin_spi_board_info[] __initdata = {
199#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
200 {
201 /* the modalias must be the same as spi device driver name */
202 .modalias = "m25p80", /* Name of spi_driver for this device */
203 /* this value is the baudrate divisor */
204 .max_speed_hz = 50000000, /* actual baudrate is SCLK/(2xspeed_hz) */
205 .bus_num = 0, /* Framework bus number */
206 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
207 .platform_data = &bfin_spi_flash_data,
208 .controller_data = &spi_flash_chip_info,
209 .mode = SPI_MODE_3,
210 },
211#endif
212
213#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
214 {
215 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
216 .max_speed_hz = 4, /* actual baudrate is SCLK/(2xspeed_hz) */
217 .bus_num = 1, /* Framework bus number */
218 .chip_select = 1, /* Framework chip select. */
219 .platform_data = NULL, /* No spi_driver specific config */
220 .controller_data = &spi_adc_chip_info,
221 },
222#endif
223
224#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
225 {
226 .modalias = "ad1836-spi",
227 .max_speed_hz = 16,
228 .bus_num = 1,
229 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
230 .controller_data = &ad1836_spi_chip_info,
231 },
232#endif
233
234#if defined(CONFIG_PBX)
235 {
236 .modalias = "fxs-spi",
237 .max_speed_hz = 4,
238 .bus_num = 1,
239 .chip_select = 3,
240 .controller_data = &spi_si3xxx_chip_info,
241 },
242
243 {
244 .modalias = "fxo-spi",
245 .max_speed_hz = 4,
246 .bus_num = 1,
247 .chip_select = 2,
248 .controller_data = &spi_si3xxx_chip_info,
249 },
250#endif
251};
252
253/* SPI (0) */
254static struct resource bfin_spi0_resource[] = {
255 [0] = {
256 .start = SPI0_REGBASE,
257 .end = SPI0_REGBASE + 0xFF,
258 .flags = IORESOURCE_MEM,
259 },
260 [1] = {
261 .start = CH_SPI,
262 .end = CH_SPI,
263 .flags = IORESOURCE_IRQ,
264 }
265};
266
267
268/* SPI controller data */
269static struct bfin5xx_spi_master bfin_spi0_info = {
270 .num_chipselect = 8,
271 .enable_dma = 1, /* master has the ability to do dma transfer */
272};
273
274static struct platform_device bfin_spi0_device = {
275 .name = "bfin-spi",
276 .id = 0, /* Bus number */
277 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
278 .resource = bfin_spi0_resource,
279 .dev = {
280 .platform_data = &bfin_spi0_info, /* Passed to driver */
281 },
282};
283#endif /* spi master and devices */
284
285#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
286static struct platform_device bfin_fb_device = {
287 .name = "bf537-fb",
288};
289#endif
290
291#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
292static struct resource bfin_uart_resources[] = {
293 {
294 .start = 0xFFC00400,
295 .end = 0xFFC004FF,
296 .flags = IORESOURCE_MEM,
297 },
298};
299
300static struct platform_device bfin_uart_device = {
301 .name = "bfin-uart",
302 .id = 1,
303 .num_resources = ARRAY_SIZE(bfin_uart_resources),
304 .resource = bfin_uart_resources,
305};
306#endif
307
308static struct platform_device *stamp_devices[] __initdata = {
309#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
310 &rtc_device,
311#endif
312
313#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
314 &dm9000_device,
315#endif
316
317#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
318 &smc91x_device,
319#endif
320
321#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
322 &net2272_bfin_device,
323#endif
324
325#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
326 &bfin_spi0_device,
327#endif
328
329#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
330 &bfin_uart_device,
331#endif
332};
333
334static int __init H8606_init(void)
335{
336 printk(KERN_INFO "HV Sistemas H8606 board support by http://www.hvsistemas.com\n");
337 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
338 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
339#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
340 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
341#endif
342 return 0;
343}
344
345arch_initcall(H8606_init); \ No newline at end of file
diff --git a/arch/blackfin/mach-bf533/boards/Makefile b/arch/blackfin/mach-bf533/boards/Makefile
index 12a631ab389d..2452b456ccbd 100644
--- a/arch/blackfin/mach-bf533/boards/Makefile
+++ b/arch/blackfin/mach-bf533/boards/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_GENERIC_BOARD) += generic_board.o
6obj-$(CONFIG_BFIN533_STAMP) += stamp.o 6obj-$(CONFIG_BFIN533_STAMP) += stamp.o
7obj-$(CONFIG_BFIN533_EZKIT) += ezkit.o 7obj-$(CONFIG_BFIN533_EZKIT) += ezkit.o
8obj-$(CONFIG_BFIN533_BLUETECHNIX_CM) += cm_bf533.o 8obj-$(CONFIG_BFIN533_BLUETECHNIX_CM) += cm_bf533.o
9obj-$(CONFIG_H8606_HVSISTEMAS) += H8606.o
diff --git a/arch/blackfin/mach-bf533/boards/cm_bf533.c b/arch/blackfin/mach-bf533/boards/cm_bf533.c
index 1c5a86adfab7..a863522a4467 100644
--- a/arch/blackfin/mach-bf533/boards/cm_bf533.c
+++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c
@@ -46,7 +46,7 @@ const char bfin_board_name[] = "Bluetechnix CM BF533";
46 46
47#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 47#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
48/* all SPI peripherals info goes here */ 48/* all SPI peripherals info goes here */
49 49#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
50static struct mtd_partition bfin_spi_flash_partitions[] = { 50static struct mtd_partition bfin_spi_flash_partitions[] = {
51 { 51 {
52 .name = "bootloader", 52 .name = "bootloader",
@@ -76,12 +76,15 @@ static struct bfin5xx_spi_chip spi_flash_chip_info = {
76 .enable_dma = 0, /* use dma transfer with this chip*/ 76 .enable_dma = 0, /* use dma transfer with this chip*/
77 .bits_per_word = 8, 77 .bits_per_word = 8,
78}; 78};
79#endif
79 80
80/* SPI ADC chip */ 81/* SPI ADC chip */
82#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
81static struct bfin5xx_spi_chip spi_adc_chip_info = { 83static struct bfin5xx_spi_chip spi_adc_chip_info = {
82 .enable_dma = 1, /* use dma transfer with this chip*/ 84 .enable_dma = 1, /* use dma transfer with this chip*/
83 .bits_per_word = 16, 85 .bits_per_word = 16,
84}; 86};
87#endif
85 88
86#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) 89#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
87static struct bfin5xx_spi_chip ad1836_spi_chip_info = { 90static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
@@ -90,7 +93,15 @@ static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
90}; 93};
91#endif 94#endif
92 95
96#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
97static struct bfin5xx_spi_chip spi_mmc_chip_info = {
98 .enable_dma = 1,
99 .bits_per_word = 8,
100};
101#endif
102
93static struct spi_board_info bfin_spi_board_info[] __initdata = { 103static struct spi_board_info bfin_spi_board_info[] __initdata = {
104#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
94 { 105 {
95 /* the modalias must be the same as spi device driver name */ 106 /* the modalias must be the same as spi device driver name */
96 .modalias = "m25p80", /* Name of spi_driver for this device */ 107 .modalias = "m25p80", /* Name of spi_driver for this device */
@@ -100,7 +111,11 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
100 .platform_data = &bfin_spi_flash_data, 111 .platform_data = &bfin_spi_flash_data,
101 .controller_data = &spi_flash_chip_info, 112 .controller_data = &spi_flash_chip_info,
102 .mode = SPI_MODE_3, 113 .mode = SPI_MODE_3,
103 }, { 114 },
115#endif
116
117#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
118 {
104 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ 119 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
105 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ 120 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
106 .bus_num = 0, /* Framework bus number */ 121 .bus_num = 0, /* Framework bus number */
@@ -108,6 +123,8 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
108 .platform_data = NULL, /* No spi_driver specific config */ 123 .platform_data = NULL, /* No spi_driver specific config */
109 .controller_data = &spi_adc_chip_info, 124 .controller_data = &spi_adc_chip_info,
110 }, 125 },
126#endif
127
111#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) 128#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
112 { 129 {
113 .modalias = "ad1836-spi", 130 .modalias = "ad1836-spi",
@@ -117,6 +134,27 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
117 .controller_data = &ad1836_spi_chip_info, 134 .controller_data = &ad1836_spi_chip_info,
118 }, 135 },
119#endif 136#endif
137
138#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
139 {
140 .modalias = "spi_mmc_dummy",
141 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
142 .bus_num = 0,
143 .chip_select = 0,
144 .platform_data = NULL,
145 .controller_data = &spi_mmc_chip_info,
146 .mode = SPI_MODE_3,
147 },
148 {
149 .modalias = "spi_mmc",
150 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
151 .bus_num = 0,
152 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
153 .platform_data = NULL,
154 .controller_data = &spi_mmc_chip_info,
155 .mode = SPI_MODE_3,
156 },
157#endif
120}; 158};
121 159
122/* SPI (0) */ 160/* SPI (0) */
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index f84be4eabfd1..62ffa500420f 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -218,7 +218,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
218#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 218#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
219 { 219 {
220 .modalias = "spi_mmc_dummy", 220 .modalias = "spi_mmc_dummy",
221 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 221 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
222 .bus_num = 0, 222 .bus_num = 0,
223 .chip_select = 0, 223 .chip_select = 0,
224 .platform_data = NULL, 224 .platform_data = NULL,
@@ -227,7 +227,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
227 }, 227 },
228 { 228 {
229 .modalias = "spi_mmc", 229 .modalias = "spi_mmc",
230 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 230 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
231 .bus_num = 0, 231 .bus_num = 0,
232 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 232 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
233 .platform_data = NULL, 233 .platform_data = NULL,
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c
index 52e2320307de..2915931045e3 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c
@@ -281,8 +281,8 @@ static struct resource net2272_bfin_resources[] = {
281 .end = 0x20200000 + 0x100, 281 .end = 0x20200000 + 0x100,
282 .flags = IORESOURCE_MEM, 282 .flags = IORESOURCE_MEM,
283 }, { 283 }, {
284 .start = IRQ_PF7, 284 .start = IRQ_PH14,
285 .end = IRQ_PF7, 285 .end = IRQ_PH14,
286 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 286 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
287 }, 287 },
288}; 288};
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index cc41f6c2ef4f..5f7b91fbafe8 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -450,7 +450,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
450#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 450#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
451 { 451 {
452 .modalias = "spi_mmc_dummy", 452 .modalias = "spi_mmc_dummy",
453 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 453 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
454 .bus_num = 0, 454 .bus_num = 0,
455 .chip_select = 0, 455 .chip_select = 0,
456 .platform_data = NULL, 456 .platform_data = NULL,
@@ -459,7 +459,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
459 }, 459 },
460 { 460 {
461 .modalias = "spi_mmc", 461 .modalias = "spi_mmc",
462 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 462 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
463 .bus_num = 0, 463 .bus_num = 0,
464 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 464 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
465 .platform_data = NULL, 465 .platform_data = NULL,
@@ -612,7 +612,7 @@ static struct platform_device bfin_sport1_uart_device = {
612 612
613static struct pata_platform_info bfin_pata_platform_data = { 613static struct pata_platform_info bfin_pata_platform_data = {
614 .ioport_shift = 1, 614 .ioport_shift = 1,
615 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, 615 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
616}; 616};
617 617
618static struct resource bfin_pata_resources[] = { 618static struct resource bfin_pata_resources[] = {
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index e3ad5802868a..1b13fa470977 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -917,7 +917,7 @@ ENTRY(_ex_table)
917 .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */ 917 .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */
918 .long _ex_replaceable /* 0x02 - User Defined */ 918 .long _ex_replaceable /* 0x02 - User Defined */
919 .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */ 919 .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */
920 .long _ex_replaceable /* 0x04 - User Defined */ 920 .long _ex_trap_c /* 0x04 - User Defined - dump trace buffer */
921 .long _ex_replaceable /* 0x05 - User Defined */ 921 .long _ex_replaceable /* 0x05 - User Defined */
922 .long _ex_replaceable /* 0x06 - User Defined */ 922 .long _ex_replaceable /* 0x06 - User Defined */
923 .long _ex_replaceable /* 0x07 - User Defined */ 923 .long _ex_replaceable /* 0x07 - User Defined */
diff --git a/arch/frv/mb93090-mb00/pci-dma.c b/arch/frv/mb93090-mb00/pci-dma.c
index 671ce1e8434f..662f7b12d005 100644
--- a/arch/frv/mb93090-mb00/pci-dma.c
+++ b/arch/frv/mb93090-mb00/pci-dma.c
@@ -15,6 +15,7 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <linux/highmem.h> 17#include <linux/highmem.h>
18#include <linux/scatterlist.h>
18#include <asm/io.h> 19#include <asm/io.h>
19 20
20void *dma_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_handle, gfp_t gfp) 21void *dma_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_handle, gfp_t gfp)
@@ -86,7 +87,7 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
86 dampr2 = __get_DAMPR(2); 87 dampr2 = __get_DAMPR(2);
87 88
88 for (i = 0; i < nents; i++) { 89 for (i = 0; i < nents; i++) {
89 vaddr = kmap_atomic(sg[i].page, __KM_CACHE); 90 vaddr = kmap_atomic(sg_page(&sg[i]), __KM_CACHE);
90 91
91 frv_dcache_writeback((unsigned long) vaddr, 92 frv_dcache_writeback((unsigned long) vaddr,
92 (unsigned long) vaddr + PAGE_SIZE); 93 (unsigned long) vaddr + PAGE_SIZE);
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index e2e9f57abe2e..ff6a8712bd6d 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -1,6 +1,6 @@
1# 1#
2# For a description of the syntax of this configuration file, 2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/config-language.txt. 3# see Documentation/kbuild/kconfig-language.txt.
4# 4#
5 5
6mainmenu "uClinux/h8300 (w/o MMU) Kernel Configuration" 6mainmenu "uClinux/h8300 (w/o MMU) Kernel Configuration"
diff --git a/arch/i386/.gitignore b/arch/i386/.gitignore
deleted file mode 100644
index 36ef4c374d25..000000000000
--- a/arch/i386/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
1boot
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig
index 75fd90dc76a3..7f6b2377d13f 100644
--- a/arch/ia64/configs/sn2_defconfig
+++ b/arch/ia64/configs/sn2_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc6 3# Linux kernel version: 2.6.23
4# Tue Sep 18 11:24:01 2007 4# Thu Oct 18 16:03:40 2007
5# 5#
6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
7 7
@@ -28,6 +28,8 @@ CONFIG_TASK_IO_ACCOUNTING=y
28CONFIG_LOG_BUF_SHIFT=20 28CONFIG_LOG_BUF_SHIFT=20
29CONFIG_CGROUPS=y 29CONFIG_CGROUPS=y
30CONFIG_CPUSETS=y 30CONFIG_CPUSETS=y
31CONFIG_FAIR_GROUP_SCHED=y
32CONFIG_FAIR_USER_SCHED=y
31CONFIG_SYSFS_DEPRECATED=y 33CONFIG_SYSFS_DEPRECATED=y
32CONFIG_RELAY=y 34CONFIG_RELAY=y
33CONFIG_BLK_DEV_INITRD=y 35CONFIG_BLK_DEV_INITRD=y
@@ -48,7 +50,6 @@ CONFIG_FUTEX=y
48CONFIG_ANON_INODES=y 50CONFIG_ANON_INODES=y
49CONFIG_EPOLL=y 51CONFIG_EPOLL=y
50CONFIG_SIGNALFD=y 52CONFIG_SIGNALFD=y
51CONFIG_TIMERFD=y
52CONFIG_EVENTFD=y 53CONFIG_EVENTFD=y
53CONFIG_SHMEM=y 54CONFIG_SHMEM=y
54CONFIG_VM_EVENT_COUNTERS=y 55CONFIG_VM_EVENT_COUNTERS=y
@@ -69,6 +70,7 @@ CONFIG_STOP_MACHINE=y
69CONFIG_BLOCK=y 70CONFIG_BLOCK=y
70# CONFIG_BLK_DEV_IO_TRACE is not set 71# CONFIG_BLK_DEV_IO_TRACE is not set
71CONFIG_BLK_DEV_BSG=y 72CONFIG_BLK_DEV_BSG=y
73CONFIG_BLOCK_COMPAT=y
72 74
73# 75#
74# IO Schedulers 76# IO Schedulers
@@ -93,6 +95,7 @@ CONFIG_MMU=y
93CONFIG_RWSEM_XCHGADD_ALGORITHM=y 95CONFIG_RWSEM_XCHGADD_ALGORITHM=y
94# CONFIG_ARCH_HAS_ILOG2_U32 is not set 96# CONFIG_ARCH_HAS_ILOG2_U32 is not set
95# CONFIG_ARCH_HAS_ILOG2_U64 is not set 97# CONFIG_ARCH_HAS_ILOG2_U64 is not set
98CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
96CONFIG_GENERIC_FIND_NEXT_BIT=y 99CONFIG_GENERIC_FIND_NEXT_BIT=y
97CONFIG_GENERIC_CALIBRATE_DELAY=y 100CONFIG_GENERIC_CALIBRATE_DELAY=y
98CONFIG_GENERIC_TIME=y 101CONFIG_GENERIC_TIME=y
@@ -113,10 +116,10 @@ CONFIG_IA64_SGI_SN2=y
113CONFIG_MCKINLEY=y 116CONFIG_MCKINLEY=y
114# CONFIG_IA64_PAGE_SIZE_4KB is not set 117# CONFIG_IA64_PAGE_SIZE_4KB is not set
115# CONFIG_IA64_PAGE_SIZE_8KB is not set 118# CONFIG_IA64_PAGE_SIZE_8KB is not set
116CONFIG_IA64_PAGE_SIZE_16KB=y 119# CONFIG_IA64_PAGE_SIZE_16KB is not set
117# CONFIG_IA64_PAGE_SIZE_64KB is not set 120CONFIG_IA64_PAGE_SIZE_64KB=y
118# CONFIG_PGTABLE_3 is not set 121CONFIG_PGTABLE_3=y
119CONFIG_PGTABLE_4=y 122# CONFIG_PGTABLE_4 is not set
120# CONFIG_HZ_100 is not set 123# CONFIG_HZ_100 is not set
121CONFIG_HZ_250=y 124CONFIG_HZ_250=y
122# CONFIG_HZ_300 is not set 125# CONFIG_HZ_300 is not set
@@ -131,6 +134,7 @@ CONFIG_SMP=y
131CONFIG_NR_CPUS=1024 134CONFIG_NR_CPUS=1024
132# CONFIG_HOTPLUG_CPU is not set 135# CONFIG_HOTPLUG_CPU is not set
133CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 136CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
137CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
134CONFIG_SCHED_SMT=y 138CONFIG_SCHED_SMT=y
135CONFIG_PREEMPT_NONE=y 139CONFIG_PREEMPT_NONE=y
136# CONFIG_PREEMPT_VOLUNTARY is not set 140# CONFIG_PREEMPT_VOLUNTARY is not set
@@ -144,6 +148,7 @@ CONFIG_DISCONTIGMEM=y
144CONFIG_FLAT_NODE_MEM_MAP=y 148CONFIG_FLAT_NODE_MEM_MAP=y
145CONFIG_NEED_MULTIPLE_NODES=y 149CONFIG_NEED_MULTIPLE_NODES=y
146# CONFIG_SPARSEMEM_STATIC is not set 150# CONFIG_SPARSEMEM_STATIC is not set
151CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
147CONFIG_SPLIT_PTLOCK_CPUS=4 152CONFIG_SPLIT_PTLOCK_CPUS=4
148CONFIG_MIGRATION=y 153CONFIG_MIGRATION=y
149CONFIG_RESOURCES_64BIT=y 154CONFIG_RESOURCES_64BIT=y
@@ -171,6 +176,7 @@ CONFIG_IA64_PALINFO=y
171CONFIG_IA64_MC_ERR_INJECT=y 176CONFIG_IA64_MC_ERR_INJECT=y
172CONFIG_SGI_SN=y 177CONFIG_SGI_SN=y
173# CONFIG_IA64_ESI is not set 178# CONFIG_IA64_ESI is not set
179# CONFIG_IA64_HP_AML_NFW is not set
174 180
175# 181#
176# SN Devices 182# SN Devices
@@ -220,7 +226,6 @@ CONFIG_PCI_DOMAINS=y
220CONFIG_PCI_SYSCALL=y 226CONFIG_PCI_SYSCALL=y
221CONFIG_PCIEPORTBUS=y 227CONFIG_PCIEPORTBUS=y
222CONFIG_HOTPLUG_PCI_PCIE=y 228CONFIG_HOTPLUG_PCI_PCIE=y
223# CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set
224CONFIG_PCIEAER=y 229CONFIG_PCIEAER=y
225CONFIG_ARCH_SUPPORTS_MSI=y 230CONFIG_ARCH_SUPPORTS_MSI=y
226# CONFIG_PCI_MSI is not set 231# CONFIG_PCI_MSI is not set
@@ -231,10 +236,6 @@ CONFIG_HOTPLUG_PCI=y
231# CONFIG_HOTPLUG_PCI_CPCI is not set 236# CONFIG_HOTPLUG_PCI_CPCI is not set
232# CONFIG_HOTPLUG_PCI_SHPC is not set 237# CONFIG_HOTPLUG_PCI_SHPC is not set
233CONFIG_HOTPLUG_PCI_SGI=y 238CONFIG_HOTPLUG_PCI_SGI=y
234
235#
236# PCCARD (PCMCIA/CardBus) support
237#
238# CONFIG_PCCARD is not set 239# CONFIG_PCCARD is not set
239 240
240# 241#
@@ -271,6 +272,7 @@ CONFIG_INET_TUNNEL=m
271CONFIG_INET_XFRM_MODE_TRANSPORT=y 272CONFIG_INET_XFRM_MODE_TRANSPORT=y
272CONFIG_INET_XFRM_MODE_TUNNEL=y 273CONFIG_INET_XFRM_MODE_TUNNEL=y
273CONFIG_INET_XFRM_MODE_BEET=y 274CONFIG_INET_XFRM_MODE_BEET=y
275CONFIG_INET_LRO=y
274CONFIG_INET_DIAG=m 276CONFIG_INET_DIAG=m
275CONFIG_INET_TCP_DIAG=m 277CONFIG_INET_TCP_DIAG=m
276# CONFIG_TCP_CONG_ADVANCED is not set 278# CONFIG_TCP_CONG_ADVANCED is not set
@@ -342,6 +344,7 @@ CONFIG_IPV6_SIT=m
342# 344#
343# Generic Driver Options 345# Generic Driver Options
344# 346#
347CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
345CONFIG_STANDALONE=y 348CONFIG_STANDALONE=y
346CONFIG_PREVENT_FIRMWARE_BUILD=y 349CONFIG_PREVENT_FIRMWARE_BUILD=y
347CONFIG_FW_LOADER=y 350CONFIG_FW_LOADER=y
@@ -402,7 +405,12 @@ CONFIG_IDE_PROC_FS=y
402# IDE chipset support/bugfixes 405# IDE chipset support/bugfixes
403# 406#
404CONFIG_IDE_GENERIC=y 407CONFIG_IDE_GENERIC=y
408# CONFIG_BLK_DEV_PLATFORM is not set
405# CONFIG_BLK_DEV_IDEPNP is not set 409# CONFIG_BLK_DEV_IDEPNP is not set
410
411#
412# PCI IDE chipsets support
413#
406CONFIG_BLK_DEV_IDEPCI=y 414CONFIG_BLK_DEV_IDEPCI=y
407CONFIG_IDEPCI_SHARE_IRQ=y 415CONFIG_IDEPCI_SHARE_IRQ=y
408CONFIG_IDEPCI_PCIBUS_ORDER=y 416CONFIG_IDEPCI_PCIBUS_ORDER=y
@@ -410,8 +418,6 @@ CONFIG_IDEPCI_PCIBUS_ORDER=y
410# CONFIG_BLK_DEV_GENERIC is not set 418# CONFIG_BLK_DEV_GENERIC is not set
411# CONFIG_BLK_DEV_OPTI621 is not set 419# CONFIG_BLK_DEV_OPTI621 is not set
412CONFIG_BLK_DEV_IDEDMA_PCI=y 420CONFIG_BLK_DEV_IDEDMA_PCI=y
413# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
414# CONFIG_IDEDMA_ONLYDISK is not set
415# CONFIG_BLK_DEV_AEC62XX is not set 421# CONFIG_BLK_DEV_AEC62XX is not set
416# CONFIG_BLK_DEV_ALI15X3 is not set 422# CONFIG_BLK_DEV_ALI15X3 is not set
417# CONFIG_BLK_DEV_AMD74XX is not set 423# CONFIG_BLK_DEV_AMD74XX is not set
@@ -439,7 +445,6 @@ CONFIG_BLK_DEV_SGIIOC4=y
439# CONFIG_BLK_DEV_TC86C001 is not set 445# CONFIG_BLK_DEV_TC86C001 is not set
440# CONFIG_IDE_ARM is not set 446# CONFIG_IDE_ARM is not set
441CONFIG_BLK_DEV_IDEDMA=y 447CONFIG_BLK_DEV_IDEDMA=y
442# CONFIG_IDEDMA_IVB is not set
443# CONFIG_BLK_DEV_HD is not set 448# CONFIG_BLK_DEV_HD is not set
444 449
445# 450#
@@ -482,6 +487,7 @@ CONFIG_SCSI_SAS_ATTRS=y
482CONFIG_SCSI_SAS_LIBSAS=y 487CONFIG_SCSI_SAS_LIBSAS=y
483# CONFIG_SCSI_SAS_ATA is not set 488# CONFIG_SCSI_SAS_ATA is not set
484# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set 489# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
490CONFIG_SCSI_SRP_ATTRS=y
485CONFIG_SCSI_LOWLEVEL=y 491CONFIG_SCSI_LOWLEVEL=y
486CONFIG_ISCSI_TCP=m 492CONFIG_ISCSI_TCP=m
487# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 493# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -492,6 +498,7 @@ CONFIG_ISCSI_TCP=m
492# CONFIG_SCSI_AIC7XXX_OLD is not set 498# CONFIG_SCSI_AIC7XXX_OLD is not set
493# CONFIG_SCSI_AIC79XX is not set 499# CONFIG_SCSI_AIC79XX is not set
494# CONFIG_SCSI_AIC94XX is not set 500# CONFIG_SCSI_AIC94XX is not set
501# CONFIG_SCSI_ADVANSYS is not set
495# CONFIG_SCSI_ARCMSR is not set 502# CONFIG_SCSI_ARCMSR is not set
496# CONFIG_MEGARAID_NEWGEN is not set 503# CONFIG_MEGARAID_NEWGEN is not set
497# CONFIG_MEGARAID_LEGACY is not set 504# CONFIG_MEGARAID_LEGACY is not set
@@ -532,6 +539,7 @@ CONFIG_ATA_ACPI=y
532# CONFIG_SATA_VIA is not set 539# CONFIG_SATA_VIA is not set
533CONFIG_SATA_VITESSE=y 540CONFIG_SATA_VITESSE=y
534# CONFIG_SATA_INIC162X is not set 541# CONFIG_SATA_INIC162X is not set
542# CONFIG_PATA_ACPI is not set
535# CONFIG_PATA_ALI is not set 543# CONFIG_PATA_ALI is not set
536# CONFIG_PATA_AMD is not set 544# CONFIG_PATA_AMD is not set
537# CONFIG_PATA_ARTOP is not set 545# CONFIG_PATA_ARTOP is not set
@@ -556,6 +564,7 @@ CONFIG_SATA_VITESSE=y
556# CONFIG_PATA_OLDPIIX is not set 564# CONFIG_PATA_OLDPIIX is not set
557# CONFIG_PATA_NETCELL is not set 565# CONFIG_PATA_NETCELL is not set
558# CONFIG_PATA_NS87410 is not set 566# CONFIG_PATA_NS87410 is not set
567# CONFIG_PATA_NS87415 is not set
559# CONFIG_PATA_OPTI is not set 568# CONFIG_PATA_OPTI is not set
560# CONFIG_PATA_OPTIDMA is not set 569# CONFIG_PATA_OPTIDMA is not set
561# CONFIG_PATA_PDC_OLD is not set 570# CONFIG_PATA_PDC_OLD is not set
@@ -588,10 +597,6 @@ CONFIG_DM_MULTIPATH=m
588CONFIG_DM_MULTIPATH_EMC=m 597CONFIG_DM_MULTIPATH_EMC=m
589# CONFIG_DM_MULTIPATH_RDAC is not set 598# CONFIG_DM_MULTIPATH_RDAC is not set
590# CONFIG_DM_DELAY is not set 599# CONFIG_DM_DELAY is not set
591
592#
593# Fusion MPT device support
594#
595CONFIG_FUSION=y 600CONFIG_FUSION=y
596CONFIG_FUSION_SPI=y 601CONFIG_FUSION_SPI=y
597CONFIG_FUSION_FC=y 602CONFIG_FUSION_FC=y
@@ -613,13 +618,16 @@ CONFIG_NETDEVICES=y
613# CONFIG_MACVLAN is not set 618# CONFIG_MACVLAN is not set
614# CONFIG_EQUALIZER is not set 619# CONFIG_EQUALIZER is not set
615# CONFIG_TUN is not set 620# CONFIG_TUN is not set
621# CONFIG_VETH is not set
616# CONFIG_NET_SB1000 is not set 622# CONFIG_NET_SB1000 is not set
623# CONFIG_IP1000 is not set
617# CONFIG_ARCNET is not set 624# CONFIG_ARCNET is not set
618# CONFIG_NET_ETHERNET is not set 625# CONFIG_NET_ETHERNET is not set
619CONFIG_NETDEV_1000=y 626CONFIG_NETDEV_1000=y
620# CONFIG_ACENIC is not set 627# CONFIG_ACENIC is not set
621# CONFIG_DL2K is not set 628# CONFIG_DL2K is not set
622# CONFIG_E1000 is not set 629# CONFIG_E1000 is not set
630# CONFIG_E1000E is not set
623# CONFIG_NS83820 is not set 631# CONFIG_NS83820 is not set
624# CONFIG_HAMACHI is not set 632# CONFIG_HAMACHI is not set
625# CONFIG_YELLOWFIN is not set 633# CONFIG_YELLOWFIN is not set
@@ -638,12 +646,15 @@ CONFIG_CHELSIO_T1=m
638CONFIG_CHELSIO_T1_1G=y 646CONFIG_CHELSIO_T1_1G=y
639# CONFIG_CHELSIO_T1_NAPI is not set 647# CONFIG_CHELSIO_T1_NAPI is not set
640CONFIG_CHELSIO_T3=m 648CONFIG_CHELSIO_T3=m
649CONFIG_IXGBE=m
641# CONFIG_IXGB is not set 650# CONFIG_IXGB is not set
642CONFIG_S2IO=m 651CONFIG_S2IO=m
643# CONFIG_S2IO_NAPI is not set 652# CONFIG_S2IO_NAPI is not set
644# CONFIG_MYRI10GE is not set 653# CONFIG_MYRI10GE is not set
645# CONFIG_NETXEN_NIC is not set 654# CONFIG_NETXEN_NIC is not set
655# CONFIG_NIU is not set
646# CONFIG_MLX4_CORE is not set 656# CONFIG_MLX4_CORE is not set
657# CONFIG_TEHUTI is not set
647# CONFIG_TR is not set 658# CONFIG_TR is not set
648 659
649# 660#
@@ -669,6 +680,7 @@ CONFIG_S2IO=m
669# CONFIG_NET_FC is not set 680# CONFIG_NET_FC is not set
670# CONFIG_SHAPER is not set 681# CONFIG_SHAPER is not set
671CONFIG_NETCONSOLE=y 682CONFIG_NETCONSOLE=y
683# CONFIG_NETCONSOLE_DYNAMIC is not set
672CONFIG_NETPOLL=y 684CONFIG_NETPOLL=y
673# CONFIG_NETPOLL_TRAP is not set 685# CONFIG_NETPOLL_TRAP is not set
674CONFIG_NET_POLL_CONTROLLER=y 686CONFIG_NET_POLL_CONTROLLER=y
@@ -690,7 +702,6 @@ CONFIG_INPUT_MOUSEDEV=y
690CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 702CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
691CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 703CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
692# CONFIG_INPUT_JOYDEV is not set 704# CONFIG_INPUT_JOYDEV is not set
693# CONFIG_INPUT_TSDEV is not set
694# CONFIG_INPUT_EVDEV is not set 705# CONFIG_INPUT_EVDEV is not set
695# CONFIG_INPUT_EVBUG is not set 706# CONFIG_INPUT_EVBUG is not set
696 707
@@ -714,6 +725,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
714# Character devices 725# Character devices
715# 726#
716CONFIG_VT=y 727CONFIG_VT=y
728# CONFIG_VT_UNICODE is not set
717CONFIG_VT_CONSOLE=y 729CONFIG_VT_CONSOLE=y
718CONFIG_HW_CONSOLE=y 730CONFIG_HW_CONSOLE=y
719# CONFIG_VT_HW_CONSOLE_BINDING is not set 731# CONFIG_VT_HW_CONSOLE_BINDING is not set
@@ -760,9 +772,6 @@ CONFIG_LEGACY_PTY_COUNT=256
760CONFIG_EFI_RTC=y 772CONFIG_EFI_RTC=y
761# CONFIG_R3964 is not set 773# CONFIG_R3964 is not set
762# CONFIG_APPLICOM is not set 774# CONFIG_APPLICOM is not set
763CONFIG_AGP=y
764CONFIG_AGP_SGI_TIOCA=y
765# CONFIG_DRM is not set
766CONFIG_RAW_DRIVER=m 775CONFIG_RAW_DRIVER=m
767CONFIG_MAX_RAW_DEVS=256 776CONFIG_MAX_RAW_DEVS=256
768# CONFIG_HPET is not set 777# CONFIG_HPET is not set
@@ -782,6 +791,12 @@ CONFIG_DEVPORT=y
782# CONFIG_HWMON is not set 791# CONFIG_HWMON is not set
783 792
784# 793#
794# Sonics Silicon Backplane
795#
796CONFIG_SSB_POSSIBLE=y
797# CONFIG_SSB is not set
798
799#
785# Multifunction device drivers 800# Multifunction device drivers
786# 801#
787# CONFIG_MFD_SM501 is not set 802# CONFIG_MFD_SM501 is not set
@@ -796,15 +811,18 @@ CONFIG_DEVPORT=y
796# 811#
797# Graphics support 812# Graphics support
798# 813#
814CONFIG_AGP=y
815CONFIG_AGP_SGI_TIOCA=y
816# CONFIG_DRM is not set
817# CONFIG_VGASTATE is not set
818CONFIG_VIDEO_OUTPUT_CONTROL=m
819# CONFIG_FB is not set
799# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 820# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
800 821
801# 822#
802# Display device support 823# Display device support
803# 824#
804# CONFIG_DISPLAY_SUPPORT is not set 825# CONFIG_DISPLAY_SUPPORT is not set
805# CONFIG_VGASTATE is not set
806CONFIG_VIDEO_OUTPUT_CONTROL=m
807# CONFIG_FB is not set
808 826
809# 827#
810# Console display driver support 828# Console display driver support
@@ -820,6 +838,7 @@ CONFIG_DUMMY_CONSOLE=y
820CONFIG_HID_SUPPORT=y 838CONFIG_HID_SUPPORT=y
821CONFIG_HID=y 839CONFIG_HID=y
822CONFIG_HID_DEBUG=y 840CONFIG_HID_DEBUG=y
841# CONFIG_HIDRAW is not set
823 842
824# 843#
825# USB Input Devices 844# USB Input Devices
@@ -951,19 +970,6 @@ CONFIG_INFINIBAND_SRP=m
951# CONFIG_RTC_CLASS is not set 970# CONFIG_RTC_CLASS is not set
952 971
953# 972#
954# DMA Engine support
955#
956# CONFIG_DMA_ENGINE is not set
957
958#
959# DMA Clients
960#
961
962#
963# DMA Devices
964#
965
966#
967# Userspace I/O 973# Userspace I/O
968# 974#
969# CONFIG_UIO is not set 975# CONFIG_UIO is not set
@@ -1005,6 +1011,8 @@ CONFIG_XFS_RT=y
1005CONFIG_INOTIFY=y 1011CONFIG_INOTIFY=y
1006CONFIG_INOTIFY_USER=y 1012CONFIG_INOTIFY_USER=y
1007CONFIG_QUOTA=y 1013CONFIG_QUOTA=y
1014CONFIG_QUOTA_NETLINK_INTERFACE=y
1015CONFIG_PRINT_QUOTA_WARNING=y
1008# CONFIG_QFMT_V1 is not set 1016# CONFIG_QFMT_V1 is not set
1009# CONFIG_QFMT_V2 is not set 1017# CONFIG_QFMT_V2 is not set
1010CONFIG_QUOTACTL=y 1018CONFIG_QUOTACTL=y
@@ -1043,7 +1051,6 @@ CONFIG_TMPFS=y
1043# CONFIG_TMPFS_POSIX_ACL is not set 1051# CONFIG_TMPFS_POSIX_ACL is not set
1044CONFIG_HUGETLBFS=y 1052CONFIG_HUGETLBFS=y
1045CONFIG_HUGETLB_PAGE=y 1053CONFIG_HUGETLB_PAGE=y
1046CONFIG_RAMFS=y
1047# CONFIG_CONFIGFS_FS is not set 1054# CONFIG_CONFIGFS_FS is not set
1048 1055
1049# 1056#
@@ -1062,10 +1069,7 @@ CONFIG_RAMFS=y
1062# CONFIG_QNX4FS_FS is not set 1069# CONFIG_QNX4FS_FS is not set
1063# CONFIG_SYSV_FS is not set 1070# CONFIG_SYSV_FS is not set
1064# CONFIG_UFS_FS is not set 1071# CONFIG_UFS_FS is not set
1065 1072CONFIG_NETWORK_FILESYSTEMS=y
1066#
1067# Network File Systems
1068#
1069CONFIG_NFS_FS=m 1073CONFIG_NFS_FS=m
1070CONFIG_NFS_V3=y 1074CONFIG_NFS_V3=y
1071# CONFIG_NFS_V3_ACL is not set 1075# CONFIG_NFS_V3_ACL is not set
@@ -1082,6 +1086,7 @@ CONFIG_EXPORTFS=m
1082CONFIG_NFS_COMMON=y 1086CONFIG_NFS_COMMON=y
1083CONFIG_SUNRPC=m 1087CONFIG_SUNRPC=m
1084CONFIG_SUNRPC_GSS=m 1088CONFIG_SUNRPC_GSS=m
1089CONFIG_SUNRPC_XPRT_RDMA=m
1085# CONFIG_SUNRPC_BIND34 is not set 1090# CONFIG_SUNRPC_BIND34 is not set
1086CONFIG_RPCSEC_GSS_KRB5=m 1091CONFIG_RPCSEC_GSS_KRB5=m
1087# CONFIG_RPCSEC_GSS_SPKM3 is not set 1092# CONFIG_RPCSEC_GSS_SPKM3 is not set
@@ -1118,10 +1123,6 @@ CONFIG_SGI_PARTITION=y
1118# CONFIG_KARMA_PARTITION is not set 1123# CONFIG_KARMA_PARTITION is not set
1119CONFIG_EFI_PARTITION=y 1124CONFIG_EFI_PARTITION=y
1120# CONFIG_SYSV68_PARTITION is not set 1125# CONFIG_SYSV68_PARTITION is not set
1121
1122#
1123# Native Language Support
1124#
1125CONFIG_NLS=y 1126CONFIG_NLS=y
1126CONFIG_NLS_DEFAULT="iso8859-1" 1127CONFIG_NLS_DEFAULT="iso8859-1"
1127CONFIG_NLS_CODEPAGE_437=y 1128CONFIG_NLS_CODEPAGE_437=y
@@ -1162,10 +1163,6 @@ CONFIG_NLS_ISO8859_1=y
1162# CONFIG_NLS_KOI8_R is not set 1163# CONFIG_NLS_KOI8_R is not set
1163# CONFIG_NLS_KOI8_U is not set 1164# CONFIG_NLS_KOI8_U is not set
1164CONFIG_NLS_UTF8=y 1165CONFIG_NLS_UTF8=y
1165
1166#
1167# Distributed Lock Manager
1168#
1169# CONFIG_DLM is not set 1166# CONFIG_DLM is not set
1170 1167
1171# 1168#
@@ -1223,6 +1220,7 @@ CONFIG_DEBUG_INFO=y
1223# CONFIG_DEBUG_VM is not set 1220# CONFIG_DEBUG_VM is not set
1224# CONFIG_DEBUG_LIST is not set 1221# CONFIG_DEBUG_LIST is not set
1225CONFIG_FORCED_INLINING=y 1222CONFIG_FORCED_INLINING=y
1223# CONFIG_BOOT_PRINTK_DELAY is not set
1226# CONFIG_RCU_TORTURE_TEST is not set 1224# CONFIG_RCU_TORTURE_TEST is not set
1227# CONFIG_FAULT_INJECTION is not set 1225# CONFIG_FAULT_INJECTION is not set
1228CONFIG_IA64_GRANULE_16MB=y 1226CONFIG_IA64_GRANULE_16MB=y
@@ -1238,6 +1236,7 @@ CONFIG_SYSVIPC_COMPAT=y
1238# 1236#
1239# CONFIG_KEYS is not set 1237# CONFIG_KEYS is not set
1240# CONFIG_SECURITY is not set 1238# CONFIG_SECURITY is not set
1239# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1241CONFIG_XOR_BLOCKS=y 1240CONFIG_XOR_BLOCKS=y
1242CONFIG_ASYNC_CORE=y 1241CONFIG_ASYNC_CORE=y
1243CONFIG_ASYNC_MEMCPY=y 1242CONFIG_ASYNC_MEMCPY=y
@@ -1262,6 +1261,7 @@ CONFIG_CRYPTO_ECB=m
1262CONFIG_CRYPTO_CBC=m 1261CONFIG_CRYPTO_CBC=m
1263CONFIG_CRYPTO_PCBC=m 1262CONFIG_CRYPTO_PCBC=m
1264# CONFIG_CRYPTO_LRW is not set 1263# CONFIG_CRYPTO_LRW is not set
1264# CONFIG_CRYPTO_XTS is not set
1265# CONFIG_CRYPTO_CRYPTD is not set 1265# CONFIG_CRYPTO_CRYPTD is not set
1266CONFIG_CRYPTO_DES=m 1266CONFIG_CRYPTO_DES=m
1267# CONFIG_CRYPTO_FCRYPT is not set 1267# CONFIG_CRYPTO_FCRYPT is not set
@@ -1275,9 +1275,11 @@ CONFIG_CRYPTO_DES=m
1275# CONFIG_CRYPTO_ARC4 is not set 1275# CONFIG_CRYPTO_ARC4 is not set
1276# CONFIG_CRYPTO_KHAZAD is not set 1276# CONFIG_CRYPTO_KHAZAD is not set
1277# CONFIG_CRYPTO_ANUBIS is not set 1277# CONFIG_CRYPTO_ANUBIS is not set
1278# CONFIG_CRYPTO_SEED is not set
1278CONFIG_CRYPTO_DEFLATE=m 1279CONFIG_CRYPTO_DEFLATE=m
1279# CONFIG_CRYPTO_MICHAEL_MIC is not set 1280# CONFIG_CRYPTO_MICHAEL_MIC is not set
1280CONFIG_CRYPTO_CRC32C=m 1281CONFIG_CRYPTO_CRC32C=m
1281# CONFIG_CRYPTO_CAMELLIA is not set 1282# CONFIG_CRYPTO_CAMELLIA is not set
1282# CONFIG_CRYPTO_TEST is not set 1283# CONFIG_CRYPTO_TEST is not set
1284# CONFIG_CRYPTO_AUTHENC is not set
1283# CONFIG_CRYPTO_HW is not set 1285# CONFIG_CRYPTO_HW is not set
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 3f7ea13358e9..6216eba2e38f 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -1231,7 +1231,7 @@ kdump_find_rsvd_region (unsigned long size,
1231 1231
1232#ifdef CONFIG_PROC_VMCORE 1232#ifdef CONFIG_PROC_VMCORE
1233/* locate the size find a the descriptor at a certain address */ 1233/* locate the size find a the descriptor at a certain address */
1234unsigned long 1234unsigned long __init
1235vmcore_find_descriptor_size (unsigned long address) 1235vmcore_find_descriptor_size (unsigned long address)
1236{ 1236{
1237 void *efi_map_start, *efi_map_end, *p; 1237 void *efi_map_start, *efi_map_end, *p;
diff --git a/arch/ia64/kernel/gate.lds.S b/arch/ia64/kernel/gate.lds.S
index 44817d97ab43..454d7a7dfa9d 100644
--- a/arch/ia64/kernel/gate.lds.S
+++ b/arch/ia64/kernel/gate.lds.S
@@ -20,6 +20,8 @@ SECTIONS
20 .gnu.version_d : { *(.gnu.version_d) } 20 .gnu.version_d : { *(.gnu.version_d) }
21 .gnu.version_r : { *(.gnu.version_r) } 21 .gnu.version_r : { *(.gnu.version_r) }
22 22
23 .note : { *(.note*) } :readable :note
24
23 .dynamic : { *(.dynamic) } :readable :dynamic 25 .dynamic : { *(.dynamic) } :readable :dynamic
24 26
25 /* 27 /*
@@ -83,6 +85,7 @@ PHDRS
83 epc PT_LOAD FILEHDR PHDRS FLAGS(1); /* PF_X */ 85 epc PT_LOAD FILEHDR PHDRS FLAGS(1); /* PF_X */
84#endif 86#endif
85 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 87 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
88 note PT_NOTE FLAGS(4); /* PF_R */
86 unwind PT_IA_64_UNWIND; 89 unwind PT_IA_64_UNWIND;
87} 90}
88 91
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 2fdbd5c3f213..e86d02959794 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -109,7 +109,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
109 write_msi_msg(irq, &msg); 109 write_msi_msg(irq, &msg);
110 set_irq_chip_and_handler(irq, &ia64_msi_chip, handle_edge_irq); 110 set_irq_chip_and_handler(irq, &ia64_msi_chip, handle_edge_irq);
111 111
112 return irq; 112 return 0;
113} 113}
114 114
115void ia64_teardown_msi_irq(unsigned int irq) 115void ia64_teardown_msi_irq(unsigned int irq)
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index ae6c3c02e117..2b3751eef5ce 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -417,34 +417,6 @@ mark_bsp_online (void)
417#endif 417#endif
418} 418}
419 419
420#ifdef CONFIG_SMP
421static void __init
422check_for_logical_procs (void)
423{
424 pal_logical_to_physical_t info;
425 s64 status;
426
427 status = ia64_pal_logical_to_phys(0, &info);
428 if (status == -1) {
429 printk(KERN_INFO "No logical to physical processor mapping "
430 "available\n");
431 return;
432 }
433 if (status) {
434 printk(KERN_ERR "ia64_pal_logical_to_phys failed with %ld\n",
435 status);
436 return;
437 }
438 /*
439 * Total number of siblings that BSP has. Though not all of them
440 * may have booted successfully. The correct number of siblings
441 * booted is in info.overview_num_log.
442 */
443 smp_num_siblings = info.overview_tpc;
444 smp_num_cpucores = info.overview_cpp;
445}
446#endif
447
448static __initdata int nomca; 420static __initdata int nomca;
449static __init int setup_nomca(char *s) 421static __init int setup_nomca(char *s)
450{ 422{
@@ -540,15 +512,6 @@ setup_arch (char **cmdline_p)
540 512
541#ifdef CONFIG_SMP 513#ifdef CONFIG_SMP
542 cpu_physical_id(0) = hard_smp_processor_id(); 514 cpu_physical_id(0) = hard_smp_processor_id();
543 check_for_logical_procs();
544 if (smp_num_cpucores > 1)
545 printk(KERN_INFO
546 "cpu package is Multi-Core capable: number of cores=%d\n",
547 smp_num_cpucores);
548 if (smp_num_siblings > 1)
549 printk(KERN_INFO
550 "cpu package is Multi-Threading capable: number of siblings=%d\n",
551 smp_num_siblings);
552#endif 515#endif
553 516
554 cpu_init(); /* initialize the bootstrap CPU */ 517 cpu_init(); /* initialize the bootstrap CPU */
@@ -661,12 +624,13 @@ show_cpuinfo (struct seq_file *m, void *v)
661 lpj*HZ/500000, (lpj*HZ/5000) % 100); 624 lpj*HZ/500000, (lpj*HZ/5000) % 100);
662#ifdef CONFIG_SMP 625#ifdef CONFIG_SMP
663 seq_printf(m, "siblings : %u\n", cpus_weight(cpu_core_map[cpunum])); 626 seq_printf(m, "siblings : %u\n", cpus_weight(cpu_core_map[cpunum]));
627 if (c->socket_id != -1)
628 seq_printf(m, "physical id: %u\n", c->socket_id);
664 if (c->threads_per_core > 1 || c->cores_per_socket > 1) 629 if (c->threads_per_core > 1 || c->cores_per_socket > 1)
665 seq_printf(m, 630 seq_printf(m,
666 "physical id: %u\n" 631 "core id : %u\n"
667 "core id : %u\n" 632 "thread id : %u\n",
668 "thread id : %u\n", 633 c->core_id, c->thread_id);
669 c->socket_id, c->core_id, c->thread_id);
670#endif 634#endif
671 seq_printf(m,"\n"); 635 seq_printf(m,"\n");
672 636
@@ -778,6 +742,9 @@ identify_cpu (struct cpuinfo_ia64 *c)
778 c->socket_id = -1; 742 c->socket_id = -1;
779 743
780 identify_siblings(c); 744 identify_siblings(c);
745
746 if (c->threads_per_core > smp_num_siblings)
747 smp_num_siblings = c->threads_per_core;
781#endif 748#endif
782 c->ppn = cpuid.field.ppn; 749 c->ppn = cpuid.field.ppn;
783 c->number = cpuid.field.number; 750 c->number = cpuid.field.number;
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index c57dbce25c12..f0fc4d8465ad 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -142,7 +142,6 @@ DEFINE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
142EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); 142EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
143 143
144int smp_num_siblings = 1; 144int smp_num_siblings = 1;
145int smp_num_cpucores = 1;
146 145
147/* which logical CPU number maps to which CPU (physical APIC ID) */ 146/* which logical CPU number maps to which CPU (physical APIC ID) */
148volatile int ia64_cpu_to_sapicid[NR_CPUS]; 147volatile int ia64_cpu_to_sapicid[NR_CPUS];
@@ -886,13 +885,17 @@ identify_siblings(struct cpuinfo_ia64 *c)
886 u16 pltid; 885 u16 pltid;
887 pal_logical_to_physical_t info; 886 pal_logical_to_physical_t info;
888 887
889 if (smp_num_cpucores == 1 && smp_num_siblings == 1)
890 return;
891
892 if ((status = ia64_pal_logical_to_phys(-1, &info)) != PAL_STATUS_SUCCESS) { 888 if ((status = ia64_pal_logical_to_phys(-1, &info)) != PAL_STATUS_SUCCESS) {
893 printk(KERN_ERR "ia64_pal_logical_to_phys failed with %ld\n", 889 if (status != PAL_STATUS_UNIMPLEMENTED) {
894 status); 890 printk(KERN_ERR
895 return; 891 "ia64_pal_logical_to_phys failed with %ld\n",
892 status);
893 return;
894 }
895
896 info.overview_ppid = 0;
897 info.overview_cpp = 1;
898 info.overview_tpc = 1;
896 } 899 }
897 if ((status = ia64_sal_physical_id_info(&pltid)) != PAL_STATUS_SUCCESS) { 900 if ((status = ia64_sal_physical_id_info(&pltid)) != PAL_STATUS_SUCCESS) {
898 printk(KERN_ERR "ia64_sal_pltid failed with %ld\n", status); 901 printk(KERN_ERR "ia64_sal_pltid failed with %ld\n", status);
@@ -900,6 +903,10 @@ identify_siblings(struct cpuinfo_ia64 *c)
900 } 903 }
901 904
902 c->socket_id = (pltid << 8) | info.overview_ppid; 905 c->socket_id = (pltid << 8) | info.overview_ppid;
906
907 if (info.overview_cpp == 1 && info.overview_tpc == 1)
908 return;
909
903 c->cores_per_socket = info.overview_cpp; 910 c->cores_per_socket = info.overview_cpp;
904 c->threads_per_core = info.overview_tpc; 911 c->threads_per_core = info.overview_tpc;
905 c->num_log = info.overview_num_log; 912 c->num_log = info.overview_num_log;
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index c6c19bf11bec..25aef6211a54 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -472,7 +472,7 @@ struct memmap_init_callback_data {
472 unsigned long zone; 472 unsigned long zone;
473}; 473};
474 474
475static int 475static int __meminit
476virtual_memmap_init (u64 start, u64 end, void *arg) 476virtual_memmap_init (u64 start, u64 end, void *arg)
477{ 477{
478 struct memmap_init_callback_data *args; 478 struct memmap_init_callback_data *args;
@@ -503,7 +503,7 @@ virtual_memmap_init (u64 start, u64 end, void *arg)
503 return 0; 503 return 0;
504} 504}
505 505
506void 506void __meminit
507memmap_init (unsigned long size, int nid, unsigned long zone, 507memmap_init (unsigned long size, int nid, unsigned long zone,
508 unsigned long start_pfn) 508 unsigned long start_pfn)
509{ 509{
diff --git a/arch/ia64/scripts/check-segrel.lds b/arch/ia64/scripts/check-segrel.lds
index 1c2f13e181d0..85a0d54fb5ab 100644
--- a/arch/ia64/scripts/check-segrel.lds
+++ b/arch/ia64/scripts/check-segrel.lds
@@ -1,6 +1,7 @@
1SECTIONS { 1SECTIONS {
2 . = SIZEOF_HEADERS; 2 . = SIZEOF_HEADERS;
3 .rodata : { *(.rodata) } :ro 3 .rodata : { *(.rodata) } :ro
4 .note : { *(.note*) }
4 . = 0xa0000; 5 . = 0xa0000;
5 .data : { *(.data) } :dat 6 .data : { *(.data) } :dat
6 /DISCARD/ : { *(*) } 7 /DISCARD/ : { *(*) }
diff --git a/arch/ia64/sn/kernel/mca.c b/arch/ia64/sn/kernel/mca.c
index 3db62f24596c..868c9aa64fe2 100644
--- a/arch/ia64/sn/kernel/mca.c
+++ b/arch/ia64/sn/kernel/mca.c
@@ -98,6 +98,7 @@ sn_platform_plat_specific_err_print(const u8 * sect_header, u8 ** oemdata,
98 while (*sn_oemdata_size > sn_oemdata_bufsize) { 98 while (*sn_oemdata_size > sn_oemdata_bufsize) {
99 u8 *newbuf = vmalloc(*sn_oemdata_size); 99 u8 *newbuf = vmalloc(*sn_oemdata_size);
100 if (!newbuf) { 100 if (!newbuf) {
101 mutex_unlock(&sn_oemdata_mutex);
101 printk(KERN_ERR "%s: unable to extend sn_oemdata\n", 102 printk(KERN_ERR "%s: unable to extend sn_oemdata\n",
102 __FUNCTION__); 103 __FUNCTION__);
103 return 1; 104 return 1;
diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
index ef490e1ce600..6f8c080dd9f9 100644
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -9,10 +9,10 @@
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10#include <linux/device.h> 10#include <linux/device.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/scatterlist.h>
12#include <linux/vmalloc.h> 13#include <linux/vmalloc.h>
13 14
14#include <asm/pgalloc.h> 15#include <asm/pgalloc.h>
15#include <asm/scatterlist.h>
16 16
17void *dma_alloc_coherent(struct device *dev, size_t size, 17void *dma_alloc_coherent(struct device *dev, size_t size,
18 dma_addr_t *handle, gfp_t flag) 18 dma_addr_t *handle, gfp_t flag)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 61262c5f9c62..2c7d6c240b73 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -546,6 +546,7 @@ config SIBYTE_BIGSUR
546 select SWAP_IO_SPACE 546 select SWAP_IO_SPACE
547 select SYS_HAS_CPU_SB1 547 select SYS_HAS_CPU_SB1
548 select SYS_SUPPORTS_BIG_ENDIAN 548 select SYS_SUPPORTS_BIG_ENDIAN
549 select SYS_SUPPORTS_HIGHMEM
549 select SYS_SUPPORTS_LITTLE_ENDIAN 550 select SYS_SUPPORTS_LITTLE_ENDIAN
550 551
551config SNI_RM 552config SNI_RM
@@ -583,6 +584,7 @@ config SNI_RM
583 584
584config TOSHIBA_JMR3927 585config TOSHIBA_JMR3927
585 bool "Toshiba JMR-TX3927 board" 586 bool "Toshiba JMR-TX3927 board"
587 select CEVT_TXX9
586 select DMA_NONCOHERENT 588 select DMA_NONCOHERENT
587 select HW_HAS_PCI 589 select HW_HAS_PCI
588 select MIPS_TX3927 590 select MIPS_TX3927
@@ -597,6 +599,7 @@ config TOSHIBA_JMR3927
597config TOSHIBA_RBTX4927 599config TOSHIBA_RBTX4927
598 bool "Toshiba RBTX49[23]7 board" 600 bool "Toshiba RBTX49[23]7 board"
599 select CEVT_R4K 601 select CEVT_R4K
602 select CEVT_TXX9
600 select DMA_NONCOHERENT 603 select DMA_NONCOHERENT
601 select HAS_TXX9_SERIAL 604 select HAS_TXX9_SERIAL
602 select HW_HAS_PCI 605 select HW_HAS_PCI
@@ -618,6 +621,7 @@ config TOSHIBA_RBTX4927
618config TOSHIBA_RBTX4938 621config TOSHIBA_RBTX4938
619 bool "Toshiba RBTX4938 board" 622 bool "Toshiba RBTX4938 board"
620 select CEVT_R4K 623 select CEVT_R4K
624 select CEVT_TXX9
621 select DMA_NONCOHERENT 625 select DMA_NONCOHERENT
622 select HAS_TXX9_SERIAL 626 select HAS_TXX9_SERIAL
623 select HW_HAS_PCI 627 select HW_HAS_PCI
@@ -730,12 +734,27 @@ config ARCH_MAY_HAVE_PC_FDC
730config BOOT_RAW 734config BOOT_RAW
731 bool 735 bool
732 736
737config CEVT_BCM1480
738 bool
739
733config CEVT_GT641XX 740config CEVT_GT641XX
734 bool 741 bool
735 742
736config CEVT_R4K 743config CEVT_R4K
737 bool 744 bool
738 745
746config CEVT_SB1250
747 bool
748
749config CEVT_TXX9
750 bool
751
752config CSRC_BCM1480
753 bool
754
755config CSRC_SB1250
756 bool
757
739config CFE 758config CFE
740 bool 759 bool
741 760
diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c
index 59e932a928d2..ddfb7f0a17a6 100644
--- a/arch/mips/au1000/common/irq.c
+++ b/arch/mips/au1000/common/irq.c
@@ -318,38 +318,6 @@ static struct irq_chip level_irq_type = {
318 .end = end_irq, 318 .end = end_irq,
319}; 319};
320 320
321#ifdef CONFIG_PM
322void startup_match20_interrupt(irq_handler_t handler)
323{
324 struct irq_desc *desc = &irq_desc[AU1000_TOY_MATCH2_INT];
325
326 static struct irqaction action;
327 memset(&action, 0, sizeof(struct irqaction));
328
329 /*
330 * This is a big problem.... since we didn't use request_irq
331 * when kernel/irq.c calls probe_irq_xxx this interrupt will
332 * be probed for usage. This will end up disabling the device :(
333 * Give it a bogus "action" pointer -- this will keep it from
334 * getting auto-probed!
335 *
336 * By setting the status to match that of request_irq() we
337 * can avoid it. --cgray
338 */
339 action.dev_id = handler;
340 action.flags = IRQF_DISABLED;
341 cpus_clear(action.mask);
342 action.name = "Au1xxx TOY";
343 action.handler = handler;
344 action.next = NULL;
345
346 desc->action = &action;
347 desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS);
348
349 local_enable_irq(AU1000_TOY_MATCH2_INT);
350}
351#endif
352
353static void __init setup_local_irq(unsigned int irq_nr, int type, int int_req) 321static void __init setup_local_irq(unsigned int irq_nr, int type, int int_req)
354{ 322{
355 unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE; 323 unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE;
diff --git a/arch/mips/au1000/common/time.c b/arch/mips/au1000/common/time.c
index 2556399708ba..f113b512d7b1 100644
--- a/arch/mips/au1000/common/time.c
+++ b/arch/mips/au1000/common/time.c
@@ -67,7 +67,7 @@ static DEFINE_SPINLOCK(time_lock);
67unsigned long wtimer; 67unsigned long wtimer;
68 68
69#ifdef CONFIG_PM 69#ifdef CONFIG_PM
70irqreturn_t counter0_irq(int irq, void *dev_id) 70static irqreturn_t counter0_irq(int irq, void *dev_id)
71{ 71{
72 unsigned long pc0; 72 unsigned long pc0;
73 int time_elapsed; 73 int time_elapsed;
@@ -117,6 +117,13 @@ irqreturn_t counter0_irq(int irq, void *dev_id)
117 return IRQ_HANDLED; 117 return IRQ_HANDLED;
118} 118}
119 119
120struct irqaction counter0_action = {
121 .handler = counter0_irq,
122 .flags = IRQF_DISABLED,
123 .name = "alchemy-toy",
124 .dev_id = NULL,
125};
126
120/* When we wakeup from sleep, we have to "catch up" on all of the 127/* When we wakeup from sleep, we have to "catch up" on all of the
121 * timer ticks we have missed. 128 * timer ticks we have missed.
122 */ 129 */
@@ -221,7 +228,7 @@ unsigned long cal_r4koff(void)
221 return (cpu_speed / HZ); 228 return (cpu_speed / HZ);
222} 229}
223 230
224void __init plat_timer_setup(struct irqaction *irq) 231void __init plat_time_init(void)
225{ 232{
226 unsigned int est_freq; 233 unsigned int est_freq;
227 234
@@ -255,15 +262,10 @@ void __init plat_timer_setup(struct irqaction *irq)
255 * we do this. 262 * we do this.
256 */ 263 */
257 if (no_au1xxx_32khz) { 264 if (no_au1xxx_32khz) {
258 unsigned int c0_status;
259
260 printk("WARNING: no 32KHz clock found.\n"); 265 printk("WARNING: no 32KHz clock found.\n");
261 266
262 /* Ensure we get CPO_COUNTER interrupts. 267 /* Ensure we get CPO_COUNTER interrupts. */
263 */ 268 set_c0_status(IE_IRQ5);
264 c0_status = read_c0_status();
265 c0_status |= IE_IRQ5;
266 write_c0_status(c0_status);
267 } 269 }
268 else { 270 else {
269 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S); 271 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S);
@@ -280,7 +282,7 @@ void __init plat_timer_setup(struct irqaction *irq)
280 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2); 282 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);
281 au_sync(); 283 au_sync();
282 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); 284 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);
283 startup_match20_interrupt(counter0_irq); 285 setup_irq(AU1000_TOY_MATCH2_INT, &counter0_action);
284 286
285 /* We can use the real 'wait' instruction. 287 /* We can use the real 'wait' instruction.
286 */ 288 */
diff --git a/arch/mips/au1000/mtx-1/Makefile b/arch/mips/au1000/mtx-1/Makefile
index 764bf9f7e281..85a90941de4f 100644
--- a/arch/mips/au1000/mtx-1/Makefile
+++ b/arch/mips/au1000/mtx-1/Makefile
@@ -8,3 +8,6 @@
8# 8#
9 9
10lib-y := init.o board_setup.o irqmap.o 10lib-y := init.o board_setup.o irqmap.o
11obj-y := platform.o
12
13EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/au1000/mtx-1/platform.c b/arch/mips/au1000/mtx-1/platform.c
new file mode 100644
index 000000000000..49c0fb409fea
--- /dev/null
+++ b/arch/mips/au1000/mtx-1/platform.c
@@ -0,0 +1,77 @@
1/*
2 * MTX-1 platform devices registration
3 *
4 * Copyright (C) 2007, Florian Fainelli <florian@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/init.h>
22#include <linux/types.h>
23#include <linux/platform_device.h>
24#include <linux/leds.h>
25
26#include <asm/gpio.h>
27
28static struct resource mtx1_wdt_res[] = {
29 [0] = {
30 .start = 15,
31 .end = 15,
32 .name = "mtx1-wdt-gpio",
33 .flags = IORESOURCE_IRQ,
34 }
35};
36
37static struct platform_device mtx1_wdt = {
38 .name = "mtx1-wdt",
39 .id = 0,
40 .num_resources = ARRAY_SIZE(mtx1_wdt_res),
41 .resource = mtx1_wdt_res,
42};
43
44static struct gpio_led default_leds[] = {
45 {
46 .name = "mtx1:green",
47 .gpio = 211,
48 }, {
49 .name = "mtx1:red",
50 .gpio = 212,
51 },
52};
53
54static struct gpio_led_platform_data mtx1_led_data = {
55 .num_leds = ARRAY_SIZE(default_leds),
56 .leds = default_leds,
57};
58
59static struct platform_device mtx1_gpio_leds = {
60 .name = "leds-gpio",
61 .id = -1,
62 .dev = {
63 .platform_data = &mtx1_led_data,
64 }
65};
66
67static struct __initdata platform_device * mtx1_devs[] = {
68 &mtx1_gpio_leds,
69 &mtx1_wdt
70};
71
72static int __init mtx1_register_devices(void)
73{
74 return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
75}
76
77arch_initcall(mtx1_register_devices);
diff --git a/arch/mips/au1000/pb1200/Makefile b/arch/mips/au1000/pb1200/Makefile
index 22b673cf55af..970b1b1d5cda 100644
--- a/arch/mips/au1000/pb1200/Makefile
+++ b/arch/mips/au1000/pb1200/Makefile
@@ -3,3 +3,5 @@
3# 3#
4 4
5lib-y := init.o board_setup.o irqmap.o 5lib-y := init.o board_setup.o irqmap.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/au1000/pb1200/board_setup.c b/arch/mips/au1000/pb1200/board_setup.c
index 5dbc9868f598..b98bebfa87c6 100644
--- a/arch/mips/au1000/pb1200/board_setup.c
+++ b/arch/mips/au1000/pb1200/board_setup.c
@@ -68,9 +68,11 @@ void board_reset(void)
68void __init board_setup(void) 68void __init board_setup(void)
69{ 69{
70 char *argptr = NULL; 70 char *argptr = NULL;
71 u32 pin_func;
72 71
73#if 0 72#if 0
73 {
74 u32 pin_func;
75
74 /* Enable PSC1 SYNC for AC97. Normaly done in audio driver, 76 /* Enable PSC1 SYNC for AC97. Normaly done in audio driver,
75 * but it is board specific code, so put it here. 77 * but it is board specific code, so put it here.
76 */ 78 */
@@ -81,11 +83,13 @@ void __init board_setup(void)
81 83
82 au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */ 84 au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */
83 au_sync(); 85 au_sync();
86 }
84#endif 87#endif
85 88
86#if defined(CONFIG_I2C_AU1550) 89#if defined(CONFIG_I2C_AU1550)
87 { 90 {
88 u32 freq0, clksrc; 91 u32 freq0, clksrc;
92 u32 pin_func;
89 93
90 /* Select SMBUS in CPLD */ 94 /* Select SMBUS in CPLD */
91 bcsr->resets &= ~(BCSR_RESETS_PCS0MUX); 95 bcsr->resets &= ~(BCSR_RESETS_PCS0MUX);
diff --git a/arch/mips/au1000/pb1200/irqmap.c b/arch/mips/au1000/pb1200/irqmap.c
index bdf00e2a35e4..c096be4ed4e7 100644
--- a/arch/mips/au1000/pb1200/irqmap.c
+++ b/arch/mips/au1000/pb1200/irqmap.c
@@ -94,51 +94,41 @@ inline void pb1200_disable_irq(unsigned int irq_nr)
94 bcsr->intclr = 1<<(irq_nr - PB1200_INT_BEGIN); 94 bcsr->intclr = 1<<(irq_nr - PB1200_INT_BEGIN);
95} 95}
96 96
97static unsigned int pb1200_startup_irq( unsigned int irq_nr ) 97static unsigned int pb1200_setup_cascade(void)
98{ 98{
99 if (++pb1200_cascade_en == 1) 99 int err;
100 { 100
101 request_irq(AU1000_GPIO_7, &pb1200_cascade_handler, 101 err = request_irq(AU1000_GPIO_7, &pb1200_cascade_handler,
102 0, "Pb1200 Cascade", (void *)&pb1200_cascade_handler ); 102 0, "Pb1200 Cascade", &pb1200_cascade_handler);
103#ifdef CONFIG_MIPS_PB1200 103 if (err)
104 /* We have a problem with CPLD rev3. Enable a workaround */ 104 return err;
105 if( ((bcsr->whoami & BCSR_WHOAMI_CPLD)>>4) <= 3) 105
106 {
107 printk("\nWARNING!!!\n");
108 printk("\nWARNING!!!\n");
109 printk("\nWARNING!!!\n");
110 printk("\nWARNING!!!\n");
111 printk("\nWARNING!!!\n");
112 printk("\nWARNING!!!\n");
113 printk("Pb1200 must be at CPLD rev4. Please have Pb1200\n");
114 printk("updated to latest revision. This software will not\n");
115 printk("work on anything less than CPLD rev4\n");
116 printk("\nWARNING!!!\n");
117 printk("\nWARNING!!!\n");
118 printk("\nWARNING!!!\n");
119 printk("\nWARNING!!!\n");
120 printk("\nWARNING!!!\n");
121 printk("\nWARNING!!!\n");
122 while(1);
123 }
124#endif
125 }
126 pb1200_enable_irq(irq_nr);
127 return 0; 106 return 0;
128} 107}
129 108
130static void pb1200_shutdown_irq( unsigned int irq_nr ) 109static unsigned int pb1200_startup_irq(unsigned int irq)
131{ 110{
132 pb1200_disable_irq(irq_nr); 111 if (++pb1200_cascade_en == 1) {
133 if (--pb1200_cascade_en == 0) 112 int res;
134 { 113
135 free_irq(AU1000_GPIO_7, &pb1200_cascade_handler ); 114 res = pb1200_setup_cascade();
115 if (res)
116 return res;
136 } 117 }
137 return; 118
119 pb1200_enable_irq(irq);
120
121 return 0;
138} 122}
139 123
140static struct irq_chip external_irq_type = 124static void pb1200_shutdown_irq(unsigned int irq)
141{ 125{
126 pb1200_disable_irq(irq);
127 if (--pb1200_cascade_en == 0)
128 free_irq(AU1000_GPIO_7, &pb1200_cascade_handler);
129}
130
131static struct irq_chip external_irq_type = {
142#ifdef CONFIG_MIPS_PB1200 132#ifdef CONFIG_MIPS_PB1200
143 .name = "Pb1200 Ext", 133 .name = "Pb1200 Ext",
144#endif 134#endif
@@ -155,16 +145,38 @@ static struct irq_chip external_irq_type =
155 145
156void _board_init_irq(void) 146void _board_init_irq(void)
157{ 147{
158 int irq_nr; 148 unsigned int irq;
159 149
160 for (irq_nr = PB1200_INT_BEGIN; irq_nr <= PB1200_INT_END; irq_nr++) 150#ifdef CONFIG_MIPS_PB1200
161 { 151 /* We have a problem with CPLD rev3. Enable a workaround */
162 set_irq_chip_and_handler(irq_nr, &external_irq_type, 152 if (((bcsr->whoami & BCSR_WHOAMI_CPLD) >> 4) <= 3) {
153 printk("\nWARNING!!!\n");
154 printk("\nWARNING!!!\n");
155 printk("\nWARNING!!!\n");
156 printk("\nWARNING!!!\n");
157 printk("\nWARNING!!!\n");
158 printk("\nWARNING!!!\n");
159 printk("Pb1200 must be at CPLD rev4. Please have Pb1200\n");
160 printk("updated to latest revision. This software will not\n");
161 printk("work on anything less than CPLD rev4\n");
162 printk("\nWARNING!!!\n");
163 printk("\nWARNING!!!\n");
164 printk("\nWARNING!!!\n");
165 printk("\nWARNING!!!\n");
166 printk("\nWARNING!!!\n");
167 printk("\nWARNING!!!\n");
168 panic("Game over. Your score is 0.");
169 }
170#endif
171
172 for (irq = PB1200_INT_BEGIN; irq <= PB1200_INT_END; irq++) {
173 set_irq_chip_and_handler(irq, &external_irq_type,
163 handle_level_irq); 174 handle_level_irq);
164 pb1200_disable_irq(irq_nr); 175 pb1200_disable_irq(irq);
165 } 176 }
166 177
167 /* GPIO_7 can not be hooked here, so it is hooked upon first 178 /*
168 request of any source attached to the cascade */ 179 * GPIO_7 can not be hooked here, so it is hooked upon first
180 * request of any source attached to the cascade
181 */
169} 182}
170
diff --git a/arch/mips/basler/excite/excite_setup.c b/arch/mips/basler/excite/excite_setup.c
index 404ca9284b30..6dd8f0d46d09 100644
--- a/arch/mips/basler/excite/excite_setup.c
+++ b/arch/mips/basler/excite/excite_setup.c
@@ -68,24 +68,23 @@ DEFINE_SPINLOCK(titan_lock);
68int titan_irqflags; 68int titan_irqflags;
69 69
70 70
71/*
72 * The eXcite platform uses the alternate timer interrupt
73 *
74 * Fixme: At the time of this writing cevt-r4k.c doesn't yet know about how
75 * to handle the alternate timer interrupt of the RM9000.
76 */
71void __init plat_time_init(void) 77void __init plat_time_init(void)
72{ 78{
73 const u32 modebit5 = ocd_readl(0x00e4); 79 const u32 modebit5 = ocd_readl(0x00e4);
74 unsigned int 80 unsigned int mult = ((modebit5 >> 11) & 0x1f) + 2;
75 mult = ((modebit5 >> 11) & 0x1f) + 2, 81 unsigned int div = ((modebit5 >> 16) & 0x1f) + 2;
76 div = ((modebit5 >> 16) & 0x1f) + 2;
77 82
78 if (div == 33) div = 1; 83 if (div == 33)
84 div = 1;
79 mips_hpt_frequency = EXCITE_CPU_EXT_CLOCK * mult / div / 2; 85 mips_hpt_frequency = EXCITE_CPU_EXT_CLOCK * mult / div / 2;
80} 86}
81 87
82void __init plat_timer_setup(struct irqaction *irq)
83{
84 /* The eXcite platform uses the alternate timer interrupt */
85 set_c0_intcontrol(0x80);
86 setup_irq(TIMER_IRQ, irq);
87}
88
89static int __init excite_init_console(void) 88static int __init excite_init_console(void)
90{ 89{
91#if defined(CONFIG_SERIAL_8250) 90#if defined(CONFIG_SERIAL_8250)
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index 885b633647e9..5a8b7acb7dd7 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -738,7 +738,6 @@ CONFIG_HW_CONSOLE=y
738CONFIG_VT_HW_CONSOLE_BINDING=y 738CONFIG_VT_HW_CONSOLE_BINDING=y
739# CONFIG_SERIAL_NONSTANDARD is not set 739# CONFIG_SERIAL_NONSTANDARD is not set
740# CONFIG_AU1X00_GPIO is not set 740# CONFIG_AU1X00_GPIO is not set
741# CONFIG_TS_AU1X00_ADS7846 is not set
742 741
743# 742#
744# Serial drivers 743# Serial drivers
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
index e3c3a07e8a7c..d4ed90bca269 100644
--- a/arch/mips/configs/db1100_defconfig
+++ b/arch/mips/configs/db1100_defconfig
@@ -714,7 +714,6 @@ CONFIG_HW_CONSOLE=y
714CONFIG_VT_HW_CONSOLE_BINDING=y 714CONFIG_VT_HW_CONSOLE_BINDING=y
715# CONFIG_SERIAL_NONSTANDARD is not set 715# CONFIG_SERIAL_NONSTANDARD is not set
716# CONFIG_AU1X00_GPIO is not set 716# CONFIG_AU1X00_GPIO is not set
717# CONFIG_TS_AU1X00_ADS7846 is not set
718 717
719# 718#
720# Serial drivers 719# Serial drivers
diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index 9aa7c3ebfa3f..a055657e6983 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -775,7 +775,6 @@ CONFIG_HW_CONSOLE=y
775CONFIG_VT_HW_CONSOLE_BINDING=y 775CONFIG_VT_HW_CONSOLE_BINDING=y
776# CONFIG_SERIAL_NONSTANDARD is not set 776# CONFIG_SERIAL_NONSTANDARD is not set
777# CONFIG_AU1X00_GPIO is not set 777# CONFIG_AU1X00_GPIO is not set
778# CONFIG_TS_AU1X00_ADS7846 is not set
779 778
780# 779#
781# Serial drivers 780# Serial drivers
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
index 99240668bca1..0ad08cf446ec 100644
--- a/arch/mips/configs/db1500_defconfig
+++ b/arch/mips/configs/db1500_defconfig
@@ -811,7 +811,6 @@ CONFIG_SERIO_RAW=m
811# CONFIG_VT is not set 811# CONFIG_VT is not set
812# CONFIG_SERIAL_NONSTANDARD is not set 812# CONFIG_SERIAL_NONSTANDARD is not set
813# CONFIG_AU1X00_GPIO is not set 813# CONFIG_AU1X00_GPIO is not set
814# CONFIG_TS_AU1X00_ADS7846 is not set
815 814
816# 815#
817# Serial drivers 816# Serial drivers
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
index 19992f76c60d..057c7d429c80 100644
--- a/arch/mips/configs/db1550_defconfig
+++ b/arch/mips/configs/db1550_defconfig
@@ -856,7 +856,6 @@ CONFIG_SERIO_RAW=m
856# CONFIG_VT is not set 856# CONFIG_VT is not set
857# CONFIG_SERIAL_NONSTANDARD is not set 857# CONFIG_SERIAL_NONSTANDARD is not set
858# CONFIG_AU1X00_GPIO is not set 858# CONFIG_AU1X00_GPIO is not set
859# CONFIG_TS_AU1X00_ADS7846 is not set
860 859
861# 860#
862# Serial drivers 861# Serial drivers
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
index d53fa8f8e099..703d28db05b9 100644
--- a/arch/mips/configs/pb1100_defconfig
+++ b/arch/mips/configs/pb1100_defconfig
@@ -731,7 +731,6 @@ CONFIG_HW_CONSOLE=y
731CONFIG_VT_HW_CONSOLE_BINDING=y 731CONFIG_VT_HW_CONSOLE_BINDING=y
732# CONFIG_SERIAL_NONSTANDARD is not set 732# CONFIG_SERIAL_NONSTANDARD is not set
733# CONFIG_AU1X00_GPIO is not set 733# CONFIG_AU1X00_GPIO is not set
734# CONFIG_TS_AU1X00_ADS7846 is not set
735 734
736# 735#
737# Serial drivers 736# Serial drivers
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index dc4aa0c66847..82f0c5cee0dc 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -849,7 +849,6 @@ CONFIG_SERIO_RAW=m
849# CONFIG_VT is not set 849# CONFIG_VT is not set
850# CONFIG_SERIAL_NONSTANDARD is not set 850# CONFIG_SERIAL_NONSTANDARD is not set
851# CONFIG_AU1X00_GPIO is not set 851# CONFIG_AU1X00_GPIO is not set
852# CONFIG_TS_AU1X00_ADS7846 is not set
853 852
854# 853#
855# Serial drivers 854# Serial drivers
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
index 24428e13002b..147a4fc7fdd8 100644
--- a/arch/mips/configs/pb1550_defconfig
+++ b/arch/mips/configs/pb1550_defconfig
@@ -842,7 +842,6 @@ CONFIG_SERIO_RAW=m
842# CONFIG_VT is not set 842# CONFIG_VT is not set
843# CONFIG_SERIAL_NONSTANDARD is not set 843# CONFIG_SERIAL_NONSTANDARD is not set
844# CONFIG_AU1X00_GPIO is not set 844# CONFIG_AU1X00_GPIO is not set
845# CONFIG_TS_AU1X00_ADS7846 is not set
846 845
847# 846#
848# Serial drivers 847# Serial drivers
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
index 49dfcef2518c..c2798229cbfb 100644
--- a/arch/mips/configs/sb1250-swarm_defconfig
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -468,7 +468,7 @@ CONFIG_BLK_DEV_IDEFLOPPY=y
468# 468#
469CONFIG_IDE_GENERIC=y 469CONFIG_IDE_GENERIC=y
470# CONFIG_BLK_DEV_IDEPCI is not set 470# CONFIG_BLK_DEV_IDEPCI is not set
471# CONFIG_BLK_DEV_IDE_SWARM is not set 471CONFIG_BLK_DEV_IDE_SWARM=y
472# CONFIG_IDE_ARM is not set 472# CONFIG_IDE_ARM is not set
473# CONFIG_BLK_DEV_IDEDMA is not set 473# CONFIG_BLK_DEV_IDEDMA is not set
474# CONFIG_IDEDMA_AUTO is not set 474# CONFIG_IDEDMA_AUTO is not set
diff --git a/arch/mips/gt64120/wrppmc/time.c b/arch/mips/gt64120/wrppmc/time.c
index b207e7f1417a..668dbd5f12c5 100644
--- a/arch/mips/gt64120/wrppmc/time.c
+++ b/arch/mips/gt64120/wrppmc/time.c
@@ -19,12 +19,6 @@
19 19
20#define WRPPMC_CPU_CLK_FREQ 40000000 /* 40MHZ */ 20#define WRPPMC_CPU_CLK_FREQ 40000000 /* 40MHZ */
21 21
22void __init plat_timer_setup(struct irqaction *irq)
23{
24 /* Install ISR for timer interrupt */
25 setup_irq(WRPPMC_MIPS_TIMER_IRQ, irq);
26}
27
28/* 22/*
29 * Estimate CPU frequency. Sets mips_hpt_frequency as a side-effect 23 * Estimate CPU frequency. Sets mips_hpt_frequency as a side-effect
30 * 24 *
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index ae25b480723e..d7f8a782aae4 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -97,9 +97,10 @@ asmlinkage void plat_irq_dispatch(void)
97 if (pending & IE_IRQ4) { 97 if (pending & IE_IRQ4) {
98 r4030_read_reg32(JAZZ_TIMER_REGISTER); 98 r4030_read_reg32(JAZZ_TIMER_REGISTER);
99 do_IRQ(JAZZ_TIMER_IRQ); 99 do_IRQ(JAZZ_TIMER_IRQ);
100 } else if (pending & IE_IRQ2) 100 } else if (pending & IE_IRQ2) {
101 do_IRQ(r4030_read_reg32(JAZZ_EISA_IRQ_ACK)); 101 irq = *(volatile u8 *)JAZZ_EISA_IRQ_ACK;
102 else if (pending & IE_IRQ1) { 102 do_IRQ(irq);
103 } else if (pending & IE_IRQ1) {
103 irq = *(volatile u8 *)JAZZ_IO_IRQ_SOURCE >> 2; 104 irq = *(volatile u8 *)JAZZ_IO_IRQ_SOURCE >> 2;
104 if (likely(irq > 0)) 105 if (likely(irq > 0))
105 do_IRQ(irq + JAZZ_IRQ_START - 1); 106 do_IRQ(irq + JAZZ_IRQ_START - 1);
@@ -117,16 +118,16 @@ static void r4030_set_mode(enum clock_event_mode mode,
117struct clock_event_device r4030_clockevent = { 118struct clock_event_device r4030_clockevent = {
118 .name = "r4030", 119 .name = "r4030",
119 .features = CLOCK_EVT_FEAT_PERIODIC, 120 .features = CLOCK_EVT_FEAT_PERIODIC,
120 .rating = 100, 121 .rating = 300,
121 .irq = JAZZ_TIMER_IRQ, 122 .irq = JAZZ_TIMER_IRQ,
122 .cpumask = CPU_MASK_CPU0,
123 .set_mode = r4030_set_mode, 123 .set_mode = r4030_set_mode,
124}; 124};
125 125
126static irqreturn_t r4030_timer_interrupt(int irq, void *dev_id) 126static irqreturn_t r4030_timer_interrupt(int irq, void *dev_id)
127{ 127{
128 r4030_clockevent.event_handler(&r4030_clockevent); 128 struct clock_event_device *cd = dev_id;
129 129
130 cd->event_handler(cd);
130 return IRQ_HANDLED; 131 return IRQ_HANDLED;
131} 132}
132 133
@@ -134,15 +135,22 @@ static struct irqaction r4030_timer_irqaction = {
134 .handler = r4030_timer_interrupt, 135 .handler = r4030_timer_interrupt,
135 .flags = IRQF_DISABLED, 136 .flags = IRQF_DISABLED,
136 .mask = CPU_MASK_CPU0, 137 .mask = CPU_MASK_CPU0,
137 .name = "timer", 138 .name = "R4030 timer",
138}; 139};
139 140
140void __init plat_time_init(void) 141void __init plat_time_init(void)
141{ 142{
142 struct irqaction *irq = &r4030_timer_irqaction; 143 struct clock_event_device *cd = &r4030_clockevent;
144 struct irqaction *action = &r4030_timer_irqaction;
145 unsigned int cpu = smp_processor_id();
143 146
144 BUG_ON(HZ != 100); 147 BUG_ON(HZ != 100);
145 148
149 cd->cpumask = cpumask_of_cpu(cpu);
150 clockevents_register_device(cd);
151 action->dev_id = cd;
152 setup_irq(JAZZ_TIMER_IRQ, action);
153
146 /* 154 /*
147 * Set clock to 100Hz. 155 * Set clock to 100Hz.
148 * 156 *
@@ -150,8 +158,5 @@ void __init plat_time_init(void)
150 * a programmable 4-bit divider. This makes it fairly inflexible. 158 * a programmable 4-bit divider. This makes it fairly inflexible.
151 */ 159 */
152 r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9); 160 r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9);
153 setup_irq(JAZZ_TIMER_IRQ, irq);
154
155 clockevents_register_device(&r4030_clockevent);
156 setup_pit_timer(); 161 setup_pit_timer();
157} 162}
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
index edb9e59248ec..06e01c8f4e3a 100644
--- a/arch/mips/jmr3927/rbhma3100/setup.c
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -27,17 +27,13 @@
27 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org) 27 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
28 */ 28 */
29 29
30#include <linux/clockchips.h>
31#include <linux/init.h> 30#include <linux/init.h>
32#include <linux/kernel.h> 31#include <linux/kernel.h>
33#include <linux/kdev_t.h> 32#include <linux/kdev_t.h>
34#include <linux/types.h> 33#include <linux/types.h>
35#include <linux/sched.h>
36#include <linux/pci.h> 34#include <linux/pci.h>
37#include <linux/ide.h> 35#include <linux/ide.h>
38#include <linux/irq.h>
39#include <linux/ioport.h> 36#include <linux/ioport.h>
40#include <linux/param.h> /* for HZ */
41#include <linux/delay.h> 37#include <linux/delay.h>
42#include <linux/pm.h> 38#include <linux/pm.h>
43#include <linux/platform_device.h> 39#include <linux/platform_device.h>
@@ -48,17 +44,13 @@
48#endif 44#endif
49 45
50#include <asm/addrspace.h> 46#include <asm/addrspace.h>
51#include <asm/time.h> 47#include <asm/txx9tmr.h>
52#include <asm/reboot.h> 48#include <asm/reboot.h>
53#include <asm/jmr3927/jmr3927.h> 49#include <asm/jmr3927/jmr3927.h>
54#include <asm/mipsregs.h> 50#include <asm/mipsregs.h>
55 51
56extern void puts(const char *cp); 52extern void puts(const char *cp);
57 53
58/* Tick Timer divider */
59#define JMR3927_TIMER_CCD 0 /* 1/2 */
60#define JMR3927_TIMER_CLK (JMR3927_IMCLK / (2 << JMR3927_TIMER_CCD))
61
62/* don't enable - see errata */ 54/* don't enable - see errata */
63static int jmr3927_ccfg_toeon; 55static int jmr3927_ccfg_toeon;
64 56
@@ -93,66 +85,12 @@ static void jmr3927_machine_power_off(void)
93 while (1); 85 while (1);
94} 86}
95 87
96static cycle_t jmr3927_hpt_read(void)
97{
98 /* We assume this function is called xtime_lock held. */
99 return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr;
100}
101
102static void jmr3927_set_mode(enum clock_event_mode mode,
103 struct clock_event_device *evt)
104{
105 /* Nothing to do here */
106}
107
108struct clock_event_device jmr3927_clock_event_device = {
109 .name = "MIPS",
110 .features = CLOCK_EVT_FEAT_PERIODIC,
111 .shift = 32,
112 .rating = 300,
113 .cpumask = CPU_MASK_CPU0,
114 .irq = JMR3927_IRQ_TICK,
115 .set_mode = jmr3927_set_mode,
116};
117
118static irqreturn_t jmr3927_timer_interrupt(int irq, void *dev_id)
119{
120 struct clock_event_device *cd = &jmr3927_clock_event_device;
121
122 jmr3927_tmrptr->tisr = 0; /* ack interrupt */
123
124 cd->event_handler(cd);
125
126 return IRQ_HANDLED;
127}
128
129static struct irqaction jmr3927_timer_irqaction = {
130 .handler = jmr3927_timer_interrupt,
131 .flags = IRQF_DISABLED | IRQF_PERCPU,
132 .name = "jmr3927-timer",
133};
134
135void __init plat_time_init(void) 88void __init plat_time_init(void)
136{ 89{
137 struct clock_event_device *cd; 90 txx9_clockevent_init(TX3927_TMR_REG(0),
138 91 TXX9_IRQ_BASE + JMR3927_IRQ_IRC_TMR(0),
139 clocksource_mips.read = jmr3927_hpt_read; 92 JMR3927_IMCLK);
140 mips_hpt_frequency = JMR3927_TIMER_CLK; 93 txx9_clocksource_init(TX3927_TMR_REG(1), JMR3927_IMCLK);
141
142 jmr3927_tmrptr->cpra = JMR3927_TIMER_CLK / HZ;
143 jmr3927_tmrptr->itmr = TXx927_TMTITMR_TIIE | TXx927_TMTITMR_TZCE;
144 jmr3927_tmrptr->ccdr = JMR3927_TIMER_CCD;
145 jmr3927_tmrptr->tcr =
146 TXx927_TMTCR_TCE | TXx927_TMTCR_CCDE | TXx927_TMTCR_TMODE_ITVL;
147
148 cd = &jmr3927_clock_event_device;
149 /* Calculate the min / max delta */
150 cd->mult = div_sc((unsigned long) JMR3927_IMCLK, NSEC_PER_SEC, 32);
151 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
152 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
153 clockevents_register_device(cd);
154
155 setup_irq(JMR3927_IRQ_TICK, &jmr3927_timer_irqaction);
156} 94}
157 95
158#define DO_WRITE_THROUGH 96#define DO_WRITE_THROUGH
@@ -317,15 +255,8 @@ static void __init tx3927_setup(void)
317 tx3927_ccfgptr->ccfg, tx3927_ccfgptr->pcfg); 255 tx3927_ccfgptr->ccfg, tx3927_ccfgptr->pcfg);
318 256
319 /* TMR */ 257 /* TMR */
320 /* disable all timers */ 258 for (i = 0; i < TX3927_NR_TMR; i++)
321 for (i = 0; i < TX3927_NR_TMR; i++) { 259 txx9_tmr_init(TX3927_TMR_REG(i));
322 tx3927_tmrptr(i)->tcr = TXx927_TMTCR_CRE;
323 tx3927_tmrptr(i)->tisr = 0;
324 tx3927_tmrptr(i)->cpra = 0xffffffff;
325 tx3927_tmrptr(i)->itmr = 0;
326 tx3927_tmrptr(i)->ccdr = 0;
327 tx3927_tmrptr(i)->pgmr = 0;
328 }
329 260
330 /* DMA */ 261 /* DMA */
331 tx3927_dmaptr->mcr = 0; 262 tx3927_dmaptr->mcr = 0;
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index d7745c8976f6..b551535b7e48 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -8,8 +8,13 @@ obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
8 ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \ 8 ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \
9 time.o topology.o traps.o unaligned.o 9 time.o topology.o traps.o unaligned.o
10 10
11obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o
11obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o 12obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o
12obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o 13obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o
14obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o
15obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o
16obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o
17obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o
13 18
14binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \ 19binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \
15 irix5sys.o sysirix.o 20 irix5sys.o sysirix.o
diff --git a/arch/mips/kernel/cevt-bcm1480.c b/arch/mips/kernel/cevt-bcm1480.c
new file mode 100644
index 000000000000..21e6d63eb4d1
--- /dev/null
+++ b/arch/mips/kernel/cevt-bcm1480.c
@@ -0,0 +1,149 @@
1/*
2 * Copyright (C) 2000,2001,2004 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#include <linux/clockchips.h>
19#include <linux/interrupt.h>
20#include <linux/percpu.h>
21
22#include <asm/addrspace.h>
23#include <asm/io.h>
24#include <asm/time.h>
25
26#include <asm/sibyte/bcm1480_regs.h>
27#include <asm/sibyte/sb1250_regs.h>
28#include <asm/sibyte/bcm1480_int.h>
29#include <asm/sibyte/bcm1480_scd.h>
30
31#include <asm/sibyte/sb1250.h>
32
33#define IMR_IP2_VAL K_BCM1480_INT_MAP_I0
34#define IMR_IP3_VAL K_BCM1480_INT_MAP_I1
35#define IMR_IP4_VAL K_BCM1480_INT_MAP_I2
36
37/*
38 * The general purpose timer ticks at 1MHz independent if
39 * the rest of the system
40 */
41static void sibyte_set_mode(enum clock_event_mode mode,
42 struct clock_event_device *evt)
43{
44 unsigned int cpu = smp_processor_id();
45 void __iomem *cfg, *init;
46
47 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
48 init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
49
50 switch (mode) {
51 case CLOCK_EVT_MODE_PERIODIC:
52 __raw_writeq(0, cfg);
53 __raw_writeq((V_SCD_TIMER_FREQ / HZ) - 1, init);
54 __raw_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
55 cfg);
56 break;
57
58 case CLOCK_EVT_MODE_ONESHOT:
59 /* Stop the timer until we actually program a shot */
60 case CLOCK_EVT_MODE_SHUTDOWN:
61 __raw_writeq(0, cfg);
62 break;
63
64 case CLOCK_EVT_MODE_UNUSED: /* shuddup gcc */
65 case CLOCK_EVT_MODE_RESUME:
66 ;
67 }
68}
69
70static int sibyte_next_event(unsigned long delta, struct clock_event_device *cd)
71{
72 unsigned int cpu = smp_processor_id();
73 void __iomem *cfg, *init;
74
75 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
76 init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
77
78 __raw_writeq(delta - 1, init);
79 __raw_writeq(M_SCD_TIMER_ENABLE, cfg);
80
81 return 0;
82}
83
84static irqreturn_t sibyte_counter_handler(int irq, void *dev_id)
85{
86 unsigned int cpu = smp_processor_id();
87 struct clock_event_device *cd = dev_id;
88 void __iomem *cfg;
89 unsigned long tmode;
90
91 if (cd->mode == CLOCK_EVT_MODE_PERIODIC)
92 tmode = M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS;
93 else
94 tmode = 0;
95
96 /* ACK interrupt */
97 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
98 ____raw_writeq(tmode, cfg);
99
100 cd->event_handler(cd);
101
102 return IRQ_HANDLED;
103}
104
105static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
106static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
107static DEFINE_PER_CPU(char [18], sibyte_hpt_name);
108
109void __cpuinit sb1480_clockevent_init(void)
110{
111 unsigned int cpu = smp_processor_id();
112 unsigned int irq = K_BCM1480_INT_TIMER_0 + cpu;
113 struct irqaction *action = &per_cpu(sibyte_hpt_irqaction, cpu);
114 struct clock_event_device *cd = &per_cpu(sibyte_hpt_clockevent, cpu);
115 unsigned char *name = per_cpu(sibyte_hpt_name, cpu);
116
117 BUG_ON(cpu > 3); /* Only have 4 general purpose timers */
118
119 sprintf(name, "bcm1480-counter-%d", cpu);
120 cd->name = name;
121 cd->features = CLOCK_EVT_FEAT_PERIODIC |
122 CLOCK_EVT_FEAT_ONESHOT;
123 clockevent_set_clock(cd, V_SCD_TIMER_FREQ);
124 cd->max_delta_ns = clockevent_delta2ns(0x7fffff, cd);
125 cd->min_delta_ns = clockevent_delta2ns(1, cd);
126 cd->rating = 200;
127 cd->irq = irq;
128 cd->cpumask = cpumask_of_cpu(cpu);
129 cd->set_next_event = sibyte_next_event;
130 cd->set_mode = sibyte_set_mode;
131 clockevents_register_device(cd);
132
133 bcm1480_mask_irq(cpu, irq);
134
135 /*
136 * Map the timer interrupt to IP[4] of this cpu
137 */
138 __raw_writeq(IMR_IP4_VAL,
139 IOADDR(A_BCM1480_IMR_REGISTER(cpu,
140 R_BCM1480_IMR_INTERRUPT_MAP_BASE_H) + (irq << 3)));
141
142 bcm1480_unmask_irq(cpu, irq);
143
144 action->handler = sibyte_counter_handler;
145 action->flags = IRQF_DISABLED | IRQF_PERCPU;
146 action->name = name;
147 action->dev_id = cd;
148 setup_irq(irq, action);
149}
diff --git a/arch/mips/kernel/cevt-gt641xx.c b/arch/mips/kernel/cevt-gt641xx.c
index 4c651b2680f9..c36772631fe0 100644
--- a/arch/mips/kernel/cevt-gt641xx.c
+++ b/arch/mips/kernel/cevt-gt641xx.c
@@ -49,10 +49,9 @@ int gt641xx_timer0_state(void)
49static int gt641xx_timer0_set_next_event(unsigned long delta, 49static int gt641xx_timer0_set_next_event(unsigned long delta,
50 struct clock_event_device *evt) 50 struct clock_event_device *evt)
51{ 51{
52 unsigned long flags;
53 u32 ctrl; 52 u32 ctrl;
54 53
55 spin_lock_irqsave(&gt641xx_timer_lock, flags); 54 spin_lock(&gt641xx_timer_lock);
56 55
57 ctrl = GT_READ(GT_TC_CONTROL_OFS); 56 ctrl = GT_READ(GT_TC_CONTROL_OFS);
58 ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK); 57 ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK);
@@ -61,7 +60,7 @@ static int gt641xx_timer0_set_next_event(unsigned long delta,
61 GT_WRITE(GT_TC0_OFS, delta); 60 GT_WRITE(GT_TC0_OFS, delta);
62 GT_WRITE(GT_TC_CONTROL_OFS, ctrl); 61 GT_WRITE(GT_TC_CONTROL_OFS, ctrl);
63 62
64 spin_unlock_irqrestore(&gt641xx_timer_lock, flags); 63 spin_unlock(&gt641xx_timer_lock);
65 64
66 return 0; 65 return 0;
67} 66}
@@ -69,10 +68,9 @@ static int gt641xx_timer0_set_next_event(unsigned long delta,
69static void gt641xx_timer0_set_mode(enum clock_event_mode mode, 68static void gt641xx_timer0_set_mode(enum clock_event_mode mode,
70 struct clock_event_device *evt) 69 struct clock_event_device *evt)
71{ 70{
72 unsigned long flags;
73 u32 ctrl; 71 u32 ctrl;
74 72
75 spin_lock_irqsave(&gt641xx_timer_lock, flags); 73 spin_lock(&gt641xx_timer_lock);
76 74
77 ctrl = GT_READ(GT_TC_CONTROL_OFS); 75 ctrl = GT_READ(GT_TC_CONTROL_OFS);
78 ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK); 76 ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK);
@@ -90,7 +88,7 @@ static void gt641xx_timer0_set_mode(enum clock_event_mode mode,
90 88
91 GT_WRITE(GT_TC_CONTROL_OFS, ctrl); 89 GT_WRITE(GT_TC_CONTROL_OFS, ctrl);
92 90
93 spin_unlock_irqrestore(&gt641xx_timer_lock, flags); 91 spin_unlock(&gt641xx_timer_lock);
94} 92}
95 93
96static void gt641xx_timer0_event_handler(struct clock_event_device *dev) 94static void gt641xx_timer0_event_handler(struct clock_event_device *dev)
@@ -133,9 +131,9 @@ static int __init gt641xx_timer0_clockevent_init(void)
133 131
134 cd = &gt641xx_timer0_clockevent; 132 cd = &gt641xx_timer0_clockevent;
135 cd->rating = 200 + gt641xx_base_clock / 10000000; 133 cd->rating = 200 + gt641xx_base_clock / 10000000;
134 clockevent_set_clock(cd, gt641xx_base_clock);
136 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd); 135 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
137 cd->min_delta_ns = clockevent_delta2ns(0x300, cd); 136 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
138 clockevent_set_clock(cd, gt641xx_base_clock);
139 137
140 clockevents_register_device(&gt641xx_timer0_clockevent); 138 clockevents_register_device(&gt641xx_timer0_clockevent);
141 139
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index ae2984fff580..bab935a3d74b 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -28,7 +28,7 @@ static int mips_next_event(unsigned long delta,
28 cnt = read_c0_count(); 28 cnt = read_c0_count();
29 cnt += delta; 29 cnt += delta;
30 write_c0_compare(cnt); 30 write_c0_compare(cnt);
31 res = ((long)(read_c0_count() - cnt ) > 0) ? -ETIME : 0; 31 res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0;
32#ifdef CONFIG_MIPS_MT_SMTC 32#ifdef CONFIG_MIPS_MT_SMTC
33 evpe(vpflags); 33 evpe(vpflags);
34 local_irq_restore(flags); 34 local_irq_restore(flags);
@@ -179,7 +179,7 @@ static int c0_compare_int_pending(void)
179 179
180static int c0_compare_int_usable(void) 180static int c0_compare_int_usable(void)
181{ 181{
182 const unsigned int delta = 0x300000; 182 unsigned int delta;
183 unsigned int cnt; 183 unsigned int cnt;
184 184
185 /* 185 /*
@@ -192,11 +192,17 @@ static int c0_compare_int_usable(void)
192 return 0; 192 return 0;
193 } 193 }
194 194
195 cnt = read_c0_count(); 195 for (delta = 0x10; delta <= 0x400000; delta <<= 1) {
196 cnt += delta; 196 cnt = read_c0_count();
197 write_c0_compare(cnt); 197 cnt += delta;
198 write_c0_compare(cnt);
199 irq_disable_hazard();
200 if ((int)(read_c0_count() - cnt) < 0)
201 break;
202 /* increase delta if the timer was already expired */
203 }
198 204
199 while ((long)(read_c0_count() - cnt) <= 0) 205 while ((int)(read_c0_count() - cnt) <= 0)
200 ; /* Wait for expiry */ 206 ; /* Wait for expiry */
201 207
202 if (!c0_compare_int_pending()) 208 if (!c0_compare_int_pending())
@@ -218,9 +224,9 @@ void __cpuinit mips_clockevent_init(void)
218 uint64_t mips_freq = mips_hpt_frequency; 224 uint64_t mips_freq = mips_hpt_frequency;
219 unsigned int cpu = smp_processor_id(); 225 unsigned int cpu = smp_processor_id();
220 struct clock_event_device *cd; 226 struct clock_event_device *cd;
221 unsigned int irq = MIPS_CPU_IRQ_BASE + 7; 227 unsigned int irq;
222 228
223 if (!cpu_has_counter) 229 if (!cpu_has_counter || !mips_hpt_frequency)
224 return; 230 return;
225 231
226#ifdef CONFIG_MIPS_MT_SMTC 232#ifdef CONFIG_MIPS_MT_SMTC
@@ -237,6 +243,15 @@ void __cpuinit mips_clockevent_init(void)
237 if (!c0_compare_int_usable()) 243 if (!c0_compare_int_usable())
238 return; 244 return;
239 245
246 /*
247 * With vectored interrupts things are getting platform specific.
248 * get_c0_compare_int is a hook to allow a platform to return the
249 * interrupt number of it's liking.
250 */
251 irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
252 if (get_c0_compare_int)
253 irq = get_c0_compare_int();
254
240 cd = &per_cpu(mips_clockevent_device, cpu); 255 cd = &per_cpu(mips_clockevent_device, cpu);
241 256
242 cd->name = "MIPS"; 257 cd->name = "MIPS";
@@ -261,13 +276,15 @@ void __cpuinit mips_clockevent_init(void)
261 276
262 clockevents_register_device(cd); 277 clockevents_register_device(cd);
263 278
264 if (!cp0_timer_irq_installed) { 279 if (!cp0_timer_irq_installed)
280 return;
281
282 cp0_timer_irq_installed = 1;
283
265#ifdef CONFIG_MIPS_MT_SMTC 284#ifdef CONFIG_MIPS_MT_SMTC
266#define CPUCTR_IMASKBIT (0x100 << cp0_compare_irq) 285#define CPUCTR_IMASKBIT (0x100 << cp0_compare_irq)
267 setup_irq_smtc(irq, &c0_compare_irqaction, CPUCTR_IMASKBIT); 286 setup_irq_smtc(irq, &c0_compare_irqaction, CPUCTR_IMASKBIT);
268#else 287#else
269 setup_irq(irq, &c0_compare_irqaction); 288 setup_irq(irq, &c0_compare_irqaction);
270#endif /* CONFIG_MIPS_MT_SMTC */ 289#endif
271 cp0_timer_irq_installed = 1;
272 }
273} 290}
diff --git a/arch/mips/kernel/cevt-sb1250.c b/arch/mips/kernel/cevt-sb1250.c
new file mode 100644
index 000000000000..e2029d0fc39b
--- /dev/null
+++ b/arch/mips/kernel/cevt-sb1250.c
@@ -0,0 +1,148 @@
1/*
2 * Copyright (C) 2000, 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#include <linux/clockchips.h>
19#include <linux/interrupt.h>
20#include <linux/percpu.h>
21
22#include <asm/addrspace.h>
23#include <asm/io.h>
24#include <asm/time.h>
25
26#include <asm/sibyte/sb1250.h>
27#include <asm/sibyte/sb1250_regs.h>
28#include <asm/sibyte/sb1250_int.h>
29#include <asm/sibyte/sb1250_scd.h>
30
31#define IMR_IP2_VAL K_INT_MAP_I0
32#define IMR_IP3_VAL K_INT_MAP_I1
33#define IMR_IP4_VAL K_INT_MAP_I2
34
35/*
36 * The general purpose timer ticks at 1MHz independent if
37 * the rest of the system
38 */
39static void sibyte_set_mode(enum clock_event_mode mode,
40 struct clock_event_device *evt)
41{
42 unsigned int cpu = smp_processor_id();
43 void __iomem *cfg, *init;
44
45 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
46 init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
47
48 switch (mode) {
49 case CLOCK_EVT_MODE_PERIODIC:
50 __raw_writeq(0, cfg);
51 __raw_writeq((V_SCD_TIMER_FREQ / HZ) - 1, init);
52 __raw_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
53 cfg);
54 break;
55
56 case CLOCK_EVT_MODE_ONESHOT:
57 /* Stop the timer until we actually program a shot */
58 case CLOCK_EVT_MODE_SHUTDOWN:
59 __raw_writeq(0, cfg);
60 break;
61
62 case CLOCK_EVT_MODE_UNUSED: /* shuddup gcc */
63 case CLOCK_EVT_MODE_RESUME:
64 ;
65 }
66}
67
68static int sibyte_next_event(unsigned long delta, struct clock_event_device *cd)
69{
70 unsigned int cpu = smp_processor_id();
71 void __iomem *cfg, *init;
72
73 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
74 init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
75
76 __raw_writeq(delta - 1, init);
77 __raw_writeq(M_SCD_TIMER_ENABLE, cfg);
78
79 return 0;
80}
81
82static irqreturn_t sibyte_counter_handler(int irq, void *dev_id)
83{
84 unsigned int cpu = smp_processor_id();
85 struct clock_event_device *cd = dev_id;
86 void __iomem *cfg;
87 unsigned long tmode;
88
89 if (cd->mode == CLOCK_EVT_MODE_PERIODIC)
90 tmode = M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS;
91 else
92 tmode = 0;
93
94 /* ACK interrupt */
95 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
96 ____raw_writeq(tmode, cfg);
97
98 cd->event_handler(cd);
99
100 return IRQ_HANDLED;
101}
102
103static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
104static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
105static DEFINE_PER_CPU(char [18], sibyte_hpt_name);
106
107void __cpuinit sb1250_clockevent_init(void)
108{
109 unsigned int cpu = smp_processor_id();
110 unsigned int irq = K_INT_TIMER_0 + cpu;
111 struct irqaction *action = &per_cpu(sibyte_hpt_irqaction, cpu);
112 struct clock_event_device *cd = &per_cpu(sibyte_hpt_clockevent, cpu);
113 unsigned char *name = per_cpu(sibyte_hpt_name, cpu);
114
115 /* Only have 4 general purpose timers, and we use last one as hpt */
116 BUG_ON(cpu > 2);
117
118 sprintf(name, "sb1250-counter-%d", cpu);
119 cd->name = name;
120 cd->features = CLOCK_EVT_FEAT_PERIODIC |
121 CLOCK_EVT_FEAT_ONESHOT;
122 clockevent_set_clock(cd, V_SCD_TIMER_FREQ);
123 cd->max_delta_ns = clockevent_delta2ns(0x7fffff, cd);
124 cd->min_delta_ns = clockevent_delta2ns(1, cd);
125 cd->rating = 200;
126 cd->irq = irq;
127 cd->cpumask = cpumask_of_cpu(cpu);
128 cd->set_next_event = sibyte_next_event;
129 cd->set_mode = sibyte_set_mode;
130 clockevents_register_device(cd);
131
132 sb1250_mask_irq(cpu, irq);
133
134 /*
135 * Map the timer interrupt to IP[4] of this cpu
136 */
137 __raw_writeq(IMR_IP4_VAL,
138 IOADDR(A_IMR_REGISTER(cpu, R_IMR_INTERRUPT_MAP_BASE) +
139 (irq << 3)));
140
141 sb1250_unmask_irq(cpu, irq);
142
143 action->handler = sibyte_counter_handler;
144 action->flags = IRQF_DISABLED | IRQF_PERCPU;
145 action->name = name;
146 action->dev_id = cd;
147 setup_irq(irq, action);
148}
diff --git a/arch/mips/kernel/cevt-txx9.c b/arch/mips/kernel/cevt-txx9.c
new file mode 100644
index 000000000000..795cb8fb0d74
--- /dev/null
+++ b/arch/mips/kernel/cevt-txx9.c
@@ -0,0 +1,171 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Based on linux/arch/mips/kernel/cevt-r4k.c,
7 * linux/arch/mips/jmr3927/rbhma3100/setup.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 * Copyright (C) 2000-2001 Toshiba Corporation
11 * Copyright (C) 2007 MIPS Technologies, Inc.
12 * Copyright (C) 2007 Ralf Baechle <ralf@linux-mips.org>
13 */
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <asm/time.h>
17#include <asm/txx9tmr.h>
18
19#define TCR_BASE (TXx9_TMTCR_CCDE | TXx9_TMTCR_CRE | TXx9_TMTCR_TMODE_ITVL)
20#define TIMER_CCD 0 /* 1/2 */
21#define TIMER_CLK(imclk) ((imclk) / (2 << TIMER_CCD))
22
23static struct txx9_tmr_reg __iomem *txx9_cs_tmrptr;
24
25static cycle_t txx9_cs_read(void)
26{
27 return __raw_readl(&txx9_cs_tmrptr->trr);
28}
29
30/* Use 1 bit smaller width to use full bits in that width */
31#define TXX9_CLOCKSOURCE_BITS (TXX9_TIMER_BITS - 1)
32
33static struct clocksource txx9_clocksource = {
34 .name = "TXx9",
35 .rating = 200,
36 .read = txx9_cs_read,
37 .mask = CLOCKSOURCE_MASK(TXX9_CLOCKSOURCE_BITS),
38 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
39};
40
41void __init txx9_clocksource_init(unsigned long baseaddr,
42 unsigned int imbusclk)
43{
44 struct txx9_tmr_reg __iomem *tmrptr;
45
46 clocksource_set_clock(&txx9_clocksource, TIMER_CLK(imbusclk));
47 clocksource_register(&txx9_clocksource);
48
49 tmrptr = ioremap(baseaddr, sizeof(struct txx9_tmr_reg));
50 __raw_writel(TCR_BASE, &tmrptr->tcr);
51 __raw_writel(0, &tmrptr->tisr);
52 __raw_writel(TIMER_CCD, &tmrptr->ccdr);
53 __raw_writel(TXx9_TMITMR_TZCE, &tmrptr->itmr);
54 __raw_writel(1 << TXX9_CLOCKSOURCE_BITS, &tmrptr->cpra);
55 __raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr);
56 txx9_cs_tmrptr = tmrptr;
57}
58
59static struct txx9_tmr_reg __iomem *txx9_tmrptr;
60
61static void txx9tmr_stop_and_clear(struct txx9_tmr_reg __iomem *tmrptr)
62{
63 /* stop and reset counter */
64 __raw_writel(TCR_BASE, &tmrptr->tcr);
65 /* clear pending interrupt */
66 __raw_writel(0, &tmrptr->tisr);
67}
68
69static void txx9tmr_set_mode(enum clock_event_mode mode,
70 struct clock_event_device *evt)
71{
72 struct txx9_tmr_reg __iomem *tmrptr = txx9_tmrptr;
73
74 txx9tmr_stop_and_clear(tmrptr);
75 switch (mode) {
76 case CLOCK_EVT_MODE_PERIODIC:
77 __raw_writel(TXx9_TMITMR_TIIE | TXx9_TMITMR_TZCE,
78 &tmrptr->itmr);
79 /* start timer */
80 __raw_writel(((u64)(NSEC_PER_SEC / HZ) * evt->mult) >>
81 evt->shift,
82 &tmrptr->cpra);
83 __raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr);
84 break;
85 case CLOCK_EVT_MODE_SHUTDOWN:
86 case CLOCK_EVT_MODE_UNUSED:
87 __raw_writel(0, &tmrptr->itmr);
88 break;
89 case CLOCK_EVT_MODE_ONESHOT:
90 __raw_writel(TXx9_TMITMR_TIIE, &tmrptr->itmr);
91 break;
92 case CLOCK_EVT_MODE_RESUME:
93 __raw_writel(TIMER_CCD, &tmrptr->ccdr);
94 __raw_writel(0, &tmrptr->itmr);
95 break;
96 }
97}
98
99static int txx9tmr_set_next_event(unsigned long delta,
100 struct clock_event_device *evt)
101{
102 struct txx9_tmr_reg __iomem *tmrptr = txx9_tmrptr;
103
104 txx9tmr_stop_and_clear(tmrptr);
105 /* start timer */
106 __raw_writel(delta, &tmrptr->cpra);
107 __raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr);
108 return 0;
109}
110
111static struct clock_event_device txx9tmr_clock_event_device = {
112 .name = "TXx9",
113 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
114 .rating = 200,
115 .cpumask = CPU_MASK_CPU0,
116 .set_mode = txx9tmr_set_mode,
117 .set_next_event = txx9tmr_set_next_event,
118};
119
120static irqreturn_t txx9tmr_interrupt(int irq, void *dev_id)
121{
122 struct clock_event_device *cd = &txx9tmr_clock_event_device;
123 struct txx9_tmr_reg __iomem *tmrptr = txx9_tmrptr;
124
125 __raw_writel(0, &tmrptr->tisr); /* ack interrupt */
126 cd->event_handler(cd);
127 return IRQ_HANDLED;
128}
129
130static struct irqaction txx9tmr_irq = {
131 .handler = txx9tmr_interrupt,
132 .flags = IRQF_DISABLED | IRQF_PERCPU,
133 .name = "txx9tmr",
134};
135
136void __init txx9_clockevent_init(unsigned long baseaddr, int irq,
137 unsigned int imbusclk)
138{
139 struct clock_event_device *cd = &txx9tmr_clock_event_device;
140 struct txx9_tmr_reg __iomem *tmrptr;
141
142 tmrptr = ioremap(baseaddr, sizeof(struct txx9_tmr_reg));
143 txx9tmr_stop_and_clear(tmrptr);
144 __raw_writel(TIMER_CCD, &tmrptr->ccdr);
145 __raw_writel(0, &tmrptr->itmr);
146 txx9_tmrptr = tmrptr;
147
148 clockevent_set_clock(cd, TIMER_CLK(imbusclk));
149 cd->max_delta_ns =
150 clockevent_delta2ns(0xffffffff >> (32 - TXX9_TIMER_BITS), cd);
151 cd->min_delta_ns = clockevent_delta2ns(0xf, cd);
152 cd->irq = irq;
153 clockevents_register_device(cd);
154 setup_irq(irq, &txx9tmr_irq);
155 printk(KERN_INFO "TXx9: clockevent device at 0x%lx, irq %d\n",
156 baseaddr, irq);
157}
158
159void __init txx9_tmr_init(unsigned long baseaddr)
160{
161 struct txx9_tmr_reg __iomem *tmrptr;
162
163 tmrptr = ioremap(baseaddr, sizeof(struct txx9_tmr_reg));
164 __raw_writel(TXx9_TMTCR_CRE, &tmrptr->tcr);
165 __raw_writel(0, &tmrptr->tisr);
166 __raw_writel(0xffffffff, &tmrptr->cpra);
167 __raw_writel(0, &tmrptr->itmr);
168 __raw_writel(0, &tmrptr->ccdr);
169 __raw_writel(0, &tmrptr->pgmr);
170 iounmap(tmrptr);
171}
diff --git a/arch/mips/kernel/csrc-bcm1480.c b/arch/mips/kernel/csrc-bcm1480.c
new file mode 100644
index 000000000000..868745e7184b
--- /dev/null
+++ b/arch/mips/kernel/csrc-bcm1480.c
@@ -0,0 +1,54 @@
1/*
2 * Copyright (C) 2000,2001,2004 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#include <linux/clocksource.h>
19
20#include <asm/addrspace.h>
21#include <asm/io.h>
22#include <asm/time.h>
23
24#include <asm/sibyte/bcm1480_regs.h>
25#include <asm/sibyte/sb1250_regs.h>
26#include <asm/sibyte/bcm1480_int.h>
27#include <asm/sibyte/bcm1480_scd.h>
28
29#include <asm/sibyte/sb1250.h>
30
31static cycle_t bcm1480_hpt_read(void)
32{
33 return (cycle_t) __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT));
34}
35
36struct clocksource bcm1480_clocksource = {
37 .name = "zbbus-cycles",
38 .rating = 200,
39 .read = bcm1480_hpt_read,
40 .mask = CLOCKSOURCE_MASK(64),
41 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
42};
43
44void __init sb1480_clocksource_init(void)
45{
46 struct clocksource *cs = &bcm1480_clocksource;
47 unsigned int plldiv;
48 unsigned long zbbus;
49
50 plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
51 zbbus = ((plldiv >> 1) * 50000000) + ((plldiv & 1) * 25000000);
52 clocksource_set_clock(cs, zbbus);
53 clocksource_register(cs);
54}
diff --git a/arch/mips/kernel/csrc-sb1250.c b/arch/mips/kernel/csrc-sb1250.c
new file mode 100644
index 000000000000..ebb16e668877
--- /dev/null
+++ b/arch/mips/kernel/csrc-sb1250.c
@@ -0,0 +1,70 @@
1/*
2 * Copyright (C) 2000, 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#include <linux/clocksource.h>
19
20#include <asm/addrspace.h>
21#include <asm/io.h>
22#include <asm/time.h>
23
24#include <asm/sibyte/sb1250.h>
25#include <asm/sibyte/sb1250_regs.h>
26#include <asm/sibyte/sb1250_int.h>
27#include <asm/sibyte/sb1250_scd.h>
28
29#define SB1250_HPT_NUM 3
30#define SB1250_HPT_VALUE M_SCD_TIMER_CNT /* max value */
31
32/*
33 * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over
34 * again.
35 */
36static cycle_t sb1250_hpt_read(void)
37{
38 unsigned int count;
39
40 count = G_SCD_TIMER_CNT(__raw_readq(IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM, R_SCD_TIMER_CNT))));
41
42 return SB1250_HPT_VALUE - count;
43}
44
45struct clocksource bcm1250_clocksource = {
46 .name = "MIPS",
47 .rating = 200,
48 .read = sb1250_hpt_read,
49 .mask = CLOCKSOURCE_MASK(23),
50 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
51};
52
53void __init sb1250_clocksource_init(void)
54{
55 struct clocksource *cs = &bcm1250_clocksource;
56
57 /* Setup hpt using timer #3 but do not enable irq for it */
58 __raw_writeq(0,
59 IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM,
60 R_SCD_TIMER_CFG)));
61 __raw_writeq(SB1250_HPT_VALUE,
62 IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM,
63 R_SCD_TIMER_INIT)));
64 __raw_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
65 IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM,
66 R_SCD_TIMER_CFG)));
67
68 clocksource_set_clock(cs, V_SCD_TIMER_FREQ);
69 clocksource_register(cs);
70}
diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c
index 5d9830df3595..c2d497ceffdd 100644
--- a/arch/mips/kernel/i8253.c
+++ b/arch/mips/kernel/i8253.c
@@ -12,8 +12,9 @@
12#include <asm/delay.h> 12#include <asm/delay.h>
13#include <asm/i8253.h> 13#include <asm/i8253.h>
14#include <asm/io.h> 14#include <asm/io.h>
15#include <asm/time.h>
15 16
16static DEFINE_SPINLOCK(i8253_lock); 17DEFINE_SPINLOCK(i8253_lock);
17 18
18/* 19/*
19 * Initialize the PIT timer. 20 * Initialize the PIT timer.
@@ -87,11 +88,10 @@ struct clock_event_device pit_clockevent = {
87 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 88 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
88 .set_mode = init_pit_timer, 89 .set_mode = init_pit_timer,
89 .set_next_event = pit_next_event, 90 .set_next_event = pit_next_event,
90 .shift = 32,
91 .irq = 0, 91 .irq = 0,
92}; 92};
93 93
94irqreturn_t timer_interrupt(int irq, void *dev_id) 94static irqreturn_t timer_interrupt(int irq, void *dev_id)
95{ 95{
96 pit_clockevent.event_handler(&pit_clockevent); 96 pit_clockevent.event_handler(&pit_clockevent);
97 97
@@ -111,19 +111,20 @@ static struct irqaction irq0 = {
111 */ 111 */
112void __init setup_pit_timer(void) 112void __init setup_pit_timer(void)
113{ 113{
114 struct clock_event_device *cd = &pit_clockevent;
115 unsigned int cpu = smp_processor_id();
116
114 /* 117 /*
115 * Start pit with the boot cpu mask and make it global after the 118 * Start pit with the boot cpu mask and make it global after the
116 * IO_APIC has been initialized. 119 * IO_APIC has been initialized.
117 */ 120 */
118 pit_clockevent.cpumask = cpumask_of_cpu(0); 121 cd->cpumask = cpumask_of_cpu(cpu);
119 pit_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, 32); 122 clockevent_set_clock(cd, CLOCK_TICK_RATE);
120 pit_clockevent.max_delta_ns = 123 cd->max_delta_ns = clockevent_delta2ns(0x7FFF, cd);
121 clockevent_delta2ns(0x7FFF, &pit_clockevent); 124 cd->min_delta_ns = clockevent_delta2ns(0xF, cd);
122 pit_clockevent.min_delta_ns = 125 clockevents_register_device(cd);
123 clockevent_delta2ns(0xF, &pit_clockevent); 126
124 clockevents_register_device(&pit_clockevent); 127 irq0.mask = cpumask_of_cpu(cpu);
125
126 irq0.mask = cpumask_of_cpu(0);
127 setup_irq(0, &irq0); 128 setup_irq(0, &irq0);
128} 129}
129 130
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index a0a91056fda7..33506ff25910 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -24,8 +24,12 @@
24 24
25#define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP))) 25#define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP)))
26 26
27#define _IRIX_NSIG 128
28#define _IRIX_NSIG_BPW BITS_PER_LONG
29#define _IRIX_NSIG_WORDS (_IRIX_NSIG / _IRIX_NSIG_BPW)
30
27typedef struct { 31typedef struct {
28 unsigned long sig[4]; 32 unsigned long sig[_IRIX_NSIG_WORDS];
29} irix_sigset_t; 33} irix_sigset_t;
30 34
31struct sigctx_irix5 { 35struct sigctx_irix5 {
@@ -527,7 +531,7 @@ asmlinkage int irix_sigpoll_sys(unsigned long __user *set,
527 531
528 expire = schedule_timeout_interruptible(expire); 532 expire = schedule_timeout_interruptible(expire);
529 533
530 for (i=0; i<=4; i++) 534 for (i=0; i < _IRIX_NSIG_WORDS; i++)
531 tmp |= (current->pending.signal.sig[i] & kset.sig[i]); 535 tmp |= (current->pending.signal.sig[i] & kset.sig[i]);
532 536
533 if (tmp) 537 if (tmp)
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 999f7853de26..35234b92b9a5 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -65,13 +65,13 @@ int ptrace_getregs(struct task_struct *child, __s64 __user *data)
65 regs = task_pt_regs(child); 65 regs = task_pt_regs(child);
66 66
67 for (i = 0; i < 32; i++) 67 for (i = 0; i < 32; i++)
68 __put_user(regs->regs[i], data + i); 68 __put_user((long)regs->regs[i], data + i);
69 __put_user(regs->lo, data + EF_LO - EF_R0); 69 __put_user((long)regs->lo, data + EF_LO - EF_R0);
70 __put_user(regs->hi, data + EF_HI - EF_R0); 70 __put_user((long)regs->hi, data + EF_HI - EF_R0);
71 __put_user(regs->cp0_epc, data + EF_CP0_EPC - EF_R0); 71 __put_user((long)regs->cp0_epc, data + EF_CP0_EPC - EF_R0);
72 __put_user(regs->cp0_badvaddr, data + EF_CP0_BADVADDR - EF_R0); 72 __put_user((long)regs->cp0_badvaddr, data + EF_CP0_BADVADDR - EF_R0);
73 __put_user(regs->cp0_status, data + EF_CP0_STATUS - EF_R0); 73 __put_user((long)regs->cp0_status, data + EF_CP0_STATUS - EF_R0);
74 __put_user(regs->cp0_cause, data + EF_CP0_CAUSE - EF_R0); 74 __put_user((long)regs->cp0_cause, data + EF_CP0_CAUSE - EF_R0);
75 75
76 return 0; 76 return 0;
77} 77}
@@ -390,11 +390,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
390 } 390 }
391 391
392 case PTRACE_GETREGS: 392 case PTRACE_GETREGS:
393 ret = ptrace_getregs(child, (__u64 __user *) data); 393 ret = ptrace_getregs(child, (__s64 __user *) data);
394 break; 394 break;
395 395
396 case PTRACE_SETREGS: 396 case PTRACE_SETREGS:
397 ret = ptrace_setregs(child, (__u64 __user *) data); 397 ret = ptrace_setregs(child, (__s64 __user *) data);
398 break; 398 break;
399 399
400 case PTRACE_GETFPREGS: 400 case PTRACE_GETFPREGS:
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index f2bffed94fa3..76818be6ba7c 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -346,11 +346,11 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
346 } 346 }
347 347
348 case PTRACE_GETREGS: 348 case PTRACE_GETREGS:
349 ret = ptrace_getregs(child, (__u64 __user *) (__u64) data); 349 ret = ptrace_getregs(child, (__s64 __user *) (__u64) data);
350 break; 350 break;
351 351
352 case PTRACE_SETREGS: 352 case PTRACE_SETREGS:
353 ret = ptrace_setregs(child, (__u64 __user *) (__u64) data); 353 ret = ptrace_setregs(child, (__s64 __user *) (__u64) data);
354 break; 354 break;
355 355
356 case PTRACE_GETFPREGS: 356 case PTRACE_GETFPREGS:
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index a8c1a698d588..9c92d42996cb 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -88,11 +88,19 @@ unsigned int smtc_status = 0;
88 88
89/* Boot command line configuration overrides */ 89/* Boot command line configuration overrides */
90 90
91static int vpe0limit;
91static int ipibuffers = 0; 92static int ipibuffers = 0;
92static int nostlb = 0; 93static int nostlb = 0;
93static int asidmask = 0; 94static int asidmask = 0;
94unsigned long smtc_asid_mask = 0xff; 95unsigned long smtc_asid_mask = 0xff;
95 96
97static int __init vpe0tcs(char *str)
98{
99 get_option(&str, &vpe0limit);
100
101 return 1;
102}
103
96static int __init ipibufs(char *str) 104static int __init ipibufs(char *str)
97{ 105{
98 get_option(&str, &ipibuffers); 106 get_option(&str, &ipibuffers);
@@ -125,6 +133,7 @@ static int __init asidmask_set(char *str)
125 return 1; 133 return 1;
126} 134}
127 135
136__setup("vpe0tcs=", vpe0tcs);
128__setup("ipibufs=", ipibufs); 137__setup("ipibufs=", ipibufs);
129__setup("nostlb", stlb_disable); 138__setup("nostlb", stlb_disable);
130__setup("asidmask=", asidmask_set); 139__setup("asidmask=", asidmask_set);
@@ -340,7 +349,7 @@ static void smtc_tc_setup(int vpe, int tc, int cpu)
340 349
341void mipsmt_prepare_cpus(void) 350void mipsmt_prepare_cpus(void)
342{ 351{
343 int i, vpe, tc, ntc, nvpe, tcpervpe, slop, cpu; 352 int i, vpe, tc, ntc, nvpe, tcpervpe[NR_CPUS], slop, cpu;
344 unsigned long flags; 353 unsigned long flags;
345 unsigned long val; 354 unsigned long val;
346 int nipi; 355 int nipi;
@@ -401,8 +410,39 @@ void mipsmt_prepare_cpus(void)
401 ntc = NR_CPUS; 410 ntc = NR_CPUS;
402 if (tclimit > 0 && ntc > tclimit) 411 if (tclimit > 0 && ntc > tclimit)
403 ntc = tclimit; 412 ntc = tclimit;
404 tcpervpe = ntc / nvpe; 413 slop = ntc % nvpe;
405 slop = ntc % nvpe; /* Residual TCs, < NVPE */ 414 for (i = 0; i < nvpe; i++) {
415 tcpervpe[i] = ntc / nvpe;
416 if (slop) {
417 if((slop - i) > 0) tcpervpe[i]++;
418 }
419 }
420 /* Handle command line override for VPE0 */
421 if (vpe0limit > ntc) vpe0limit = ntc;
422 if (vpe0limit > 0) {
423 int slopslop;
424 if (vpe0limit < tcpervpe[0]) {
425 /* Reducing TC count - distribute to others */
426 slop = tcpervpe[0] - vpe0limit;
427 slopslop = slop % (nvpe - 1);
428 tcpervpe[0] = vpe0limit;
429 for (i = 1; i < nvpe; i++) {
430 tcpervpe[i] += slop / (nvpe - 1);
431 if(slopslop && ((slopslop - (i - 1) > 0)))
432 tcpervpe[i]++;
433 }
434 } else if (vpe0limit > tcpervpe[0]) {
435 /* Increasing TC count - steal from others */
436 slop = vpe0limit - tcpervpe[0];
437 slopslop = slop % (nvpe - 1);
438 tcpervpe[0] = vpe0limit;
439 for (i = 1; i < nvpe; i++) {
440 tcpervpe[i] -= slop / (nvpe - 1);
441 if(slopslop && ((slopslop - (i - 1) > 0)))
442 tcpervpe[i]--;
443 }
444 }
445 }
406 446
407 /* Set up shared TLB */ 447 /* Set up shared TLB */
408 smtc_configure_tlb(); 448 smtc_configure_tlb();
@@ -416,7 +456,7 @@ void mipsmt_prepare_cpus(void)
416 if (vpe != 0) 456 if (vpe != 0)
417 printk(", "); 457 printk(", ");
418 printk("VPE %d: TC", vpe); 458 printk("VPE %d: TC", vpe);
419 for (i = 0; i < tcpervpe; i++) { 459 for (i = 0; i < tcpervpe[vpe]; i++) {
420 /* 460 /*
421 * TC 0 is bound to VPE 0 at reset, 461 * TC 0 is bound to VPE 0 at reset,
422 * and is presumably executing this 462 * and is presumably executing this
@@ -429,15 +469,6 @@ void mipsmt_prepare_cpus(void)
429 printk(" %d", tc); 469 printk(" %d", tc);
430 tc++; 470 tc++;
431 } 471 }
432 if (slop) {
433 if (tc != 0) {
434 smtc_tc_setup(vpe, tc, cpu);
435 cpu++;
436 }
437 printk(" %d", tc);
438 tc++;
439 slop--;
440 }
441 if (vpe != 0) { 472 if (vpe != 0) {
442 /* 473 /*
443 * Clear any stale software interrupts from VPE's Cause 474 * Clear any stale software interrupts from VPE's Cause
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index b95fe93dd646..af1bdc897488 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -73,7 +73,14 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
73 73
74 task_size = STACK_TOP; 74 task_size = STACK_TOP;
75 75
76 if (len > task_size)
77 return -ENOMEM;
78
76 if (flags & MAP_FIXED) { 79 if (flags & MAP_FIXED) {
80 /* Even MAP_FIXED mappings must reside within task_size. */
81 if (task_size - len < addr)
82 return -EINVAL;
83
77 /* 84 /*
78 * We do not accept a shared mapping if it would violate 85 * We do not accept a shared mapping if it would violate
79 * cache aliasing constraints. 86 * cache aliasing constraints.
@@ -83,8 +90,6 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
83 return addr; 90 return addr;
84 } 91 }
85 92
86 if (len > task_size)
87 return -ENOMEM;
88 do_color_align = 0; 93 do_color_align = 0;
89 if (filp || (flags & MAP_SHARED)) 94 if (filp || (flags & MAP_SHARED))
90 do_color_align = 1; 95 do_color_align = 1;
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 6c6849a8f136..3284b9b4ecac 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -3,42 +3,31 @@
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 * Copyright (c) 2003, 2004 Maciej W. Rozycki 4 * Copyright (c) 2003, 2004 Maciej W. Rozycki
5 * 5 *
6 * Common time service routines for MIPS machines. See 6 * Common time service routines for MIPS machines.
7 * Documentation/mips/time.README.
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your 10 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version. 11 * option) any later version.
13 */ 12 */
13#include <linux/bug.h>
14#include <linux/clockchips.h> 14#include <linux/clockchips.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/param.h> 19#include <linux/param.h>
20#include <linux/profile.h>
21#include <linux/time.h> 20#include <linux/time.h>
22#include <linux/timex.h> 21#include <linux/timex.h>
23#include <linux/smp.h> 22#include <linux/smp.h>
24#include <linux/kernel_stat.h>
25#include <linux/spinlock.h> 23#include <linux/spinlock.h>
26#include <linux/interrupt.h>
27#include <linux/module.h> 24#include <linux/module.h>
28#include <linux/kallsyms.h>
29 25
30#include <asm/bootinfo.h>
31#include <asm/cache.h>
32#include <asm/compiler.h>
33#include <asm/cpu.h>
34#include <asm/cpu-features.h> 26#include <asm/cpu-features.h>
35#include <asm/div64.h> 27#include <asm/div64.h>
36#include <asm/sections.h>
37#include <asm/smtc_ipi.h> 28#include <asm/smtc_ipi.h>
38#include <asm/time.h> 29#include <asm/time.h>
39 30
40#include <irq.h>
41
42/* 31/*
43 * forward reference 32 * forward reference
44 */ 33 */
@@ -62,14 +51,6 @@ int update_persistent_clock(struct timespec now)
62} 51}
63 52
64/* 53/*
65 * Null high precision timer functions for systems lacking one.
66 */
67static cycle_t null_hpt_read(void)
68{
69 return 0;
70}
71
72/*
73 * High precision timer functions for a R4k-compatible timer. 54 * High precision timer functions for a R4k-compatible timer.
74 */ 55 */
75static cycle_t c0_hpt_read(void) 56static cycle_t c0_hpt_read(void)
@@ -79,22 +60,6 @@ static cycle_t c0_hpt_read(void)
79 60
80int (*mips_timer_state)(void); 61int (*mips_timer_state)(void);
81 62
82/*
83 * local_timer_interrupt() does profiling and process accounting
84 * on a per-CPU basis.
85 *
86 * In UP mode, it is invoked from the (global) timer_interrupt.
87 *
88 * In SMP mode, it might invoked by per-CPU timer interrupt, or
89 * a broadcasted inter-processor interrupt which itself is triggered
90 * by the global timer interrupt.
91 */
92void local_timer_interrupt(int irq, void *dev_id)
93{
94 profile_tick(CPU_PROFILING);
95 update_process_times(user_mode(get_irq_regs()));
96}
97
98int null_perf_irq(void) 63int null_perf_irq(void)
99{ 64{
100 return 0; 65 return 0;
@@ -115,14 +80,17 @@ EXPORT_SYMBOL(perf_irq);
115 * (only needed if you intended to use cpu counter as timer interrupt 80 * (only needed if you intended to use cpu counter as timer interrupt
116 * source) 81 * source)
117 * 2) calculate a couple of cached variables for later usage 82 * 2) calculate a couple of cached variables for later usage
118 * 3) plat_timer_setup() -
119 * a) (optional) over-write any choices made above by time_init().
120 * b) machine specific code should setup the timer irqaction.
121 * c) enable the timer interrupt
122 */ 83 */
123 84
124unsigned int mips_hpt_frequency; 85unsigned int mips_hpt_frequency;
125 86
87static struct clocksource clocksource_mips = {
88 .name = "MIPS",
89 .read = c0_hpt_read,
90 .mask = CLOCKSOURCE_MASK(32),
91 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
92};
93
126static unsigned int __init calibrate_hpt(void) 94static unsigned int __init calibrate_hpt(void)
127{ 95{
128 cycle_t frequency, hpt_start, hpt_end, hpt_count, hz; 96 cycle_t frequency, hpt_start, hpt_end, hpt_count, hz;
@@ -165,12 +133,6 @@ static unsigned int __init calibrate_hpt(void)
165 return frequency >> log_2_loops; 133 return frequency >> log_2_loops;
166} 134}
167 135
168struct clocksource clocksource_mips = {
169 .name = "MIPS",
170 .mask = CLOCKSOURCE_MASK(32),
171 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
172};
173
174void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock) 136void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock)
175{ 137{
176 u64 temp; 138 u64 temp;
@@ -206,9 +168,6 @@ void __cpuinit clockevent_set_clock(struct clock_event_device *cd,
206 168
207static void __init init_mips_clocksource(void) 169static void __init init_mips_clocksource(void)
208{ 170{
209 if (!mips_hpt_frequency || clocksource_mips.read == null_hpt_read)
210 return;
211
212 /* Calclate a somewhat reasonable rating value */ 171 /* Calclate a somewhat reasonable rating value */
213 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000; 172 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
214 173
@@ -221,29 +180,26 @@ void __init __weak plat_time_init(void)
221{ 180{
222} 181}
223 182
224void __init __weak plat_timer_setup(struct irqaction *irq) 183/*
184 * This function exists in order to cause an error due to a duplicate
185 * definition if platform code should have its own implementation. The hook
186 * to use instead is plat_time_init. plat_time_init does not receive the
187 * irqaction pointer argument anymore. This is because any function which
188 * initializes an interrupt timer now takes care of its own request_irq rsp.
189 * setup_irq calls and each clock_event_device should use its own
190 * struct irqrequest.
191 */
192void __init plat_timer_setup(void)
225{ 193{
194 BUG();
226} 195}
227 196
228void __init time_init(void) 197void __init time_init(void)
229{ 198{
230 plat_time_init(); 199 plat_time_init();
231 200
232 /* Choose appropriate high precision timer routines. */ 201 if (cpu_has_counter && (mips_hpt_frequency || mips_timer_state)) {
233 if (!cpu_has_counter && !clocksource_mips.read)
234 /* No high precision timer -- sorry. */
235 clocksource_mips.read = null_hpt_read;
236 else if (!mips_hpt_frequency && !mips_timer_state) {
237 /* A high precision timer of unknown frequency. */
238 if (!clocksource_mips.read)
239 /* No external high precision timer -- use R4k. */
240 clocksource_mips.read = c0_hpt_read;
241 } else {
242 /* We know counter frequency. Or we can get it. */ 202 /* We know counter frequency. Or we can get it. */
243 if (!clocksource_mips.read) {
244 /* No external high precision timer -- use R4k. */
245 clocksource_mips.read = c0_hpt_read;
246 }
247 if (!mips_hpt_frequency) 203 if (!mips_hpt_frequency)
248 mips_hpt_frequency = calibrate_hpt(); 204 mips_hpt_frequency = calibrate_hpt();
249 205
@@ -251,8 +207,8 @@ void __init time_init(void)
251 printk("Using %u.%03u MHz high precision timer.\n", 207 printk("Using %u.%03u MHz high precision timer.\n",
252 ((mips_hpt_frequency + 500) / 1000) / 1000, 208 ((mips_hpt_frequency + 500) / 1000) / 1000,
253 ((mips_hpt_frequency + 500) / 1000) % 1000); 209 ((mips_hpt_frequency + 500) / 1000) % 1000);
210 init_mips_clocksource();
254 } 211 }
255 212
256 init_mips_clocksource();
257 mips_clockevent_init(); 213 mips_clockevent_init();
258} 214}
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 2781cff1485e..5fc2398bdb76 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -63,21 +63,23 @@ SECTIONS
63 63
64 /* writeable */ 64 /* writeable */
65 .data : { /* Data */ 65 .data : { /* Data */
66 . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */ 66 . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */
67 /* 67 /*
68 * This ALIGN is needed as a workaround for a bug a gcc bug upto 4.1 which 68 * This ALIGN is needed as a workaround for a bug a
69 * limits the maximum alignment to at most 32kB and results in the following 69 * gcc bug upto 4.1 which limits the maximum alignment
70 * warning: 70 * to at most 32kB and results in the following
71 * 71 * warning:
72 * CC arch/mips/kernel/init_task.o 72 *
73 * arch/mips/kernel/init_task.c:30: warning: alignment of ‘init_thread_union’ 73 * CC arch/mips/kernel/init_task.o
74 * is greater than maximum object file alignment. Using 32768 74 * arch/mips/kernel/init_task.c:30: warning: alignment
75 */ 75 * of ‘init_thread_union’ is greater than maximum
76 . = ALIGN(_PAGE_SIZE); 76 * object file alignment. Using 32768
77 *(.data.init_task) 77 */
78 78 . = ALIGN(_PAGE_SIZE);
79 DATA_DATA 79 *(.data.init_task)
80 CONSTRUCTORS 80
81 DATA_DATA
82 CONSTRUCTORS
81 } 83 }
82 _gp = . + 0x8000; 84 _gp = . + 0x8000;
83 .lit8 : { 85 .lit8 : {
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index df8cbe4c7c0d..436a64ff3989 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -942,8 +942,8 @@ static int vpe_elfload(struct vpe * v)
942 if (phdr->p_type != PT_LOAD) 942 if (phdr->p_type != PT_LOAD)
943 continue; 943 continue;
944 944
945 memcpy((void *)phdr->p_vaddr, (char *)hdr + phdr->p_offset, phdr->p_filesz); 945 memcpy((void *)phdr->p_paddr, (char *)hdr + phdr->p_offset, phdr->p_filesz);
946 memset((void *)phdr->p_vaddr + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz); 946 memset((void *)phdr->p_paddr + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz);
947 phdr++; 947 phdr++;
948 } 948 }
949 949
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
index 54827d0174bf..e072da4ff3b3 100644
--- a/arch/mips/lasat/setup.c
+++ b/arch/mips/lasat/setup.c
@@ -117,14 +117,11 @@ static struct notifier_block lasat_panic_block[] =
117 } 117 }
118}; 118};
119 119
120void plat_time_init(void) 120void __init plat_time_init(void)
121{ 121{
122 mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2; 122 mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2;
123}
124 123
125void __init plat_timer_setup(struct irqaction *irq) 124 change_c0_status(ST0_IM, IE_IRQ0);
126{
127 change_c0_status(ST0_IM, IE_IRQ0 | IE_IRQ5);
128} 125}
129 126
130void __init plat_mem_setup(void) 127void __init plat_mem_setup(void)
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index 9d6243a8c15a..f02ce6308e51 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -127,26 +127,6 @@ unsigned long read_persistent_clock(void)
127 return mc146818_get_cmos_time(); 127 return mc146818_get_cmos_time();
128} 128}
129 129
130void __init plat_time_init(void)
131{
132 unsigned int est_freq;
133
134 /* Set Data mode - binary. */
135 CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_DM_BINARY, RTC_CONTROL);
136
137 est_freq = estimate_cpu_frequency();
138
139 printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,
140 (est_freq%1000000)*100/1000000);
141
142 cpu_khz = est_freq / 1000;
143
144 mips_scroll_message();
145#ifdef CONFIG_I8253 /* Only Malta has a PIT */
146 setup_pit_timer();
147#endif
148}
149
150void __init plat_perf_setup(void) 130void __init plat_perf_setup(void)
151{ 131{
152 cp0_perfcount_irq = -1; 132 cp0_perfcount_irq = -1;
@@ -166,14 +146,13 @@ void __init plat_perf_setup(void)
166 } 146 }
167} 147}
168 148
169void __init plat_timer_setup(struct irqaction *irq) 149unsigned int __init get_c0_compare_int(void)
170{ 150{
171#ifdef MSC01E_INT_BASE 151#ifdef MSC01E_INT_BASE
172 if (cpu_has_veic) { 152 if (cpu_has_veic) {
173 set_vi_handler(MSC01E_INT_CPUCTR, mips_timer_dispatch); 153 set_vi_handler(MSC01E_INT_CPUCTR, mips_timer_dispatch);
174 mips_cpu_timer_irq = MSC01E_INT_BASE + MSC01E_INT_CPUCTR; 154 mips_cpu_timer_irq = MSC01E_INT_BASE + MSC01E_INT_CPUCTR;
175 } 155 } else
176 else
177#endif 156#endif
178 { 157 {
179 if (cpu_has_vint) 158 if (cpu_has_vint)
@@ -181,13 +160,26 @@ void __init plat_timer_setup(struct irqaction *irq)
181 mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq; 160 mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
182 } 161 }
183 162
184#ifdef CONFIG_MIPS_MT_SMTC 163 return mips_cpu_timer_irq;
185 setup_irq_smtc(mips_cpu_timer_irq, irq, 0x100 << cp0_compare_irq); 164}
186#else 165
187 setup_irq(mips_cpu_timer_irq, irq); 166void __init plat_time_init(void)
188#endif /* CONFIG_MIPS_MT_SMTC */ 167{
189#ifdef CONFIG_SMP 168 unsigned int est_freq;
190 set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq); 169
170 /* Set Data mode - binary. */
171 CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_DM_BINARY, RTC_CONTROL);
172
173 est_freq = estimate_cpu_frequency();
174
175 printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,
176 (est_freq%1000000)*100/1000000);
177
178 cpu_khz = est_freq / 1000;
179
180 mips_scroll_message();
181#ifdef CONFIG_I8253 /* Only Malta has a PIT */
182 setup_pit_timer();
191#endif 183#endif
192 184
193 plat_perf_setup(); 185 plat_perf_setup();
diff --git a/arch/mips/mipssim/sim_time.c b/arch/mips/mipssim/sim_time.c
index e7fa0d1078a3..bfaafa38846f 100644
--- a/arch/mips/mipssim/sim_time.c
+++ b/arch/mips/mipssim/sim_time.c
@@ -75,25 +75,6 @@ static unsigned int __init estimate_cpu_frequency(void)
75 return count; 75 return count;
76} 76}
77 77
78void __init plat_time_init(void)
79{
80 unsigned int est_freq, flags;
81
82 local_irq_save(flags);
83
84 /* Set Data mode - binary. */
85 CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_DM_BINARY, RTC_CONTROL);
86
87 est_freq = estimate_cpu_frequency();
88
89 printk(KERN_INFO "CPU frequency %d.%02d MHz\n", est_freq / 1000000,
90 (est_freq % 1000000) * 100 / 1000000);
91
92 cpu_khz = est_freq / 1000;
93
94 local_irq_restore(flags);
95}
96
97static int mips_cpu_timer_irq; 78static int mips_cpu_timer_irq;
98 79
99static void mips_timer_dispatch(void) 80static void mips_timer_dispatch(void)
@@ -102,26 +83,37 @@ static void mips_timer_dispatch(void)
102} 83}
103 84
104 85
105void __init plat_timer_setup(struct irqaction *irq) 86unsigned __init get_c0_compare_int(void)
106{ 87{
88#ifdef MSC01E_INT_BASE
107 if (cpu_has_veic) { 89 if (cpu_has_veic) {
108 set_vi_handler(MSC01E_INT_CPUCTR, mips_timer_dispatch); 90 set_vi_handler(MSC01E_INT_CPUCTR, mips_timer_dispatch);
109 mips_cpu_timer_irq = MSC01E_INT_BASE + MSC01E_INT_CPUCTR; 91 mips_cpu_timer_irq = MSC01E_INT_BASE + MSC01E_INT_CPUCTR;
110 } else { 92 } else {
93#endif
111 if (cpu_has_vint) 94 if (cpu_has_vint)
112 set_vi_handler(cp0_compare_irq, mips_timer_dispatch); 95 set_vi_handler(cp0_compare_irq, mips_timer_dispatch);
113 mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq; 96 mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
114 } 97 }
115 98
116 /* we are using the cpu counter for timer interrupts */ 99 return mips_cpu_timer_irq;
117 setup_irq(mips_cpu_timer_irq, irq); 100}
118 101
119#ifdef CONFIG_SMP 102void __init plat_time_init(void)
120 /* irq_desc(riptor) is a global resource, when the interrupt overlaps 103{
121 on seperate cpu's the first one tries to handle the second interrupt. 104 unsigned int est_freq, flags;
122 The effect is that the int remains disabled on the second cpu. 105
123 Mark the interrupt with IRQ_PER_CPU to avoid any confusion */ 106 local_irq_save(flags);
124 irq_desc[mips_cpu_timer_irq].flags |= IRQ_PER_CPU; 107
125 set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq); 108 /* Set Data mode - binary. */
126#endif 109 CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_DM_BINARY, RTC_CONTROL);
110
111 est_freq = estimate_cpu_frequency();
112
113 printk(KERN_INFO "CPU frequency %d.%02d MHz\n", est_freq / 1000000,
114 (est_freq % 1000000) * 100 / 1000000);
115
116 cpu_khz = est_freq / 1000;
117
118 local_irq_restore(flags);
127} 119}
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
index c55312f6fd3a..562abb77d1d5 100644
--- a/arch/mips/mm/c-r3k.c
+++ b/arch/mips/mm/c-r3k.c
@@ -7,7 +7,7 @@
7 * Tx39XX R4k style caches added. HK 7 * Tx39XX R4k style caches added. HK
8 * Copyright (C) 1998, 1999, 2000 Harald Koerfgen 8 * Copyright (C) 1998, 1999, 2000 Harald Koerfgen
9 * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov 9 * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
10 * Copyright (C) 2001, 2004 Maciej W. Rozycki 10 * Copyright (C) 2001, 2004, 2007 Maciej W. Rozycki
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
@@ -26,8 +26,6 @@
26static unsigned long icache_size, dcache_size; /* Size in bytes */ 26static unsigned long icache_size, dcache_size; /* Size in bytes */
27static unsigned long icache_lsize, dcache_lsize; /* Size in bytes */ 27static unsigned long icache_lsize, dcache_lsize; /* Size in bytes */
28 28
29#undef DEBUG_CACHE
30
31unsigned long __init r3k_cache_size(unsigned long ca_flags) 29unsigned long __init r3k_cache_size(unsigned long ca_flags)
32{ 30{
33 unsigned long flags, status, dummy, size; 31 unsigned long flags, status, dummy, size;
@@ -217,26 +215,6 @@ static void r3k_flush_dcache_range(unsigned long start, unsigned long end)
217 write_c0_status(flags); 215 write_c0_status(flags);
218} 216}
219 217
220static inline unsigned long get_phys_page(unsigned long addr,
221 struct mm_struct *mm)
222{
223 pgd_t *pgd;
224 pud_t *pud;
225 pmd_t *pmd;
226 pte_t *pte;
227 unsigned long physpage;
228
229 pgd = pgd_offset(mm, addr);
230 pud = pud_offset(pgd, addr);
231 pmd = pmd_offset(pud, addr);
232 pte = pte_offset(pmd, addr);
233
234 if ((physpage = pte_val(*pte)) & _PAGE_VALID)
235 return KSEG0ADDR(physpage & PAGE_MASK);
236
237 return 0;
238}
239
240static inline void r3k_flush_cache_all(void) 218static inline void r3k_flush_cache_all(void)
241{ 219{
242} 220}
@@ -252,12 +230,40 @@ static void r3k_flush_cache_mm(struct mm_struct *mm)
252} 230}
253 231
254static void r3k_flush_cache_range(struct vm_area_struct *vma, 232static void r3k_flush_cache_range(struct vm_area_struct *vma,
255 unsigned long start, unsigned long end) 233 unsigned long start, unsigned long end)
256{ 234{
257} 235}
258 236
259static void r3k_flush_cache_page(struct vm_area_struct *vma, unsigned long page, unsigned long pfn) 237static void r3k_flush_cache_page(struct vm_area_struct *vma,
238 unsigned long addr, unsigned long pfn)
260{ 239{
240 unsigned long kaddr = KSEG0ADDR(pfn << PAGE_SHIFT);
241 int exec = vma->vm_flags & VM_EXEC;
242 struct mm_struct *mm = vma->vm_mm;
243 pgd_t *pgdp;
244 pud_t *pudp;
245 pmd_t *pmdp;
246 pte_t *ptep;
247
248 pr_debug("cpage[%08lx,%08lx]\n",
249 cpu_context(smp_processor_id(), mm), addr);
250
251 /* No ASID => no such page in the cache. */
252 if (cpu_context(smp_processor_id(), mm) == 0)
253 return;
254
255 pgdp = pgd_offset(mm, addr);
256 pudp = pud_offset(pgdp, addr);
257 pmdp = pmd_offset(pudp, addr);
258 ptep = pte_offset(pmdp, addr);
259
260 /* Invalid => no such page in the cache. */
261 if (!(pte_val(*ptep) & _PAGE_PRESENT))
262 return;
263
264 r3k_flush_dcache_range(kaddr, kaddr + PAGE_SIZE);
265 if (exec)
266 r3k_flush_icache_range(kaddr, kaddr + PAGE_SIZE);
261} 267}
262 268
263static void local_r3k_flush_data_cache_page(void *addr) 269static void local_r3k_flush_data_cache_page(void *addr)
@@ -272,9 +278,7 @@ static void r3k_flush_cache_sigtramp(unsigned long addr)
272{ 278{
273 unsigned long flags; 279 unsigned long flags;
274 280
275#ifdef DEBUG_CACHE 281 pr_debug("csigtramp[%08lx]\n", addr);
276 printk("csigtramp[%08lx]", addr);
277#endif
278 282
279 flags = read_c0_status(); 283 flags = read_c0_status();
280 284
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index d7088331fb0f..6806d58211b2 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -345,11 +345,26 @@ static void r4k___flush_cache_all(void)
345 r4k_on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1); 345 r4k_on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1);
346} 346}
347 347
348static inline int has_valid_asid(const struct mm_struct *mm)
349{
350#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
351 int i;
352
353 for_each_online_cpu(i)
354 if (cpu_context(i, mm))
355 return 1;
356
357 return 0;
358#else
359 return cpu_context(smp_processor_id(), mm);
360#endif
361}
362
348static inline void local_r4k_flush_cache_range(void * args) 363static inline void local_r4k_flush_cache_range(void * args)
349{ 364{
350 struct vm_area_struct *vma = args; 365 struct vm_area_struct *vma = args;
351 366
352 if (!(cpu_context(smp_processor_id(), vma->vm_mm))) 367 if (!(has_valid_asid(vma->vm_mm)))
353 return; 368 return;
354 369
355 r4k_blast_dcache(); 370 r4k_blast_dcache();
@@ -368,7 +383,7 @@ static inline void local_r4k_flush_cache_mm(void * args)
368{ 383{
369 struct mm_struct *mm = args; 384 struct mm_struct *mm = args;
370 385
371 if (!cpu_context(smp_processor_id(), mm)) 386 if (!has_valid_asid(mm))
372 return; 387 return;
373 388
374 /* 389 /*
@@ -420,7 +435,7 @@ static inline void local_r4k_flush_cache_page(void *args)
420 * If ownes no valid ASID yet, cannot possibly have gotten 435 * If ownes no valid ASID yet, cannot possibly have gotten
421 * this page into the cache. 436 * this page into the cache.
422 */ 437 */
423 if (cpu_context(smp_processor_id(), mm) == 0) 438 if (!has_valid_asid(mm))
424 return; 439 return;
425 440
426 addr &= PAGE_MASK; 441 addr &= PAGE_MASK;
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index b1b40527658b..33519ce49540 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -12,8 +12,8 @@
12#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/string.h>
16#include <linux/scatterlist.h> 15#include <linux/scatterlist.h>
16#include <linux/string.h>
17 17
18#include <asm/cache.h> 18#include <asm/cache.h>
19#include <asm/io.h> 19#include <asm/io.h>
diff --git a/arch/mips/pci/fixup-pmcmsp.c b/arch/mips/pci/fixup-pmcmsp.c
index 00261211dbfa..65735b1b7665 100644
--- a/arch/mips/pci/fixup-pmcmsp.c
+++ b/arch/mips/pci/fixup-pmcmsp.c
@@ -202,7 +202,7 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
202 * RETURNS: IRQ number 202 * RETURNS: IRQ number
203 * 203 *
204 ****************************************************************************/ 204 ****************************************************************************/
205int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 205int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
206{ 206{
207#if !defined(CONFIG_PMC_MSP7120_GW) && !defined(CONFIG_PMC_MSP7120_EVAL) 207#if !defined(CONFIG_PMC_MSP7120_GW) && !defined(CONFIG_PMC_MSP7120_EVAL)
208 printk(KERN_WARNING "PCI: unknown board, no PCI IRQs assigned.\n"); 208 printk(KERN_WARNING "PCI: unknown board, no PCI IRQs assigned.\n");
diff --git a/arch/mips/pci/fixup-tb0219.c b/arch/mips/pci/fixup-tb0219.c
index 720a2b720c5c..ed87733f6796 100644
--- a/arch/mips/pci/fixup-tb0219.c
+++ b/arch/mips/pci/fixup-tb0219.c
@@ -2,7 +2,7 @@
2 * fixup-tb0219.c, The TANBAC TB0219 specific PCI fixups. 2 * fixup-tb0219.c, The TANBAC TB0219 specific PCI fixups.
3 * 3 *
4 * Copyright (C) 2003 Megasolution Inc. <matsu@megasolution.jp> 4 * Copyright (C) 2003 Megasolution Inc. <matsu@megasolution.jp>
5 * Copyright (C) 2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 5 * Copyright (C) 2004-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c
index 059eade96f2e..109c95ca698b 100644
--- a/arch/mips/pci/ops-pmcmsp.c
+++ b/arch/mips/pci/ops-pmcmsp.c
@@ -404,7 +404,7 @@ int msp_pcibios_config_access(unsigned char access_type,
404 if (pciirqflag == 0) { 404 if (pciirqflag == 0) {
405 request_irq(MSP_INT_PCI,/* Hardcoded internal MSP7120 wiring */ 405 request_irq(MSP_INT_PCI,/* Hardcoded internal MSP7120 wiring */
406 bpci_interrupt, 406 bpci_interrupt,
407 SA_SHIRQ | SA_INTERRUPT, 407 IRQF_SHARED | IRQF_DISABLED,
408 "PMC MSP PCI Host", 408 "PMC MSP PCI Host",
409 preg); 409 preg);
410 pciirqflag = ~0; 410 pciirqflag = ~0;
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_serial.c b/arch/mips/pmc-sierra/msp71xx/msp_serial.c
index 15e7b8000b4c..9de34302e5f4 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_serial.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_serial.c
@@ -122,7 +122,7 @@ void __init msp_serial_setup(void)
122 up.uartclk = uartclk; 122 up.uartclk = uartclk;
123 up.regshift = 2; 123 up.regshift = 2;
124 up.iotype = UPIO_DWAPB; /* UPIO_MEM like */ 124 up.iotype = UPIO_DWAPB; /* UPIO_MEM like */
125 up.flags = STD_COM_FLAGS; 125 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
126 up.type = PORT_16550A; 126 up.type = PORT_16550A;
127 up.line = 0; 127 up.line = 0;
128 up.private_data = (void*)UART0_STATUS_REG; 128 up.private_data = (void*)UART0_STATUS_REG;
diff --git a/arch/mips/qemu/q-irq.c b/arch/mips/qemu/q-irq.c
index 4681757460a1..11f984767880 100644
--- a/arch/mips/qemu/q-irq.c
+++ b/arch/mips/qemu/q-irq.c
@@ -1,4 +1,5 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/interrupt.h>
2#include <linux/linkage.h> 3#include <linux/linkage.h>
3 4
4#include <asm/i8259.h> 5#include <asm/i8259.h>
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index f5dccf01da11..08d45369be45 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -131,12 +131,12 @@ static struct irq_chip rt_irq_type = {
131static int rt_next_event(unsigned long delta, struct clock_event_device *evt) 131static int rt_next_event(unsigned long delta, struct clock_event_device *evt)
132{ 132{
133 unsigned int cpu = smp_processor_id(); 133 unsigned int cpu = smp_processor_id();
134 int slice = cputoslice(cpu) == 0; 134 int slice = cputoslice(cpu);
135 unsigned long cnt; 135 unsigned long cnt;
136 136
137 cnt = LOCAL_HUB_L(PI_RT_COUNT); 137 cnt = LOCAL_HUB_L(PI_RT_COUNT);
138 cnt += delta; 138 cnt += delta;
139 LOCAL_HUB_S(slice ? PI_RT_COMPARE_A : PI_RT_COMPARE_B, cnt); 139 LOCAL_HUB_S(PI_RT_COMPARE_A + PI_COUNT_OFFSET * slice, cnt);
140 140
141 return LOCAL_HUB_L(PI_RT_COUNT) >= cnt ? -ETIME : 0; 141 return LOCAL_HUB_L(PI_RT_COUNT) >= cnt ? -ETIME : 0;
142} 142}
@@ -164,9 +164,12 @@ static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id)
164{ 164{
165 struct clock_event_device *cd = dev_id; 165 struct clock_event_device *cd = dev_id;
166 unsigned int cpu = smp_processor_id(); 166 unsigned int cpu = smp_processor_id();
167 int slice = cputoslice(cpu) == 0; 167 int slice = cputoslice(cpu);
168 168
169 LOCAL_HUB_S(slice ? PI_RT_PEND_A : PI_RT_PEND_B, 0); /* Ack */ 169 /*
170 * Ack
171 */
172 LOCAL_HUB_S(PI_RT_PEND_A + PI_COUNT_OFFSET * slice, 0);
170 cd->event_handler(cd); 173 cd->event_handler(cd);
171 174
172 return IRQ_HANDLED; 175 return IRQ_HANDLED;
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index 7e8094f617bf..aab17ddd2f30 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -40,13 +40,6 @@ static void inline flush_mace_bus(void)
40 mace->perif.ctrl.misc; 40 mace->perif.ctrl.misc;
41} 41}
42 42
43#undef DEBUG_IRQ
44#ifdef DEBUG_IRQ
45#define DBG(x...) printk(x)
46#else
47#define DBG(x...)
48#endif
49
50/* 43/*
51 * O2 irq map 44 * O2 irq map
52 * 45 *
@@ -125,6 +118,7 @@ struct irqaction memerr_irq = {
125 .mask = CPU_MASK_NONE, 118 .mask = CPU_MASK_NONE,
126 .name = "CRIME memory error", 119 .name = "CRIME memory error",
127}; 120};
121
128struct irqaction cpuerr_irq = { 122struct irqaction cpuerr_irq = {
129 .handler = crime_cpuerr_intr, 123 .handler = crime_cpuerr_intr,
130 .flags = IRQF_DISABLED, 124 .flags = IRQF_DISABLED,
@@ -139,46 +133,70 @@ struct irqaction cpuerr_irq = {
139 133
140static uint64_t crime_mask; 134static uint64_t crime_mask;
141 135
142static void enable_crime_irq(unsigned int irq) 136static inline void crime_enable_irq(unsigned int irq)
143{ 137{
144 crime_mask |= 1 << (irq - 1); 138 unsigned int bit = irq - CRIME_IRQ_BASE;
139
140 crime_mask |= 1 << bit;
145 crime->imask = crime_mask; 141 crime->imask = crime_mask;
146} 142}
147 143
148static void disable_crime_irq(unsigned int irq) 144static inline void crime_disable_irq(unsigned int irq)
149{ 145{
150 crime_mask &= ~(1 << (irq - 1)); 146 unsigned int bit = irq - CRIME_IRQ_BASE;
147
148 crime_mask &= ~(1 << bit);
151 crime->imask = crime_mask; 149 crime->imask = crime_mask;
152 flush_crime_bus(); 150 flush_crime_bus();
153} 151}
154 152
155static void mask_and_ack_crime_irq(unsigned int irq) 153static void crime_level_mask_and_ack_irq(unsigned int irq)
154{
155 crime_disable_irq(irq);
156}
157
158static void crime_level_end_irq(unsigned int irq)
159{
160 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
161 crime_enable_irq(irq);
162}
163
164static struct irq_chip crime_level_interrupt = {
165 .name = "IP32 CRIME",
166 .ack = crime_level_mask_and_ack_irq,
167 .mask = crime_disable_irq,
168 .mask_ack = crime_level_mask_and_ack_irq,
169 .unmask = crime_enable_irq,
170 .end = crime_level_end_irq,
171};
172
173static void crime_edge_mask_and_ack_irq(unsigned int irq)
156{ 174{
175 unsigned int bit = irq - CRIME_IRQ_BASE;
176 uint64_t crime_int;
177
157 /* Edge triggered interrupts must be cleared. */ 178 /* Edge triggered interrupts must be cleared. */
158 if ((irq >= CRIME_GBE0_IRQ && irq <= CRIME_GBE3_IRQ) 179
159 || (irq >= CRIME_RE_EMPTY_E_IRQ && irq <= CRIME_RE_IDLE_E_IRQ) 180 crime_int = crime->hard_int;
160 || (irq >= CRIME_SOFT0_IRQ && irq <= CRIME_SOFT2_IRQ)) { 181 crime_int &= ~(1 << bit);
161 uint64_t crime_int; 182 crime->hard_int = crime_int;
162 crime_int = crime->hard_int; 183
163 crime_int &= ~(1 << (irq - 1)); 184 crime_disable_irq(irq);
164 crime->hard_int = crime_int;
165 }
166 disable_crime_irq(irq);
167} 185}
168 186
169static void end_crime_irq(unsigned int irq) 187static void crime_edge_end_irq(unsigned int irq)
170{ 188{
171 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) 189 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
172 enable_crime_irq(irq); 190 crime_enable_irq(irq);
173} 191}
174 192
175static struct irq_chip ip32_crime_interrupt = { 193static struct irq_chip crime_edge_interrupt = {
176 .name = "IP32 CRIME", 194 .name = "IP32 CRIME",
177 .ack = mask_and_ack_crime_irq, 195 .ack = crime_edge_mask_and_ack_irq,
178 .mask = disable_crime_irq, 196 .mask = crime_disable_irq,
179 .mask_ack = mask_and_ack_crime_irq, 197 .mask_ack = crime_edge_mask_and_ack_irq,
180 .unmask = enable_crime_irq, 198 .unmask = crime_enable_irq,
181 .end = end_crime_irq, 199 .end = crime_edge_end_irq,
182}; 200};
183 201
184/* 202/*
@@ -265,7 +283,7 @@ static void enable_maceisa_irq(unsigned int irq)
265{ 283{
266 unsigned int crime_int = 0; 284 unsigned int crime_int = 0;
267 285
268 DBG("maceisa enable: %u\n", irq); 286 pr_debug("maceisa enable: %u\n", irq);
269 287
270 switch (irq) { 288 switch (irq) {
271 case MACEISA_AUDIO_SW_IRQ ... MACEISA_AUDIO3_MERR_IRQ: 289 case MACEISA_AUDIO_SW_IRQ ... MACEISA_AUDIO3_MERR_IRQ:
@@ -278,7 +296,7 @@ static void enable_maceisa_irq(unsigned int irq)
278 crime_int = MACE_SUPERIO_INT; 296 crime_int = MACE_SUPERIO_INT;
279 break; 297 break;
280 } 298 }
281 DBG("crime_int %08x enabled\n", crime_int); 299 pr_debug("crime_int %08x enabled\n", crime_int);
282 crime_mask |= crime_int; 300 crime_mask |= crime_int;
283 crime->imask = crime_mask; 301 crime->imask = crime_mask;
284 maceisa_mask |= 1 << (irq - 33); 302 maceisa_mask |= 1 << (irq - 33);
@@ -290,11 +308,11 @@ static void disable_maceisa_irq(unsigned int irq)
290 unsigned int crime_int = 0; 308 unsigned int crime_int = 0;
291 309
292 maceisa_mask &= ~(1 << (irq - 33)); 310 maceisa_mask &= ~(1 << (irq - 33));
293 if(!(maceisa_mask & MACEISA_AUDIO_INT)) 311 if (!(maceisa_mask & MACEISA_AUDIO_INT))
294 crime_int |= MACE_AUDIO_INT; 312 crime_int |= MACE_AUDIO_INT;
295 if(!(maceisa_mask & MACEISA_MISC_INT)) 313 if (!(maceisa_mask & MACEISA_MISC_INT))
296 crime_int |= MACE_MISC_INT; 314 crime_int |= MACE_MISC_INT;
297 if(!(maceisa_mask & MACEISA_SUPERIO_INT)) 315 if (!(maceisa_mask & MACEISA_SUPERIO_INT))
298 crime_int |= MACE_SUPERIO_INT; 316 crime_int |= MACE_SUPERIO_INT;
299 crime_mask &= ~crime_int; 317 crime_mask &= ~crime_int;
300 crime->imask = crime_mask; 318 crime->imask = crime_mask;
@@ -327,12 +345,12 @@ static void end_maceisa_irq(unsigned irq)
327} 345}
328 346
329static struct irq_chip ip32_maceisa_interrupt = { 347static struct irq_chip ip32_maceisa_interrupt = {
330 .name = "IP32 MACE ISA", 348 .name = "IP32 MACE ISA",
331 .ack = mask_and_ack_maceisa_irq, 349 .ack = mask_and_ack_maceisa_irq,
332 .mask = disable_maceisa_irq, 350 .mask = disable_maceisa_irq,
333 .mask_ack = mask_and_ack_maceisa_irq, 351 .mask_ack = mask_and_ack_maceisa_irq,
334 .unmask = enable_maceisa_irq, 352 .unmask = enable_maceisa_irq,
335 .end = end_maceisa_irq, 353 .end = end_maceisa_irq,
336}; 354};
337 355
338/* This is used for regular non-ISA, non-PCI MACE interrupts. That means 356/* This is used for regular non-ISA, non-PCI MACE interrupts. That means
@@ -411,7 +429,7 @@ static void ip32_irq0(void)
411 irq = __ffs(mace_int & maceisa_mask) + MACEISA_AUDIO_SW_IRQ; 429 irq = __ffs(mace_int & maceisa_mask) + MACEISA_AUDIO_SW_IRQ;
412 } 430 }
413 431
414 DBG("*irq %u*\n", irq); 432 pr_debug("*irq %u*\n", irq);
415 do_IRQ(irq); 433 do_IRQ(irq);
416} 434}
417 435
@@ -472,23 +490,31 @@ void __init arch_init_irq(void)
472 490
473 mips_cpu_irq_init(); 491 mips_cpu_irq_init();
474 for (irq = MIPS_CPU_IRQ_BASE + 8; irq <= IP32_IRQ_MAX; irq++) { 492 for (irq = MIPS_CPU_IRQ_BASE + 8; irq <= IP32_IRQ_MAX; irq++) {
475 struct irq_chip *chip;
476
477 switch (irq) { 493 switch (irq) {
478 case MACE_VID_IN1_IRQ ... MACE_PCI_BRIDGE_IRQ: 494 case MACE_VID_IN1_IRQ ... MACE_PCI_BRIDGE_IRQ:
479 chip = &ip32_mace_interrupt; 495 set_irq_chip(irq, &ip32_mace_interrupt);
480 break; 496 break;
481 case MACEPCI_SCSI0_IRQ ... MACEPCI_SHARED2_IRQ: 497 case MACEPCI_SCSI0_IRQ ... MACEPCI_SHARED2_IRQ:
482 chip = &ip32_macepci_interrupt; 498 set_irq_chip(irq, &ip32_macepci_interrupt);
499 break;
500 case CRIME_GBE0_IRQ ... CRIME_GBE3_IRQ:
501 set_irq_chip(irq, &crime_edge_interrupt);
502 break;
503 case CRIME_CPUERR_IRQ:
504 case CRIME_MEMERR_IRQ:
505 set_irq_chip(irq, &crime_level_interrupt);
483 break; 506 break;
484 case CRIME_GBE0_IRQ ... CRIME_VICE_IRQ: 507 case CRIME_RE_EMPTY_E_IRQ ... CRIME_RE_IDLE_E_IRQ:
485 chip = &ip32_crime_interrupt; 508 case CRIME_SOFT0_IRQ ... CRIME_SOFT2_IRQ:
509 set_irq_chip(irq, &crime_edge_interrupt);
510 break;
511 case CRIME_VICE_IRQ:
512 set_irq_chip(irq, &crime_edge_interrupt);
486 break; 513 break;
487 default: 514 default:
488 chip = &ip32_maceisa_interrupt; 515 set_irq_chip(irq, &ip32_maceisa_interrupt);
516 break;
489 } 517 }
490
491 set_irq_chip(irq, chip);
492 } 518 }
493 setup_irq(CRIME_MEMERR_IRQ, &memerr_irq); 519 setup_irq(CRIME_MEMERR_IRQ, &memerr_irq);
494 setup_irq(CRIME_CPUERR_IRQ, &cpuerr_irq); 520 setup_irq(CRIME_CPUERR_IRQ, &cpuerr_irq);
diff --git a/arch/mips/sgi-ip32/ip32-platform.c b/arch/mips/sgi-ip32/ip32-platform.c
index 7309e48d163d..77febd68fcd4 100644
--- a/arch/mips/sgi-ip32/ip32-platform.c
+++ b/arch/mips/sgi-ip32/ip32-platform.c
@@ -42,7 +42,7 @@ static struct platform_device uart8250_device = {
42static int __init uart8250_init(void) 42static int __init uart8250_init(void)
43{ 43{
44 uart8250_data[0].membase = (void __iomem *) &mace->isa.serial1; 44 uart8250_data[0].membase = (void __iomem *) &mace->isa.serial1;
45 uart8250_data[1].membase = (void __iomem *) &mace->isa.serial1; 45 uart8250_data[1].membase = (void __iomem *) &mace->isa.serial2;
46 46
47 return platform_device_register(&uart8250_device); 47 return platform_device_register(&uart8250_device);
48} 48}
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig
index e8fb880272bd..366b19d33f77 100644
--- a/arch/mips/sibyte/Kconfig
+++ b/arch/mips/sibyte/Kconfig
@@ -1,5 +1,7 @@
1config SIBYTE_SB1250 1config SIBYTE_SB1250
2 bool 2 bool
3 select CEVT_SB1250
4 select CSRC_SB1250
3 select HW_HAS_PCI 5 select HW_HAS_PCI
4 select IRQ_CPU 6 select IRQ_CPU
5 select SIBYTE_ENABLE_LDT_IF_PCI 7 select SIBYTE_ENABLE_LDT_IF_PCI
@@ -9,6 +11,8 @@ config SIBYTE_SB1250
9 11
10config SIBYTE_BCM1120 12config SIBYTE_BCM1120
11 bool 13 bool
14 select CEVT_SB1250
15 select CSRC_SB1250
12 select IRQ_CPU 16 select IRQ_CPU
13 select SIBYTE_BCM112X 17 select SIBYTE_BCM112X
14 select SIBYTE_HAS_ZBUS_PROFILING 18 select SIBYTE_HAS_ZBUS_PROFILING
@@ -16,6 +20,8 @@ config SIBYTE_BCM1120
16 20
17config SIBYTE_BCM1125 21config SIBYTE_BCM1125
18 bool 22 bool
23 select CEVT_SB1250
24 select CSRC_SB1250
19 select HW_HAS_PCI 25 select HW_HAS_PCI
20 select IRQ_CPU 26 select IRQ_CPU
21 select SIBYTE_BCM112X 27 select SIBYTE_BCM112X
@@ -24,6 +30,8 @@ config SIBYTE_BCM1125
24 30
25config SIBYTE_BCM1125H 31config SIBYTE_BCM1125H
26 bool 32 bool
33 select CEVT_SB1250
34 select CSRC_SB1250
27 select HW_HAS_PCI 35 select HW_HAS_PCI
28 select IRQ_CPU 36 select IRQ_CPU
29 select SIBYTE_BCM112X 37 select SIBYTE_BCM112X
@@ -33,12 +41,16 @@ config SIBYTE_BCM1125H
33 41
34config SIBYTE_BCM112X 42config SIBYTE_BCM112X
35 bool 43 bool
44 select CEVT_SB1250
45 select CSRC_SB1250
36 select IRQ_CPU 46 select IRQ_CPU
37 select SIBYTE_SB1xxx_SOC 47 select SIBYTE_SB1xxx_SOC
38 select SIBYTE_HAS_ZBUS_PROFILING 48 select SIBYTE_HAS_ZBUS_PROFILING
39 49
40config SIBYTE_BCM1x80 50config SIBYTE_BCM1x80
41 bool 51 bool
52 select CEVT_BCM1480
53 select CSRC_BCM1480
42 select HW_HAS_PCI 54 select HW_HAS_PCI
43 select IRQ_CPU 55 select IRQ_CPU
44 select SIBYTE_HAS_ZBUS_PROFILING 56 select SIBYTE_HAS_ZBUS_PROFILING
@@ -47,6 +59,8 @@ config SIBYTE_BCM1x80
47 59
48config SIBYTE_BCM1x55 60config SIBYTE_BCM1x55
49 bool 61 bool
62 select CEVT_BCM1480
63 select CSRC_BCM1480
50 select HW_HAS_PCI 64 select HW_HAS_PCI
51 select IRQ_CPU 65 select IRQ_CPU
52 select SIBYTE_SB1xxx_SOC 66 select SIBYTE_SB1xxx_SOC
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index 10299bafeab7..e28d626255a3 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -265,42 +265,6 @@ void __init init_bcm1480_irqs(void)
265 } 265 }
266} 266}
267 267
268
269static irqreturn_t bcm1480_dummy_handler(int irq, void *dev_id)
270{
271 return IRQ_NONE;
272}
273
274static struct irqaction bcm1480_dummy_action = {
275 .handler = bcm1480_dummy_handler,
276 .flags = 0,
277 .mask = CPU_MASK_NONE,
278 .name = "bcm1480-private",
279 .next = NULL,
280 .dev_id = 0
281};
282
283int bcm1480_steal_irq(int irq)
284{
285 struct irq_desc *desc = irq_desc + irq;
286 unsigned long flags;
287 int retval = 0;
288
289 if (irq >= BCM1480_NR_IRQS)
290 return -EINVAL;
291
292 spin_lock_irqsave(&desc->lock, flags);
293 /* Don't allow sharing at all for these */
294 if (desc->action != NULL)
295 retval = -EBUSY;
296 else {
297 desc->action = &bcm1480_dummy_action;
298 desc->depth = 0;
299 }
300 spin_unlock_irqrestore(&desc->lock, flags);
301 return 0;
302}
303
304/* 268/*
305 * init_IRQ is called early in the boot sequence from init/main.c. It 269 * init_IRQ is called early in the boot sequence from init/main.c. It
306 * is responsible for setting up the interrupt mapper and installing the 270 * is responsible for setting up the interrupt mapper and installing the
@@ -329,7 +293,6 @@ int bcm1480_steal_irq(int irq)
329 293
330void __init arch_init_irq(void) 294void __init arch_init_irq(void)
331{ 295{
332
333 unsigned int i, cpu; 296 unsigned int i, cpu;
334 u64 tmp; 297 u64 tmp;
335 unsigned int imask = STATUSF_IP4 | STATUSF_IP3 | STATUSF_IP2 | 298 unsigned int imask = STATUSF_IP4 | STATUSF_IP3 | STATUSF_IP2 |
@@ -386,8 +349,6 @@ void __init arch_init_irq(void)
386 __raw_writeq(tmp, IOADDR(A_BCM1480_IMR_REGISTER(cpu, R_BCM1480_IMR_INTERRUPT_MASK_L))); 349 __raw_writeq(tmp, IOADDR(A_BCM1480_IMR_REGISTER(cpu, R_BCM1480_IMR_INTERRUPT_MASK_L)));
387 } 350 }
388 351
389 bcm1480_steal_irq(K_BCM1480_INT_MBOX_0_0);
390
391 /* 352 /*
392 * Note that the timer interrupts are also mapped, but this is 353 * Note that the timer interrupts are also mapped, but this is
393 * done in bcm1480_time_init(). Also, the profiling driver 354 * done in bcm1480_time_init(). Also, the profiling driver
@@ -411,7 +372,6 @@ void __init arch_init_irq(void)
411 /* QQQ FIXME */ 372 /* QQQ FIXME */
412 __raw_writeq(M_DUART_IMR_BRK, IO_SPACE_BASE + A_DUART_IMRREG(kgdb_port)); 373 __raw_writeq(M_DUART_IMR_BRK, IO_SPACE_BASE + A_DUART_IMRREG(kgdb_port));
413 374
414 bcm1480_steal_irq(kgdb_irq);
415 __raw_writeq(IMR_IP6_VAL, 375 __raw_writeq(IMR_IP6_VAL,
416 IO_SPACE_BASE + A_BCM1480_IMR_REGISTER(0, R_BCM1480_IMR_INTERRUPT_MAP_BASE_H) + 376 IO_SPACE_BASE + A_BCM1480_IMR_REGISTER(0, R_BCM1480_IMR_INTERRUPT_MAP_BASE_H) +
417 (kgdb_irq<<3)); 377 (kgdb_irq<<3));
diff --git a/arch/mips/sibyte/bcm1480/time.c b/arch/mips/sibyte/bcm1480/time.c
index 610f0253954d..1680a68952ae 100644
--- a/arch/mips/sibyte/bcm1480/time.c
+++ b/arch/mips/sibyte/bcm1480/time.c
@@ -15,166 +15,10 @@
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18#include <linux/clockchips.h> 18#include <linux/init.h>
19#include <linux/interrupt.h>
20#include <linux/irq.h>
21#include <linux/percpu.h>
22#include <linux/spinlock.h>
23 19
24#include <asm/addrspace.h> 20extern void sb1480_clockevent_init(void);
25#include <asm/time.h> 21extern void sb1480_clocksource_init(void);
26#include <asm/io.h>
27
28#include <asm/sibyte/bcm1480_regs.h>
29#include <asm/sibyte/sb1250_regs.h>
30#include <asm/sibyte/bcm1480_int.h>
31#include <asm/sibyte/bcm1480_scd.h>
32
33#include <asm/sibyte/sb1250.h>
34
35
36#define IMR_IP2_VAL K_BCM1480_INT_MAP_I0
37#define IMR_IP3_VAL K_BCM1480_INT_MAP_I1
38#define IMR_IP4_VAL K_BCM1480_INT_MAP_I2
39
40extern int bcm1480_steal_irq(int irq);
41
42/*
43 * The general purpose timer ticks at 1MHz independent if
44 * the rest of the system
45 */
46static void sibyte_set_mode(enum clock_event_mode mode,
47 struct clock_event_device *evt)
48{
49 unsigned int cpu = smp_processor_id();
50 void __iomem *timer_cfg, *timer_init;
51
52 timer_cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
53 timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
54
55 switch (mode) {
56 case CLOCK_EVT_MODE_PERIODIC:
57 __raw_writeq(0, timer_cfg);
58 __raw_writeq((V_SCD_TIMER_FREQ / HZ) - 1, timer_init);
59 __raw_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
60 timer_cfg);
61 break;
62
63 case CLOCK_EVT_MODE_ONESHOT:
64 /* Stop the timer until we actually program a shot */
65 case CLOCK_EVT_MODE_SHUTDOWN:
66 __raw_writeq(0, timer_cfg);
67 break;
68
69 case CLOCK_EVT_MODE_UNUSED: /* shuddup gcc */
70 case CLOCK_EVT_MODE_RESUME:
71 ;
72 }
73}
74
75static int sibyte_next_event(unsigned long delta, struct clock_event_device *cd)
76{
77 unsigned int cpu = smp_processor_id();
78 void __iomem *timer_init;
79 unsigned int cnt;
80 int res;
81
82 timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
83 cnt = __raw_readq(timer_init);
84 cnt += delta;
85 __raw_writeq(cnt, timer_init);
86 res = ((long)(__raw_readq(timer_init) - cnt ) > 0) ? -ETIME : 0;
87
88 return res;
89}
90
91static irqreturn_t sibyte_counter_handler(int irq, void *dev_id)
92{
93 unsigned int cpu = smp_processor_id();
94 struct clock_event_device *cd = dev_id;
95 void __iomem *timer_cfg;
96
97 timer_cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
98
99 /* Reset the timer */
100 __raw_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
101 timer_cfg);
102 cd->event_handler(cd);
103
104 return IRQ_HANDLED;
105}
106
107static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
108static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
109static DEFINE_PER_CPU(char [18], sibyte_hpt_name);
110
111void __cpuinit sb1480_clockevent_init(void)
112{
113 unsigned int cpu = smp_processor_id();
114 unsigned int irq = K_BCM1480_INT_TIMER_0 + cpu;
115 struct irqaction *action = &per_cpu(sibyte_hpt_irqaction, cpu);
116 struct clock_event_device *cd = &per_cpu(sibyte_hpt_clockevent, cpu);
117 unsigned char *name = per_cpu(sibyte_hpt_name, cpu);
118
119 BUG_ON(cpu > 3); /* Only have 4 general purpose timers */
120
121 sprintf(name, "bcm1480-counter %d", cpu);
122 cd->name = name;
123 cd->features = CLOCK_EVT_FEAT_PERIODIC |
124 CLOCK_EVT_MODE_ONESHOT;
125 clockevent_set_clock(cd, V_SCD_TIMER_FREQ);
126 cd->max_delta_ns = clockevent_delta2ns(0x7fffff, cd);
127 cd->min_delta_ns = clockevent_delta2ns(1, cd);
128 cd->rating = 200;
129 cd->irq = irq;
130 cd->cpumask = cpumask_of_cpu(cpu);
131 cd->set_next_event = sibyte_next_event;
132 cd->set_mode = sibyte_set_mode;
133 clockevents_register_device(cd);
134
135 bcm1480_mask_irq(cpu, irq);
136
137 /*
138 * Map timer interrupt to IP[4] of this cpu
139 */
140 __raw_writeq(IMR_IP4_VAL,
141 IOADDR(A_BCM1480_IMR_REGISTER(cpu,
142 R_BCM1480_IMR_INTERRUPT_MAP_BASE_H) + (irq << 3)));
143
144 bcm1480_unmask_irq(cpu, irq);
145 bcm1480_steal_irq(irq);
146
147 action->handler = sibyte_counter_handler;
148 action->flags = IRQF_DISABLED | IRQF_PERCPU;
149 action->name = name;
150 action->dev_id = cd;
151 setup_irq(irq, action);
152}
153
154static cycle_t bcm1480_hpt_read(void)
155{
156 return (cycle_t) __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT));
157}
158
159struct clocksource bcm1480_clocksource = {
160 .name = "zbbus-cycles",
161 .rating = 200,
162 .read = bcm1480_hpt_read,
163 .mask = CLOCKSOURCE_MASK(64),
164 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
165};
166
167void __init sb1480_clocksource_init(void)
168{
169 struct clocksource *cs = &bcm1480_clocksource;
170 unsigned int plldiv;
171 unsigned long zbbus;
172
173 plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
174 zbbus = ((plldiv >> 1) * 50000000) + ((plldiv & 1) * 25000000);
175 clocksource_set_clock(cs, zbbus);
176 clocksource_register(cs);
177}
178 22
179void __init plat_time_init(void) 23void __init plat_time_init(void)
180{ 24{
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index 53780a179d1d..eac9065ffe0c 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -236,41 +236,6 @@ void __init init_sb1250_irqs(void)
236} 236}
237 237
238 238
239static irqreturn_t sb1250_dummy_handler(int irq, void *dev_id)
240{
241 return IRQ_NONE;
242}
243
244static struct irqaction sb1250_dummy_action = {
245 .handler = sb1250_dummy_handler,
246 .flags = 0,
247 .mask = CPU_MASK_NONE,
248 .name = "sb1250-private",
249 .next = NULL,
250 .dev_id = 0
251};
252
253int sb1250_steal_irq(int irq)
254{
255 struct irq_desc *desc = irq_desc + irq;
256 unsigned long flags;
257 int retval = 0;
258
259 if (irq >= SB1250_NR_IRQS)
260 return -EINVAL;
261
262 spin_lock_irqsave(&desc->lock, flags);
263 /* Don't allow sharing at all for these */
264 if (desc->action != NULL)
265 retval = -EBUSY;
266 else {
267 desc->action = &sb1250_dummy_action;
268 desc->depth = 0;
269 }
270 spin_unlock_irqrestore(&desc->lock, flags);
271 return 0;
272}
273
274/* 239/*
275 * arch_init_irq is called early in the boot sequence from init/main.c via 240 * arch_init_irq is called early in the boot sequence from init/main.c via
276 * init_IRQ. It is responsible for setting up the interrupt mapper and 241 * init_IRQ. It is responsible for setting up the interrupt mapper and
@@ -342,8 +307,6 @@ void __init arch_init_irq(void)
342 __raw_writeq(tmp, IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MASK))); 307 __raw_writeq(tmp, IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MASK)));
343 __raw_writeq(tmp, IOADDR(A_IMR_REGISTER(1, R_IMR_INTERRUPT_MASK))); 308 __raw_writeq(tmp, IOADDR(A_IMR_REGISTER(1, R_IMR_INTERRUPT_MASK)));
344 309
345 sb1250_steal_irq(K_INT_MBOX_0);
346
347 /* 310 /*
348 * Note that the timer interrupts are also mapped, but this is 311 * Note that the timer interrupts are also mapped, but this is
349 * done in sb1250_time_init(). Also, the profiling driver 312 * done in sb1250_time_init(). Also, the profiling driver
@@ -367,7 +330,6 @@ void __init arch_init_irq(void)
367 __raw_writeq(M_DUART_IMR_BRK, 330 __raw_writeq(M_DUART_IMR_BRK,
368 IOADDR(A_DUART_IMRREG(kgdb_port))); 331 IOADDR(A_DUART_IMRREG(kgdb_port)));
369 332
370 sb1250_steal_irq(kgdb_irq);
371 __raw_writeq(IMR_IP6_VAL, 333 __raw_writeq(IMR_IP6_VAL,
372 IOADDR(A_IMR_REGISTER(0, 334 IOADDR(A_IMR_REGISTER(0,
373 R_IMR_INTERRUPT_MAP_BASE) + 335 R_IMR_INTERRUPT_MAP_BASE) +
diff --git a/arch/mips/sibyte/sb1250/time.c b/arch/mips/sibyte/sb1250/time.c
index a41e908bc218..68337bf7a5aa 100644
--- a/arch/mips/sibyte/sb1250/time.c
+++ b/arch/mips/sibyte/sb1250/time.c
@@ -15,198 +15,10 @@
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18#include <linux/init.h>
18 19
19/* 20extern void sb1250_clocksource_init(void);
20 * These are routines to set up and handle interrupts from the 21extern void sb1250_clockevent_init(void);
21 * sb1250 general purpose timer 0. We're using the timer as a
22 * system clock, so we set it up to run at 100 Hz. On every
23 * interrupt, we update our idea of what the time of day is,
24 * then call do_timer() in the architecture-independent kernel
25 * code to do general bookkeeping (e.g. update jiffies, run
26 * bottom halves, etc.)
27 */
28#include <linux/clockchips.h>
29#include <linux/interrupt.h>
30#include <linux/sched.h>
31#include <linux/spinlock.h>
32#include <linux/kernel_stat.h>
33
34#include <asm/irq.h>
35#include <asm/addrspace.h>
36#include <asm/time.h>
37#include <asm/io.h>
38
39#include <asm/sibyte/sb1250.h>
40#include <asm/sibyte/sb1250_regs.h>
41#include <asm/sibyte/sb1250_int.h>
42#include <asm/sibyte/sb1250_scd.h>
43
44
45#define IMR_IP2_VAL K_INT_MAP_I0
46#define IMR_IP3_VAL K_INT_MAP_I1
47#define IMR_IP4_VAL K_INT_MAP_I2
48
49#define SB1250_HPT_NUM 3
50#define SB1250_HPT_VALUE M_SCD_TIMER_CNT /* max value */
51
52
53extern int sb1250_steal_irq(int irq);
54
55/*
56 * The general purpose timer ticks at 1 Mhz independent if
57 * the rest of the system
58 */
59static void sibyte_set_mode(enum clock_event_mode mode,
60 struct clock_event_device *evt)
61{
62 unsigned int cpu = smp_processor_id();
63 void __iomem *timer_cfg, *timer_init;
64
65 timer_cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
66 timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
67
68 switch(mode) {
69 case CLOCK_EVT_MODE_PERIODIC:
70 __raw_writeq(0, timer_cfg);
71 __raw_writeq((V_SCD_TIMER_FREQ / HZ) - 1, timer_init);
72 __raw_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
73 timer_cfg);
74 break;
75
76 case CLOCK_EVT_MODE_ONESHOT:
77 /* Stop the timer until we actually program a shot */
78 case CLOCK_EVT_MODE_SHUTDOWN:
79 __raw_writeq(0, timer_cfg);
80 break;
81
82 case CLOCK_EVT_MODE_UNUSED: /* shuddup gcc */
83 case CLOCK_EVT_MODE_RESUME:
84 ;
85 }
86}
87
88static int
89sibyte_next_event(unsigned long delta, struct clock_event_device *evt)
90{
91 unsigned int cpu = smp_processor_id();
92 void __iomem *timer_cfg, *timer_init;
93
94 timer_cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
95 timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
96
97 __raw_writeq(0, timer_cfg);
98 __raw_writeq(delta, timer_init);
99 __raw_writeq(M_SCD_TIMER_ENABLE, timer_cfg);
100
101 return 0;
102}
103
104static irqreturn_t sibyte_counter_handler(int irq, void *dev_id)
105{
106 unsigned int cpu = smp_processor_id();
107 struct clock_event_device *cd = dev_id;
108
109 /* ACK interrupt */
110 ____raw_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
111 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)));
112
113 cd->event_handler(cd);
114
115 return IRQ_HANDLED;
116}
117
118static struct irqaction sibyte_irqaction = {
119 .handler = sibyte_counter_handler,
120 .flags = IRQF_DISABLED | IRQF_PERCPU,
121 .name = "timer",
122};
123
124static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
125static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
126static DEFINE_PER_CPU(char [18], sibyte_hpt_name);
127
128void __cpuinit sb1250_clockevent_init(void)
129{
130 unsigned int cpu = smp_processor_id();
131 unsigned int irq = K_INT_TIMER_0 + cpu;
132 struct irqaction *action = &per_cpu(sibyte_hpt_irqaction, cpu);
133 struct clock_event_device *cd = &per_cpu(sibyte_hpt_clockevent, cpu);
134 unsigned char *name = per_cpu(sibyte_hpt_name, cpu);
135
136 /* Only have 4 general purpose timers, and we use last one as hpt */
137 BUG_ON(cpu > 2);
138
139 sprintf(name, "bcm1480-counter %d", cpu);
140 cd->name = name;
141 cd->features = CLOCK_EVT_FEAT_PERIODIC |
142 CLOCK_EVT_MODE_ONESHOT;
143 clockevent_set_clock(cd, V_SCD_TIMER_FREQ);
144 cd->max_delta_ns = clockevent_delta2ns(0x7fffff, cd);
145 cd->min_delta_ns = clockevent_delta2ns(1, cd);
146 cd->rating = 200;
147 cd->irq = irq;
148 cd->cpumask = cpumask_of_cpu(cpu);
149 cd->set_next_event = sibyte_next_event;
150 cd->set_mode = sibyte_set_mode;
151 clockevents_register_device(cd);
152
153 sb1250_mask_irq(cpu, irq);
154
155 /* Map the timer interrupt to ip[4] of this cpu */
156 __raw_writeq(IMR_IP4_VAL,
157 IOADDR(A_IMR_REGISTER(cpu, R_IMR_INTERRUPT_MAP_BASE) +
158 (irq << 3)));
159 cd->cpumask = cpumask_of_cpu(0);
160
161 sb1250_unmask_irq(cpu, irq);
162 sb1250_steal_irq(irq);
163
164 action->handler = sibyte_counter_handler;
165 action->flags = IRQF_DISABLED | IRQF_PERCPU;
166 action->name = name;
167 action->dev_id = cd;
168 setup_irq(irq, &sibyte_irqaction);
169}
170
171/*
172 * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over
173 * again.
174 */
175static cycle_t sb1250_hpt_read(void)
176{
177 unsigned int count;
178
179 count = G_SCD_TIMER_CNT(__raw_readq(IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM, R_SCD_TIMER_CNT))));
180
181 return SB1250_HPT_VALUE - count;
182}
183
184struct clocksource bcm1250_clocksource = {
185 .name = "MIPS",
186 .rating = 200,
187 .read = sb1250_hpt_read,
188 .mask = CLOCKSOURCE_MASK(23),
189 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
190};
191
192void __init sb1250_clocksource_init(void)
193{
194 struct clocksource *cs = &bcm1250_clocksource;
195
196 /* Setup hpt using timer #3 but do not enable irq for it */
197 __raw_writeq(0,
198 IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM,
199 R_SCD_TIMER_CFG)));
200 __raw_writeq(SB1250_HPT_VALUE,
201 IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM,
202 R_SCD_TIMER_INIT)));
203 __raw_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
204 IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM,
205 R_SCD_TIMER_CFG)));
206
207 clocksource_set_clock(cs, V_SCD_TIMER_FREQ);
208 clocksource_register(cs);
209}
210 22
211void __init plat_time_init(void) 23void __init plat_time_init(void)
212{ 24{
diff --git a/arch/mips/sni/time.c b/arch/mips/sni/time.c
index 0910b35cb71f..6f339af08d22 100644
--- a/arch/mips/sni/time.c
+++ b/arch/mips/sni/time.c
@@ -1,6 +1,7 @@
1#include <linux/types.h> 1#include <linux/types.h>
2#include <linux/interrupt.h> 2#include <linux/interrupt.h>
3#include <linux/time.h> 3#include <linux/time.h>
4#include <linux/clockchips.h>
4 5
5#include <asm/i8253.h> 6#include <asm/i8253.h>
6#include <asm/sni.h> 7#include <asm/sni.h>
@@ -11,27 +12,78 @@
11#define SNI_COUNTER2_DIV 64 12#define SNI_COUNTER2_DIV 64
12#define SNI_COUNTER0_DIV ((SNI_CLOCK_TICK_RATE / SNI_COUNTER2_DIV) / HZ) 13#define SNI_COUNTER0_DIV ((SNI_CLOCK_TICK_RATE / SNI_COUNTER2_DIV) / HZ)
13 14
14static void sni_a20r_timer_ack(void) 15static void a20r_set_mode(enum clock_event_mode mode,
16 struct clock_event_device *evt)
15{ 17{
16 *(volatile u8 *)A20R_PT_TIM0_ACK = 0x0; wmb(); 18 switch (mode) {
19 case CLOCK_EVT_MODE_PERIODIC:
20 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0x34;
21 wmb();
22 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV;
23 wmb();
24 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV >> 8;
25 wmb();
26
27 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0xb4;
28 wmb();
29 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV;
30 wmb();
31 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV >> 8;
32 wmb();
33
34 break;
35 case CLOCK_EVT_MODE_ONESHOT:
36 case CLOCK_EVT_MODE_UNUSED:
37 case CLOCK_EVT_MODE_SHUTDOWN:
38 break;
39 case CLOCK_EVT_MODE_RESUME:
40 break;
41 }
17} 42}
18 43
44static struct clock_event_device a20r_clockevent_device = {
45 .name = "a20r-timer",
46 .features = CLOCK_EVT_FEAT_PERIODIC,
47
48 /* .mult, .shift, .max_delta_ns and .min_delta_ns left uninitialized */
49
50 .rating = 300,
51 .irq = SNI_A20R_IRQ_TIMER,
52 .set_mode = a20r_set_mode,
53};
54
55static irqreturn_t a20r_interrupt(int irq, void *dev_id)
56{
57 struct clock_event_device *cd = dev_id;
58
59 *(volatile u8 *)A20R_PT_TIM0_ACK = 0;
60 wmb();
61
62 cd->event_handler(cd);
63
64 return IRQ_HANDLED;
65}
66
67static struct irqaction a20r_irqaction = {
68 .handler = a20r_interrupt,
69 .flags = IRQF_DISABLED | IRQF_PERCPU,
70 .name = "a20r-timer",
71};
72
19/* 73/*
20 * a20r platform uses 2 counters to divide the input frequency. 74 * a20r platform uses 2 counters to divide the input frequency.
21 * Counter 2 output is connected to Counter 0 & 1 input. 75 * Counter 2 output is connected to Counter 0 & 1 input.
22 */ 76 */
23static void __init sni_a20r_timer_setup(struct irqaction *irq) 77static void __init sni_a20r_timer_setup(void)
24{ 78{
25 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0x34; wmb(); 79 struct clock_event_device *cd = &a20r_clockevent_device;
26 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = (SNI_COUNTER0_DIV) & 0xff; wmb(); 80 struct irqaction *action = &a20r_irqaction;
27 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = (SNI_COUNTER0_DIV >> 8) & 0xff; wmb(); 81 unsigned int cpu = smp_processor_id();
28 82
29 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0xb4; wmb(); 83 cd->cpumask = cpumask_of_cpu(cpu);
30 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = (SNI_COUNTER2_DIV) & 0xff; wmb(); 84 clockevents_register_device(cd);
31 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = (SNI_COUNTER2_DIV >> 8) & 0xff; wmb(); 85 action->dev_id = cd;
32 86 setup_irq(SNI_A20R_IRQ_TIMER, &a20r_irqaction);
33 setup_irq(SNI_A20R_IRQ_TIMER, irq);
34 mips_timer_ack = sni_a20r_timer_ack;
35} 87}
36 88
37#define SNI_8254_TICK_RATE 1193182UL 89#define SNI_8254_TICK_RATE 1193182UL
@@ -118,18 +170,13 @@ void __init plat_time_init(void)
118 170
119 mips_hpt_frequency = r4k_tick * HZ; 171 mips_hpt_frequency = r4k_tick * HZ;
120 172
121 setup_pit_timer();
122}
123
124void __init plat_timer_setup(struct irqaction *irq)
125{
126 switch (sni_brd_type) { 173 switch (sni_brd_type) {
127 case SNI_BRD_10: 174 case SNI_BRD_10:
128 case SNI_BRD_10NEW: 175 case SNI_BRD_10NEW:
129 case SNI_BRD_TOWER_OASIC: 176 case SNI_BRD_TOWER_OASIC:
130 case SNI_BRD_MINITOWER: 177 case SNI_BRD_MINITOWER:
131 sni_a20r_timer_setup(irq); 178 sni_a20r_timer_setup();
132 break; 179 break;
133 } 180 }
134} 181}
135 182
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index c7470fba6180..0299595ce1c4 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -63,6 +63,7 @@
63#include <asm/processor.h> 63#include <asm/processor.h>
64#include <asm/reboot.h> 64#include <asm/reboot.h>
65#include <asm/time.h> 65#include <asm/time.h>
66#include <asm/txx9tmr.h>
66#include <linux/bootmem.h> 67#include <linux/bootmem.h>
67#include <linux/blkdev.h> 68#include <linux/blkdev.h>
68#ifdef CONFIG_TOSHIBA_FPCIB0 69#ifdef CONFIG_TOSHIBA_FPCIB0
@@ -93,7 +94,6 @@
93 94
94#define TOSHIBA_RBTX4927_SETUP_EFWFU ( 1 << 3 ) 95#define TOSHIBA_RBTX4927_SETUP_EFWFU ( 1 << 3 )
95#define TOSHIBA_RBTX4927_SETUP_SETUP ( 1 << 4 ) 96#define TOSHIBA_RBTX4927_SETUP_SETUP ( 1 << 4 )
96#define TOSHIBA_RBTX4927_SETUP_TIME_INIT ( 1 << 5 )
97#define TOSHIBA_RBTX4927_SETUP_PCIBIOS ( 1 << 7 ) 97#define TOSHIBA_RBTX4927_SETUP_PCIBIOS ( 1 << 7 )
98#define TOSHIBA_RBTX4927_SETUP_PCI1 ( 1 << 8 ) 98#define TOSHIBA_RBTX4927_SETUP_PCI1 ( 1 << 8 )
99#define TOSHIBA_RBTX4927_SETUP_PCI2 ( 1 << 9 ) 99#define TOSHIBA_RBTX4927_SETUP_PCI2 ( 1 << 9 )
@@ -130,7 +130,6 @@ extern void toshiba_rbtx4927_power_off(void);
130 130
131int tx4927_using_backplane = 0; 131int tx4927_using_backplane = 0;
132 132
133extern void gt64120_time_init(void);
134extern void toshiba_rbtx4927_irq_setup(void); 133extern void toshiba_rbtx4927_irq_setup(void);
135 134
136char *prom_getcmdline(void); 135char *prom_getcmdline(void);
@@ -721,6 +720,7 @@ void toshiba_rbtx4927_power_off(void)
721 720
722void __init toshiba_rbtx4927_setup(void) 721void __init toshiba_rbtx4927_setup(void)
723{ 722{
723 int i;
724 u32 cp0_config; 724 u32 cp0_config;
725 char *argptr; 725 char *argptr;
726 726
@@ -764,6 +764,9 @@ void __init toshiba_rbtx4927_setup(void)
764 _machine_halt = toshiba_rbtx4927_halt; 764 _machine_halt = toshiba_rbtx4927_halt;
765 pm_power_off = toshiba_rbtx4927_power_off; 765 pm_power_off = toshiba_rbtx4927_power_off;
766 766
767 for (i = 0; i < TX4927_NR_TMR; i++)
768 txx9_tmr_init(TX4927_TMR_REG(0) & 0xfffffffffULL);
769
767#ifdef CONFIG_PCI 770#ifdef CONFIG_PCI
768 771
769 /* PCIC */ 772 /* PCIC */
@@ -892,7 +895,6 @@ void __init toshiba_rbtx4927_setup(void)
892#ifdef CONFIG_SERIAL_TXX9 895#ifdef CONFIG_SERIAL_TXX9
893 { 896 {
894 extern int early_serial_txx9_setup(struct uart_port *port); 897 extern int early_serial_txx9_setup(struct uart_port *port);
895 int i;
896 struct uart_port req; 898 struct uart_port req;
897 for(i = 0; i < 2; i++) { 899 for(i = 0; i < 2; i++) {
898 memset(&req, 0, sizeof(req)); 900 memset(&req, 0, sizeof(req));
@@ -937,12 +939,11 @@ void __init toshiba_rbtx4927_setup(void)
937void __init 939void __init
938toshiba_rbtx4927_time_init(void) 940toshiba_rbtx4927_time_init(void)
939{ 941{
940 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n");
941
942 mips_hpt_frequency = tx4927_cpu_clock / 2; 942 mips_hpt_frequency = tx4927_cpu_clock / 2;
943 943 if (tx4927_ccfgptr->ccfg & TX4927_CCFG_TINTDIS)
944 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n"); 944 txx9_clockevent_init(TX4927_TMR_REG(0) & 0xfffffffffULL,
945 945 TXX9_IRQ_BASE + 17,
946 50000000);
946} 947}
947 948
948static int __init toshiba_rbtx4927_rtc_init(void) 949static int __init toshiba_rbtx4927_rtc_init(void)
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/setup.c b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
index ceecaf498957..4a8152375efe 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/setup.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
@@ -26,6 +26,7 @@
26#include <asm/reboot.h> 26#include <asm/reboot.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/time.h> 28#include <asm/time.h>
29#include <asm/txx9tmr.h>
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
30#include <asm/io.h> 31#include <asm/io.h>
31#include <asm/bootinfo.h> 32#include <asm/bootinfo.h>
@@ -773,15 +774,8 @@ void __init tx4938_board_setup(void)
773 } 774 }
774 775
775 /* TMR */ 776 /* TMR */
776 /* disable all timers */ 777 for (i = 0; i < TX4938_NR_TMR; i++)
777 for (i = 0; i < TX4938_NR_TMR; i++) { 778 txx9_tmr_init(TX4938_TMR_REG(i) & 0xfffffffffULL);
778 tx4938_tmrptr(i)->tcr = 0x00000020;
779 tx4938_tmrptr(i)->tisr = 0;
780 tx4938_tmrptr(i)->cpra = 0xffffffff;
781 tx4938_tmrptr(i)->itmr = 0;
782 tx4938_tmrptr(i)->ccdr = 0;
783 tx4938_tmrptr(i)->pgmr = 0;
784 }
785 779
786 /* enable DMA */ 780 /* enable DMA */
787 TX4938_WR64(0xff1fb150, TX4938_DMA_MCR_MSTEN); 781 TX4938_WR64(0xff1fb150, TX4938_DMA_MCR_MSTEN);
@@ -852,12 +846,13 @@ void tx4938_report_pcic_status(void)
852 846
853#endif /* CONFIG_PCI */ 847#endif /* CONFIG_PCI */
854 848
855/* We use onchip r4k counter or TMR timer as our system wide timer
856 * interrupt running at 100HZ. */
857
858void __init plat_time_init(void) 849void __init plat_time_init(void)
859{ 850{
860 mips_hpt_frequency = txx9_cpu_clock / 2; 851 mips_hpt_frequency = txx9_cpu_clock / 2;
852 if (tx4938_ccfgptr->ccfg & TX4938_CCFG_TINTDIS)
853 txx9_clockevent_init(TX4938_TMR_REG(0) & 0xfffffffffULL,
854 TXX9_IRQ_BASE + TX4938_IR_TMR(0),
855 txx9_gbus_clock / 2);
861} 856}
862 857
863void __init toshiba_rbtx4938_setup(void) 858void __init toshiba_rbtx4938_setup(void)
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 4ec716d8c1a6..1330061020ab 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -513,7 +513,7 @@ config ZFCPDUMP
513 default n 513 default n
514 help 514 help
515 Select this option if you want to build an zfcpdump enabled kernel. 515 Select this option if you want to build an zfcpdump enabled kernel.
516 Refer to "Documentation/s390/zfcpdump.txt" for more details on this. 516 Refer to <file:Documentation/s390/zfcpdump.txt> for more details on this.
517 517
518endmenu 518endmenu
519 519
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 247f8a65e733..22a3eb38438b 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -182,9 +182,7 @@ config CPU_HAS_IPR_IRQ
182 bool 182 bool
183 183
184config CPU_HAS_SR_RB 184config CPU_HAS_SR_RB
185 bool "CPU has SR.RB" 185 bool
186 depends on CPU_SH3 || CPU_SH4
187 default y
188 help 186 help
189 This will enable the use of SR.RB register bank usage. Processors 187 This will enable the use of SR.RB register bank usage. Processors
190 that are lacking this bit must have another method in place for 188 that are lacking this bit must have another method in place for
@@ -291,9 +289,7 @@ config SH_DREAMCAST
291 depends on CPU_SUBTYPE_SH7091 289 depends on CPU_SUBTYPE_SH7091
292 help 290 help
293 Select Dreamcast if configuring for a SEGA Dreamcast. 291 Select Dreamcast if configuring for a SEGA Dreamcast.
294 More information at 292 More information at <http://www.linux-sh.org>
295 <http://www.m17n.org/linux-sh/dreamcast/>. There is a
296 Dreamcast project is at <http://linuxdc.sourceforge.net/>.
297 293
298config SH_MPC1211 294config SH_MPC1211
299 bool "Interface MPC1211" 295 bool "Interface MPC1211"
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index b507b501f0cf..ab2f9f3c354c 100644
--- a/arch/sh/Kconfig.debug
+++ b/arch/sh/Kconfig.debug
@@ -86,6 +86,14 @@ config 4KSTACKS
86 on the VM subsystem for higher order allocations. This option 86 on the VM subsystem for higher order allocations. This option
87 will also use IRQ stacks to compensate for the reduced stackspace. 87 will also use IRQ stacks to compensate for the reduced stackspace.
88 88
89config IRQSTACKS
90 bool "Use separate kernel stacks when processing interrupts"
91 depends on DEBUG_KERNEL
92 help
93 If you say Y here the kernel will use separate kernel stacks
94 for handling hard and soft interrupts. This can help avoid
95 overflowing the process kernel stacks.
96
89config SH_KGDB 97config SH_KGDB
90 bool "Include KGDB kernel debugger" 98 bool "Include KGDB kernel debugger"
91 select FRAME_POINTER 99 select FRAME_POINTER
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 408342b175c8..e189fae8b60c 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -66,7 +66,7 @@ cflags-y += $(isaflags-y) -ffreestanding
66cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \ 66cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \
67 $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g') 67 $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g')
68 68
69OBJCOPYFLAGS := -O binary -R .note -R .comment -R .stab -R .stabstr -S 69OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment -R .stab -R .stabstr -S
70 70
71# 71#
72# arch/sh/defconfig doesn't reflect any real hardware, and as such should 72# arch/sh/defconfig doesn't reflect any real hardware, and as such should
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c
index afe9de73666a..0fdc0bc19145 100644
--- a/arch/sh/boards/renesas/r7780rp/setup.c
+++ b/arch/sh/boards/renesas/r7780rp/setup.c
@@ -16,6 +16,8 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/pata_platform.h> 18#include <linux/pata_platform.h>
19#include <linux/types.h>
20#include <net/ax88796.h>
19#include <asm/machvec.h> 21#include <asm/machvec.h>
20#include <asm/r7780rp.h> 22#include <asm/r7780rp.h>
21#include <asm/clock.h> 23#include <asm/clock.h>
@@ -136,11 +138,50 @@ static struct platform_device heartbeat_device = {
136 .resource = heartbeat_resources, 138 .resource = heartbeat_resources,
137}; 139};
138 140
141static struct ax_plat_data ax88796_platdata = {
142 .flags = AXFLG_HAS_93CX6,
143 .wordlength = 2,
144 .dcr_val = 0x1,
145 .rcr_val = 0x40,
146};
147
148static struct resource ax88796_resources[] = {
149 {
150#ifdef CONFIG_SH_R7780RP
151 .start = 0xa5800400,
152 .end = 0xa5800400 + (0x20 * 0x2) - 1,
153#else
154 .start = 0xa4100400,
155 .end = 0xa4100400 + (0x20 * 0x2) - 1,
156#endif
157 .flags = IORESOURCE_MEM,
158 },
159 {
160 .start = IRQ_AX88796,
161 .end = IRQ_AX88796,
162 .flags = IORESOURCE_IRQ,
163 },
164};
165
166static struct platform_device ax88796_device = {
167 .name = "ax88796",
168 .id = 0,
169
170 .dev = {
171 .platform_data = &ax88796_platdata,
172 },
173
174 .num_resources = ARRAY_SIZE(ax88796_resources),
175 .resource = ax88796_resources,
176};
177
178
139static struct platform_device *r7780rp_devices[] __initdata = { 179static struct platform_device *r7780rp_devices[] __initdata = {
140 &r8a66597_usb_host_device, 180 &r8a66597_usb_host_device,
141 &m66592_usb_peripheral_device, 181 &m66592_usb_peripheral_device,
142 &cf_ide_device, 182 &cf_ide_device,
143 &heartbeat_device, 183 &heartbeat_device,
184 &ax88796_device,
144}; 185};
145 186
146static int __init r7780rp_devices_setup(void) 187static int __init r7780rp_devices_setup(void)
@@ -183,6 +224,34 @@ static void r7780rp_power_off(void)
183 ctrl_outw(0x0001, PA_POFF); 224 ctrl_outw(0x0001, PA_POFF);
184} 225}
185 226
227static inline unsigned char is_ide_ioaddr(unsigned long addr)
228{
229 return ((cf_ide_resources[0].start <= addr &&
230 addr <= cf_ide_resources[0].end) ||
231 (cf_ide_resources[1].start <= addr &&
232 addr <= cf_ide_resources[1].end));
233}
234
235void highlander_writeb(u8 b, void __iomem *addr)
236{
237 unsigned long tmp = (unsigned long __force)addr;
238
239 if (is_ide_ioaddr(tmp))
240 ctrl_outw((u16)b, tmp);
241 else
242 ctrl_outb(b, tmp);
243}
244
245u8 highlander_readb(void __iomem *addr)
246{
247 unsigned long tmp = (unsigned long __force)addr;
248
249 if (is_ide_ioaddr(tmp))
250 return ctrl_inw(tmp) & 0xff;
251 else
252 return ctrl_inb(tmp);
253}
254
186/* 255/*
187 * Initialize the board 256 * Initialize the board
188 */ 257 */
@@ -267,4 +336,6 @@ static struct sh_machine_vector mv_highlander __initmv = {
267 .mv_setup = highlander_setup, 336 .mv_setup = highlander_setup,
268 .mv_init_irq = highlander_init_irq, 337 .mv_init_irq = highlander_init_irq,
269 .mv_irq_demux = highlander_irq_demux, 338 .mv_irq_demux = highlander_irq_demux,
339 .mv_readb = highlander_readb,
340 .mv_writeb = highlander_writeb,
270}; 341};
diff --git a/arch/sh/boards/se/7722/setup.c b/arch/sh/boards/se/7722/setup.c
index 03b63457e178..20f064083cc2 100644
--- a/arch/sh/boards/se/7722/setup.c
+++ b/arch/sh/boards/se/7722/setup.c
@@ -103,8 +103,8 @@ static void __init se7722_setup(char **cmdline_p)
103 103
104 ctrl_outl(0x00051001, MSTPCR0); 104 ctrl_outl(0x00051001, MSTPCR0);
105 ctrl_outl(0x00000000, MSTPCR1); 105 ctrl_outl(0x00000000, MSTPCR1);
106 /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC */ 106 /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC, USB */
107 ctrl_outl(0xffffbfC0, MSTPCR2); 107 ctrl_outl(0xffffb7c0, MSTPCR2);
108 108
109 ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */ 109 ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */
110 ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */ 110 ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */
diff --git a/arch/sh/configs/r7785rp_defconfig b/arch/sh/configs/r7785rp_defconfig
index 5c29338532da..158e03f0b1ef 100644
--- a/arch/sh/configs/r7785rp_defconfig
+++ b/arch/sh/configs/r7785rp_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-rc4 3# Linux kernel version: 2.6.24-rc1
4# Thu Jul 12 12:33:15 2007 4# Fri Nov 2 14:30:49 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
@@ -13,39 +13,40 @@ CONFIG_GENERIC_IRQ_PROBE=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_TIME=y 14CONFIG_GENERIC_TIME=y
15CONFIG_GENERIC_CLOCKEVENTS=y 15CONFIG_GENERIC_CLOCKEVENTS=y
16CONFIG_SYS_SUPPORTS_NUMA=y
16CONFIG_SYS_SUPPORTS_PCI=y 17CONFIG_SYS_SUPPORTS_PCI=y
17CONFIG_STACKTRACE_SUPPORT=y 18CONFIG_STACKTRACE_SUPPORT=y
18CONFIG_LOCKDEP_SUPPORT=y 19CONFIG_LOCKDEP_SUPPORT=y
19# CONFIG_ARCH_HAS_ILOG2_U32 is not set 20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
20# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y
21CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
22 24
23# 25#
24# Code maturity level options 26# General setup
25# 27#
26CONFIG_EXPERIMENTAL=y 28CONFIG_EXPERIMENTAL=y
27CONFIG_BROKEN_ON_SMP=y 29CONFIG_BROKEN_ON_SMP=y
28CONFIG_LOCK_KERNEL=y 30CONFIG_LOCK_KERNEL=y
29CONFIG_INIT_ENV_ARG_LIMIT=32 31CONFIG_INIT_ENV_ARG_LIMIT=32
30
31#
32# General setup
33#
34CONFIG_LOCALVERSION="" 32CONFIG_LOCALVERSION=""
35CONFIG_LOCALVERSION_AUTO=y 33CONFIG_LOCALVERSION_AUTO=y
36CONFIG_SWAP=y 34CONFIG_SWAP=y
37CONFIG_SYSVIPC=y 35CONFIG_SYSVIPC=y
38# CONFIG_IPC_NS is not set
39CONFIG_SYSVIPC_SYSCTL=y 36CONFIG_SYSVIPC_SYSCTL=y
40# CONFIG_POSIX_MQUEUE is not set 37# CONFIG_POSIX_MQUEUE is not set
41CONFIG_BSD_PROCESS_ACCT=y 38CONFIG_BSD_PROCESS_ACCT=y
42# CONFIG_BSD_PROCESS_ACCT_V3 is not set 39# CONFIG_BSD_PROCESS_ACCT_V3 is not set
43# CONFIG_TASKSTATS is not set 40# CONFIG_TASKSTATS is not set
44# CONFIG_UTS_NS is not set 41# CONFIG_USER_NS is not set
45# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
46CONFIG_IKCONFIG=y 43CONFIG_IKCONFIG=y
47CONFIG_IKCONFIG_PROC=y 44CONFIG_IKCONFIG_PROC=y
48CONFIG_LOG_BUF_SHIFT=14 45CONFIG_LOG_BUF_SHIFT=14
46# CONFIG_CGROUPS is not set
47CONFIG_FAIR_GROUP_SCHED=y
48CONFIG_FAIR_USER_SCHED=y
49# CONFIG_FAIR_CGROUP_SCHED is not set
49# CONFIG_SYSFS_DEPRECATED is not set 50# CONFIG_SYSFS_DEPRECATED is not set
50# CONFIG_RELAY is not set 51# CONFIG_RELAY is not set
51# CONFIG_BLK_DEV_INITRD is not set 52# CONFIG_BLK_DEV_INITRD is not set
@@ -66,7 +67,6 @@ CONFIG_BASE_FULL=y
66CONFIG_ANON_INODES=y 67CONFIG_ANON_INODES=y
67# CONFIG_EPOLL is not set 68# CONFIG_EPOLL is not set
68CONFIG_SIGNALFD=y 69CONFIG_SIGNALFD=y
69CONFIG_TIMERFD=y
70CONFIG_EVENTFD=y 70CONFIG_EVENTFD=y
71CONFIG_SHMEM=y 71CONFIG_SHMEM=y
72CONFIG_VM_EVENT_COUNTERS=y 72CONFIG_VM_EVENT_COUNTERS=y
@@ -75,24 +75,17 @@ CONFIG_SLAB=y
75# CONFIG_SLOB is not set 75# CONFIG_SLOB is not set
76# CONFIG_TINY_SHMEM is not set 76# CONFIG_TINY_SHMEM is not set
77CONFIG_BASE_SMALL=0 77CONFIG_BASE_SMALL=0
78
79#
80# Loadable module support
81#
82CONFIG_MODULES=y 78CONFIG_MODULES=y
83CONFIG_MODULE_UNLOAD=y 79CONFIG_MODULE_UNLOAD=y
84# CONFIG_MODULE_FORCE_UNLOAD is not set 80# CONFIG_MODULE_FORCE_UNLOAD is not set
85# CONFIG_MODVERSIONS is not set 81# CONFIG_MODVERSIONS is not set
86# CONFIG_MODULE_SRCVERSION_ALL is not set 82# CONFIG_MODULE_SRCVERSION_ALL is not set
87CONFIG_KMOD=y 83CONFIG_KMOD=y
88
89#
90# Block layer
91#
92CONFIG_BLOCK=y 84CONFIG_BLOCK=y
93# CONFIG_LBD is not set 85# CONFIG_LBD is not set
94# CONFIG_BLK_DEV_IO_TRACE is not set 86# CONFIG_BLK_DEV_IO_TRACE is not set
95# CONFIG_LSF is not set 87# CONFIG_LSF is not set
88# CONFIG_BLK_DEV_BSG is not set
96 89
97# 90#
98# IO Schedulers 91# IO Schedulers
@@ -115,7 +108,6 @@ CONFIG_CPU_SH4A=y
115CONFIG_CPU_SHX2=y 108CONFIG_CPU_SHX2=y
116# CONFIG_CPU_SUBTYPE_SH7619 is not set 109# CONFIG_CPU_SUBTYPE_SH7619 is not set
117# CONFIG_CPU_SUBTYPE_SH7206 is not set 110# CONFIG_CPU_SUBTYPE_SH7206 is not set
118# CONFIG_CPU_SUBTYPE_SH7300 is not set
119# CONFIG_CPU_SUBTYPE_SH7705 is not set 111# CONFIG_CPU_SUBTYPE_SH7705 is not set
120# CONFIG_CPU_SUBTYPE_SH7706 is not set 112# CONFIG_CPU_SUBTYPE_SH7706 is not set
121# CONFIG_CPU_SUBTYPE_SH7707 is not set 113# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -123,6 +115,7 @@ CONFIG_CPU_SHX2=y
123# CONFIG_CPU_SUBTYPE_SH7709 is not set 115# CONFIG_CPU_SUBTYPE_SH7709 is not set
124# CONFIG_CPU_SUBTYPE_SH7710 is not set 116# CONFIG_CPU_SUBTYPE_SH7710 is not set
125# CONFIG_CPU_SUBTYPE_SH7712 is not set 117# CONFIG_CPU_SUBTYPE_SH7712 is not set
118# CONFIG_CPU_SUBTYPE_SH7720 is not set
126# CONFIG_CPU_SUBTYPE_SH7750 is not set 119# CONFIG_CPU_SUBTYPE_SH7750 is not set
127# CONFIG_CPU_SUBTYPE_SH7091 is not set 120# CONFIG_CPU_SUBTYPE_SH7091 is not set
128# CONFIG_CPU_SUBTYPE_SH7750R is not set 121# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -137,7 +130,6 @@ CONFIG_CPU_SHX2=y
137# CONFIG_CPU_SUBTYPE_SH7780 is not set 130# CONFIG_CPU_SUBTYPE_SH7780 is not set
138CONFIG_CPU_SUBTYPE_SH7785=y 131CONFIG_CPU_SUBTYPE_SH7785=y
139# CONFIG_CPU_SUBTYPE_SHX3 is not set 132# CONFIG_CPU_SUBTYPE_SHX3 is not set
140# CONFIG_CPU_SUBTYPE_SH73180 is not set
141# CONFIG_CPU_SUBTYPE_SH7343 is not set 133# CONFIG_CPU_SUBTYPE_SH7343 is not set
142# CONFIG_CPU_SUBTYPE_SH7722 is not set 134# CONFIG_CPU_SUBTYPE_SH7722 is not set
143 135
@@ -149,15 +141,17 @@ CONFIG_MMU=y
149CONFIG_PAGE_OFFSET=0x80000000 141CONFIG_PAGE_OFFSET=0x80000000
150CONFIG_MEMORY_START=0x08000000 142CONFIG_MEMORY_START=0x08000000
151CONFIG_MEMORY_SIZE=0x08000000 143CONFIG_MEMORY_SIZE=0x08000000
152CONFIG_32BIT=y 144# CONFIG_32BIT is not set
153# CONFIG_X2TLB is not set 145# CONFIG_X2TLB is not set
154CONFIG_VSYSCALL=y 146CONFIG_VSYSCALL=y
147# CONFIG_NUMA is not set
155CONFIG_ARCH_FLATMEM_ENABLE=y 148CONFIG_ARCH_FLATMEM_ENABLE=y
156CONFIG_ARCH_SPARSEMEM_ENABLE=y 149CONFIG_ARCH_SPARSEMEM_ENABLE=y
157CONFIG_ARCH_SPARSEMEM_DEFAULT=y 150CONFIG_ARCH_SPARSEMEM_DEFAULT=y
158CONFIG_MAX_ACTIVE_REGIONS=1 151CONFIG_MAX_ACTIVE_REGIONS=2
159CONFIG_ARCH_POPULATES_NODE_MAP=y 152CONFIG_ARCH_POPULATES_NODE_MAP=y
160CONFIG_ARCH_SELECT_MEMORY_MODEL=y 153CONFIG_ARCH_SELECT_MEMORY_MODEL=y
154CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
161CONFIG_PAGE_SIZE_4KB=y 155CONFIG_PAGE_SIZE_4KB=y
162# CONFIG_PAGE_SIZE_8KB is not set 156# CONFIG_PAGE_SIZE_8KB is not set
163# CONFIG_PAGE_SIZE_64KB is not set 157# CONFIG_PAGE_SIZE_64KB is not set
@@ -167,12 +161,14 @@ CONFIG_HUGETLB_PAGE_SIZE_1MB=y
167# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set 161# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set
168# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set 162# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set
169CONFIG_SELECT_MEMORY_MODEL=y 163CONFIG_SELECT_MEMORY_MODEL=y
170CONFIG_FLATMEM_MANUAL=y 164# CONFIG_FLATMEM_MANUAL is not set
171# CONFIG_DISCONTIGMEM_MANUAL is not set 165# CONFIG_DISCONTIGMEM_MANUAL is not set
172# CONFIG_SPARSEMEM_MANUAL is not set 166CONFIG_SPARSEMEM_MANUAL=y
173CONFIG_FLATMEM=y 167CONFIG_SPARSEMEM=y
174CONFIG_FLAT_NODE_MEM_MAP=y 168CONFIG_HAVE_MEMORY_PRESENT=y
175CONFIG_SPARSEMEM_STATIC=y 169CONFIG_SPARSEMEM_STATIC=y
170# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
171# CONFIG_MEMORY_HOTPLUG is not set
176CONFIG_SPLIT_PTLOCK_CPUS=4 172CONFIG_SPLIT_PTLOCK_CPUS=4
177# CONFIG_RESOURCES_64BIT is not set 173# CONFIG_RESOURCES_64BIT is not set
178CONFIG_ZONE_DMA_FLAG=0 174CONFIG_ZONE_DMA_FLAG=0
@@ -182,7 +178,9 @@ CONFIG_NR_QUICK=2
182# Cache configuration 178# Cache configuration
183# 179#
184# CONFIG_SH_DIRECT_MAPPED is not set 180# CONFIG_SH_DIRECT_MAPPED is not set
185# CONFIG_SH_WRITETHROUGH is not set 181CONFIG_CACHE_WRITEBACK=y
182# CONFIG_CACHE_WRITETHROUGH is not set
183# CONFIG_CACHE_OFF is not set
186 184
187# 185#
188# Processor features 186# Processor features
@@ -190,12 +188,11 @@ CONFIG_NR_QUICK=2
190CONFIG_CPU_LITTLE_ENDIAN=y 188CONFIG_CPU_LITTLE_ENDIAN=y
191# CONFIG_CPU_BIG_ENDIAN is not set 189# CONFIG_CPU_BIG_ENDIAN is not set
192CONFIG_SH_FPU=y 190CONFIG_SH_FPU=y
193# CONFIG_SH_DSP is not set
194CONFIG_SH_STORE_QUEUES=y 191CONFIG_SH_STORE_QUEUES=y
195CONFIG_CPU_HAS_INTEVT=y 192CONFIG_CPU_HAS_INTEVT=y
196CONFIG_CPU_HAS_INTC2_IRQ=y
197CONFIG_CPU_HAS_SR_RB=y 193CONFIG_CPU_HAS_SR_RB=y
198CONFIG_CPU_HAS_PTEA=y 194CONFIG_CPU_HAS_PTEA=y
195CONFIG_CPU_HAS_FPU=y
199 196
200# 197#
201# Board support 198# Board support
@@ -214,6 +211,7 @@ CONFIG_SH_PCLK_FREQ=50000000
214# CONFIG_TICK_ONESHOT is not set 211# CONFIG_TICK_ONESHOT is not set
215# CONFIG_NO_HZ is not set 212# CONFIG_NO_HZ is not set
216# CONFIG_HIGH_RES_TIMERS is not set 213# CONFIG_HIGH_RES_TIMERS is not set
214CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
217 215
218# 216#
219# CPU Frequency scaling 217# CPU Frequency scaling
@@ -249,6 +247,7 @@ CONFIG_KEXEC=y
249# CONFIG_PREEMPT_VOLUNTARY is not set 247# CONFIG_PREEMPT_VOLUNTARY is not set
250CONFIG_PREEMPT=y 248CONFIG_PREEMPT=y
251CONFIG_PREEMPT_BKL=y 249CONFIG_PREEMPT_BKL=y
250CONFIG_GUSA=y
252 251
253# 252#
254# Boot options 253# Boot options
@@ -268,10 +267,6 @@ CONFIG_PCI_AUTO=y
268CONFIG_PCI_AUTO_UPDATE_RESOURCES=y 267CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
269# CONFIG_ARCH_SUPPORTS_MSI is not set 268# CONFIG_ARCH_SUPPORTS_MSI is not set
270# CONFIG_PCI_DEBUG is not set 269# CONFIG_PCI_DEBUG is not set
271
272#
273# PCCARD (PCMCIA/CardBus) support
274#
275# CONFIG_PCCARD is not set 270# CONFIG_PCCARD is not set
276# CONFIG_HOTPLUG_PCI is not set 271# CONFIG_HOTPLUG_PCI is not set
277 272
@@ -322,6 +317,7 @@ CONFIG_IP_PNP_DHCP=y
322CONFIG_INET_XFRM_MODE_TRANSPORT=y 317CONFIG_INET_XFRM_MODE_TRANSPORT=y
323CONFIG_INET_XFRM_MODE_TUNNEL=y 318CONFIG_INET_XFRM_MODE_TUNNEL=y
324CONFIG_INET_XFRM_MODE_BEET=y 319CONFIG_INET_XFRM_MODE_BEET=y
320# CONFIG_INET_LRO is not set
325CONFIG_INET_DIAG=y 321CONFIG_INET_DIAG=y
326CONFIG_INET_TCP_DIAG=y 322CONFIG_INET_TCP_DIAG=y
327# CONFIG_TCP_CONG_ADVANCED is not set 323# CONFIG_TCP_CONG_ADVANCED is not set
@@ -348,10 +344,6 @@ CONFIG_LLC=m
348# CONFIG_LAPB is not set 344# CONFIG_LAPB is not set
349# CONFIG_ECONET is not set 345# CONFIG_ECONET is not set
350# CONFIG_WAN_ROUTER is not set 346# CONFIG_WAN_ROUTER is not set
351
352#
353# QoS and/or fair queueing
354#
355# CONFIG_NET_SCHED is not set 347# CONFIG_NET_SCHED is not set
356 348
357# 349#
@@ -371,6 +363,7 @@ CONFIG_WIRELESS_EXT=y
371# CONFIG_MAC80211 is not set 363# CONFIG_MAC80211 is not set
372# CONFIG_IEEE80211 is not set 364# CONFIG_IEEE80211 is not set
373# CONFIG_RFKILL is not set 365# CONFIG_RFKILL is not set
366# CONFIG_NET_9P is not set
374 367
375# 368#
376# Device Drivers 369# Device Drivers
@@ -379,33 +372,17 @@ CONFIG_WIRELESS_EXT=y
379# 372#
380# Generic Driver Options 373# Generic Driver Options
381# 374#
375CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
382CONFIG_STANDALONE=y 376CONFIG_STANDALONE=y
383CONFIG_PREVENT_FIRMWARE_BUILD=y 377CONFIG_PREVENT_FIRMWARE_BUILD=y
384CONFIG_FW_LOADER=m 378CONFIG_FW_LOADER=m
385# CONFIG_DEBUG_DRIVER is not set 379# CONFIG_DEBUG_DRIVER is not set
386# CONFIG_DEBUG_DEVRES is not set 380# CONFIG_DEBUG_DEVRES is not set
387# CONFIG_SYS_HYPERVISOR is not set 381# CONFIG_SYS_HYPERVISOR is not set
388
389#
390# Connector - unified userspace <-> kernelspace linker
391#
392# CONFIG_CONNECTOR is not set 382# CONFIG_CONNECTOR is not set
393# CONFIG_MTD is not set 383# CONFIG_MTD is not set
394
395#
396# Parallel port support
397#
398# CONFIG_PARPORT is not set 384# CONFIG_PARPORT is not set
399 385CONFIG_BLK_DEV=y
400#
401# Plug and Play support
402#
403# CONFIG_PNPACPI is not set
404
405#
406# Block devices
407#
408# CONFIG_BLK_CPQ_DA is not set
409# CONFIG_BLK_CPQ_CISS_DA is not set 386# CONFIG_BLK_CPQ_CISS_DA is not set
410# CONFIG_BLK_DEV_DAC960 is not set 387# CONFIG_BLK_DEV_DAC960 is not set
411# CONFIG_BLK_DEV_UMEM is not set 388# CONFIG_BLK_DEV_UMEM is not set
@@ -419,14 +396,11 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
419CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 396CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
420# CONFIG_CDROM_PKTCDVD is not set 397# CONFIG_CDROM_PKTCDVD is not set
421# CONFIG_ATA_OVER_ETH is not set 398# CONFIG_ATA_OVER_ETH is not set
422 399CONFIG_MISC_DEVICES=y
423#
424# Misc devices
425#
426# CONFIG_PHANTOM is not set 400# CONFIG_PHANTOM is not set
401CONFIG_EEPROM_93CX6=y
427# CONFIG_SGI_IOC4 is not set 402# CONFIG_SGI_IOC4 is not set
428# CONFIG_TIFM_CORE is not set 403# CONFIG_TIFM_CORE is not set
429# CONFIG_BLINK is not set
430# CONFIG_IDE is not set 404# CONFIG_IDE is not set
431 405
432# 406#
@@ -434,6 +408,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
434# 408#
435# CONFIG_RAID_ATTRS is not set 409# CONFIG_RAID_ATTRS is not set
436CONFIG_SCSI=y 410CONFIG_SCSI=y
411CONFIG_SCSI_DMA=y
437# CONFIG_SCSI_TGT is not set 412# CONFIG_SCSI_TGT is not set
438# CONFIG_SCSI_NETLINK is not set 413# CONFIG_SCSI_NETLINK is not set
439CONFIG_SCSI_PROC_FS=y 414CONFIG_SCSI_PROC_FS=y
@@ -463,12 +438,9 @@ CONFIG_SCSI_WAIT_SCAN=m
463# CONFIG_SCSI_SPI_ATTRS is not set 438# CONFIG_SCSI_SPI_ATTRS is not set
464# CONFIG_SCSI_FC_ATTRS is not set 439# CONFIG_SCSI_FC_ATTRS is not set
465# CONFIG_SCSI_ISCSI_ATTRS is not set 440# CONFIG_SCSI_ISCSI_ATTRS is not set
466# CONFIG_SCSI_SAS_ATTRS is not set
467# CONFIG_SCSI_SAS_LIBSAS is not set 441# CONFIG_SCSI_SAS_LIBSAS is not set
468 442# CONFIG_SCSI_SRP_ATTRS is not set
469# 443CONFIG_SCSI_LOWLEVEL=y
470# SCSI low-level drivers
471#
472# CONFIG_ISCSI_TCP is not set 444# CONFIG_ISCSI_TCP is not set
473# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 445# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
474# CONFIG_SCSI_3W_9XXX is not set 446# CONFIG_SCSI_3W_9XXX is not set
@@ -478,7 +450,6 @@ CONFIG_SCSI_WAIT_SCAN=m
478# CONFIG_SCSI_AIC7XXX_OLD is not set 450# CONFIG_SCSI_AIC7XXX_OLD is not set
479# CONFIG_SCSI_AIC79XX is not set 451# CONFIG_SCSI_AIC79XX is not set
480# CONFIG_SCSI_AIC94XX is not set 452# CONFIG_SCSI_AIC94XX is not set
481# CONFIG_SCSI_DPT_I2O is not set
482# CONFIG_SCSI_ARCMSR is not set 453# CONFIG_SCSI_ARCMSR is not set
483# CONFIG_MEGARAID_NEWGEN is not set 454# CONFIG_MEGARAID_NEWGEN is not set
484# CONFIG_MEGARAID_LEGACY is not set 455# CONFIG_MEGARAID_LEGACY is not set
@@ -543,6 +514,7 @@ CONFIG_SATA_SIL=y
543# CONFIG_PATA_OLDPIIX is not set 514# CONFIG_PATA_OLDPIIX is not set
544# CONFIG_PATA_NETCELL is not set 515# CONFIG_PATA_NETCELL is not set
545# CONFIG_PATA_NS87410 is not set 516# CONFIG_PATA_NS87410 is not set
517# CONFIG_PATA_NS87415 is not set
546# CONFIG_PATA_OPTI is not set 518# CONFIG_PATA_OPTI is not set
547# CONFIG_PATA_OPTIDMA is not set 519# CONFIG_PATA_OPTIDMA is not set
548# CONFIG_PATA_PDC_OLD is not set 520# CONFIG_PATA_PDC_OLD is not set
@@ -556,45 +528,26 @@ CONFIG_SATA_SIL=y
556# CONFIG_PATA_VIA is not set 528# CONFIG_PATA_VIA is not set
557# CONFIG_PATA_WINBOND is not set 529# CONFIG_PATA_WINBOND is not set
558CONFIG_PATA_PLATFORM=y 530CONFIG_PATA_PLATFORM=y
559
560#
561# Multi-device support (RAID and LVM)
562#
563# CONFIG_MD is not set 531# CONFIG_MD is not set
564
565#
566# Fusion MPT device support
567#
568# CONFIG_FUSION is not set 532# CONFIG_FUSION is not set
569# CONFIG_FUSION_SPI is not set
570# CONFIG_FUSION_FC is not set
571# CONFIG_FUSION_SAS is not set
572 533
573# 534#
574# IEEE 1394 (FireWire) support 535# IEEE 1394 (FireWire) support
575# 536#
576# CONFIG_FIREWIRE is not set 537# CONFIG_FIREWIRE is not set
577# CONFIG_IEEE1394 is not set 538# CONFIG_IEEE1394 is not set
578
579#
580# I2O device support
581#
582# CONFIG_I2O is not set 539# CONFIG_I2O is not set
583
584#
585# Network device support
586#
587CONFIG_NETDEVICES=y 540CONFIG_NETDEVICES=y
541# CONFIG_NETDEVICES_MULTIQUEUE is not set
588# CONFIG_DUMMY is not set 542# CONFIG_DUMMY is not set
589# CONFIG_BONDING is not set 543# CONFIG_BONDING is not set
544# CONFIG_MACVLAN is not set
590# CONFIG_EQUALIZER is not set 545# CONFIG_EQUALIZER is not set
591# CONFIG_TUN is not set 546# CONFIG_TUN is not set
547# CONFIG_VETH is not set
548# CONFIG_IP1000 is not set
592# CONFIG_ARCNET is not set 549# CONFIG_ARCNET is not set
593# CONFIG_PHYLIB is not set 550# CONFIG_PHYLIB is not set
594
595#
596# Ethernet (10 or 100Mbit)
597#
598CONFIG_NET_ETHERNET=y 551CONFIG_NET_ETHERNET=y
599CONFIG_MII=y 552CONFIG_MII=y
600# CONFIG_STNIC is not set 553# CONFIG_STNIC is not set
@@ -603,17 +556,20 @@ CONFIG_MII=y
603# CONFIG_CASSINI is not set 556# CONFIG_CASSINI is not set
604# CONFIG_NET_VENDOR_3COM is not set 557# CONFIG_NET_VENDOR_3COM is not set
605# CONFIG_SMC91X is not set 558# CONFIG_SMC91X is not set
606 559# CONFIG_SMC911X is not set
607#
608# Tulip family network device support
609#
610# CONFIG_NET_TULIP is not set 560# CONFIG_NET_TULIP is not set
611# CONFIG_HP100 is not set 561# CONFIG_HP100 is not set
562# CONFIG_IBM_NEW_EMAC_ZMII is not set
563# CONFIG_IBM_NEW_EMAC_RGMII is not set
564# CONFIG_IBM_NEW_EMAC_TAH is not set
565# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
612# CONFIG_NET_PCI is not set 566# CONFIG_NET_PCI is not set
567# CONFIG_B44 is not set
613CONFIG_NETDEV_1000=y 568CONFIG_NETDEV_1000=y
614# CONFIG_ACENIC is not set 569# CONFIG_ACENIC is not set
615# CONFIG_DL2K is not set 570# CONFIG_DL2K is not set
616# CONFIG_E1000 is not set 571# CONFIG_E1000 is not set
572# CONFIG_E1000E is not set
617# CONFIG_NS83820 is not set 573# CONFIG_NS83820 is not set
618# CONFIG_HAMACHI is not set 574# CONFIG_HAMACHI is not set
619# CONFIG_YELLOWFIN is not set 575# CONFIG_YELLOWFIN is not set
@@ -631,11 +587,14 @@ CONFIG_R8169=y
631CONFIG_NETDEV_10000=y 587CONFIG_NETDEV_10000=y
632# CONFIG_CHELSIO_T1 is not set 588# CONFIG_CHELSIO_T1 is not set
633# CONFIG_CHELSIO_T3 is not set 589# CONFIG_CHELSIO_T3 is not set
590# CONFIG_IXGBE is not set
634# CONFIG_IXGB is not set 591# CONFIG_IXGB is not set
635# CONFIG_S2IO is not set 592# CONFIG_S2IO is not set
636# CONFIG_MYRI10GE is not set 593# CONFIG_MYRI10GE is not set
637# CONFIG_NETXEN_NIC is not set 594# CONFIG_NETXEN_NIC is not set
595# CONFIG_NIU is not set
638# CONFIG_MLX4_CORE is not set 596# CONFIG_MLX4_CORE is not set
597# CONFIG_TEHUTI is not set
639# CONFIG_TR is not set 598# CONFIG_TR is not set
640 599
641# 600#
@@ -653,15 +612,7 @@ CONFIG_NETDEV_10000=y
653# CONFIG_NETCONSOLE is not set 612# CONFIG_NETCONSOLE is not set
654# CONFIG_NETPOLL is not set 613# CONFIG_NETPOLL is not set
655# CONFIG_NET_POLL_CONTROLLER is not set 614# CONFIG_NET_POLL_CONTROLLER is not set
656
657#
658# ISDN subsystem
659#
660# CONFIG_ISDN is not set 615# CONFIG_ISDN is not set
661
662#
663# Telephony Support
664#
665# CONFIG_PHONE is not set 616# CONFIG_PHONE is not set
666 617
667# 618#
@@ -669,6 +620,7 @@ CONFIG_NETDEV_10000=y
669# 620#
670CONFIG_INPUT=y 621CONFIG_INPUT=y
671# CONFIG_INPUT_FF_MEMLESS is not set 622# CONFIG_INPUT_FF_MEMLESS is not set
623# CONFIG_INPUT_POLLDEV is not set
672 624
673# 625#
674# Userland interfaces 626# Userland interfaces
@@ -678,7 +630,6 @@ CONFIG_INPUT_MOUSEDEV=y
678CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 630CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
679CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 631CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
680# CONFIG_INPUT_JOYDEV is not set 632# CONFIG_INPUT_JOYDEV is not set
681# CONFIG_INPUT_TSDEV is not set
682# CONFIG_INPUT_EVDEV is not set 633# CONFIG_INPUT_EVDEV is not set
683# CONFIG_INPUT_EVBUG is not set 634# CONFIG_INPUT_EVBUG is not set
684 635
@@ -732,21 +683,11 @@ CONFIG_SERIAL_CORE_CONSOLE=y
732CONFIG_UNIX98_PTYS=y 683CONFIG_UNIX98_PTYS=y
733CONFIG_LEGACY_PTYS=y 684CONFIG_LEGACY_PTYS=y
734CONFIG_LEGACY_PTY_COUNT=256 685CONFIG_LEGACY_PTY_COUNT=256
735
736#
737# IPMI
738#
739# CONFIG_IPMI_HANDLER is not set 686# CONFIG_IPMI_HANDLER is not set
740# CONFIG_WATCHDOG is not set
741CONFIG_HW_RANDOM=y 687CONFIG_HW_RANDOM=y
742# CONFIG_R3964 is not set 688# CONFIG_R3964 is not set
743# CONFIG_APPLICOM is not set 689# CONFIG_APPLICOM is not set
744# CONFIG_DRM is not set
745# CONFIG_RAW_DRIVER is not set 690# CONFIG_RAW_DRIVER is not set
746
747#
748# TPM devices
749#
750# CONFIG_TCG_TPM is not set 691# CONFIG_TCG_TPM is not set
751CONFIG_DEVPORT=y 692CONFIG_DEVPORT=y
752# CONFIG_I2C is not set 693# CONFIG_I2C is not set
@@ -756,21 +697,31 @@ CONFIG_DEVPORT=y
756# 697#
757# CONFIG_SPI is not set 698# CONFIG_SPI is not set
758# CONFIG_SPI_MASTER is not set 699# CONFIG_SPI_MASTER is not set
759
760#
761# Dallas's 1-wire bus
762#
763# CONFIG_W1 is not set 700# CONFIG_W1 is not set
701# CONFIG_POWER_SUPPLY is not set
764CONFIG_HWMON=y 702CONFIG_HWMON=y
765# CONFIG_HWMON_VID is not set 703# CONFIG_HWMON_VID is not set
766# CONFIG_SENSORS_ABITUGURU is not set
767# CONFIG_SENSORS_F71805F is not set 704# CONFIG_SENSORS_F71805F is not set
705# CONFIG_SENSORS_F71882FG is not set
706# CONFIG_SENSORS_IT87 is not set
707# CONFIG_SENSORS_PC87360 is not set
768# CONFIG_SENSORS_PC87427 is not set 708# CONFIG_SENSORS_PC87427 is not set
709# CONFIG_SENSORS_SIS5595 is not set
769# CONFIG_SENSORS_SMSC47M1 is not set 710# CONFIG_SENSORS_SMSC47M1 is not set
770# CONFIG_SENSORS_SMSC47B397 is not set 711# CONFIG_SENSORS_SMSC47B397 is not set
712# CONFIG_SENSORS_VIA686A is not set
771# CONFIG_SENSORS_VT1211 is not set 713# CONFIG_SENSORS_VT1211 is not set
714# CONFIG_SENSORS_VT8231 is not set
772# CONFIG_SENSORS_W83627HF is not set 715# CONFIG_SENSORS_W83627HF is not set
716# CONFIG_SENSORS_W83627EHF is not set
773# CONFIG_HWMON_DEBUG_CHIP is not set 717# CONFIG_HWMON_DEBUG_CHIP is not set
718# CONFIG_WATCHDOG is not set
719
720#
721# Sonics Silicon Backplane
722#
723CONFIG_SSB_POSSIBLE=y
724# CONFIG_SSB is not set
774 725
775# 726#
776# Multifunction device drivers 727# Multifunction device drivers
@@ -787,19 +738,16 @@ CONFIG_HWMON=y
787# 738#
788# Graphics support 739# Graphics support
789# 740#
790# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 741# CONFIG_DRM is not set
791
792#
793# Display device support
794#
795# CONFIG_DISPLAY_SUPPORT is not set
796# CONFIG_VGASTATE is not set 742# CONFIG_VGASTATE is not set
743# CONFIG_VIDEO_OUTPUT_CONTROL is not set
797CONFIG_FB=y 744CONFIG_FB=y
798# CONFIG_FIRMWARE_EDID is not set 745# CONFIG_FIRMWARE_EDID is not set
799# CONFIG_FB_DDC is not set 746# CONFIG_FB_DDC is not set
800# CONFIG_FB_CFB_FILLRECT is not set 747# CONFIG_FB_CFB_FILLRECT is not set
801# CONFIG_FB_CFB_COPYAREA is not set 748# CONFIG_FB_CFB_COPYAREA is not set
802# CONFIG_FB_CFB_IMAGEBLIT is not set 749# CONFIG_FB_CFB_IMAGEBLIT is not set
750# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
803# CONFIG_FB_SYS_FILLRECT is not set 751# CONFIG_FB_SYS_FILLRECT is not set
804# CONFIG_FB_SYS_COPYAREA is not set 752# CONFIG_FB_SYS_COPYAREA is not set
805# CONFIG_FB_SYS_IMAGEBLIT is not set 753# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -819,7 +767,6 @@ CONFIG_FB_DEFERRED_IO=y
819# CONFIG_FB_CYBER2000 is not set 767# CONFIG_FB_CYBER2000 is not set
820# CONFIG_FB_ASILIANT is not set 768# CONFIG_FB_ASILIANT is not set
821# CONFIG_FB_IMSTT is not set 769# CONFIG_FB_IMSTT is not set
822# CONFIG_FB_EPSON1355 is not set
823# CONFIG_FB_S1D13XXX is not set 770# CONFIG_FB_S1D13XXX is not set
824# CONFIG_FB_NVIDIA is not set 771# CONFIG_FB_NVIDIA is not set
825# CONFIG_FB_RIVA is not set 772# CONFIG_FB_RIVA is not set
@@ -839,6 +786,12 @@ CONFIG_FB_DEFERRED_IO=y
839# CONFIG_FB_ARK is not set 786# CONFIG_FB_ARK is not set
840# CONFIG_FB_PM3 is not set 787# CONFIG_FB_PM3 is not set
841# CONFIG_FB_VIRTUAL is not set 788# CONFIG_FB_VIRTUAL is not set
789# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
790
791#
792# Display device support
793#
794# CONFIG_DISPLAY_SUPPORT is not set
842# CONFIG_LOGO is not set 795# CONFIG_LOGO is not set
843 796
844# 797#
@@ -855,20 +808,14 @@ CONFIG_SOUND=m
855# Open Sound System 808# Open Sound System
856# 809#
857CONFIG_SOUND_PRIME=m 810CONFIG_SOUND_PRIME=m
858# CONFIG_OSS_OBSOLETE is not set
859# CONFIG_SOUND_TRIDENT is not set 811# CONFIG_SOUND_TRIDENT is not set
860# CONFIG_SOUND_MSNDCLAS is not set 812# CONFIG_SOUND_MSNDCLAS is not set
861# CONFIG_SOUND_MSNDPIN is not set 813# CONFIG_SOUND_MSNDPIN is not set
862 814CONFIG_HID_SUPPORT=y
863#
864# HID Devices
865#
866CONFIG_HID=y 815CONFIG_HID=y
867# CONFIG_HID_DEBUG is not set 816# CONFIG_HID_DEBUG is not set
868 817# CONFIG_HIDRAW is not set
869# 818CONFIG_USB_SUPPORT=y
870# USB support
871#
872CONFIG_USB_ARCH_HAS_HCD=y 819CONFIG_USB_ARCH_HAS_HCD=y
873CONFIG_USB_ARCH_HAS_OHCI=y 820CONFIG_USB_ARCH_HAS_OHCI=y
874CONFIG_USB_ARCH_HAS_EHCI=y 821CONFIG_USB_ARCH_HAS_EHCI=y
@@ -883,32 +830,8 @@ CONFIG_USB_ARCH_HAS_EHCI=y
883# 830#
884# CONFIG_USB_GADGET is not set 831# CONFIG_USB_GADGET is not set
885# CONFIG_MMC is not set 832# CONFIG_MMC is not set
886
887#
888# LED devices
889#
890# CONFIG_NEW_LEDS is not set 833# CONFIG_NEW_LEDS is not set
891
892#
893# LED drivers
894#
895
896#
897# LED Triggers
898#
899
900#
901# InfiniBand support
902#
903# CONFIG_INFINIBAND is not set 834# CONFIG_INFINIBAND is not set
904
905#
906# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
907#
908
909#
910# Real Time Clock
911#
912CONFIG_RTC_LIB=y 835CONFIG_RTC_LIB=y
913CONFIG_RTC_CLASS=y 836CONFIG_RTC_CLASS=y
914CONFIG_RTC_HCTOSYS=y 837CONFIG_RTC_HCTOSYS=y
@@ -925,10 +848,6 @@ CONFIG_RTC_INTF_DEV=y
925# CONFIG_RTC_DRV_TEST is not set 848# CONFIG_RTC_DRV_TEST is not set
926 849
927# 850#
928# I2C RTC drivers
929#
930
931#
932# SPI RTC drivers 851# SPI RTC drivers
933# 852#
934 853
@@ -936,8 +855,10 @@ CONFIG_RTC_INTF_DEV=y
936# Platform RTC drivers 855# Platform RTC drivers
937# 856#
938# CONFIG_RTC_DRV_DS1553 is not set 857# CONFIG_RTC_DRV_DS1553 is not set
858# CONFIG_RTC_DRV_STK17TA8 is not set
939# CONFIG_RTC_DRV_DS1742 is not set 859# CONFIG_RTC_DRV_DS1742 is not set
940# CONFIG_RTC_DRV_M48T86 is not set 860# CONFIG_RTC_DRV_M48T86 is not set
861# CONFIG_RTC_DRV_M48T59 is not set
941# CONFIG_RTC_DRV_V3020 is not set 862# CONFIG_RTC_DRV_V3020 is not set
942 863
943# 864#
@@ -946,17 +867,9 @@ CONFIG_RTC_INTF_DEV=y
946CONFIG_RTC_DRV_SH=y 867CONFIG_RTC_DRV_SH=y
947 868
948# 869#
949# DMA Engine support 870# Userspace I/O
950#
951# CONFIG_DMA_ENGINE is not set
952
953#
954# DMA Clients
955#
956
957#
958# DMA Devices
959# 871#
872# CONFIG_UIO is not set
960 873
961# 874#
962# File systems 875# File systems
@@ -1017,7 +930,6 @@ CONFIG_TMPFS=y
1017# CONFIG_TMPFS_POSIX_ACL is not set 930# CONFIG_TMPFS_POSIX_ACL is not set
1018CONFIG_HUGETLBFS=y 931CONFIG_HUGETLBFS=y
1019CONFIG_HUGETLB_PAGE=y 932CONFIG_HUGETLB_PAGE=y
1020CONFIG_RAMFS=y
1021CONFIG_CONFIGFS_FS=m 933CONFIG_CONFIGFS_FS=m
1022 934
1023# 935#
@@ -1036,10 +948,7 @@ CONFIG_CONFIGFS_FS=m
1036# CONFIG_QNX4FS_FS is not set 948# CONFIG_QNX4FS_FS is not set
1037# CONFIG_SYSV_FS is not set 949# CONFIG_SYSV_FS is not set
1038# CONFIG_UFS_FS is not set 950# CONFIG_UFS_FS is not set
1039 951CONFIG_NETWORK_FILESYSTEMS=y
1040#
1041# Network File Systems
1042#
1043CONFIG_NFS_FS=y 952CONFIG_NFS_FS=y
1044CONFIG_NFS_V3=y 953CONFIG_NFS_V3=y
1045# CONFIG_NFS_V3_ACL is not set 954# CONFIG_NFS_V3_ACL is not set
@@ -1065,17 +974,12 @@ CONFIG_RPCSEC_GSS_KRB5=y
1065# CONFIG_NCP_FS is not set 974# CONFIG_NCP_FS is not set
1066# CONFIG_CODA_FS is not set 975# CONFIG_CODA_FS is not set
1067# CONFIG_AFS_FS is not set 976# CONFIG_AFS_FS is not set
1068# CONFIG_9P_FS is not set
1069 977
1070# 978#
1071# Partition Types 979# Partition Types
1072# 980#
1073# CONFIG_PARTITION_ADVANCED is not set 981# CONFIG_PARTITION_ADVANCED is not set
1074CONFIG_MSDOS_PARTITION=y 982CONFIG_MSDOS_PARTITION=y
1075
1076#
1077# Native Language Support
1078#
1079CONFIG_NLS=y 983CONFIG_NLS=y
1080CONFIG_NLS_DEFAULT="iso8859-1" 984CONFIG_NLS_DEFAULT="iso8859-1"
1081CONFIG_NLS_CODEPAGE_437=y 985CONFIG_NLS_CODEPAGE_437=y
@@ -1116,23 +1020,18 @@ CONFIG_NLS_ISO8859_1=y
1116# CONFIG_NLS_KOI8_R is not set 1020# CONFIG_NLS_KOI8_R is not set
1117# CONFIG_NLS_KOI8_U is not set 1021# CONFIG_NLS_KOI8_U is not set
1118# CONFIG_NLS_UTF8 is not set 1022# CONFIG_NLS_UTF8 is not set
1119
1120#
1121# Distributed Lock Manager
1122#
1123# CONFIG_DLM is not set 1023# CONFIG_DLM is not set
1124 1024CONFIG_INSTRUMENTATION=y
1125#
1126# Profiling support
1127#
1128CONFIG_PROFILING=y 1025CONFIG_PROFILING=y
1129CONFIG_OPROFILE=m 1026CONFIG_OPROFILE=m
1027# CONFIG_MARKERS is not set
1130 1028
1131# 1029#
1132# Kernel hacking 1030# Kernel hacking
1133# 1031#
1134CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1032CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1135# CONFIG_PRINTK_TIME is not set 1033# CONFIG_PRINTK_TIME is not set
1034CONFIG_ENABLE_WARN_DEPRECATED=y
1136CONFIG_ENABLE_MUST_CHECK=y 1035CONFIG_ENABLE_MUST_CHECK=y
1137CONFIG_MAGIC_SYSRQ=y 1036CONFIG_MAGIC_SYSRQ=y
1138# CONFIG_UNUSED_SYMBOLS is not set 1037# CONFIG_UNUSED_SYMBOLS is not set
@@ -1141,6 +1040,7 @@ CONFIG_DEBUG_FS=y
1141CONFIG_DEBUG_KERNEL=y 1040CONFIG_DEBUG_KERNEL=y
1142# CONFIG_DEBUG_SHIRQ is not set 1041# CONFIG_DEBUG_SHIRQ is not set
1143# CONFIG_DETECT_SOFTLOCKUP is not set 1042# CONFIG_DETECT_SOFTLOCKUP is not set
1043CONFIG_SCHED_DEBUG=y
1144# CONFIG_SCHEDSTATS is not set 1044# CONFIG_SCHEDSTATS is not set
1145# CONFIG_TIMER_STATS is not set 1045# CONFIG_TIMER_STATS is not set
1146# CONFIG_DEBUG_SLAB is not set 1046# CONFIG_DEBUG_SLAB is not set
@@ -1150,6 +1050,7 @@ CONFIG_DEBUG_MUTEXES=y
1150CONFIG_DEBUG_LOCK_ALLOC=y 1050CONFIG_DEBUG_LOCK_ALLOC=y
1151# CONFIG_PROVE_LOCKING is not set 1051# CONFIG_PROVE_LOCKING is not set
1152CONFIG_LOCKDEP=y 1052CONFIG_LOCKDEP=y
1053# CONFIG_LOCK_STAT is not set
1153# CONFIG_DEBUG_LOCKDEP is not set 1054# CONFIG_DEBUG_LOCKDEP is not set
1154# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1055# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1155CONFIG_DEBUG_LOCKING_API_SELFTESTS=y 1056CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
@@ -1159,17 +1060,21 @@ CONFIG_DEBUG_BUGVERBOSE=y
1159CONFIG_DEBUG_INFO=y 1060CONFIG_DEBUG_INFO=y
1160# CONFIG_DEBUG_VM is not set 1061# CONFIG_DEBUG_VM is not set
1161# CONFIG_DEBUG_LIST is not set 1062# CONFIG_DEBUG_LIST is not set
1063# CONFIG_DEBUG_SG is not set
1162CONFIG_FRAME_POINTER=y 1064CONFIG_FRAME_POINTER=y
1163CONFIG_FORCED_INLINING=y 1065CONFIG_FORCED_INLINING=y
1066# CONFIG_BOOT_PRINTK_DELAY is not set
1164# CONFIG_RCU_TORTURE_TEST is not set 1067# CONFIG_RCU_TORTURE_TEST is not set
1165# CONFIG_FAULT_INJECTION is not set 1068# CONFIG_FAULT_INJECTION is not set
1069# CONFIG_SAMPLES is not set
1166CONFIG_SH_STANDARD_BIOS=y 1070CONFIG_SH_STANDARD_BIOS=y
1167# CONFIG_EARLY_SCIF_CONSOLE is not set 1071# CONFIG_EARLY_SCIF_CONSOLE is not set
1168CONFIG_EARLY_PRINTK=y 1072CONFIG_EARLY_PRINTK=y
1169# CONFIG_DEBUG_BOOTMEM is not set 1073# CONFIG_DEBUG_BOOTMEM is not set
1170CONFIG_DEBUG_STACKOVERFLOW=y 1074CONFIG_DEBUG_STACKOVERFLOW=y
1171CONFIG_DEBUG_STACK_USAGE=y 1075CONFIG_DEBUG_STACK_USAGE=y
1172# CONFIG_4KSTACKS is not set 1076CONFIG_4KSTACKS=y
1077# CONFIG_IRQSTACKS is not set
1173# CONFIG_SH_KGDB is not set 1078# CONFIG_SH_KGDB is not set
1174 1079
1175# 1080#
@@ -1177,10 +1082,7 @@ CONFIG_DEBUG_STACK_USAGE=y
1177# 1082#
1178# CONFIG_KEYS is not set 1083# CONFIG_KEYS is not set
1179# CONFIG_SECURITY is not set 1084# CONFIG_SECURITY is not set
1180 1085# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1181#
1182# Cryptographic options
1183#
1184CONFIG_CRYPTO=y 1086CONFIG_CRYPTO=y
1185CONFIG_CRYPTO_ALGAPI=y 1087CONFIG_CRYPTO_ALGAPI=y
1186CONFIG_CRYPTO_BLKCIPHER=y 1088CONFIG_CRYPTO_BLKCIPHER=y
@@ -1201,6 +1103,7 @@ CONFIG_CRYPTO_ECB=m
1201CONFIG_CRYPTO_CBC=y 1103CONFIG_CRYPTO_CBC=y
1202CONFIG_CRYPTO_PCBC=m 1104CONFIG_CRYPTO_PCBC=m
1203# CONFIG_CRYPTO_LRW is not set 1105# CONFIG_CRYPTO_LRW is not set
1106# CONFIG_CRYPTO_XTS is not set
1204# CONFIG_CRYPTO_CRYPTD is not set 1107# CONFIG_CRYPTO_CRYPTD is not set
1205CONFIG_CRYPTO_DES=y 1108CONFIG_CRYPTO_DES=y
1206# CONFIG_CRYPTO_FCRYPT is not set 1109# CONFIG_CRYPTO_FCRYPT is not set
@@ -1214,15 +1117,14 @@ CONFIG_CRYPTO_DES=y
1214# CONFIG_CRYPTO_ARC4 is not set 1117# CONFIG_CRYPTO_ARC4 is not set
1215# CONFIG_CRYPTO_KHAZAD is not set 1118# CONFIG_CRYPTO_KHAZAD is not set
1216# CONFIG_CRYPTO_ANUBIS is not set 1119# CONFIG_CRYPTO_ANUBIS is not set
1120# CONFIG_CRYPTO_SEED is not set
1217# CONFIG_CRYPTO_DEFLATE is not set 1121# CONFIG_CRYPTO_DEFLATE is not set
1218# CONFIG_CRYPTO_MICHAEL_MIC is not set 1122# CONFIG_CRYPTO_MICHAEL_MIC is not set
1219# CONFIG_CRYPTO_CRC32C is not set 1123# CONFIG_CRYPTO_CRC32C is not set
1220# CONFIG_CRYPTO_CAMELLIA is not set 1124# CONFIG_CRYPTO_CAMELLIA is not set
1221# CONFIG_CRYPTO_TEST is not set 1125# CONFIG_CRYPTO_TEST is not set
1222 1126# CONFIG_CRYPTO_AUTHENC is not set
1223# 1127CONFIG_CRYPTO_HW=y
1224# Hardware crypto devices
1225#
1226 1128
1227# 1129#
1228# Library routines 1130# Library routines
@@ -1232,6 +1134,7 @@ CONFIG_BITREVERSE=y
1232# CONFIG_CRC16 is not set 1134# CONFIG_CRC16 is not set
1233# CONFIG_CRC_ITU_T is not set 1135# CONFIG_CRC_ITU_T is not set
1234CONFIG_CRC32=y 1136CONFIG_CRC32=y
1137# CONFIG_CRC7 is not set
1235# CONFIG_LIBCRC32C is not set 1138# CONFIG_LIBCRC32C is not set
1236CONFIG_HAS_IOMEM=y 1139CONFIG_HAS_IOMEM=y
1237CONFIG_HAS_IOPORT=y 1140CONFIG_HAS_IOPORT=y
diff --git a/arch/sh/drivers/pci/pci-st40.c b/arch/sh/drivers/pci/pci-st40.c
index 1502a14386b6..0814a5afe9b7 100644
--- a/arch/sh/drivers/pci/pci-st40.c
+++ b/arch/sh/drivers/pci/pci-st40.c
@@ -114,7 +114,7 @@ static struct pci_err int_error[]={
114 { INT_MWPDI, "MWPDI: PERR from target at data write"}, 114 { INT_MWPDI, "MWPDI: PERR from target at data write"},
115 { INT_MRDPEI, "MRDPEI: Master read data parity error"} 115 { INT_MRDPEI, "MRDPEI: Master read data parity error"}
116}; 116};
117#define NUM_PCI_INT_ERRS (sizeof(int_error)/sizeof(struct pci_err)) 117#define NUM_PCI_INT_ERRS ARRAY_SIZE(int_error)
118 118
119static struct pci_err aint_error[]={ 119static struct pci_err aint_error[]={
120 { AINT_MBI, "MBI: Master broken"}, 120 { AINT_MBI, "MBI: Master broken"},
@@ -126,7 +126,7 @@ static struct pci_err aint_error[]={
126 { AINT_WDPE, "WDPE: Write data parity"} 126 { AINT_WDPE, "WDPE: Write data parity"}
127}; 127};
128 128
129#define NUM_PCI_AINT_ERRS (sizeof(aint_error)/sizeof(struct pci_err)) 129#define NUM_PCI_AINT_ERRS ARRAY_SIZE(aint_error)
130 130
131static void print_pci_errors(unsigned reg,struct pci_err *error,int num_errors) 131static void print_pci_errors(unsigned reg,struct pci_err *error,int num_errors)
132{ 132{
diff --git a/arch/sh/kernel/cpu/irq/ipr.c b/arch/sh/kernel/cpu/irq/ipr.c
index 5da325414880..56ea7b269b59 100644
--- a/arch/sh/kernel/cpu/irq/ipr.c
+++ b/arch/sh/kernel/cpu/irq/ipr.c
@@ -49,7 +49,6 @@ static void enable_ipr_irq(unsigned int irq)
49 * bits/4. This is to make it easier to read the value directly from the 49 * bits/4. This is to make it easier to read the value directly from the
50 * datasheets. The IPR address is calculated using the ipr_offset table. 50 * datasheets. The IPR address is calculated using the ipr_offset table.
51 */ 51 */
52
53void register_ipr_controller(struct ipr_desc *desc) 52void register_ipr_controller(struct ipr_desc *desc)
54{ 53{
55 int i; 54 int i;
@@ -71,12 +70,4 @@ void register_ipr_controller(struct ipr_desc *desc)
71 disable_ipr_irq(p->irq); 70 disable_ipr_irq(p->irq);
72 } 71 }
73} 72}
74
75EXPORT_SYMBOL(register_ipr_controller); 73EXPORT_SYMBOL(register_ipr_controller);
76
77#if !defined(CONFIG_CPU_HAS_PINT_IRQ)
78int ipr_irq_demux(int irq)
79{
80 return irq;
81}
82#endif
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index 55f66104431d..b9c6547c4a90 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -14,6 +14,32 @@
14#include <asm/mmzone.h> 14#include <asm/mmzone.h>
15#include <asm/sci.h> 15#include <asm/sci.h>
16 16
17static struct resource usbf_resources[] = {
18 [0] = {
19 .name = "m66592_udc",
20 .start = 0xA4480000,
21 .end = 0xA44800FF,
22 .flags = IORESOURCE_MEM,
23 },
24 [1] = {
25 .name = "m66592_udc",
26 .start = 65,
27 .end = 65,
28 .flags = IORESOURCE_IRQ,
29 },
30};
31
32static struct platform_device usbf_device = {
33 .name = "m66592_udc",
34 .id = -1,
35 .dev = {
36 .dma_mask = NULL,
37 .coherent_dma_mask = 0xffffffff,
38 },
39 .num_resources = ARRAY_SIZE(usbf_resources),
40 .resource = usbf_resources,
41};
42
17static struct plat_sci_port sci_platform_data[] = { 43static struct plat_sci_port sci_platform_data[] = {
18 { 44 {
19 .mapbase = 0xffe00000, 45 .mapbase = 0xffe00000,
@@ -47,6 +73,7 @@ static struct platform_device sci_device = {
47}; 73};
48 74
49static struct platform_device *sh7722_devices[] __initdata = { 75static struct platform_device *sh7722_devices[] __initdata = {
76 &usbf_device,
50 &sci_device, 77 &sci_device,
51}; 78};
52 79
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 4b49d03ffbd2..348da194ec99 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -69,7 +69,7 @@ unlock:
69} 69}
70#endif 70#endif
71 71
72#ifdef CONFIG_4KSTACKS 72#ifdef CONFIG_IRQSTACKS
73/* 73/*
74 * per-CPU IRQ handling contexts (thread information and stack) 74 * per-CPU IRQ handling contexts (thread information and stack)
75 */ 75 */
@@ -85,7 +85,7 @@ static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
85asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs) 85asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs)
86{ 86{
87 struct pt_regs *old_regs = set_irq_regs(regs); 87 struct pt_regs *old_regs = set_irq_regs(regs);
88#ifdef CONFIG_4KSTACKS 88#ifdef CONFIG_IRQSTACKS
89 union irq_ctx *curctx, *irqctx; 89 union irq_ctx *curctx, *irqctx;
90#endif 90#endif
91 91
@@ -109,7 +109,7 @@ asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs)
109 109
110 irq = irq_demux(evt2irq(irq)); 110 irq = irq_demux(evt2irq(irq));
111 111
112#ifdef CONFIG_4KSTACKS 112#ifdef CONFIG_IRQSTACKS
113 curctx = (union irq_ctx *)current_thread_info(); 113 curctx = (union irq_ctx *)current_thread_info();
114 irqctx = hardirq_ctx[smp_processor_id()]; 114 irqctx = hardirq_ctx[smp_processor_id()];
115 115
@@ -157,7 +157,7 @@ asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs)
157 return 1; 157 return 1;
158} 158}
159 159
160#ifdef CONFIG_4KSTACKS 160#ifdef CONFIG_IRQSTACKS
161static char softirq_stack[NR_CPUS * THREAD_SIZE] 161static char softirq_stack[NR_CPUS * THREAD_SIZE]
162 __attribute__((__section__(".bss.page_aligned"))); 162 __attribute__((__section__(".bss.page_aligned")));
163 163
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index b749403f6b38..0b8c45d53a47 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -32,12 +32,6 @@
32#include <asm/clock.h> 32#include <asm/clock.h>
33#include <asm/mmu_context.h> 33#include <asm/mmu_context.h>
34 34
35extern void * __rd_start, * __rd_end;
36
37/*
38 * Machine setup..
39 */
40
41/* 35/*
42 * Initialize loops_per_jiffy as 10000000 (1000MIPS). 36 * Initialize loops_per_jiffy as 10000000 (1000MIPS).
43 * This value will be used at the very early stage of serial setup. 37 * This value will be used at the very early stage of serial setup.
@@ -63,33 +57,25 @@ struct screen_info screen_info;
63 57
64extern int root_mountflags; 58extern int root_mountflags;
65 59
66/*
67 * This is set up by the setup-routine at boot-time
68 */
69#define PARAM ((unsigned char *)empty_zero_page)
70
71#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000))
72#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004))
73#define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008))
74#define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c))
75#define INITRD_START (*(unsigned long *) (PARAM+0x010))
76#define INITRD_SIZE (*(unsigned long *) (PARAM+0x014))
77/* ... */
78#define COMMAND_LINE ((char *) (PARAM+0x100))
79
80#define RAMDISK_IMAGE_START_MASK 0x07FF 60#define RAMDISK_IMAGE_START_MASK 0x07FF
81#define RAMDISK_PROMPT_FLAG 0x8000 61#define RAMDISK_PROMPT_FLAG 0x8000
82#define RAMDISK_LOAD_FLAG 0x4000 62#define RAMDISK_LOAD_FLAG 0x4000
83 63
84static char __initdata command_line[COMMAND_LINE_SIZE] = { 0, }; 64static char __initdata command_line[COMMAND_LINE_SIZE] = { 0, };
85 65
86static struct resource code_resource = { .name = "Kernel code", }; 66static struct resource code_resource = {
87static struct resource data_resource = { .name = "Kernel data", }; 67 .name = "Kernel code",
68 .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
69};
70
71static struct resource data_resource = {
72 .name = "Kernel data",
73 .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
74};
88 75
89unsigned long memory_start; 76unsigned long memory_start;
90EXPORT_SYMBOL(memory_start); 77EXPORT_SYMBOL(memory_start);
91 78unsigned long memory_end = 0;
92unsigned long memory_end;
93EXPORT_SYMBOL(memory_end); 79EXPORT_SYMBOL(memory_end);
94 80
95static int __init early_parse_mem(char *p) 81static int __init early_parse_mem(char *p)
@@ -195,14 +181,7 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
195 sparse_memory_present_with_active_regions(0); 181 sparse_memory_present_with_active_regions(0);
196 182
197#ifdef CONFIG_BLK_DEV_INITRD 183#ifdef CONFIG_BLK_DEV_INITRD
198 ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); 184 ROOT_DEV = Root_RAM0;
199 if (&__rd_start != &__rd_end) {
200 LOADER_TYPE = 1;
201 INITRD_START = PHYSADDR((unsigned long)&__rd_start) -
202 __MEMORY_START;
203 INITRD_SIZE = (unsigned long)&__rd_end -
204 (unsigned long)&__rd_start;
205 }
206 185
207 if (LOADER_TYPE && INITRD_START) { 186 if (LOADER_TYPE && INITRD_START) {
208 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { 187 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
@@ -265,7 +244,8 @@ void __init setup_arch(char **cmdline_p)
265 data_resource.end = virt_to_phys(_edata)-1; 244 data_resource.end = virt_to_phys(_edata)-1;
266 245
267 memory_start = (unsigned long)PAGE_OFFSET+__MEMORY_START; 246 memory_start = (unsigned long)PAGE_OFFSET+__MEMORY_START;
268 memory_end = memory_start + __MEMORY_SIZE; 247 if (!memory_end)
248 memory_end = memory_start + __MEMORY_SIZE;
269 249
270#ifdef CONFIG_CMDLINE_BOOL 250#ifdef CONFIG_CMDLINE_BOOL
271 strlcpy(command_line, CONFIG_CMDLINE, sizeof(command_line)); 251 strlcpy(command_line, CONFIG_CMDLINE, sizeof(command_line));
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S
index 6d5abba2ee27..0956fb3681a3 100644
--- a/arch/sh/kernel/vmlinux.lds.S
+++ b/arch/sh/kernel/vmlinux.lds.S
@@ -1,4 +1,4 @@
1/* $Id: vmlinux.lds.S,v 1.8 2003/05/16 17:18:14 lethal Exp $ 1/*
2 * ld script to make SuperH Linux kernel 2 * ld script to make SuperH Linux kernel
3 * Written by Niibe Yutaka 3 * Written by Niibe Yutaka
4 */ 4 */
@@ -15,121 +15,124 @@ OUTPUT_ARCH(sh)
15ENTRY(_start) 15ENTRY(_start)
16SECTIONS 16SECTIONS
17{ 17{
18 . = CONFIG_PAGE_OFFSET + CONFIG_MEMORY_START + CONFIG_ZERO_PAGE_OFFSET; 18 . = CONFIG_PAGE_OFFSET + CONFIG_MEMORY_START + CONFIG_ZERO_PAGE_OFFSET;
19 _text = .; /* Text and read-only data */ 19 _text = .; /* Text and read-only data */
20 text = .; /* Text and read-only data */ 20
21 .empty_zero_page : { 21 .empty_zero_page : {
22 *(.empty_zero_page) 22 *(.empty_zero_page)
23 } = 0 23 } = 0
24 .text : { 24
25 *(.text.head) 25 .text : {
26 TEXT_TEXT 26 *(.text.head)
27 SCHED_TEXT 27 TEXT_TEXT
28 LOCK_TEXT 28 SCHED_TEXT
29 *(.fixup) 29 LOCK_TEXT
30 *(.gnu.warning) 30 KPROBES_TEXT
31 *(.fixup)
32 *(.gnu.warning)
31 } = 0x0009 33 } = 0x0009
32 34
33 . = ALIGN(16); /* Exception table */ 35 . = ALIGN(16); /* Exception table */
34 __start___ex_table = .; 36 __start___ex_table = .;
35 __ex_table : { *(__ex_table) } 37 __ex_table : { *(__ex_table) }
36 __stop___ex_table = .; 38 __stop___ex_table = .;
39
40 _etext = .; /* End of text section */
37 41
38 _etext = .; /* End of text section */ 42 BUG_TABLE
43 NOTES
44 RO_DATA(PAGE_SIZE)
39 45
40 RODATA 46 . = ALIGN(THREAD_SIZE);
47 .data : { /* Data */
48 *(.data.init_task)
41 49
42 BUG_TABLE 50 . = ALIGN(L1_CACHE_BYTES);
51 *(.data.cacheline_aligned)
43 52
44 .data : { /* Data */ 53 . = ALIGN(L1_CACHE_BYTES);
45 DATA_DATA 54 *(.data.read_mostly)
46 55
47 /* Align the initial ramdisk image (INITRD) on page boundaries. */ 56 . = ALIGN(PAGE_SIZE);
48 . = ALIGN(PAGE_SIZE); 57 *(.data.page_aligned)
49 __rd_start = .;
50 *(.initrd)
51 . = ALIGN(PAGE_SIZE);
52 __rd_end = .;
53 58
54 CONSTRUCTORS 59 __nosave_begin = .;
60 *(.data.nosave)
61 . = ALIGN(PAGE_SIZE);
62 __nosave_end = .;
63
64 DATA_DATA
65 CONSTRUCTORS
55 } 66 }
56 67
57 . = ALIGN(PAGE_SIZE); 68 _edata = .; /* End of data section */
58 .data.page_aligned : { *(.data.page_aligned) }
59 __nosave_begin = .;
60 .data_nosave : { *(.data.nosave) }
61 . = ALIGN(PAGE_SIZE);
62 __nosave_end = .;
63
64 PERCPU(PAGE_SIZE)
65
66 . = ALIGN(L1_CACHE_BYTES);
67 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
68
69 _edata = .; /* End of data section */
70
71 . = ALIGN(THREAD_SIZE); /* init_task */
72 .data.init_task : { *(.data.init_task) }
73
74 . = ALIGN(PAGE_SIZE); /* Init code and data */
75 __init_begin = .;
76 _sinittext = .;
77 .init.text : { *(.init.text) }
78 _einittext = .;
79 .init.data : { *(.init.data) }
80 . = ALIGN(16);
81 __setup_start = .;
82 .init.setup : { *(.init.setup) }
83 __setup_end = .;
84 __initcall_start = .;
85 .initcall.init : {
86 INITCALLS
87 }
88 __initcall_end = .;
89 __con_initcall_start = .;
90 .con_initcall.init : { *(.con_initcall.init) }
91 __con_initcall_end = .;
92 SECURITY_INIT
93
94 /* .exit.text is discarded at runtime, not link time, to deal with
95 references from .rodata */
96 .exit.text : { *(.exit.text) }
97 .exit.data : { *(.exit.data) }
98 69
99#ifdef CONFIG_BLK_DEV_INITRD 70 . = ALIGN(PAGE_SIZE); /* Init code and data */
100 . = ALIGN(PAGE_SIZE); 71 __init_begin = .;
72 _sinittext = .;
73 .init.text : { *(.init.text) }
74 _einittext = .;
75 .init.data : { *(.init.data) }
76
77 . = ALIGN(16);
78 __setup_start = .;
79 .init.setup : { *(.init.setup) }
80 __setup_end = .;
101 81
102 __initramfs_start = .; 82 __initcall_start = .;
103 .init.ramfs : { *(.init.ramfs) } 83 .initcall.init : {
104 __initramfs_end = .; 84 INITCALLS
85 }
86 __initcall_end = .;
87 __con_initcall_start = .;
88 .con_initcall.init : { *(.con_initcall.init) }
89 __con_initcall_end = .;
90
91 SECURITY_INIT
92
93#ifdef CONFIG_BLK_DEV_INITRD
94 . = ALIGN(PAGE_SIZE);
95 __initramfs_start = .;
96 .init.ramfs : { *(.init.ramfs) }
97 __initramfs_end = .;
105#endif 98#endif
106 99
107 . = ALIGN(4);
108 __machvec_start = .;
109 .machvec.init : { *(.machvec.init) }
110 __machvec_end = .;
111
112 . = ALIGN(PAGE_SIZE);
113 .bss : {
114 __init_end = .;
115 __bss_start = .; /* BSS */
116 *(.bss.page_aligned)
117 *(.bss)
118 . = ALIGN(4); 100 . = ALIGN(4);
119 _ebss = .; /* uClinux MTD sucks */ 101 __machvec_start = .;
120 _end = . ; 102 .machvec.init : { *(.machvec.init) }
121 } 103 __machvec_end = .;
122 104
123 /* When something in the kernel is NOT compiled as a module, the 105 PERCPU(PAGE_SIZE)
124 * module cleanup code and data are put into these segments. Both 106
125 * can then be thrown away, as cleanup code is never called unless 107 /*
126 * it's a module. 108 * .exit.text is discarded at runtime, not link time, to deal with
127 */ 109 * references from __bug_table
128 /DISCARD/ : { 110 */
129 *(.exitcall.exit) 111 .exit.text : { *(.exit.text) }
112 .exit.data : { *(.exit.data) }
113
114 . = ALIGN(PAGE_SIZE);
115 .bss : {
116 __init_end = .;
117 __bss_start = .; /* BSS */
118 *(.bss.page_aligned)
119 *(.bss)
120 *(COMMON)
121 . = ALIGN(4);
122 _ebss = .; /* uClinux MTD sucks */
123 _end = . ;
130 } 124 }
131 125
132 STABS_DEBUG 126 /*
127 * When something in the kernel is NOT compiled as a module, the
128 * module cleanup code and data are put into these segments. Both
129 * can then be thrown away, as cleanup code is never called unless
130 * it's a module.
131 */
132 /DISCARD/ : {
133 *(.exitcall.exit)
134 }
133 135
134 DWARF_DEBUG 136 STABS_DEBUG
137 DWARF_DEBUG
135} 138}
diff --git a/arch/sh/kernel/vsyscall/vsyscall.lds.S b/arch/sh/kernel/vsyscall/vsyscall.lds.S
index c9bf2af35d35..6d59ee7c23dd 100644
--- a/arch/sh/kernel/vsyscall/vsyscall.lds.S
+++ b/arch/sh/kernel/vsyscall/vsyscall.lds.S
@@ -38,7 +38,10 @@ SECTIONS
38 .text : { *(.text) } :text =0x90909090 38 .text : { *(.text) } :text =0x90909090
39 .note : { *(.note.*) } :text :note 39 .note : { *(.note.*) } :text :note
40 .eh_frame_hdr : { *(.eh_frame_hdr ) } :text :eh_frame_hdr 40 .eh_frame_hdr : { *(.eh_frame_hdr ) } :text :eh_frame_hdr
41 .eh_frame : { KEEP (*(.eh_frame)) } :text 41 .eh_frame : {
42 KEEP (*(.eh_frame))
43 LONG (0)
44 } :text
42 .dynamic : { *(.dynamic) } :text :dynamic 45 .dynamic : { *(.dynamic) } :text :dynamic
43 .useless : { 46 .useless : {
44 *(.got.plt) *(.got) 47 *(.got.plt) *(.got)
diff --git a/arch/sh/mm/copy_page.S b/arch/sh/mm/copy_page.S
index a81dbdb05596..3d8409daa4be 100644
--- a/arch/sh/mm/copy_page.S
+++ b/arch/sh/mm/copy_page.S
@@ -255,7 +255,11 @@ EX( mov.l @r5+,r8 )
255EX( mov.l @r5+,r9 ) 255EX( mov.l @r5+,r9 )
256EX( mov.l @r5+,r10 ) 256EX( mov.l @r5+,r10 )
257EX( mov.l @r5+,r11 ) 257EX( mov.l @r5+,r11 )
258#ifdef CONFIG_CPU_SH4
258EX( movca.l r0,@r4 ) 259EX( movca.l r0,@r4 )
260#else
261EX( mov.l r0,@r4 )
262#endif
259 add #-32, r6 263 add #-32, r6
260EX( mov.l r1,@(4,r4) ) 264EX( mov.l r1,@(4,r4) )
261 mov #32, r0 265 mov #32, r0
diff --git a/arch/sh/oprofile/op_model_sh7750.c b/arch/sh/oprofile/op_model_sh7750.c
index ebee7e24ede9..6b9a98e07004 100644
--- a/arch/sh/oprofile/op_model_sh7750.c
+++ b/arch/sh/oprofile/op_model_sh7750.c
@@ -16,7 +16,6 @@
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/notifier.h>
20#include <asm/uaccess.h> 19#include <asm/uaccess.h>
21#include <asm/io.h> 20#include <asm/io.h>
22 21
@@ -44,8 +43,6 @@
44 */ 43 */
45#define NR_CNTRS 2 44#define NR_CNTRS 2
46 45
47extern const char *get_cpu_subtype(void);
48
49struct op_counter_config { 46struct op_counter_config {
50 unsigned long enabled; 47 unsigned long enabled;
51 unsigned long event; 48 unsigned long event;
@@ -111,17 +108,12 @@ static struct op_counter_config ctr[NR_CNTRS];
111 * behavior. 108 * behavior.
112 */ 109 */
113 110
114static int sh7750_timer_notify(struct notifier_block *self, 111static int sh7750_timer_notify(struct pt_regs *regs)
115 unsigned long val, void *regs)
116{ 112{
117 oprofile_add_sample((struct pt_regs *)regs, 0); 113 oprofile_add_sample(regs, 0);
118 return 0; 114 return 0;
119} 115}
120 116
121static struct notifier_block sh7750_timer_notifier = {
122 .notifier_call = sh7750_timer_notify,
123};
124
125static u64 sh7750_read_counter(int counter) 117static u64 sh7750_read_counter(int counter)
126{ 118{
127 u32 hi, lo; 119 u32 hi, lo;
@@ -240,7 +232,7 @@ static int sh7750_perf_counter_start(void)
240 ctrl_outw(pmcr | PMCR_ENABLE, PMCR2); 232 ctrl_outw(pmcr | PMCR_ENABLE, PMCR2);
241 } 233 }
242 234
243 return register_profile_notifier(&sh7750_timer_notifier); 235 return register_timer_hook(sh7750_timer_notify);
244} 236}
245 237
246static void sh7750_perf_counter_stop(void) 238static void sh7750_perf_counter_stop(void)
@@ -248,7 +240,7 @@ static void sh7750_perf_counter_stop(void)
248 ctrl_outw(ctrl_inw(PMCR1) & ~PMCR_PMEN, PMCR1); 240 ctrl_outw(ctrl_inw(PMCR1) & ~PMCR_PMEN, PMCR1);
249 ctrl_outw(ctrl_inw(PMCR2) & ~PMCR_PMEN, PMCR2); 241 ctrl_outw(ctrl_inw(PMCR2) & ~PMCR_PMEN, PMCR2);
250 242
251 unregister_profile_notifier(&sh7750_timer_notifier); 243 unregister_timer_hook(sh7750_timer_notify);
252} 244}
253 245
254static struct oprofile_operations sh7750_perf_counter_ops = { 246static struct oprofile_operations sh7750_perf_counter_ops = {
@@ -257,13 +249,13 @@ static struct oprofile_operations sh7750_perf_counter_ops = {
257 .stop = sh7750_perf_counter_stop, 249 .stop = sh7750_perf_counter_stop,
258}; 250};
259 251
260int __init oprofile_arch_init(struct oprofile_operations **ops) 252int __init oprofile_arch_init(struct oprofile_operations *ops)
261{ 253{
262 if (!(current_cpu_data.flags & CPU_HAS_PERF_COUNTER)) 254 if (!(current_cpu_data.flags & CPU_HAS_PERF_COUNTER))
263 return -ENODEV; 255 return -ENODEV;
264 256
265 sh7750_perf_counter_ops.cpu_type = (char *)get_cpu_subtype(); 257 ops = &sh7750_perf_counter_ops;
266 *ops = &sh7750_perf_counter_ops; 258 ops->cpu_type = (char *)get_cpu_subtype(&current_cpu_data);
267 259
268 printk(KERN_INFO "oprofile: using SH-4 (%s) performance monitoring.\n", 260 printk(KERN_INFO "oprofile: using SH-4 (%s) performance monitoring.\n",
269 sh7750_perf_counter_ops.cpu_type); 261 sh7750_perf_counter_ops.cpu_type);
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types
index 439bfe3d29af..ff071693325c 100644
--- a/arch/sh/tools/mach-types
+++ b/arch/sh/tools/mach-types
@@ -1,26 +1,35 @@
1# 1#
2# List of boards. 2# MACH_<xxx> CONFIG_<xxx>
3# 3#
4 4
5# 5#
6# MACH_<xxx> CONFIG_<xxx> 6# List of board groups.
7# 7#
8SE SH_SOLUTION_ENGINE 8SE SH_SOLUTION_ENGINE
97751SE SH_7751_SOLUTION_ENGINE 9HIGHLANDER SH_HIGHLANDER
107722SE SH_7722_SOLUTION_ENGINE 10RTS7751R2D SH_RTS7751R2D
117343SE SH_7343_SOLUTION_ENGINE 11
12#
13# List of companion chips / MFDs.
14#
15HD64461 HD64461
16HD64465 HD64465
17
18#
19# List of boards.
20#
127206SE SH_7206_SOLUTION_ENGINE 217206SE SH_7206_SOLUTION_ENGINE
227343SE SH_7343_SOLUTION_ENGINE
137619SE SH_7619_SOLUTION_ENGINE 237619SE SH_7619_SOLUTION_ENGINE
247722SE SH_7722_SOLUTION_ENGINE
257751SE SH_7751_SOLUTION_ENGINE
147780SE SH_7780_SOLUTION_ENGINE 267780SE SH_7780_SOLUTION_ENGINE
157751SYSTEMH SH_7751_SYSTEMH 277751SYSTEMH SH_7751_SYSTEMH
16HP6XX SH_HP6XX 28HP6XX SH_HP6XX
17HD64461 HD64461
18HD64465 HD64465
19DREAMCAST SH_DREAMCAST 29DREAMCAST SH_DREAMCAST
20MPC1211 SH_MPC1211 30MPC1211 SH_MPC1211
21SNAPGEAR SH_SECUREEDGE5410 31SNAPGEAR SH_SECUREEDGE5410
22HS7751RVOIP SH_HS7751RVOIP 32HS7751RVOIP SH_HS7751RVOIP
23RTS7751R2D SH_RTS7751R2D
24EDOSK7705 SH_EDOSK7705 33EDOSK7705 SH_EDOSK7705
25SH4202_MICRODEV SH_SH4202_MICRODEV 34SH4202_MICRODEV SH_SH4202_MICRODEV
26SH03 SH_SH03 35SH03 SH_SH03
@@ -32,3 +41,7 @@ TITAN SH_TITAN
32SHMIN SH_SHMIN 41SHMIN SH_SHMIN
337710VOIPGW SH_7710VOIPGW 427710VOIPGW SH_7710VOIPGW
34LBOXRE2 SH_LBOX_RE2 43LBOXRE2 SH_LBOX_RE2
44X3PROTO SH_X3PROTO
45MAGICPANELR2 SH_MAGIC_PANEL_R2
46R2D_PLUS RTS7751R2D_PLUS
47R2D_1 RTS7751R2D_1
diff --git a/arch/sh64/Kconfig b/arch/sh64/Kconfig
index ba204bac49df..6884d5a518ad 100644
--- a/arch/sh64/Kconfig
+++ b/arch/sh64/Kconfig
@@ -1,6 +1,6 @@
1# 1#
2# For a description of the syntax of this configuration file, 2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/config-language.txt. 3# see Documentation/kbuild/kconfig-language.txt.
4# 4#
5 5
6mainmenu "Linux/SH64 Kernel Configuration" 6mainmenu "Linux/SH64 Kernel Configuration"
diff --git a/arch/sh64/configs/cayman_defconfig b/arch/sh64/configs/cayman_defconfig
index 91b59118c1b1..75552bb01405 100644
--- a/arch/sh64/configs/cayman_defconfig
+++ b/arch/sh64/configs/cayman_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc8 3# Linux kernel version: 2.6.24-rc1
4# Tue Oct 9 15:37:16 2007 4# Fri Nov 2 14:35:27 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH64=y 7CONFIG_SUPERH64=y
@@ -36,6 +36,10 @@ CONFIG_POSIX_MQUEUE=y
36# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
37# CONFIG_IKCONFIG is not set 37# CONFIG_IKCONFIG is not set
38CONFIG_LOG_BUF_SHIFT=14 38CONFIG_LOG_BUF_SHIFT=14
39# CONFIG_CGROUPS is not set
40CONFIG_FAIR_GROUP_SCHED=y
41CONFIG_FAIR_USER_SCHED=y
42# CONFIG_FAIR_CGROUP_SCHED is not set
39CONFIG_SYSFS_DEPRECATED=y 43CONFIG_SYSFS_DEPRECATED=y
40# CONFIG_RELAY is not set 44# CONFIG_RELAY is not set
41# CONFIG_BLK_DEV_INITRD is not set 45# CONFIG_BLK_DEV_INITRD is not set
@@ -148,6 +152,7 @@ CONFIG_FLATMEM_MANUAL=y
148CONFIG_FLATMEM=y 152CONFIG_FLATMEM=y
149CONFIG_FLAT_NODE_MEM_MAP=y 153CONFIG_FLAT_NODE_MEM_MAP=y
150# CONFIG_SPARSEMEM_STATIC is not set 154# CONFIG_SPARSEMEM_STATIC is not set
155# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
151CONFIG_SPLIT_PTLOCK_CPUS=4 156CONFIG_SPLIT_PTLOCK_CPUS=4
152# CONFIG_RESOURCES_64BIT is not set 157# CONFIG_RESOURCES_64BIT is not set
153CONFIG_ZONE_DMA_FLAG=0 158CONFIG_ZONE_DMA_FLAG=0
@@ -160,10 +165,6 @@ CONFIG_PCI=y
160CONFIG_SH_PCIDMA_NONCOHERENT=y 165CONFIG_SH_PCIDMA_NONCOHERENT=y
161# CONFIG_ARCH_SUPPORTS_MSI is not set 166# CONFIG_ARCH_SUPPORTS_MSI is not set
162# CONFIG_PCI_DEBUG is not set 167# CONFIG_PCI_DEBUG is not set
163
164#
165# PCCARD (PCMCIA/CardBus) support
166#
167# CONFIG_PCCARD is not set 168# CONFIG_PCCARD is not set
168# CONFIG_HOTPLUG_PCI is not set 169# CONFIG_HOTPLUG_PCI is not set
169 170
@@ -209,6 +210,7 @@ CONFIG_IP_PNP=y
209CONFIG_INET_XFRM_MODE_TRANSPORT=y 210CONFIG_INET_XFRM_MODE_TRANSPORT=y
210CONFIG_INET_XFRM_MODE_TUNNEL=y 211CONFIG_INET_XFRM_MODE_TUNNEL=y
211CONFIG_INET_XFRM_MODE_BEET=y 212CONFIG_INET_XFRM_MODE_BEET=y
213# CONFIG_INET_LRO is not set
212CONFIG_INET_DIAG=y 214CONFIG_INET_DIAG=y
213CONFIG_INET_TCP_DIAG=y 215CONFIG_INET_TCP_DIAG=y
214# CONFIG_TCP_CONG_ADVANCED is not set 216# CONFIG_TCP_CONG_ADVANCED is not set
@@ -234,10 +236,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
234# CONFIG_LAPB is not set 236# CONFIG_LAPB is not set
235# CONFIG_ECONET is not set 237# CONFIG_ECONET is not set
236# CONFIG_WAN_ROUTER is not set 238# CONFIG_WAN_ROUTER is not set
237
238#
239# QoS and/or fair queueing
240#
241# CONFIG_NET_SCHED is not set 239# CONFIG_NET_SCHED is not set
242 240
243# 241#
@@ -266,6 +264,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
266# 264#
267# Generic Driver Options 265# Generic Driver Options
268# 266#
267CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
269CONFIG_STANDALONE=y 268CONFIG_STANDALONE=y
270CONFIG_PREVENT_FIRMWARE_BUILD=y 269CONFIG_PREVENT_FIRMWARE_BUILD=y
271# CONFIG_FW_LOADER is not set 270# CONFIG_FW_LOADER is not set
@@ -333,6 +332,7 @@ CONFIG_SCSI_SPI_ATTRS=y
333# CONFIG_SCSI_FC_ATTRS is not set 332# CONFIG_SCSI_FC_ATTRS is not set
334# CONFIG_SCSI_ISCSI_ATTRS is not set 333# CONFIG_SCSI_ISCSI_ATTRS is not set
335# CONFIG_SCSI_SAS_LIBSAS is not set 334# CONFIG_SCSI_SAS_LIBSAS is not set
335# CONFIG_SCSI_SRP_ATTRS is not set
336CONFIG_SCSI_LOWLEVEL=y 336CONFIG_SCSI_LOWLEVEL=y
337# CONFIG_ISCSI_TCP is not set 337# CONFIG_ISCSI_TCP is not set
338# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 338# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -370,14 +370,7 @@ CONFIG_SCSI_SYM53C8XX_MMIO=y
370# CONFIG_SCSI_SRP is not set 370# CONFIG_SCSI_SRP is not set
371# CONFIG_ATA is not set 371# CONFIG_ATA is not set
372# CONFIG_MD is not set 372# CONFIG_MD is not set
373
374#
375# Fusion MPT device support
376#
377# CONFIG_FUSION is not set 373# CONFIG_FUSION is not set
378# CONFIG_FUSION_SPI is not set
379# CONFIG_FUSION_FC is not set
380# CONFIG_FUSION_SAS is not set
381 374
382# 375#
383# IEEE 1394 (FireWire) support 376# IEEE 1394 (FireWire) support
@@ -392,6 +385,8 @@ CONFIG_NETDEVICES=y
392# CONFIG_MACVLAN is not set 385# CONFIG_MACVLAN is not set
393# CONFIG_EQUALIZER is not set 386# CONFIG_EQUALIZER is not set
394# CONFIG_TUN is not set 387# CONFIG_TUN is not set
388# CONFIG_VETH is not set
389# CONFIG_IP1000 is not set
395# CONFIG_ARCNET is not set 390# CONFIG_ARCNET is not set
396# CONFIG_PHYLIB is not set 391# CONFIG_PHYLIB is not set
397CONFIG_NET_ETHERNET=y 392CONFIG_NET_ETHERNET=y
@@ -402,6 +397,7 @@ CONFIG_NET_ETHERNET=y
402# CONFIG_CASSINI is not set 397# CONFIG_CASSINI is not set
403# CONFIG_NET_VENDOR_3COM is not set 398# CONFIG_NET_VENDOR_3COM is not set
404# CONFIG_SMC91X is not set 399# CONFIG_SMC91X is not set
400# CONFIG_SMC911X is not set
405CONFIG_NET_TULIP=y 401CONFIG_NET_TULIP=y
406# CONFIG_DE2104X is not set 402# CONFIG_DE2104X is not set
407CONFIG_TULIP=y 403CONFIG_TULIP=y
@@ -413,13 +409,16 @@ CONFIG_TULIP=y
413# CONFIG_DM9102 is not set 409# CONFIG_DM9102 is not set
414# CONFIG_ULI526X is not set 410# CONFIG_ULI526X is not set
415# CONFIG_HP100 is not set 411# CONFIG_HP100 is not set
412# CONFIG_IBM_NEW_EMAC_ZMII is not set
413# CONFIG_IBM_NEW_EMAC_RGMII is not set
414# CONFIG_IBM_NEW_EMAC_TAH is not set
415# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
416CONFIG_NET_PCI=y 416CONFIG_NET_PCI=y
417# CONFIG_PCNET32 is not set 417# CONFIG_PCNET32 is not set
418# CONFIG_AMD8111_ETH is not set 418# CONFIG_AMD8111_ETH is not set
419# CONFIG_ADAPTEC_STARFIRE is not set 419# CONFIG_ADAPTEC_STARFIRE is not set
420# CONFIG_B44 is not set 420# CONFIG_B44 is not set
421# CONFIG_FORCEDETH is not set 421# CONFIG_FORCEDETH is not set
422# CONFIG_DGRS is not set
423# CONFIG_EEPRO100 is not set 422# CONFIG_EEPRO100 is not set
424# CONFIG_E100 is not set 423# CONFIG_E100 is not set
425# CONFIG_FEALNX is not set 424# CONFIG_FEALNX is not set
@@ -437,6 +436,7 @@ CONFIG_NETDEV_1000=y
437# CONFIG_ACENIC is not set 436# CONFIG_ACENIC is not set
438# CONFIG_DL2K is not set 437# CONFIG_DL2K is not set
439# CONFIG_E1000 is not set 438# CONFIG_E1000 is not set
439# CONFIG_E1000E is not set
440# CONFIG_NS83820 is not set 440# CONFIG_NS83820 is not set
441# CONFIG_HAMACHI is not set 441# CONFIG_HAMACHI is not set
442# CONFIG_YELLOWFIN is not set 442# CONFIG_YELLOWFIN is not set
@@ -453,11 +453,14 @@ CONFIG_NETDEV_1000=y
453CONFIG_NETDEV_10000=y 453CONFIG_NETDEV_10000=y
454# CONFIG_CHELSIO_T1 is not set 454# CONFIG_CHELSIO_T1 is not set
455# CONFIG_CHELSIO_T3 is not set 455# CONFIG_CHELSIO_T3 is not set
456# CONFIG_IXGBE is not set
456# CONFIG_IXGB is not set 457# CONFIG_IXGB is not set
457# CONFIG_S2IO is not set 458# CONFIG_S2IO is not set
458# CONFIG_MYRI10GE is not set 459# CONFIG_MYRI10GE is not set
459# CONFIG_NETXEN_NIC is not set 460# CONFIG_NETXEN_NIC is not set
461# CONFIG_NIU is not set
460# CONFIG_MLX4_CORE is not set 462# CONFIG_MLX4_CORE is not set
463# CONFIG_TEHUTI is not set
461# CONFIG_TR is not set 464# CONFIG_TR is not set
462 465
463# 466#
@@ -493,7 +496,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
493CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 496CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
494CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 497CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
495# CONFIG_INPUT_JOYDEV is not set 498# CONFIG_INPUT_JOYDEV is not set
496# CONFIG_INPUT_TSDEV is not set
497# CONFIG_INPUT_EVDEV is not set 499# CONFIG_INPUT_EVDEV is not set
498# CONFIG_INPUT_EVBUG is not set 500# CONFIG_INPUT_EVBUG is not set
499 501
@@ -561,23 +563,9 @@ CONFIG_UNIX98_PTYS=y
561CONFIG_LEGACY_PTYS=y 563CONFIG_LEGACY_PTYS=y
562CONFIG_LEGACY_PTY_COUNT=256 564CONFIG_LEGACY_PTY_COUNT=256
563# CONFIG_IPMI_HANDLER is not set 565# CONFIG_IPMI_HANDLER is not set
564CONFIG_WATCHDOG=y
565# CONFIG_WATCHDOG_NOWAYOUT is not set
566
567#
568# Watchdog Device Drivers
569#
570# CONFIG_SOFT_WATCHDOG is not set
571
572#
573# PCI-based Watchdog Cards
574#
575# CONFIG_PCIPCWATCHDOG is not set
576# CONFIG_WDTPCI is not set
577CONFIG_HW_RANDOM=y 566CONFIG_HW_RANDOM=y
578# CONFIG_R3964 is not set 567# CONFIG_R3964 is not set
579# CONFIG_APPLICOM is not set 568# CONFIG_APPLICOM is not set
580# CONFIG_DRM is not set
581# CONFIG_RAW_DRIVER is not set 569# CONFIG_RAW_DRIVER is not set
582# CONFIG_TCG_TPM is not set 570# CONFIG_TCG_TPM is not set
583CONFIG_DEVPORT=y 571CONFIG_DEVPORT=y
@@ -644,8 +632,6 @@ CONFIG_I2C_BOARDINFO=y
644# CONFIG_POWER_SUPPLY is not set 632# CONFIG_POWER_SUPPLY is not set
645CONFIG_HWMON=y 633CONFIG_HWMON=y
646# CONFIG_HWMON_VID is not set 634# CONFIG_HWMON_VID is not set
647# CONFIG_SENSORS_ABITUGURU is not set
648# CONFIG_SENSORS_ABITUGURU3 is not set
649# CONFIG_SENSORS_AD7418 is not set 635# CONFIG_SENSORS_AD7418 is not set
650# CONFIG_SENSORS_ADM1021 is not set 636# CONFIG_SENSORS_ADM1021 is not set
651# CONFIG_SENSORS_ADM1025 is not set 637# CONFIG_SENSORS_ADM1025 is not set
@@ -653,12 +639,12 @@ CONFIG_HWMON=y
653# CONFIG_SENSORS_ADM1029 is not set 639# CONFIG_SENSORS_ADM1029 is not set
654# CONFIG_SENSORS_ADM1031 is not set 640# CONFIG_SENSORS_ADM1031 is not set
655# CONFIG_SENSORS_ADM9240 is not set 641# CONFIG_SENSORS_ADM9240 is not set
656# CONFIG_SENSORS_ASB100 is not set 642# CONFIG_SENSORS_ADT7470 is not set
657# CONFIG_SENSORS_ATXP1 is not set 643# CONFIG_SENSORS_ATXP1 is not set
658# CONFIG_SENSORS_DS1621 is not set 644# CONFIG_SENSORS_DS1621 is not set
659# CONFIG_SENSORS_F71805F is not set 645# CONFIG_SENSORS_F71805F is not set
660# CONFIG_SENSORS_FSCHER is not set 646# CONFIG_SENSORS_F71882FG is not set
661# CONFIG_SENSORS_FSCPOS is not set 647# CONFIG_SENSORS_F75375S is not set
662# CONFIG_SENSORS_GL518SM is not set 648# CONFIG_SENSORS_GL518SM is not set
663# CONFIG_SENSORS_GL520SM is not set 649# CONFIG_SENSORS_GL520SM is not set
664# CONFIG_SENSORS_IT87 is not set 650# CONFIG_SENSORS_IT87 is not set
@@ -694,6 +680,25 @@ CONFIG_HWMON=y
694# CONFIG_SENSORS_W83627HF is not set 680# CONFIG_SENSORS_W83627HF is not set
695# CONFIG_SENSORS_W83627EHF is not set 681# CONFIG_SENSORS_W83627EHF is not set
696# CONFIG_HWMON_DEBUG_CHIP is not set 682# CONFIG_HWMON_DEBUG_CHIP is not set
683CONFIG_WATCHDOG=y
684# CONFIG_WATCHDOG_NOWAYOUT is not set
685
686#
687# Watchdog Device Drivers
688#
689# CONFIG_SOFT_WATCHDOG is not set
690
691#
692# PCI-based Watchdog Cards
693#
694# CONFIG_PCIPCWATCHDOG is not set
695# CONFIG_WDTPCI is not set
696
697#
698# Sonics Silicon Backplane
699#
700CONFIG_SSB_POSSIBLE=y
701# CONFIG_SSB is not set
697 702
698# 703#
699# Multifunction device drivers 704# Multifunction device drivers
@@ -713,11 +718,11 @@ CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
713# CONFIG_VIDEO_VIVI is not set 718# CONFIG_VIDEO_VIVI is not set
714# CONFIG_VIDEO_SAA5246A is not set 719# CONFIG_VIDEO_SAA5246A is not set
715# CONFIG_VIDEO_SAA5249 is not set 720# CONFIG_VIDEO_SAA5249 is not set
716# CONFIG_TUNER_TEA5761 is not set
717# CONFIG_VIDEO_SAA7134 is not set 721# CONFIG_VIDEO_SAA7134 is not set
718# CONFIG_VIDEO_HEXIUM_ORION is not set 722# CONFIG_VIDEO_HEXIUM_ORION is not set
719# CONFIG_VIDEO_HEXIUM_GEMINI is not set 723# CONFIG_VIDEO_HEXIUM_GEMINI is not set
720# CONFIG_VIDEO_CX88 is not set 724# CONFIG_VIDEO_CX88 is not set
725# CONFIG_VIDEO_CX23885 is not set
721# CONFIG_VIDEO_CAFE_CCIC is not set 726# CONFIG_VIDEO_CAFE_CCIC is not set
722# CONFIG_RADIO_ADAPTERS is not set 727# CONFIG_RADIO_ADAPTERS is not set
723CONFIG_DVB_CORE=y 728CONFIG_DVB_CORE=y
@@ -796,6 +801,7 @@ CONFIG_DVB_CAPTURE_DRIVERS=y
796# CONFIG_DVB_OR51132 is not set 801# CONFIG_DVB_OR51132 is not set
797# CONFIG_DVB_BCM3510 is not set 802# CONFIG_DVB_BCM3510 is not set
798# CONFIG_DVB_LGDT330X is not set 803# CONFIG_DVB_LGDT330X is not set
804# CONFIG_DVB_S5H1409 is not set
799 805
800# 806#
801# Tuners/PLL support 807# Tuners/PLL support
@@ -805,6 +811,9 @@ CONFIG_DVB_CAPTURE_DRIVERS=y
805# CONFIG_DVB_TDA827X is not set 811# CONFIG_DVB_TDA827X is not set
806# CONFIG_DVB_TUNER_QT1010 is not set 812# CONFIG_DVB_TUNER_QT1010 is not set
807# CONFIG_DVB_TUNER_MT2060 is not set 813# CONFIG_DVB_TUNER_MT2060 is not set
814# CONFIG_DVB_TUNER_MT2266 is not set
815# CONFIG_DVB_TUNER_MT2131 is not set
816# CONFIG_DVB_TUNER_DIB0070 is not set
808 817
809# 818#
810# Miscellaneous devices 819# Miscellaneous devices
@@ -817,12 +826,7 @@ CONFIG_DAB=y
817# 826#
818# Graphics support 827# Graphics support
819# 828#
820# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 829# CONFIG_DRM is not set
821
822#
823# Display device support
824#
825# CONFIG_DISPLAY_SUPPORT is not set
826# CONFIG_VGASTATE is not set 830# CONFIG_VGASTATE is not set
827CONFIG_VIDEO_OUTPUT_CONTROL=y 831CONFIG_VIDEO_OUTPUT_CONTROL=y
828CONFIG_FB=y 832CONFIG_FB=y
@@ -831,6 +835,7 @@ CONFIG_FIRMWARE_EDID=y
831CONFIG_FB_CFB_FILLRECT=y 835CONFIG_FB_CFB_FILLRECT=y
832CONFIG_FB_CFB_COPYAREA=y 836CONFIG_FB_CFB_COPYAREA=y
833CONFIG_FB_CFB_IMAGEBLIT=y 837CONFIG_FB_CFB_IMAGEBLIT=y
838# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
834# CONFIG_FB_SYS_FILLRECT is not set 839# CONFIG_FB_SYS_FILLRECT is not set
835# CONFIG_FB_SYS_COPYAREA is not set 840# CONFIG_FB_SYS_COPYAREA is not set
836# CONFIG_FB_SYS_IMAGEBLIT is not set 841# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -869,6 +874,12 @@ CONFIG_FB_KYRO=y
869# CONFIG_FB_ARK is not set 874# CONFIG_FB_ARK is not set
870# CONFIG_FB_PM3 is not set 875# CONFIG_FB_PM3 is not set
871# CONFIG_FB_VIRTUAL is not set 876# CONFIG_FB_VIRTUAL is not set
877# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
878
879#
880# Display device support
881#
882# CONFIG_DISPLAY_SUPPORT is not set
872 883
873# 884#
874# Console display driver support 885# Console display driver support
@@ -903,6 +914,7 @@ CONFIG_LOGO_SUPERH_CLUT224=y
903CONFIG_HID_SUPPORT=y 914CONFIG_HID_SUPPORT=y
904CONFIG_HID=y 915CONFIG_HID=y
905# CONFIG_HID_DEBUG is not set 916# CONFIG_HID_DEBUG is not set
917# CONFIG_HIDRAW is not set
906CONFIG_USB_SUPPORT=y 918CONFIG_USB_SUPPORT=y
907CONFIG_USB_ARCH_HAS_HCD=y 919CONFIG_USB_ARCH_HAS_HCD=y
908CONFIG_USB_ARCH_HAS_OHCI=y 920CONFIG_USB_ARCH_HAS_OHCI=y
@@ -923,19 +935,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
923# CONFIG_RTC_CLASS is not set 935# CONFIG_RTC_CLASS is not set
924 936
925# 937#
926# DMA Engine support
927#
928# CONFIG_DMA_ENGINE is not set
929
930#
931# DMA Clients
932#
933
934#
935# DMA Devices
936#
937
938#
939# Userspace I/O 938# Userspace I/O
940# 939#
941# CONFIG_UIO is not set 940# CONFIG_UIO is not set
@@ -994,7 +993,6 @@ CONFIG_TMPFS=y
994# CONFIG_TMPFS_POSIX_ACL is not set 993# CONFIG_TMPFS_POSIX_ACL is not set
995CONFIG_HUGETLBFS=y 994CONFIG_HUGETLBFS=y
996CONFIG_HUGETLB_PAGE=y 995CONFIG_HUGETLB_PAGE=y
997CONFIG_RAMFS=y
998# CONFIG_CONFIGFS_FS is not set 996# CONFIG_CONFIGFS_FS is not set
999 997
1000# 998#
@@ -1013,10 +1011,7 @@ CONFIG_RAMFS=y
1013# CONFIG_QNX4FS_FS is not set 1011# CONFIG_QNX4FS_FS is not set
1014# CONFIG_SYSV_FS is not set 1012# CONFIG_SYSV_FS is not set
1015# CONFIG_UFS_FS is not set 1013# CONFIG_UFS_FS is not set
1016 1014CONFIG_NETWORK_FILESYSTEMS=y
1017#
1018# Network File Systems
1019#
1020CONFIG_NFS_FS=y 1015CONFIG_NFS_FS=y
1021CONFIG_NFS_V3=y 1016CONFIG_NFS_V3=y
1022# CONFIG_NFS_V3_ACL is not set 1017# CONFIG_NFS_V3_ACL is not set
@@ -1058,26 +1053,17 @@ CONFIG_MSDOS_PARTITION=y
1058# CONFIG_KARMA_PARTITION is not set 1053# CONFIG_KARMA_PARTITION is not set
1059# CONFIG_EFI_PARTITION is not set 1054# CONFIG_EFI_PARTITION is not set
1060# CONFIG_SYSV68_PARTITION is not set 1055# CONFIG_SYSV68_PARTITION is not set
1061
1062#
1063# Native Language Support
1064#
1065# CONFIG_NLS is not set 1056# CONFIG_NLS is not set
1066
1067#
1068# Distributed Lock Manager
1069#
1070# CONFIG_DLM is not set 1057# CONFIG_DLM is not set
1071 1058CONFIG_INSTRUMENTATION=y
1072#
1073# Profiling support
1074#
1075# CONFIG_PROFILING is not set 1059# CONFIG_PROFILING is not set
1060# CONFIG_MARKERS is not set
1076 1061
1077# 1062#
1078# Kernel hacking 1063# Kernel hacking
1079# 1064#
1080# CONFIG_PRINTK_TIME is not set 1065# CONFIG_PRINTK_TIME is not set
1066CONFIG_ENABLE_WARN_DEPRECATED=y
1081CONFIG_ENABLE_MUST_CHECK=y 1067CONFIG_ENABLE_MUST_CHECK=y
1082CONFIG_MAGIC_SYSRQ=y 1068CONFIG_MAGIC_SYSRQ=y
1083# CONFIG_UNUSED_SYMBOLS is not set 1069# CONFIG_UNUSED_SYMBOLS is not set
@@ -1101,10 +1087,13 @@ CONFIG_DEBUG_BUGVERBOSE=y
1101# CONFIG_DEBUG_INFO is not set 1087# CONFIG_DEBUG_INFO is not set
1102# CONFIG_DEBUG_VM is not set 1088# CONFIG_DEBUG_VM is not set
1103# CONFIG_DEBUG_LIST is not set 1089# CONFIG_DEBUG_LIST is not set
1090# CONFIG_DEBUG_SG is not set
1104CONFIG_FRAME_POINTER=y 1091CONFIG_FRAME_POINTER=y
1105CONFIG_FORCED_INLINING=y 1092CONFIG_FORCED_INLINING=y
1093# CONFIG_BOOT_PRINTK_DELAY is not set
1106# CONFIG_RCU_TORTURE_TEST is not set 1094# CONFIG_RCU_TORTURE_TEST is not set
1107# CONFIG_FAULT_INJECTION is not set 1095# CONFIG_FAULT_INJECTION is not set
1096# CONFIG_SAMPLES is not set
1108# CONFIG_EARLY_PRINTK is not set 1097# CONFIG_EARLY_PRINTK is not set
1109CONFIG_SH64_PROC_TLB=y 1098CONFIG_SH64_PROC_TLB=y
1110CONFIG_SH64_PROC_ASIDS=y 1099CONFIG_SH64_PROC_ASIDS=y
@@ -1118,6 +1107,7 @@ CONFIG_SH64_SR_WATCH=y
1118# 1107#
1119# CONFIG_KEYS is not set 1108# CONFIG_KEYS is not set
1120# CONFIG_SECURITY is not set 1109# CONFIG_SECURITY is not set
1110# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1121# CONFIG_CRYPTO is not set 1111# CONFIG_CRYPTO is not set
1122 1112
1123# 1113#
diff --git a/arch/sh64/configs/harp_defconfig b/arch/sh64/configs/harp_defconfig
index e4b84b51baf8..ba302cd0c285 100644
--- a/arch/sh64/configs/harp_defconfig
+++ b/arch/sh64/configs/harp_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc8 3# Linux kernel version: 2.6.24-rc1
4# Mon Oct 1 18:01:38 2007 4# Fri Nov 2 14:35:57 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH64=y 7CONFIG_SUPERH64=y
@@ -36,6 +36,10 @@ CONFIG_POSIX_MQUEUE=y
36# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
37# CONFIG_IKCONFIG is not set 37# CONFIG_IKCONFIG is not set
38CONFIG_LOG_BUF_SHIFT=14 38CONFIG_LOG_BUF_SHIFT=14
39# CONFIG_CGROUPS is not set
40CONFIG_FAIR_GROUP_SCHED=y
41CONFIG_FAIR_USER_SCHED=y
42# CONFIG_FAIR_CGROUP_SCHED is not set
39CONFIG_SYSFS_DEPRECATED=y 43CONFIG_SYSFS_DEPRECATED=y
40# CONFIG_RELAY is not set 44# CONFIG_RELAY is not set
41# CONFIG_BLK_DEV_INITRD is not set 45# CONFIG_BLK_DEV_INITRD is not set
@@ -141,6 +145,7 @@ CONFIG_FLATMEM_MANUAL=y
141CONFIG_FLATMEM=y 145CONFIG_FLATMEM=y
142CONFIG_FLAT_NODE_MEM_MAP=y 146CONFIG_FLAT_NODE_MEM_MAP=y
143# CONFIG_SPARSEMEM_STATIC is not set 147# CONFIG_SPARSEMEM_STATIC is not set
148# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
144CONFIG_SPLIT_PTLOCK_CPUS=4 149CONFIG_SPLIT_PTLOCK_CPUS=4
145# CONFIG_RESOURCES_64BIT is not set 150# CONFIG_RESOURCES_64BIT is not set
146CONFIG_ZONE_DMA_FLAG=0 151CONFIG_ZONE_DMA_FLAG=0
@@ -150,10 +155,6 @@ CONFIG_NR_QUICK=1
150# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 155# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
151# 156#
152# CONFIG_ARCH_SUPPORTS_MSI is not set 157# CONFIG_ARCH_SUPPORTS_MSI is not set
153
154#
155# PCCARD (PCMCIA/CardBus) support
156#
157# CONFIG_PCCARD is not set 158# CONFIG_PCCARD is not set
158 159
159# 160#
@@ -198,6 +199,7 @@ CONFIG_IP_PNP=y
198CONFIG_INET_XFRM_MODE_TRANSPORT=y 199CONFIG_INET_XFRM_MODE_TRANSPORT=y
199CONFIG_INET_XFRM_MODE_TUNNEL=y 200CONFIG_INET_XFRM_MODE_TUNNEL=y
200CONFIG_INET_XFRM_MODE_BEET=y 201CONFIG_INET_XFRM_MODE_BEET=y
202# CONFIG_INET_LRO is not set
201CONFIG_INET_DIAG=y 203CONFIG_INET_DIAG=y
202CONFIG_INET_TCP_DIAG=y 204CONFIG_INET_TCP_DIAG=y
203# CONFIG_TCP_CONG_ADVANCED is not set 205# CONFIG_TCP_CONG_ADVANCED is not set
@@ -223,10 +225,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
223# CONFIG_LAPB is not set 225# CONFIG_LAPB is not set
224# CONFIG_ECONET is not set 226# CONFIG_ECONET is not set
225# CONFIG_WAN_ROUTER is not set 227# CONFIG_WAN_ROUTER is not set
226
227#
228# QoS and/or fair queueing
229#
230# CONFIG_NET_SCHED is not set 228# CONFIG_NET_SCHED is not set
231 229
232# 230#
@@ -255,6 +253,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
255# 253#
256# Generic Driver Options 254# Generic Driver Options
257# 255#
256CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
258CONFIG_STANDALONE=y 257CONFIG_STANDALONE=y
259CONFIG_PREVENT_FIRMWARE_BUILD=y 258CONFIG_PREVENT_FIRMWARE_BUILD=y
260# CONFIG_FW_LOADER is not set 259# CONFIG_FW_LOADER is not set
@@ -314,6 +313,7 @@ CONFIG_SCSI_SPI_ATTRS=y
314# CONFIG_SCSI_FC_ATTRS is not set 313# CONFIG_SCSI_FC_ATTRS is not set
315# CONFIG_SCSI_ISCSI_ATTRS is not set 314# CONFIG_SCSI_ISCSI_ATTRS is not set
316# CONFIG_SCSI_SAS_LIBSAS is not set 315# CONFIG_SCSI_SAS_LIBSAS is not set
316# CONFIG_SCSI_SRP_ATTRS is not set
317CONFIG_SCSI_LOWLEVEL=y 317CONFIG_SCSI_LOWLEVEL=y
318# CONFIG_ISCSI_TCP is not set 318# CONFIG_ISCSI_TCP is not set
319# CONFIG_SCSI_DEBUG is not set 319# CONFIG_SCSI_DEBUG is not set
@@ -326,11 +326,18 @@ CONFIG_NETDEVICES=y
326# CONFIG_MACVLAN is not set 326# CONFIG_MACVLAN is not set
327# CONFIG_EQUALIZER is not set 327# CONFIG_EQUALIZER is not set
328# CONFIG_TUN is not set 328# CONFIG_TUN is not set
329# CONFIG_VETH is not set
329# CONFIG_PHYLIB is not set 330# CONFIG_PHYLIB is not set
330CONFIG_NET_ETHERNET=y 331CONFIG_NET_ETHERNET=y
331# CONFIG_MII is not set 332# CONFIG_MII is not set
332# CONFIG_STNIC is not set 333# CONFIG_STNIC is not set
333# CONFIG_SMC91X is not set 334# CONFIG_SMC91X is not set
335# CONFIG_SMC911X is not set
336# CONFIG_IBM_NEW_EMAC_ZMII is not set
337# CONFIG_IBM_NEW_EMAC_RGMII is not set
338# CONFIG_IBM_NEW_EMAC_TAH is not set
339# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
340# CONFIG_B44 is not set
334CONFIG_NETDEV_1000=y 341CONFIG_NETDEV_1000=y
335CONFIG_NETDEV_10000=y 342CONFIG_NETDEV_10000=y
336 343
@@ -364,7 +371,6 @@ CONFIG_INPUT_MOUSEDEV=y
364CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 371CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
365CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 372CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
366# CONFIG_INPUT_JOYDEV is not set 373# CONFIG_INPUT_JOYDEV is not set
367# CONFIG_INPUT_TSDEV is not set
368# CONFIG_INPUT_EVDEV is not set 374# CONFIG_INPUT_EVDEV is not set
369# CONFIG_INPUT_EVBUG is not set 375# CONFIG_INPUT_EVBUG is not set
370 376
@@ -410,13 +416,6 @@ CONFIG_UNIX98_PTYS=y
410CONFIG_LEGACY_PTYS=y 416CONFIG_LEGACY_PTYS=y
411CONFIG_LEGACY_PTY_COUNT=256 417CONFIG_LEGACY_PTY_COUNT=256
412# CONFIG_IPMI_HANDLER is not set 418# CONFIG_IPMI_HANDLER is not set
413CONFIG_WATCHDOG=y
414# CONFIG_WATCHDOG_NOWAYOUT is not set
415
416#
417# Watchdog Device Drivers
418#
419# CONFIG_SOFT_WATCHDOG is not set
420CONFIG_HW_RANDOM=y 419CONFIG_HW_RANDOM=y
421# CONFIG_R3964 is not set 420# CONFIG_R3964 is not set
422# CONFIG_RAW_DRIVER is not set 421# CONFIG_RAW_DRIVER is not set
@@ -432,9 +431,8 @@ CONFIG_HW_RANDOM=y
432# CONFIG_POWER_SUPPLY is not set 431# CONFIG_POWER_SUPPLY is not set
433CONFIG_HWMON=y 432CONFIG_HWMON=y
434# CONFIG_HWMON_VID is not set 433# CONFIG_HWMON_VID is not set
435# CONFIG_SENSORS_ABITUGURU is not set
436# CONFIG_SENSORS_ABITUGURU3 is not set
437# CONFIG_SENSORS_F71805F is not set 434# CONFIG_SENSORS_F71805F is not set
435# CONFIG_SENSORS_F71882FG is not set
438# CONFIG_SENSORS_IT87 is not set 436# CONFIG_SENSORS_IT87 is not set
439# CONFIG_SENSORS_PC87360 is not set 437# CONFIG_SENSORS_PC87360 is not set
440# CONFIG_SENSORS_PC87427 is not set 438# CONFIG_SENSORS_PC87427 is not set
@@ -444,6 +442,19 @@ CONFIG_HWMON=y
444# CONFIG_SENSORS_W83627HF is not set 442# CONFIG_SENSORS_W83627HF is not set
445# CONFIG_SENSORS_W83627EHF is not set 443# CONFIG_SENSORS_W83627EHF is not set
446# CONFIG_HWMON_DEBUG_CHIP is not set 444# CONFIG_HWMON_DEBUG_CHIP is not set
445CONFIG_WATCHDOG=y
446# CONFIG_WATCHDOG_NOWAYOUT is not set
447
448#
449# Watchdog Device Drivers
450#
451# CONFIG_SOFT_WATCHDOG is not set
452
453#
454# Sonics Silicon Backplane
455#
456CONFIG_SSB_POSSIBLE=y
457# CONFIG_SSB is not set
447 458
448# 459#
449# Multifunction device drivers 460# Multifunction device drivers
@@ -460,12 +471,6 @@ CONFIG_DAB=y
460# 471#
461# Graphics support 472# Graphics support
462# 473#
463# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
464
465#
466# Display device support
467#
468# CONFIG_DISPLAY_SUPPORT is not set
469# CONFIG_VGASTATE is not set 474# CONFIG_VGASTATE is not set
470CONFIG_VIDEO_OUTPUT_CONTROL=y 475CONFIG_VIDEO_OUTPUT_CONTROL=y
471CONFIG_FB=y 476CONFIG_FB=y
@@ -474,6 +479,7 @@ CONFIG_FIRMWARE_EDID=y
474# CONFIG_FB_CFB_FILLRECT is not set 479# CONFIG_FB_CFB_FILLRECT is not set
475# CONFIG_FB_CFB_COPYAREA is not set 480# CONFIG_FB_CFB_COPYAREA is not set
476# CONFIG_FB_CFB_IMAGEBLIT is not set 481# CONFIG_FB_CFB_IMAGEBLIT is not set
482# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
477# CONFIG_FB_SYS_FILLRECT is not set 483# CONFIG_FB_SYS_FILLRECT is not set
478# CONFIG_FB_SYS_COPYAREA is not set 484# CONFIG_FB_SYS_COPYAREA is not set
479# CONFIG_FB_SYS_IMAGEBLIT is not set 485# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -490,6 +496,12 @@ CONFIG_FB_MODE_HELPERS=y
490# 496#
491# CONFIG_FB_S1D13XXX is not set 497# CONFIG_FB_S1D13XXX is not set
492# CONFIG_FB_VIRTUAL is not set 498# CONFIG_FB_VIRTUAL is not set
499# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
500
501#
502# Display device support
503#
504# CONFIG_DISPLAY_SUPPORT is not set
493 505
494# 506#
495# Console display driver support 507# Console display driver support
@@ -524,6 +536,7 @@ CONFIG_LOGO_SUPERH_CLUT224=y
524CONFIG_HID_SUPPORT=y 536CONFIG_HID_SUPPORT=y
525CONFIG_HID=y 537CONFIG_HID=y
526# CONFIG_HID_DEBUG is not set 538# CONFIG_HID_DEBUG is not set
539# CONFIG_HIDRAW is not set
527CONFIG_USB_SUPPORT=y 540CONFIG_USB_SUPPORT=y
528CONFIG_USB_ARCH_HAS_HCD=y 541CONFIG_USB_ARCH_HAS_HCD=y
529# CONFIG_USB_ARCH_HAS_OHCI is not set 542# CONFIG_USB_ARCH_HAS_OHCI is not set
@@ -543,19 +556,6 @@ CONFIG_USB_ARCH_HAS_HCD=y
543# CONFIG_RTC_CLASS is not set 556# CONFIG_RTC_CLASS is not set
544 557
545# 558#
546# DMA Engine support
547#
548# CONFIG_DMA_ENGINE is not set
549
550#
551# DMA Clients
552#
553
554#
555# DMA Devices
556#
557
558#
559# Userspace I/O 559# Userspace I/O
560# 560#
561# CONFIG_UIO is not set 561# CONFIG_UIO is not set
@@ -614,7 +614,6 @@ CONFIG_TMPFS=y
614# CONFIG_TMPFS_POSIX_ACL is not set 614# CONFIG_TMPFS_POSIX_ACL is not set
615CONFIG_HUGETLBFS=y 615CONFIG_HUGETLBFS=y
616CONFIG_HUGETLB_PAGE=y 616CONFIG_HUGETLB_PAGE=y
617CONFIG_RAMFS=y
618# CONFIG_CONFIGFS_FS is not set 617# CONFIG_CONFIGFS_FS is not set
619 618
620# 619#
@@ -633,10 +632,7 @@ CONFIG_RAMFS=y
633# CONFIG_QNX4FS_FS is not set 632# CONFIG_QNX4FS_FS is not set
634# CONFIG_SYSV_FS is not set 633# CONFIG_SYSV_FS is not set
635# CONFIG_UFS_FS is not set 634# CONFIG_UFS_FS is not set
636 635CONFIG_NETWORK_FILESYSTEMS=y
637#
638# Network File Systems
639#
640CONFIG_NFS_FS=y 636CONFIG_NFS_FS=y
641CONFIG_NFS_V3=y 637CONFIG_NFS_V3=y
642# CONFIG_NFS_V3_ACL is not set 638# CONFIG_NFS_V3_ACL is not set
@@ -678,26 +674,17 @@ CONFIG_MSDOS_PARTITION=y
678# CONFIG_KARMA_PARTITION is not set 674# CONFIG_KARMA_PARTITION is not set
679# CONFIG_EFI_PARTITION is not set 675# CONFIG_EFI_PARTITION is not set
680# CONFIG_SYSV68_PARTITION is not set 676# CONFIG_SYSV68_PARTITION is not set
681
682#
683# Native Language Support
684#
685# CONFIG_NLS is not set 677# CONFIG_NLS is not set
686
687#
688# Distributed Lock Manager
689#
690# CONFIG_DLM is not set 678# CONFIG_DLM is not set
691 679CONFIG_INSTRUMENTATION=y
692#
693# Profiling support
694#
695# CONFIG_PROFILING is not set 680# CONFIG_PROFILING is not set
681# CONFIG_MARKERS is not set
696 682
697# 683#
698# Kernel hacking 684# Kernel hacking
699# 685#
700# CONFIG_PRINTK_TIME is not set 686# CONFIG_PRINTK_TIME is not set
687CONFIG_ENABLE_WARN_DEPRECATED=y
701CONFIG_ENABLE_MUST_CHECK=y 688CONFIG_ENABLE_MUST_CHECK=y
702CONFIG_MAGIC_SYSRQ=y 689CONFIG_MAGIC_SYSRQ=y
703# CONFIG_UNUSED_SYMBOLS is not set 690# CONFIG_UNUSED_SYMBOLS is not set
@@ -721,16 +708,17 @@ CONFIG_DEBUG_BUGVERBOSE=y
721# CONFIG_DEBUG_INFO is not set 708# CONFIG_DEBUG_INFO is not set
722# CONFIG_DEBUG_VM is not set 709# CONFIG_DEBUG_VM is not set
723# CONFIG_DEBUG_LIST is not set 710# CONFIG_DEBUG_LIST is not set
711# CONFIG_DEBUG_SG is not set
724CONFIG_FRAME_POINTER=y 712CONFIG_FRAME_POINTER=y
725CONFIG_FORCED_INLINING=y 713CONFIG_FORCED_INLINING=y
714# CONFIG_BOOT_PRINTK_DELAY is not set
726# CONFIG_FAULT_INJECTION is not set 715# CONFIG_FAULT_INJECTION is not set
716# CONFIG_SAMPLES is not set
727# CONFIG_EARLY_PRINTK is not set 717# CONFIG_EARLY_PRINTK is not set
728# CONFIG_DEBUG_KERNEL_WITH_GDB_STUB is not set
729CONFIG_SH64_PROC_TLB=y 718CONFIG_SH64_PROC_TLB=y
730CONFIG_SH64_PROC_ASIDS=y 719CONFIG_SH64_PROC_ASIDS=y
731CONFIG_SH64_SR_WATCH=y 720CONFIG_SH64_SR_WATCH=y
732# CONFIG_POOR_MANS_STRACE is not set 721# CONFIG_POOR_MANS_STRACE is not set
733# CONFIG_SH_ALPHANUMERIC is not set
734# CONFIG_SH_NO_BSS_INIT is not set 722# CONFIG_SH_NO_BSS_INIT is not set
735 723
736# 724#
@@ -738,6 +726,7 @@ CONFIG_SH64_SR_WATCH=y
738# 726#
739# CONFIG_KEYS is not set 727# CONFIG_KEYS is not set
740# CONFIG_SECURITY is not set 728# CONFIG_SECURITY is not set
729# CONFIG_SECURITY_FILE_CAPABILITIES is not set
741# CONFIG_CRYPTO is not set 730# CONFIG_CRYPTO is not set
742 731
743# 732#
diff --git a/arch/sh64/configs/sim_defconfig b/arch/sh64/configs/sim_defconfig
index f83bae659dc3..18476cc522c3 100644
--- a/arch/sh64/configs/sim_defconfig
+++ b/arch/sh64/configs/sim_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc8 3# Linux kernel version: 2.6.24-rc1
4# Mon Oct 1 17:50:35 2007 4# Fri Nov 2 14:36:08 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH64=y 7CONFIG_SUPERH64=y
@@ -33,6 +33,10 @@ CONFIG_SWAP=y
33# CONFIG_USER_NS is not set 33# CONFIG_USER_NS is not set
34# CONFIG_IKCONFIG is not set 34# CONFIG_IKCONFIG is not set
35CONFIG_LOG_BUF_SHIFT=14 35CONFIG_LOG_BUF_SHIFT=14
36# CONFIG_CGROUPS is not set
37CONFIG_FAIR_GROUP_SCHED=y
38CONFIG_FAIR_USER_SCHED=y
39# CONFIG_FAIR_CGROUP_SCHED is not set
36CONFIG_SYSFS_DEPRECATED=y 40CONFIG_SYSFS_DEPRECATED=y
37# CONFIG_RELAY is not set 41# CONFIG_RELAY is not set
38# CONFIG_BLK_DEV_INITRD is not set 42# CONFIG_BLK_DEV_INITRD is not set
@@ -138,6 +142,7 @@ CONFIG_FLATMEM_MANUAL=y
138CONFIG_FLATMEM=y 142CONFIG_FLATMEM=y
139CONFIG_FLAT_NODE_MEM_MAP=y 143CONFIG_FLAT_NODE_MEM_MAP=y
140# CONFIG_SPARSEMEM_STATIC is not set 144# CONFIG_SPARSEMEM_STATIC is not set
145# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
141CONFIG_SPLIT_PTLOCK_CPUS=4 146CONFIG_SPLIT_PTLOCK_CPUS=4
142# CONFIG_RESOURCES_64BIT is not set 147# CONFIG_RESOURCES_64BIT is not set
143CONFIG_ZONE_DMA_FLAG=0 148CONFIG_ZONE_DMA_FLAG=0
@@ -147,10 +152,6 @@ CONFIG_NR_QUICK=1
147# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 152# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
148# 153#
149# CONFIG_ARCH_SUPPORTS_MSI is not set 154# CONFIG_ARCH_SUPPORTS_MSI is not set
150
151#
152# PCCARD (PCMCIA/CardBus) support
153#
154# CONFIG_PCCARD is not set 155# CONFIG_PCCARD is not set
155 156
156# 157#
@@ -171,6 +172,7 @@ CONFIG_BINFMT_ELF=y
171# 172#
172# Generic Driver Options 173# Generic Driver Options
173# 174#
175CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
174CONFIG_STANDALONE=y 176CONFIG_STANDALONE=y
175CONFIG_PREVENT_FIRMWARE_BUILD=y 177CONFIG_PREVENT_FIRMWARE_BUILD=y
176# CONFIG_FW_LOADER is not set 178# CONFIG_FW_LOADER is not set
@@ -217,6 +219,7 @@ CONFIG_SCSI_MULTI_LUN=y
217CONFIG_SCSI_SPI_ATTRS=y 219CONFIG_SCSI_SPI_ATTRS=y
218# CONFIG_SCSI_FC_ATTRS is not set 220# CONFIG_SCSI_FC_ATTRS is not set
219# CONFIG_SCSI_SAS_LIBSAS is not set 221# CONFIG_SCSI_SAS_LIBSAS is not set
222# CONFIG_SCSI_SRP_ATTRS is not set
220CONFIG_SCSI_LOWLEVEL=y 223CONFIG_SCSI_LOWLEVEL=y
221# CONFIG_SCSI_DEBUG is not set 224# CONFIG_SCSI_DEBUG is not set
222# CONFIG_ATA is not set 225# CONFIG_ATA is not set
@@ -238,7 +241,6 @@ CONFIG_INPUT_MOUSEDEV=y
238CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 241CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
239CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 242CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
240# CONFIG_INPUT_JOYDEV is not set 243# CONFIG_INPUT_JOYDEV is not set
241# CONFIG_INPUT_TSDEV is not set
242# CONFIG_INPUT_EVDEV is not set 244# CONFIG_INPUT_EVDEV is not set
243# CONFIG_INPUT_EVBUG is not set 245# CONFIG_INPUT_EVBUG is not set
244 246
@@ -283,7 +285,6 @@ CONFIG_SERIAL_CORE_CONSOLE=y
283CONFIG_UNIX98_PTYS=y 285CONFIG_UNIX98_PTYS=y
284# CONFIG_LEGACY_PTYS is not set 286# CONFIG_LEGACY_PTYS is not set
285# CONFIG_IPMI_HANDLER is not set 287# CONFIG_IPMI_HANDLER is not set
286# CONFIG_WATCHDOG is not set
287# CONFIG_HW_RANDOM is not set 288# CONFIG_HW_RANDOM is not set
288# CONFIG_R3964 is not set 289# CONFIG_R3964 is not set
289# CONFIG_RAW_DRIVER is not set 290# CONFIG_RAW_DRIVER is not set
@@ -298,6 +299,13 @@ CONFIG_UNIX98_PTYS=y
298# CONFIG_W1 is not set 299# CONFIG_W1 is not set
299# CONFIG_POWER_SUPPLY is not set 300# CONFIG_POWER_SUPPLY is not set
300# CONFIG_HWMON is not set 301# CONFIG_HWMON is not set
302# CONFIG_WATCHDOG is not set
303
304#
305# Sonics Silicon Backplane
306#
307CONFIG_SSB_POSSIBLE=y
308# CONFIG_SSB is not set
301 309
302# 310#
303# Multifunction device drivers 311# Multifunction device drivers
@@ -313,12 +321,6 @@ CONFIG_DAB=y
313# 321#
314# Graphics support 322# Graphics support
315# 323#
316# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
317
318#
319# Display device support
320#
321# CONFIG_DISPLAY_SUPPORT is not set
322# CONFIG_VGASTATE is not set 324# CONFIG_VGASTATE is not set
323CONFIG_VIDEO_OUTPUT_CONTROL=y 325CONFIG_VIDEO_OUTPUT_CONTROL=y
324CONFIG_FB=y 326CONFIG_FB=y
@@ -327,6 +329,7 @@ CONFIG_FIRMWARE_EDID=y
327# CONFIG_FB_CFB_FILLRECT is not set 329# CONFIG_FB_CFB_FILLRECT is not set
328# CONFIG_FB_CFB_COPYAREA is not set 330# CONFIG_FB_CFB_COPYAREA is not set
329# CONFIG_FB_CFB_IMAGEBLIT is not set 331# CONFIG_FB_CFB_IMAGEBLIT is not set
332# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
330# CONFIG_FB_SYS_FILLRECT is not set 333# CONFIG_FB_SYS_FILLRECT is not set
331# CONFIG_FB_SYS_COPYAREA is not set 334# CONFIG_FB_SYS_COPYAREA is not set
332# CONFIG_FB_SYS_IMAGEBLIT is not set 335# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -343,6 +346,12 @@ CONFIG_FB_MODE_HELPERS=y
343# 346#
344# CONFIG_FB_S1D13XXX is not set 347# CONFIG_FB_S1D13XXX is not set
345# CONFIG_FB_VIRTUAL is not set 348# CONFIG_FB_VIRTUAL is not set
349# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
350
351#
352# Display device support
353#
354# CONFIG_DISPLAY_SUPPORT is not set
346 355
347# 356#
348# Console display driver support 357# Console display driver support
@@ -381,19 +390,6 @@ CONFIG_LOGO_SUPERH_CLUT224=y
381# CONFIG_RTC_CLASS is not set 390# CONFIG_RTC_CLASS is not set
382 391
383# 392#
384# DMA Engine support
385#
386# CONFIG_DMA_ENGINE is not set
387
388#
389# DMA Clients
390#
391
392#
393# DMA Devices
394#
395
396#
397# Userspace I/O 393# Userspace I/O
398# 394#
399# CONFIG_UIO is not set 395# CONFIG_UIO is not set
@@ -451,7 +447,6 @@ CONFIG_TMPFS=y
451# CONFIG_TMPFS_POSIX_ACL is not set 447# CONFIG_TMPFS_POSIX_ACL is not set
452CONFIG_HUGETLBFS=y 448CONFIG_HUGETLBFS=y
453CONFIG_HUGETLB_PAGE=y 449CONFIG_HUGETLB_PAGE=y
454CONFIG_RAMFS=y
455# CONFIG_CONFIGFS_FS is not set 450# CONFIG_CONFIGFS_FS is not set
456 451
457# 452#
@@ -492,22 +487,17 @@ CONFIG_MSDOS_PARTITION=y
492# CONFIG_KARMA_PARTITION is not set 487# CONFIG_KARMA_PARTITION is not set
493# CONFIG_EFI_PARTITION is not set 488# CONFIG_EFI_PARTITION is not set
494# CONFIG_SYSV68_PARTITION is not set 489# CONFIG_SYSV68_PARTITION is not set
495
496#
497# Native Language Support
498#
499# CONFIG_NLS is not set 490# CONFIG_NLS is not set
500 491CONFIG_INSTRUMENTATION=y
501#
502# Profiling support
503#
504CONFIG_PROFILING=y 492CONFIG_PROFILING=y
505# CONFIG_OPROFILE is not set 493# CONFIG_OPROFILE is not set
494# CONFIG_MARKERS is not set
506 495
507# 496#
508# Kernel hacking 497# Kernel hacking
509# 498#
510# CONFIG_PRINTK_TIME is not set 499# CONFIG_PRINTK_TIME is not set
500CONFIG_ENABLE_WARN_DEPRECATED=y
511CONFIG_ENABLE_MUST_CHECK=y 501CONFIG_ENABLE_MUST_CHECK=y
512CONFIG_MAGIC_SYSRQ=y 502CONFIG_MAGIC_SYSRQ=y
513# CONFIG_UNUSED_SYMBOLS is not set 503# CONFIG_UNUSED_SYMBOLS is not set
@@ -531,16 +521,17 @@ CONFIG_DEBUG_BUGVERBOSE=y
531# CONFIG_DEBUG_INFO is not set 521# CONFIG_DEBUG_INFO is not set
532# CONFIG_DEBUG_VM is not set 522# CONFIG_DEBUG_VM is not set
533# CONFIG_DEBUG_LIST is not set 523# CONFIG_DEBUG_LIST is not set
524# CONFIG_DEBUG_SG is not set
534CONFIG_FRAME_POINTER=y 525CONFIG_FRAME_POINTER=y
535CONFIG_FORCED_INLINING=y 526CONFIG_FORCED_INLINING=y
527# CONFIG_BOOT_PRINTK_DELAY is not set
536# CONFIG_FAULT_INJECTION is not set 528# CONFIG_FAULT_INJECTION is not set
529# CONFIG_SAMPLES is not set
537# CONFIG_EARLY_PRINTK is not set 530# CONFIG_EARLY_PRINTK is not set
538# CONFIG_DEBUG_KERNEL_WITH_GDB_STUB is not set
539CONFIG_SH64_PROC_TLB=y 531CONFIG_SH64_PROC_TLB=y
540CONFIG_SH64_PROC_ASIDS=y 532CONFIG_SH64_PROC_ASIDS=y
541CONFIG_SH64_SR_WATCH=y 533CONFIG_SH64_SR_WATCH=y
542# CONFIG_POOR_MANS_STRACE is not set 534# CONFIG_POOR_MANS_STRACE is not set
543# CONFIG_SH_ALPHANUMERIC is not set
544CONFIG_SH_NO_BSS_INIT=y 535CONFIG_SH_NO_BSS_INIT=y
545 536
546# 537#
@@ -548,6 +539,7 @@ CONFIG_SH_NO_BSS_INIT=y
548# 539#
549# CONFIG_KEYS is not set 540# CONFIG_KEYS is not set
550# CONFIG_SECURITY is not set 541# CONFIG_SECURITY is not set
542# CONFIG_SECURITY_FILE_CAPABILITIES is not set
551# CONFIG_CRYPTO is not set 543# CONFIG_CRYPTO is not set
552 544
553# 545#
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index f2eae457fc9a..f2d432edc92d 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -753,7 +753,7 @@ void __init pci_time_init(void)
753 local_irq_enable(); 753 local_irq_enable();
754} 754}
755 755
756static __inline__ unsigned long do_gettimeoffset(void) 756static inline unsigned long do_gettimeoffset(void)
757{ 757{
758 /* 758 /*
759 * We divide all by 100 759 * We divide all by 100
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index 33f7a3ddb104..77460e316a03 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -1,7 +1,6 @@
1/* $Id: process.c,v 1.161 2002/01/23 11:27:32 davem Exp $ 1/* linux/arch/sparc/kernel/process.c
2 * linux/arch/sparc/kernel/process.c
3 * 2 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1995 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 */ 5 */
7 6
@@ -397,7 +396,7 @@ void flush_thread(void)
397 } 396 }
398} 397}
399 398
400static __inline__ struct sparc_stackf __user * 399static inline struct sparc_stackf __user *
401clone_stackframe(struct sparc_stackf __user *dst, 400clone_stackframe(struct sparc_stackf __user *dst,
402 struct sparc_stackf __user *src) 401 struct sparc_stackf __user *src)
403{ 402{
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 4bf78a5e8e0f..45cb7c5286d7 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -1,7 +1,6 @@
1/* $Id: time.c,v 1.60 2002/01/23 14:33:55 davem Exp $ 1/* linux/arch/sparc/kernel/time.c
2 * linux/arch/sparc/kernel/time.c
3 * 2 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) 4 * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu)
6 * 5 *
7 * Chris Davis (cdavis@cois.on.ca) 03/27/1998 6 * Chris Davis (cdavis@cois.on.ca) 03/27/1998
@@ -210,7 +209,7 @@ static void __devinit kick_start_clock(void)
210} 209}
211 210
212/* Return nonzero if the clock chip battery is low. */ 211/* Return nonzero if the clock chip battery is low. */
213static __inline__ int has_low_battery(void) 212static inline int has_low_battery(void)
214{ 213{
215 struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs; 214 struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs;
216 unsigned char data1, data2; 215 unsigned char data1, data2;
@@ -252,7 +251,7 @@ static void __devinit mostek_set_system_time(void)
252} 251}
253 252
254/* Probe for the real time clock chip on Sun4 */ 253/* Probe for the real time clock chip on Sun4 */
255static __inline__ void sun4_clock_probe(void) 254static inline void sun4_clock_probe(void)
256{ 255{
257#ifdef CONFIG_SUN4 256#ifdef CONFIG_SUN4
258 int temp; 257 int temp;
diff --git a/arch/sparc/mm/btfixup.c b/arch/sparc/mm/btfixup.c
index ec4231c2855a..a312d127d47a 100644
--- a/arch/sparc/mm/btfixup.c
+++ b/arch/sparc/mm/btfixup.c
@@ -1,5 +1,4 @@
1/* $Id: btfixup.c,v 1.10 2000/05/09 17:40:13 davem Exp $ 1/* btfixup.c: Boot time code fixup and relocator, so that
2 * btfixup.c: Boot time code fixup and relocator, so that
3 * we can get rid of most indirect calls to achieve single 2 * we can get rid of most indirect calls to achieve single
4 * image sun4c and srmmu kernel. 3 * image sun4c and srmmu kernel.
5 * 4 *
@@ -69,7 +68,7 @@ static void __init set_addr(unsigned int *addr, unsigned int q1, int fmangled, u
69 } 68 }
70} 69}
71#else 70#else
72static __inline__ void set_addr(unsigned int *addr, unsigned int q1, int fmangled, unsigned int value) 71static inline void set_addr(unsigned int *addr, unsigned int q1, int fmangled, unsigned int value)
73{ 72{
74 *addr = value; 73 *addr = value;
75} 74}
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index 1666087c5b80..b86dfce8eee4 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -144,7 +144,7 @@ static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus
144 spin_lock_irqsave(&iounit->lock, flags); 144 spin_lock_irqsave(&iounit->lock, flags);
145 while (sz != 0) { 145 while (sz != 0) {
146 --sz; 146 --sz;
147 sg->dvma_address = iounit_get_area(iounit, sg_virt(sg), sg->length); 147 sg->dvma_address = iounit_get_area(iounit, (unsigned long) sg_virt(sg), sg->length);
148 sg->dvma_length = sg->length; 148 sg->dvma_length = sg->length;
149 sg = sg_next(sg); 149 sg = sg_next(sg);
150 } 150 }
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index a2cc141291c7..0729305f2f59 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -1,7 +1,6 @@
1/* $Id: sun4c.c,v 1.212 2001/12/21 04:56:15 davem Exp $ 1/* sun4c.c: Doing in software what should be done in hardware.
2 * sun4c.c: Doing in software what should be done in hardware.
3 * 2 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1996 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 Andrew Tridgell (Andrew.Tridgell@anu.edu.au) 5 * Copyright (C) 1996 Andrew Tridgell (Andrew.Tridgell@anu.edu.au)
7 * Copyright (C) 1997-2000 Anton Blanchard (anton@samba.org) 6 * Copyright (C) 1997-2000 Anton Blanchard (anton@samba.org)
@@ -719,7 +718,7 @@ static void add_ring(struct sun4c_mmu_ring *ring,
719 ring->num_entries++; 718 ring->num_entries++;
720} 719}
721 720
722static __inline__ void add_lru(struct sun4c_mmu_entry *entry) 721static inline void add_lru(struct sun4c_mmu_entry *entry)
723{ 722{
724 struct sun4c_mmu_ring *ring = &sun4c_ulru_ring; 723 struct sun4c_mmu_ring *ring = &sun4c_ulru_ring;
725 struct sun4c_mmu_entry *head = &ring->ringhd; 724 struct sun4c_mmu_entry *head = &ring->ringhd;
@@ -746,7 +745,7 @@ static void add_ring_ordered(struct sun4c_mmu_ring *ring,
746 add_lru(entry); 745 add_lru(entry);
747} 746}
748 747
749static __inline__ void remove_ring(struct sun4c_mmu_ring *ring, 748static inline void remove_ring(struct sun4c_mmu_ring *ring,
750 struct sun4c_mmu_entry *entry) 749 struct sun4c_mmu_entry *entry)
751{ 750{
752 struct sun4c_mmu_entry *next = entry->next; 751 struct sun4c_mmu_entry *next = entry->next;
@@ -1836,7 +1835,7 @@ static unsigned long sun4c_pte_to_pgoff(pte_t pte)
1836} 1835}
1837 1836
1838 1837
1839static __inline__ unsigned long sun4c_pmd_page_v(pmd_t pmd) 1838static inline unsigned long sun4c_pmd_page_v(pmd_t pmd)
1840{ 1839{
1841 return (pmd_val(pmd) & PAGE_MASK); 1840 return (pmd_val(pmd) & PAGE_MASK);
1842} 1841}
@@ -1922,7 +1921,7 @@ static void sun4c_free_pgd_fast(pgd_t *pgd)
1922} 1921}
1923 1922
1924 1923
1925static __inline__ pte_t * 1924static inline pte_t *
1926sun4c_pte_alloc_one_fast(struct mm_struct *mm, unsigned long address) 1925sun4c_pte_alloc_one_fast(struct mm_struct *mm, unsigned long address)
1927{ 1926{
1928 unsigned long *ret; 1927 unsigned long *ret;
@@ -1956,7 +1955,7 @@ static struct page *sun4c_pte_alloc_one(struct mm_struct *mm, unsigned long addr
1956 return virt_to_page(pte); 1955 return virt_to_page(pte);
1957} 1956}
1958 1957
1959static __inline__ void sun4c_free_pte_fast(pte_t *pte) 1958static inline void sun4c_free_pte_fast(pte_t *pte)
1960{ 1959{
1961 *(unsigned long *)pte = (unsigned long) pte_quicklist; 1960 *(unsigned long *)pte = (unsigned long) pte_quicklist;
1962 pte_quicklist = (unsigned long *) pte; 1961 pte_quicklist = (unsigned long *) pte;
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index bd59ab0760b3..10b212a1f9f5 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -408,7 +408,7 @@ config SUNOS_EMUL
408 408
409config SOLARIS_EMUL 409config SOLARIS_EMUL
410 tristate "Solaris binary emulation (EXPERIMENTAL)" 410 tristate "Solaris binary emulation (EXPERIMENTAL)"
411 depends on SPARC32_COMPAT && EXPERIMENTAL 411 depends on SPARC32_COMPAT && NET && EXPERIMENTAL
412 help 412 help
413 This is experimental code which will enable you to run (many) 413 This is experimental code which will enable you to run (many)
414 Solaris binaries on your SPARC Linux machine. 414 Solaris binaries on your SPARC Linux machine.
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index e023d4b2fef4..22734ac08c8a 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23 3# Linux kernel version: 2.6.24-rc1
4# Sun Oct 21 19:57:44 2007 4# Wed Oct 31 15:36:47 2007
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -19,6 +19,7 @@ CONFIG_ARCH_MAY_HAVE_PC_FDC=y
19CONFIG_AUDIT_ARCH=y 19CONFIG_AUDIT_ARCH=y
20CONFIG_ARCH_NO_VIRT_TO_BUS=y 20CONFIG_ARCH_NO_VIRT_TO_BUS=y
21CONFIG_OF=y 21CONFIG_OF=y
22CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
22CONFIG_SPARC64_PAGE_SIZE_8KB=y 23CONFIG_SPARC64_PAGE_SIZE_8KB=y
23# CONFIG_SPARC64_PAGE_SIZE_64KB is not set 24# CONFIG_SPARC64_PAGE_SIZE_64KB is not set
24# CONFIG_SPARC64_PAGE_SIZE_512KB is not set 25# CONFIG_SPARC64_PAGE_SIZE_512KB is not set
@@ -55,7 +56,8 @@ CONFIG_FAIR_USER_SCHED=y
55# CONFIG_FAIR_CGROUP_SCHED is not set 56# CONFIG_FAIR_CGROUP_SCHED is not set
56CONFIG_SYSFS_DEPRECATED=y 57CONFIG_SYSFS_DEPRECATED=y
57CONFIG_RELAY=y 58CONFIG_RELAY=y
58# CONFIG_BLK_DEV_INITRD is not set 59CONFIG_BLK_DEV_INITRD=y
60CONFIG_INITRAMFS_SOURCE=""
59CONFIG_CC_OPTIMIZE_FOR_SIZE=y 61CONFIG_CC_OPTIMIZE_FOR_SIZE=y
60CONFIG_SYSCTL=y 62CONFIG_SYSCTL=y
61# CONFIG_EMBEDDED is not set 63# CONFIG_EMBEDDED is not set
@@ -117,22 +119,7 @@ CONFIG_NO_HZ=y
117CONFIG_HIGH_RES_TIMERS=y 119CONFIG_HIGH_RES_TIMERS=y
118CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 120CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
119# CONFIG_SMP is not set 121# CONFIG_SMP is not set
120CONFIG_CPU_FREQ=y 122# CONFIG_CPU_FREQ is not set
121CONFIG_CPU_FREQ_TABLE=m
122# CONFIG_CPU_FREQ_DEBUG is not set
123CONFIG_CPU_FREQ_STAT=m
124CONFIG_CPU_FREQ_STAT_DETAILS=y
125CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
126# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
127# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
128# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
129CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
130CONFIG_CPU_FREQ_GOV_POWERSAVE=m
131CONFIG_CPU_FREQ_GOV_USERSPACE=m
132CONFIG_CPU_FREQ_GOV_ONDEMAND=m
133CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
134CONFIG_US3_FREQ=m
135CONFIG_US2E_FREQ=m
136CONFIG_RWSEM_XCHGADD_ALGORITHM=y 123CONFIG_RWSEM_XCHGADD_ALGORITHM=y
137CONFIG_GENERIC_FIND_NEXT_BIT=y 124CONFIG_GENERIC_FIND_NEXT_BIT=y
138CONFIG_GENERIC_HWEIGHT=y 125CONFIG_GENERIC_HWEIGHT=y
@@ -161,7 +148,7 @@ CONFIG_SBUS=y
161CONFIG_SBUSCHAR=y 148CONFIG_SBUSCHAR=y
162CONFIG_SUN_AUXIO=y 149CONFIG_SUN_AUXIO=y
163CONFIG_SUN_IO=y 150CONFIG_SUN_IO=y
164# CONFIG_SUN_LDOMS is not set 151CONFIG_SUN_LDOMS=y
165CONFIG_PCI=y 152CONFIG_PCI=y
166CONFIG_PCI_DOMAINS=y 153CONFIG_PCI_DOMAINS=y
167CONFIG_PCI_SYSCALL=y 154CONFIG_PCI_SYSCALL=y
@@ -338,6 +325,7 @@ CONFIG_CDROM_PKTCDVD=m
338CONFIG_CDROM_PKTCDVD_BUFFERS=8 325CONFIG_CDROM_PKTCDVD_BUFFERS=8
339CONFIG_CDROM_PKTCDVD_WCACHE=y 326CONFIG_CDROM_PKTCDVD_WCACHE=y
340CONFIG_ATA_OVER_ETH=m 327CONFIG_ATA_OVER_ETH=m
328CONFIG_SUNVDC=m
341CONFIG_MISC_DEVICES=y 329CONFIG_MISC_DEVICES=y
342# CONFIG_PHANTOM is not set 330# CONFIG_PHANTOM is not set
343# CONFIG_EEPROM_93CX6 is not set 331# CONFIG_EEPROM_93CX6 is not set
@@ -440,12 +428,12 @@ CONFIG_SCSI_WAIT_SCAN=m
440# 428#
441CONFIG_SCSI_SPI_ATTRS=y 429CONFIG_SCSI_SPI_ATTRS=y
442CONFIG_SCSI_FC_ATTRS=y 430CONFIG_SCSI_FC_ATTRS=y
443CONFIG_SCSI_ISCSI_ATTRS=m 431# CONFIG_SCSI_ISCSI_ATTRS is not set
444# CONFIG_SCSI_SAS_ATTRS is not set 432# CONFIG_SCSI_SAS_ATTRS is not set
445# CONFIG_SCSI_SAS_LIBSAS is not set 433# CONFIG_SCSI_SAS_LIBSAS is not set
446# CONFIG_SCSI_SRP_ATTRS is not set 434# CONFIG_SCSI_SRP_ATTRS is not set
447CONFIG_SCSI_LOWLEVEL=y 435CONFIG_SCSI_LOWLEVEL=y
448CONFIG_ISCSI_TCP=m 436# CONFIG_ISCSI_TCP is not set
449# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 437# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
450# CONFIG_SCSI_3W_9XXX is not set 438# CONFIG_SCSI_3W_9XXX is not set
451# CONFIG_SCSI_ACARD is not set 439# CONFIG_SCSI_ACARD is not set
@@ -506,7 +494,7 @@ CONFIG_DM_ZERO=m
506# CONFIG_I2O is not set 494# CONFIG_I2O is not set
507CONFIG_NETDEVICES=y 495CONFIG_NETDEVICES=y
508# CONFIG_NETDEVICES_MULTIQUEUE is not set 496# CONFIG_NETDEVICES_MULTIQUEUE is not set
509CONFIG_DUMMY=m 497# CONFIG_DUMMY is not set
510# CONFIG_BONDING is not set 498# CONFIG_BONDING is not set
511# CONFIG_MACVLAN is not set 499# CONFIG_MACVLAN is not set
512# CONFIG_EQUALIZER is not set 500# CONFIG_EQUALIZER is not set
@@ -523,6 +511,7 @@ CONFIG_MII=m
523# CONFIG_SUNQE is not set 511# CONFIG_SUNQE is not set
524# CONFIG_SUNGEM is not set 512# CONFIG_SUNGEM is not set
525CONFIG_CASSINI=m 513CONFIG_CASSINI=m
514CONFIG_SUNVNET=m
526# CONFIG_NET_VENDOR_3COM is not set 515# CONFIG_NET_VENDOR_3COM is not set
527# CONFIG_NET_TULIP is not set 516# CONFIG_NET_TULIP is not set
528# CONFIG_HP100 is not set 517# CONFIG_HP100 is not set
@@ -577,7 +566,7 @@ CONFIG_NETDEV_10000=y
577# CONFIG_S2IO is not set 566# CONFIG_S2IO is not set
578# CONFIG_MYRI10GE is not set 567# CONFIG_MYRI10GE is not set
579# CONFIG_NETXEN_NIC is not set 568# CONFIG_NETXEN_NIC is not set
580# CONFIG_NIU is not set 569CONFIG_NIU=m
581# CONFIG_MLX4_CORE is not set 570# CONFIG_MLX4_CORE is not set
582# CONFIG_TEHUTI is not set 571# CONFIG_TEHUTI is not set
583# CONFIG_TR is not set 572# CONFIG_TR is not set
@@ -702,7 +691,8 @@ CONFIG_SERIAL_SUNCORE=y
702# CONFIG_SERIAL_SUNZILOG is not set 691# CONFIG_SERIAL_SUNZILOG is not set
703CONFIG_SERIAL_SUNSU=y 692CONFIG_SERIAL_SUNSU=y
704CONFIG_SERIAL_SUNSU_CONSOLE=y 693CONFIG_SERIAL_SUNSU_CONSOLE=y
705CONFIG_SERIAL_SUNSAB=m 694CONFIG_SERIAL_SUNSAB=y
695CONFIG_SERIAL_SUNSAB_CONSOLE=y
706CONFIG_SERIAL_SUNHV=y 696CONFIG_SERIAL_SUNHV=y
707CONFIG_SERIAL_CORE=y 697CONFIG_SERIAL_CORE=y
708CONFIG_SERIAL_CORE_CONSOLE=y 698CONFIG_SERIAL_CORE_CONSOLE=y
@@ -880,9 +870,17 @@ CONFIG_FB_TILEBLITTING=y
880# CONFIG_FB_ASILIANT is not set 870# CONFIG_FB_ASILIANT is not set
881# CONFIG_FB_IMSTT is not set 871# CONFIG_FB_IMSTT is not set
882# CONFIG_FB_UVESA is not set 872# CONFIG_FB_UVESA is not set
883# CONFIG_FB_SBUS is not set 873CONFIG_FB_SBUS=y
884# CONFIG_FB_XVR500 is not set 874# CONFIG_FB_BW2 is not set
885# CONFIG_FB_XVR2500 is not set 875# CONFIG_FB_CG3 is not set
876CONFIG_FB_CG6=y
877CONFIG_FB_FFB=y
878# CONFIG_FB_TCX is not set
879# CONFIG_FB_CG14 is not set
880# CONFIG_FB_P9100 is not set
881# CONFIG_FB_LEO is not set
882CONFIG_FB_XVR500=y
883CONFIG_FB_XVR2500=y
886# CONFIG_FB_S1D13XXX is not set 884# CONFIG_FB_S1D13XXX is not set
887# CONFIG_FB_NVIDIA is not set 885# CONFIG_FB_NVIDIA is not set
888# CONFIG_FB_RIVA is not set 886# CONFIG_FB_RIVA is not set
@@ -892,7 +890,11 @@ CONFIG_FB_RADEON_I2C=y
892# CONFIG_FB_RADEON_BACKLIGHT is not set 890# CONFIG_FB_RADEON_BACKLIGHT is not set
893# CONFIG_FB_RADEON_DEBUG is not set 891# CONFIG_FB_RADEON_DEBUG is not set
894# CONFIG_FB_ATY128 is not set 892# CONFIG_FB_ATY128 is not set
895# CONFIG_FB_ATY is not set 893CONFIG_FB_ATY=y
894CONFIG_FB_ATY_CT=y
895# CONFIG_FB_ATY_GENERIC_LCD is not set
896CONFIG_FB_ATY_GX=y
897# CONFIG_FB_ATY_BACKLIGHT is not set
896# CONFIG_FB_S3 is not set 898# CONFIG_FB_S3 is not set
897# CONFIG_FB_SAVAGE is not set 899# CONFIG_FB_SAVAGE is not set
898# CONFIG_FB_SIS is not set 900# CONFIG_FB_SIS is not set
@@ -1191,7 +1193,7 @@ CONFIG_USB_STORAGE=m
1191# 1193#
1192# Misc Linux/SPARC drivers 1194# Misc Linux/SPARC drivers
1193# 1195#
1194CONFIG_SUN_OPENPROMIO=m 1196CONFIG_SUN_OPENPROMIO=y
1195# CONFIG_OBP_FLASH is not set 1197# CONFIG_OBP_FLASH is not set
1196# CONFIG_SUN_BPP is not set 1198# CONFIG_SUN_BPP is not set
1197# CONFIG_BBC_I2C is not set 1199# CONFIG_BBC_I2C is not set
@@ -1199,11 +1201,6 @@ CONFIG_SUN_OPENPROMIO=m
1199# CONFIG_DISPLAY7SEG is not set 1201# CONFIG_DISPLAY7SEG is not set
1200 1202
1201# 1203#
1202# Fibre Channel support
1203#
1204# CONFIG_FC4 is not set
1205
1206#
1207# File systems 1204# File systems
1208# 1205#
1209CONFIG_EXT2_FS=y 1206CONFIG_EXT2_FS=y
@@ -1345,6 +1342,7 @@ CONFIG_KPROBES=y
1345# 1342#
1346CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1343CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1347CONFIG_PRINTK_TIME=y 1344CONFIG_PRINTK_TIME=y
1345# CONFIG_ENABLE_WARN_DEPRECATED is not set
1348CONFIG_ENABLE_MUST_CHECK=y 1346CONFIG_ENABLE_MUST_CHECK=y
1349CONFIG_MAGIC_SYSRQ=y 1347CONFIG_MAGIC_SYSRQ=y
1350# CONFIG_UNUSED_SYMBOLS is not set 1348# CONFIG_UNUSED_SYMBOLS is not set
@@ -1371,6 +1369,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1371# CONFIG_DEBUG_INFO is not set 1369# CONFIG_DEBUG_INFO is not set
1372# CONFIG_DEBUG_VM is not set 1370# CONFIG_DEBUG_VM is not set
1373# CONFIG_DEBUG_LIST is not set 1371# CONFIG_DEBUG_LIST is not set
1372# CONFIG_DEBUG_SG is not set
1374CONFIG_FORCED_INLINING=y 1373CONFIG_FORCED_INLINING=y
1375# CONFIG_BOOT_PRINTK_DELAY is not set 1374# CONFIG_BOOT_PRINTK_DELAY is not set
1376# CONFIG_RCU_TORTURE_TEST is not set 1375# CONFIG_RCU_TORTURE_TEST is not set
diff --git a/arch/sparc64/kernel/binfmt_elf32.c b/arch/sparc64/kernel/binfmt_elf32.c
index 9ad84ff10a17..1587a29a4b0e 100644
--- a/arch/sparc64/kernel/binfmt_elf32.c
+++ b/arch/sparc64/kernel/binfmt_elf32.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * binfmt_elf32.c: Support 32-bit Sparc ELF binaries on Ultra. 2 * binfmt_elf32.c: Support 32-bit Sparc ELF binaries on Ultra.
3 * 3 *
4 * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz) 5 * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz)
6 */ 6 */
7 7
@@ -133,7 +133,7 @@ struct elf_prpsinfo32
133 133
134#undef cputime_to_timeval 134#undef cputime_to_timeval
135#define cputime_to_timeval cputime_to_compat_timeval 135#define cputime_to_timeval cputime_to_compat_timeval
136static __inline__ void 136static inline void
137cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value) 137cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value)
138{ 138{
139 unsigned long jiffies = cputime_to_jiffies(cputime); 139 unsigned long jiffies = cputime_to_jiffies(cputime);
diff --git a/arch/sparc64/kernel/central.c b/arch/sparc64/kernel/central.c
index 8230099f0d8a..b61b8dfb09cf 100644
--- a/arch/sparc64/kernel/central.c
+++ b/arch/sparc64/kernel/central.c
@@ -1,7 +1,6 @@
1/* $Id: central.c,v 1.15 2001/12/19 00:29:51 davem Exp $ 1/* central.c: Central FHC driver for Sunfire/Starfire/Wildfire.
2 * central.c: Central FHC driver for Sunfire/Starfire/Wildfire.
3 * 2 *
4 * Copyright (C) 1997, 1999 David S. Miller (davem@redhat.com) 3 * Copyright (C) 1997, 1999 David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#include <linux/kernel.h> 6#include <linux/kernel.h>
@@ -385,7 +384,7 @@ void __init central_probe(void)
385 init_all_fhc_hw(); 384 init_all_fhc_hw();
386} 385}
387 386
388static __inline__ void fhc_ledblink(struct linux_fhc *fhc, int on) 387static inline void fhc_ledblink(struct linux_fhc *fhc, int on)
389{ 388{
390 u32 tmp; 389 u32 tmp;
391 390
@@ -402,7 +401,7 @@ static __inline__ void fhc_ledblink(struct linux_fhc *fhc, int on)
402 upa_readl(fhc->fhc_regs.pregs + FHC_PREGS_CTRL); 401 upa_readl(fhc->fhc_regs.pregs + FHC_PREGS_CTRL);
403} 402}
404 403
405static __inline__ void central_ledblink(struct linux_central *central, int on) 404static inline void central_ledblink(struct linux_central *central, int on)
406{ 405{
407 u8 tmp; 406 u8 tmp;
408 407
diff --git a/arch/sparc64/kernel/iommu_common.c b/arch/sparc64/kernel/iommu_common.c
index b70324e0d83d..efd5dff85f60 100644
--- a/arch/sparc64/kernel/iommu_common.c
+++ b/arch/sparc64/kernel/iommu_common.c
@@ -234,7 +234,7 @@ unsigned long prepare_sg(struct scatterlist *sg, int nents)
234 dma_sg->dma_length = dent_len; 234 dma_sg->dma_length = dent_len;
235 235
236 if (dma_sg != sg) { 236 if (dma_sg != sg) {
237 dma_sg = next_sg(dma_sg); 237 dma_sg = sg_next(dma_sg);
238 dma_sg->dma_length = 0; 238 dma_sg->dma_length = 0;
239 } 239 }
240 240
diff --git a/arch/sparc64/kernel/ldc.c b/arch/sparc64/kernel/ldc.c
index c8313cb60f0a..217478a94128 100644
--- a/arch/sparc64/kernel/ldc.c
+++ b/arch/sparc64/kernel/ldc.c
@@ -2121,7 +2121,7 @@ int ldc_map_sg(struct ldc_channel *lp,
2121 state.nc = 0; 2121 state.nc = 0;
2122 2122
2123 for (i = 0; i < num_sg; i++) 2123 for (i = 0; i < num_sg; i++)
2124 fill_cookies(&state, page_to_pfn(sg[i].page) << PAGE_SHIFT, 2124 fill_cookies(&state, page_to_pfn(sg_page(&sg[i])) << PAGE_SHIFT,
2125 sg[i].offset, sg[i].length); 2125 sg[i].offset, sg[i].length);
2126 2126
2127 return state.nc; 2127 return state.nc;
diff --git a/arch/sparc64/kernel/semaphore.c b/arch/sparc64/kernel/semaphore.c
index a809e63f03ef..9974a6899551 100644
--- a/arch/sparc64/kernel/semaphore.c
+++ b/arch/sparc64/kernel/semaphore.c
@@ -1,5 +1,4 @@
1/* $Id: semaphore.c,v 1.9 2001/11/18 00:12:56 davem Exp $ 1/* semaphore.c: Sparc64 semaphore implementation.
2 * semaphore.c: Sparc64 semaphore implementation.
3 * 2 *
4 * This is basically the PPC semaphore scheme ported to use 3 * This is basically the PPC semaphore scheme ported to use
5 * the sparc64 atomic instructions, so see the PPC code for 4 * the sparc64 atomic instructions, so see the PPC code for
@@ -19,7 +18,7 @@
19 * sem->count = tmp; 18 * sem->count = tmp;
20 * return old_count; 19 * return old_count;
21 */ 20 */
22static __inline__ int __sem_update_count(struct semaphore *sem, int incr) 21static inline int __sem_update_count(struct semaphore *sem, int incr)
23{ 22{
24 int old_count, tmp; 23 int old_count, tmp;
25 24
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 407d74a8a542..7cd8d94df0dc 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -459,7 +459,7 @@ again:
459 } 459 }
460} 460}
461 461
462static __inline__ void spitfire_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask) 462static inline void spitfire_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask)
463{ 463{
464 u64 pstate; 464 u64 pstate;
465 int i; 465 int i;
@@ -906,7 +906,7 @@ extern atomic_t dcpage_flushes;
906extern atomic_t dcpage_flushes_xcall; 906extern atomic_t dcpage_flushes_xcall;
907#endif 907#endif
908 908
909static __inline__ void __local_flush_dcache_page(struct page *page) 909static inline void __local_flush_dcache_page(struct page *page)
910{ 910{
911#ifdef DCACHE_ALIASING_POSSIBLE 911#ifdef DCACHE_ALIASING_POSSIBLE
912 __flush_dcache_page(page_address(page), 912 __flush_dcache_page(page_address(page),
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index 23fad7ebdd0d..60765e314bd8 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -221,7 +221,7 @@ EXPORT_SYMBOL(pci_dma_supported);
221/* I/O device mmaping on Sparc64. */ 221/* I/O device mmaping on Sparc64. */
222EXPORT_SYMBOL(io_remap_pfn_range); 222EXPORT_SYMBOL(io_remap_pfn_range);
223 223
224#ifdef CONFIG_COMPAT 224#if defined(CONFIG_COMPAT) && defined(CONFIG_NET)
225/* Solaris/SunOS binary compatibility */ 225/* Solaris/SunOS binary compatibility */
226EXPORT_SYMBOL(verify_compat_iovec); 226EXPORT_SYMBOL(verify_compat_iovec);
227#endif 227#endif
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 560cb1edb1d0..c56573a10eee 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -318,7 +318,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
318 318
319 if (flags & MAP_FIXED) { 319 if (flags & MAP_FIXED) {
320 /* Ok, don't mess with it. */ 320 /* Ok, don't mess with it. */
321 return get_unmapped_area(NULL, addr, len, pgoff, flags); 321 return get_unmapped_area(NULL, orig_addr, len, pgoff, flags);
322 } 322 }
323 flags &= ~MAP_SHARED; 323 flags &= ~MAP_SHARED;
324 324
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index cd8c740cba1d..a2cf955294c1 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -1070,7 +1070,7 @@ static int set_rtc_mmss(unsigned long nowtime)
1070 * Not having a register set can lead to trouble. 1070 * Not having a register set can lead to trouble.
1071 * Also starfire doesn't have a tod clock. 1071 * Also starfire doesn't have a tod clock.
1072 */ 1072 */
1073 if (!mregs && !dregs & !bregs) 1073 if (!mregs && !dregs && !bregs)
1074 return -1; 1074 return -1;
1075 1075
1076 if (mregs) { 1076 if (mregs) {
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index e9c7e4f07abf..04998388259f 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -1,7 +1,6 @@
1/* $Id: traps.c,v 1.85 2002/02/09 19:49:31 davem Exp $ 1/* arch/sparc64/kernel/traps.c
2 * arch/sparc64/kernel/traps.c
3 * 2 *
4 * Copyright (C) 1995,1997 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1995,1997 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1997,1999,2000 Jakub Jelinek (jakub@redhat.com) 4 * Copyright (C) 1997,1999,2000 Jakub Jelinek (jakub@redhat.com)
6 */ 5 */
7 6
@@ -765,7 +764,7 @@ static unsigned long cheetah_afsr_errors;
765 */ 764 */
766struct cheetah_err_info *cheetah_error_log; 765struct cheetah_err_info *cheetah_error_log;
767 766
768static __inline__ struct cheetah_err_info *cheetah_get_error_log(unsigned long afsr) 767static inline struct cheetah_err_info *cheetah_get_error_log(unsigned long afsr)
769{ 768{
770 struct cheetah_err_info *p; 769 struct cheetah_err_info *p;
771 int cpu = smp_processor_id(); 770 int cpu = smp_processor_id();
@@ -1085,7 +1084,7 @@ static unsigned char cheetah_mtag_syntab[] = {
1085}; 1084};
1086 1085
1087/* Return the highest priority error conditon mentioned. */ 1086/* Return the highest priority error conditon mentioned. */
1088static __inline__ unsigned long cheetah_get_hipri(unsigned long afsr) 1087static inline unsigned long cheetah_get_hipri(unsigned long afsr)
1089{ 1088{
1090 unsigned long tmp = 0; 1089 unsigned long tmp = 0;
1091 int i; 1090 int i;
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 100c4456ed1e..e18ccf85224f 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -201,7 +201,7 @@ inline void flush_dcache_page_impl(struct page *page)
201#define dcache_dirty_cpu(page) \ 201#define dcache_dirty_cpu(page) \
202 (((page)->flags >> PG_dcache_cpu_shift) & PG_dcache_cpu_mask) 202 (((page)->flags >> PG_dcache_cpu_shift) & PG_dcache_cpu_mask)
203 203
204static __inline__ void set_dcache_dirty(struct page *page, int this_cpu) 204static inline void set_dcache_dirty(struct page *page, int this_cpu)
205{ 205{
206 unsigned long mask = this_cpu; 206 unsigned long mask = this_cpu;
207 unsigned long non_cpu_bits; 207 unsigned long non_cpu_bits;
@@ -223,7 +223,7 @@ static __inline__ void set_dcache_dirty(struct page *page, int this_cpu)
223 : "g1", "g7"); 223 : "g1", "g7");
224} 224}
225 225
226static __inline__ void clear_dcache_dirty_cpu(struct page *page, unsigned long cpu) 226static inline void clear_dcache_dirty_cpu(struct page *page, unsigned long cpu)
227{ 227{
228 unsigned long mask = (1UL << PG_dcache_dirty); 228 unsigned long mask = (1UL << PG_dcache_dirty);
229 229
diff --git a/arch/sparc64/mm/tsb.c b/arch/sparc64/mm/tsb.c
index 7ff0a02f5813..a3e6e4b635b3 100644
--- a/arch/sparc64/mm/tsb.c
+++ b/arch/sparc64/mm/tsb.c
@@ -182,7 +182,9 @@ static void setup_tsb_params(struct mm_struct *mm, unsigned long tsb_idx, unsign
182 break; 182 break;
183 183
184 default: 184 default:
185 BUG(); 185 printk(KERN_ERR "TSB[%s:%d]: Impossible TSB size %lu, killing process.\n",
186 current->comm, current->pid, tsb_bytes);
187 do_exit(SIGSEGV);
186 }; 188 };
187 tte |= pte_sz_bits(page_sz); 189 tte |= pte_sz_bits(page_sz);
188 190
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S
index 737c26923c09..2865c105b6a4 100644
--- a/arch/sparc64/mm/ultra.S
+++ b/arch/sparc64/mm/ultra.S
@@ -120,13 +120,6 @@ __spitfire_flush_tlb_mm_slow:
120/* 120/*
121 * The following code flushes one page_size worth. 121 * The following code flushes one page_size worth.
122 */ 122 */
123#if (PAGE_SHIFT == 13)
124#define ITAG_MASK 0xfe
125#elif (PAGE_SHIFT == 16)
126#define ITAG_MASK 0x7fe
127#else
128#error unsupported PAGE_SIZE
129#endif
130 .section .kprobes.text, "ax" 123 .section .kprobes.text, "ax"
131 .align 32 124 .align 32
132 .globl __flush_icache_page 125 .globl __flush_icache_page
diff --git a/arch/sparc64/prom/console.c b/arch/sparc64/prom/console.c
index 3fafa9a8b50b..e1c3fc87484d 100644
--- a/arch/sparc64/prom/console.c
+++ b/arch/sparc64/prom/console.c
@@ -1,8 +1,7 @@
1/* $Id: console.c,v 1.9 1997/10/29 07:41:43 ecd Exp $ 1/* console.c: Routines that deal with sending and receiving IO
2 * console.c: Routines that deal with sending and receiving IO
3 * to/from the current console device using the PROM. 2 * to/from the current console device using the PROM.
4 * 3 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
6 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 5 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
7 */ 6 */
8 7
@@ -19,7 +18,7 @@ extern int prom_stdin, prom_stdout;
19/* Non blocking get character from console input device, returns -1 18/* Non blocking get character from console input device, returns -1
20 * if no input was taken. This can be used for polling. 19 * if no input was taken. This can be used for polling.
21 */ 20 */
22__inline__ int 21inline int
23prom_nbgetchar(void) 22prom_nbgetchar(void)
24{ 23{
25 char inc; 24 char inc;
@@ -35,7 +34,7 @@ prom_nbgetchar(void)
35/* Non blocking put character to console device, returns -1 if 34/* Non blocking put character to console device, returns -1 if
36 * unsuccessful. 35 * unsuccessful.
37 */ 36 */
38__inline__ int 37inline int
39prom_nbputchar(char c) 38prom_nbputchar(char c)
40{ 39{
41 char outc; 40 char outc;
diff --git a/arch/sparc64/prom/tree.c b/arch/sparc64/prom/tree.c
index b2c5b12c9818..a99ccd7fb1b0 100644
--- a/arch/sparc64/prom/tree.c
+++ b/arch/sparc64/prom/tree.c
@@ -18,14 +18,12 @@
18/* Return the child of node 'node' or zero if no this node has no 18/* Return the child of node 'node' or zero if no this node has no
19 * direct descendent. 19 * direct descendent.
20 */ 20 */
21__inline__ int 21inline int __prom_getchild(int node)
22__prom_getchild(int node)
23{ 22{
24 return p1275_cmd ("child", P1275_INOUT(1, 1), node); 23 return p1275_cmd ("child", P1275_INOUT(1, 1), node);
25} 24}
26 25
27__inline__ int 26inline int prom_getchild(int node)
28prom_getchild(int node)
29{ 27{
30 int cnode; 28 int cnode;
31 29
@@ -35,8 +33,7 @@ prom_getchild(int node)
35 return (int)cnode; 33 return (int)cnode;
36} 34}
37 35
38__inline__ int 36inline int prom_getparent(int node)
39prom_getparent(int node)
40{ 37{
41 int cnode; 38 int cnode;
42 39
@@ -49,14 +46,12 @@ prom_getparent(int node)
49/* Return the next sibling of node 'node' or zero if no more siblings 46/* Return the next sibling of node 'node' or zero if no more siblings
50 * at this level of depth in the tree. 47 * at this level of depth in the tree.
51 */ 48 */
52__inline__ int 49inline int __prom_getsibling(int node)
53__prom_getsibling(int node)
54{ 50{
55 return p1275_cmd(prom_peer_name, P1275_INOUT(1, 1), node); 51 return p1275_cmd(prom_peer_name, P1275_INOUT(1, 1), node);
56} 52}
57 53
58__inline__ int 54inline int prom_getsibling(int node)
59prom_getsibling(int node)
60{ 55{
61 int sibnode; 56 int sibnode;
62 57
@@ -72,8 +67,7 @@ prom_getsibling(int node)
72/* Return the length in bytes of property 'prop' at node 'node'. 67/* Return the length in bytes of property 'prop' at node 'node'.
73 * Return -1 on error. 68 * Return -1 on error.
74 */ 69 */
75__inline__ int 70inline int prom_getproplen(int node, const char *prop)
76prom_getproplen(int node, const char *prop)
77{ 71{
78 if((!node) || (!prop)) return -1; 72 if((!node) || (!prop)) return -1;
79 return p1275_cmd ("getproplen", 73 return p1275_cmd ("getproplen",
@@ -86,8 +80,8 @@ prom_getproplen(int node, const char *prop)
86 * 'buffer' which has a size of 'bufsize'. If the acquisition 80 * 'buffer' which has a size of 'bufsize'. If the acquisition
87 * was successful the length will be returned, else -1 is returned. 81 * was successful the length will be returned, else -1 is returned.
88 */ 82 */
89__inline__ int 83inline int prom_getproperty(int node, const char *prop,
90prom_getproperty(int node, const char *prop, char *buffer, int bufsize) 84 char *buffer, int bufsize)
91{ 85{
92 int plen; 86 int plen;
93 87
@@ -107,8 +101,7 @@ prom_getproperty(int node, const char *prop, char *buffer, int bufsize)
107/* Acquire an integer property and return its value. Returns -1 101/* Acquire an integer property and return its value. Returns -1
108 * on failure. 102 * on failure.
109 */ 103 */
110__inline__ int 104inline int prom_getint(int node, const char *prop)
111prom_getint(int node, const char *prop)
112{ 105{
113 int intprop; 106 int intprop;
114 107
@@ -122,8 +115,7 @@ prom_getint(int node, const char *prop)
122 * integer. 115 * integer.
123 */ 116 */
124 117
125int 118int prom_getintdefault(int node, const char *property, int deflt)
126prom_getintdefault(int node, const char *property, int deflt)
127{ 119{
128 int retval; 120 int retval;
129 121
@@ -134,8 +126,7 @@ prom_getintdefault(int node, const char *property, int deflt)
134} 126}
135 127
136/* Acquire a boolean property, 1=TRUE 0=FALSE. */ 128/* Acquire a boolean property, 1=TRUE 0=FALSE. */
137int 129int prom_getbool(int node, const char *prop)
138prom_getbool(int node, const char *prop)
139{ 130{
140 int retval; 131 int retval;
141 132
@@ -148,8 +139,7 @@ prom_getbool(int node, const char *prop)
148 * string on error. The char pointer is the user supplied string 139 * string on error. The char pointer is the user supplied string
149 * buffer. 140 * buffer.
150 */ 141 */
151void 142void prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size)
152prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size)
153{ 143{
154 int len; 144 int len;
155 145
@@ -163,8 +153,7 @@ prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size)
163/* Does the device at node 'node' have name 'name'? 153/* Does the device at node 'node' have name 'name'?
164 * YES = 1 NO = 0 154 * YES = 1 NO = 0
165 */ 155 */
166int 156int prom_nodematch(int node, const char *name)
167prom_nodematch(int node, const char *name)
168{ 157{
169 char namebuf[128]; 158 char namebuf[128];
170 prom_getproperty(node, "name", namebuf, sizeof(namebuf)); 159 prom_getproperty(node, "name", namebuf, sizeof(namebuf));
@@ -175,8 +164,7 @@ prom_nodematch(int node, const char *name)
175/* Search siblings at 'node_start' for a node with name 164/* Search siblings at 'node_start' for a node with name
176 * 'nodename'. Return node if successful, zero if not. 165 * 'nodename'. Return node if successful, zero if not.
177 */ 166 */
178int 167int prom_searchsiblings(int node_start, const char *nodename)
179prom_searchsiblings(int node_start, const char *nodename)
180{ 168{
181 169
182 int thisnode, error; 170 int thisnode, error;
@@ -197,8 +185,7 @@ prom_searchsiblings(int node_start, const char *nodename)
197/* Return the first property type for node 'node'. 185/* Return the first property type for node 'node'.
198 * buffer should be at least 32B in length 186 * buffer should be at least 32B in length
199 */ 187 */
200__inline__ char * 188inline char *prom_firstprop(int node, char *buffer)
201prom_firstprop(int node, char *buffer)
202{ 189{
203 *buffer = 0; 190 *buffer = 0;
204 if(node == -1) return buffer; 191 if(node == -1) return buffer;
@@ -212,8 +199,7 @@ prom_firstprop(int node, char *buffer)
212 * at node 'node' . Returns NULL string if no more 199 * at node 'node' . Returns NULL string if no more
213 * property types for this node. 200 * property types for this node.
214 */ 201 */
215__inline__ char * 202inline char *prom_nextprop(int node, const char *oprop, char *buffer)
216prom_nextprop(int node, const char *oprop, char *buffer)
217{ 203{
218 char buf[32]; 204 char buf[32];
219 205
@@ -279,8 +265,7 @@ prom_setprop(int node, const char *pname, char *value, int size)
279 node, pname, value, P1275_SIZE(size)); 265 node, pname, value, P1275_SIZE(size));
280} 266}
281 267
282__inline__ int 268inline int prom_inst2pkg(int inst)
283prom_inst2pkg(int inst)
284{ 269{
285 int node; 270 int node;
286 271
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386
index 9876d80d85dd..e0ac74e5d4c4 100644
--- a/arch/um/Kconfig.i386
+++ b/arch/um/Kconfig.i386
@@ -1,6 +1,6 @@
1menu "Host processor type and features" 1menu "Host processor type and features"
2 2
3source "arch/i386/Kconfig.cpu" 3source "arch/x86/Kconfig.cpu"
4 4
5endmenu 5endmenu
6 6
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 0178df306939..b01dfb00e5f8 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -9,6 +9,7 @@ ELF_ARCH := $(SUBARCH)
9ELF_FORMAT := elf32-$(SUBARCH) 9ELF_FORMAT := elf32-$(SUBARCH)
10OBJCOPYFLAGS := -O binary -R .note -R .comment -S 10OBJCOPYFLAGS := -O binary -R .note -R .comment -S
11HEADER_ARCH := x86 11HEADER_ARCH := x86
12CHECKFLAGS += -D__i386__
12 13
13ifeq ("$(origin SUBARCH)", "command line") 14ifeq ("$(origin SUBARCH)", "command line")
14ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)") 15ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)")
@@ -26,10 +27,8 @@ AFLAGS += -DCONFIG_X86_32
26CONFIG_X86_32 := y 27CONFIG_X86_32 := y
27export CONFIG_X86_32 28export CONFIG_X86_32
28 29
29ARCH_KERNEL_DEFINES += -U__$(SUBARCH)__ -U$(SUBARCH)
30
31# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y. 30# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
32include $(srctree)/arch/i386/Makefile.cpu 31include $(srctree)/arch/x86/Makefile_32.cpu
33 32
34# prevent gcc from keeping the stack 16 byte aligned. Taken from i386. 33# prevent gcc from keeping the stack 16 byte aligned. Taken from i386.
35cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) 34cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index fe5316f0c6a5..8ed362f93582 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -6,12 +6,9 @@ START := 0x60000000
6 6
7_extra_flags_ = -fno-builtin -m64 7_extra_flags_ = -fno-builtin -m64
8 8
9#We #undef __x86_64__ for kernelspace, not for userspace where
10#it's needed for headers to work!
11ARCH_KERNEL_DEFINES = -U__$(SUBARCH)__
12KBUILD_CFLAGS += $(_extra_flags_) 9KBUILD_CFLAGS += $(_extra_flags_)
13 10
14CHECKFLAGS += -m64 11CHECKFLAGS += -m64 -D__x86_64__
15KBUILD_AFLAGS += -m64 12KBUILD_AFLAGS += -m64
16LDFLAGS += -m elf_x86_64 13LDFLAGS += -m elf_x86_64
17KBUILD_CPPFLAGS += -m64 14KBUILD_CPPFLAGS += -m64
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 3a8cd3dfb51c..e184b44b1011 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -35,6 +35,7 @@
35#include "linux/genhd.h" 35#include "linux/genhd.h"
36#include "linux/spinlock.h" 36#include "linux/spinlock.h"
37#include "linux/platform_device.h" 37#include "linux/platform_device.h"
38#include "linux/scatterlist.h"
38#include "asm/segment.h" 39#include "asm/segment.h"
39#include "asm/uaccess.h" 40#include "asm/uaccess.h"
40#include "asm/irq.h" 41#include "asm/irq.h"
@@ -704,6 +705,7 @@ static int ubd_add(int n, char **error_out)
704 ubd_dev->size = ROUND_BLOCK(ubd_dev->size); 705 ubd_dev->size = ROUND_BLOCK(ubd_dev->size);
705 706
706 INIT_LIST_HEAD(&ubd_dev->restart); 707 INIT_LIST_HEAD(&ubd_dev->restart);
708 sg_init_table(&ubd_dev->sg, MAX_SG);
707 709
708 err = -ENOMEM; 710 err = -ENOMEM;
709 ubd_dev->queue = blk_init_queue(do_ubd_request, &ubd_dev->lock); 711 ubd_dev->queue = blk_init_queue(do_ubd_request, &ubd_dev->lock);
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 8456397f5f4d..59822dee438a 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -165,7 +165,7 @@ static void __init kmap_init(void)
165 kmap_prot = PAGE_KERNEL; 165 kmap_prot = PAGE_KERNEL;
166} 166}
167 167
168static void init_highmem(void) 168static void __init init_highmem(void)
169{ 169{
170 pgd_t *pgd; 170 pgd_t *pgd;
171 pud_t *pud; 171 pud_t *pud;
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index 9657c89fdf31..bd3da8a61f64 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -155,7 +155,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
155 if (err) 155 if (err)
156 return err; 156 return err;
157 157
158 n = copy_to_user((void *) buf, fpregs, sizeof(fpregs)); 158 n = copy_to_user(buf, fpregs, sizeof(fpregs));
159 if(n > 0) 159 if(n > 0)
160 return -EFAULT; 160 return -EFAULT;
161 161
@@ -168,7 +168,7 @@ int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
168 long fpregs[HOST_FP_SIZE]; 168 long fpregs[HOST_FP_SIZE];
169 169
170 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 170 BUG_ON(sizeof(*buf) != sizeof(fpregs));
171 n = copy_from_user(fpregs, (void *) buf, sizeof(fpregs)); 171 n = copy_from_user(fpregs, buf, sizeof(fpregs));
172 if (n > 0) 172 if (n > 0)
173 return -EFAULT; 173 return -EFAULT;
174 174
@@ -185,7 +185,7 @@ int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
185 if (err) 185 if (err)
186 return err; 186 return err;
187 187
188 n = copy_to_user((void *) buf, fpregs, sizeof(fpregs)); 188 n = copy_to_user(buf, fpregs, sizeof(fpregs));
189 if(n > 0) 189 if(n > 0)
190 return -EFAULT; 190 return -EFAULT;
191 191
@@ -198,7 +198,7 @@ int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
198 long fpregs[HOST_XFP_SIZE]; 198 long fpregs[HOST_XFP_SIZE];
199 199
200 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 200 BUG_ON(sizeof(*buf) != sizeof(fpregs));
201 n = copy_from_user(fpregs, (void *) buf, sizeof(fpregs)); 201 n = copy_from_user(fpregs, buf, sizeof(fpregs));
202 if (n > 0) 202 if (n > 0)
203 return -EFAULT; 203 return -EFAULT;
204 204
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c
index a3cfeed17af4..b7631b0e9ddc 100644
--- a/arch/um/sys-x86_64/ptrace.c
+++ b/arch/um/sys-x86_64/ptrace.c
@@ -154,7 +154,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
154 if (err) 154 if (err)
155 return err; 155 return err;
156 156
157 n = copy_to_user((void *) buf, fpregs, sizeof(fpregs)); 157 n = copy_to_user(buf, fpregs, sizeof(fpregs));
158 if(n > 0) 158 if(n > 0)
159 return -EFAULT; 159 return -EFAULT;
160 160
@@ -167,7 +167,7 @@ int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
167 long fpregs[HOST_FP_SIZE]; 167 long fpregs[HOST_FP_SIZE];
168 168
169 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 169 BUG_ON(sizeof(*buf) != sizeof(fpregs));
170 n = copy_from_user(fpregs, (void *) buf, sizeof(fpregs)); 170 n = copy_from_user(fpregs, buf, sizeof(fpregs));
171 if (n > 0) 171 if (n > 0)
172 return -EFAULT; 172 return -EFAULT;
173 173
diff --git a/arch/i386/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 0e2adadf5905..0e2adadf5905 100644
--- a/arch/i386/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
diff --git a/arch/i386/Kconfig.debug b/arch/x86/Kconfig.debug
index f03531eacdfb..761ca7b5f120 100644
--- a/arch/i386/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -1,13 +1,12 @@
1menu "Kernel hacking" 1menu "Kernel hacking"
2 2
3config TRACE_IRQFLAGS_SUPPORT 3config TRACE_IRQFLAGS_SUPPORT
4 bool 4 def_bool y
5 default y
6 5
7source "lib/Kconfig.debug" 6source "lib/Kconfig.debug"
8 7
9config EARLY_PRINTK 8config EARLY_PRINTK
10 bool "Early printk" if EMBEDDED && DEBUG_KERNEL 9 bool "Early printk" if EMBEDDED && DEBUG_KERNEL && X86_32
11 default y 10 default y
12 help 11 help
13 Write kernel log output directly into the VGA buffer or to a serial 12 Write kernel log output directly into the VGA buffer or to a serial
@@ -37,10 +36,12 @@ config DEBUG_STACK_USAGE
37 36
38comment "Page alloc debug is incompatible with Software Suspend on i386" 37comment "Page alloc debug is incompatible with Software Suspend on i386"
39 depends on DEBUG_KERNEL && HIBERNATION 38 depends on DEBUG_KERNEL && HIBERNATION
39 depends on X86_32
40 40
41config DEBUG_PAGEALLOC 41config DEBUG_PAGEALLOC
42 bool "Debug page memory allocations" 42 bool "Debug page memory allocations"
43 depends on DEBUG_KERNEL && !HIBERNATION && !HUGETLBFS 43 depends on DEBUG_KERNEL && !HIBERNATION && !HUGETLBFS
44 depends on X86_32
44 help 45 help
45 Unmap pages from the kernel linear mapping after free_pages(). 46 Unmap pages from the kernel linear mapping after free_pages().
46 This results in a large slowdown, but helps to find certain types 47 This results in a large slowdown, but helps to find certain types
@@ -59,6 +60,7 @@ config DEBUG_RODATA
59config 4KSTACKS 60config 4KSTACKS
60 bool "Use 4Kb for kernel stacks instead of 8Kb" 61 bool "Use 4Kb for kernel stacks instead of 8Kb"
61 depends on DEBUG_KERNEL 62 depends on DEBUG_KERNEL
63 depends on X86_32
62 help 64 help
63 If you say Y here the kernel will use a 4Kb stacksize for the 65 If you say Y here the kernel will use a 4Kb stacksize for the
64 kernel stack attached to each process/thread. This facilitates 66 kernel stack attached to each process/thread. This facilitates
@@ -67,22 +69,47 @@ config 4KSTACKS
67 will also use IRQ stacks to compensate for the reduced stackspace. 69 will also use IRQ stacks to compensate for the reduced stackspace.
68 70
69config X86_FIND_SMP_CONFIG 71config X86_FIND_SMP_CONFIG
70 bool 72 def_bool y
71 depends on X86_LOCAL_APIC || X86_VOYAGER 73 depends on X86_LOCAL_APIC || X86_VOYAGER
72 default y 74 depends on X86_32
73 75
74config X86_MPPARSE 76config X86_MPPARSE
75 bool 77 def_bool y
76 depends on X86_LOCAL_APIC && !X86_VISWS 78 depends on X86_LOCAL_APIC && !X86_VISWS
77 default y 79 depends on X86_32
78 80
79config DOUBLEFAULT 81config DOUBLEFAULT
80 default y 82 default y
81 bool "Enable doublefault exception handler" if EMBEDDED 83 bool "Enable doublefault exception handler" if EMBEDDED
84 depends on X86_32
85 help
86 This option allows trapping of rare doublefault exceptions that
87 would otherwise cause a system to silently reboot. Disabling this
88 option saves about 4k and might cause you much additional grey
89 hair.
90
91config IOMMU_DEBUG
92 bool "Enable IOMMU debugging"
93 depends on GART_IOMMU && DEBUG_KERNEL
94 depends on X86_64
95 help
96 Force the IOMMU to on even when you have less than 4GB of
97 memory and add debugging code. On overflow always panic. And
98 allow to enable IOMMU leak tracing. Can be disabled at boot
99 time with iommu=noforce. This will also enable scatter gather
100 list merging. Currently not recommended for production
101 code. When you use it make sure you have a big enough
102 IOMMU/AGP aperture. Most of the options enabled by this can
103 be set more finegrained using the iommu= command line
104 options. See Documentation/x86_64/boot-options.txt for more
105 details.
106
107config IOMMU_LEAK
108 bool "IOMMU leak tracing"
109 depends on DEBUG_KERNEL
110 depends on IOMMU_DEBUG
82 help 111 help
83 This option allows trapping of rare doublefault exceptions that 112 Add a simple leak tracer to the IOMMU code. This is useful when you
84 would otherwise cause a system to silently reboot. Disabling this 113 are debugging a buggy device driver that leaks IOMMU mappings.
85 option saves about 4k and might cause you much additional grey
86 hair.
87 114
88endmenu 115endmenu
diff --git a/arch/i386/Kconfig b/arch/x86/Kconfig.i386
index b4437ce0f973..7331efe891a7 100644
--- a/arch/i386/Kconfig
+++ b/arch/x86/Kconfig.i386
@@ -287,7 +287,7 @@ config ES7000_CLUSTERED_APIC
287 default y 287 default y
288 depends on SMP && X86_ES7000 && MPENTIUMIII 288 depends on SMP && X86_ES7000 && MPENTIUMIII
289 289
290source "arch/i386/Kconfig.cpu" 290source "arch/x86/Kconfig.cpu"
291 291
292config HPET_TIMER 292config HPET_TIMER
293 bool "HPET Timer Support" 293 bool "HPET Timer Support"
@@ -1272,7 +1272,7 @@ source "fs/Kconfig"
1272 1272
1273source "kernel/Kconfig.instrumentation" 1273source "kernel/Kconfig.instrumentation"
1274 1274
1275source "arch/i386/Kconfig.debug" 1275source "arch/x86/Kconfig.debug"
1276 1276
1277source "security/Kconfig" 1277source "security/Kconfig"
1278 1278
diff --git a/arch/x86_64/Kconfig b/arch/x86/Kconfig.x86_64
index 308970aa5382..cc468ea61240 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86/Kconfig.x86_64
@@ -97,10 +97,6 @@ config X86_CMPXCHG
97 bool 97 bool
98 default y 98 default y
99 99
100config EARLY_PRINTK
101 bool
102 default y
103
104config GENERIC_ISA_DMA 100config GENERIC_ISA_DMA
105 bool 101 bool
106 default y 102 default y
@@ -479,8 +475,8 @@ config HPET_EMULATE_RTC
479 475
480# Mark as embedded because too many people got it wrong. 476# Mark as embedded because too many people got it wrong.
481# The code disables itself when not needed. 477# The code disables itself when not needed.
482config IOMMU 478config GART_IOMMU
483 bool "IOMMU support" if EMBEDDED 479 bool "GART IOMMU support" if EMBEDDED
484 default y 480 default y
485 select SWIOTLB 481 select SWIOTLB
486 select AGP 482 select AGP
@@ -687,7 +683,7 @@ source kernel/Kconfig.hz
687 683
688config K8_NB 684config K8_NB
689 def_bool y 685 def_bool y
690 depends on AGP_AMD64 || IOMMU || (PCI && NUMA) 686 depends on AGP_AMD64 || GART_IOMMU || (PCI && NUMA)
691 687
692endmenu 688endmenu
693 689
@@ -753,7 +749,6 @@ config PCI_DOMAINS
753config DMAR 749config DMAR
754 bool "Support for DMA Remapping Devices (EXPERIMENTAL)" 750 bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
755 depends on PCI_MSI && ACPI && EXPERIMENTAL 751 depends on PCI_MSI && ACPI && EXPERIMENTAL
756 default y
757 help 752 help
758 DMA remapping (DMAR) devices support enables independent address 753 DMA remapping (DMAR) devices support enables independent address
759 translations for Direct Memory Access (DMA) from devices. 754 translations for Direct Memory Access (DMA) from devices.
@@ -835,7 +830,7 @@ source fs/Kconfig
835 830
836source "kernel/Kconfig.instrumentation" 831source "kernel/Kconfig.instrumentation"
837 832
838source "arch/x86_64/Kconfig.debug" 833source "arch/x86/Kconfig.debug"
839 834
840source "security/Kconfig" 835source "security/Kconfig"
841 836
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
new file mode 100644
index 000000000000..309597386a77
--- /dev/null
+++ b/arch/x86/Makefile
@@ -0,0 +1,16 @@
1# Unified Makefile for i386 and x86_64
2
3# select defconfig based on actual architecture
4KBUILD_DEFCONFIG := $(ARCH)_defconfig
5
6# # No need to remake these files
7$(srctree)/arch/x86/Makefile%: ;
8
9ifeq ($(ARCH),i386)
10 include $(srctree)/arch/x86/Makefile_32
11else
12 include $(srctree)/arch/x86/Makefile_64
13endif
14
15
16
diff --git a/arch/i386/Makefile b/arch/x86/Makefile_32
index f5b9a37def8b..346ac0766875 100644
--- a/arch/i386/Makefile
+++ b/arch/x86/Makefile_32
@@ -1,5 +1,5 @@
1# 1#
2# i386/Makefile 2# i386 Makefile
3# 3#
4# This file is included by the global makefile so that you can add your own 4# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies. Remember to do have actions 5# architecture-specific flags and dependencies. Remember to do have actions
@@ -17,9 +17,6 @@
17# 20050320 Kianusch Sayah Karadji <kianusch@sk-tech.net> 17# 20050320 Kianusch Sayah Karadji <kianusch@sk-tech.net>
18# Added support for GEODE CPU 18# Added support for GEODE CPU
19 19
20# Fill in SRCARCH
21SRCARCH := x86
22
23# BITS is used as extension for files which are available in a 32 bit 20# BITS is used as extension for files which are available in a 32 bit
24# and a 64 bit version to simplify shared Makefiles. 21# and a 64 bit version to simplify shared Makefiles.
25# e.g.: obj-y += foo_$(BITS).o 22# e.g.: obj-y += foo_$(BITS).o
@@ -46,7 +43,7 @@ KBUILD_CFLAGS += -pipe -msoft-float -mregparm=3 -freg-struct-return
46KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2) 43KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2)
47 44
48# CPU-specific tuning. Anything which can be shared with UML should go here. 45# CPU-specific tuning. Anything which can be shared with UML should go here.
49include $(srctree)/arch/i386/Makefile.cpu 46include $(srctree)/arch/x86/Makefile_32.cpu
50 47
51# temporary until string.h is fixed 48# temporary until string.h is fixed
52cflags-y += -ffreestanding 49cflags-y += -ffreestanding
diff --git a/arch/i386/Makefile.cpu b/arch/x86/Makefile_32.cpu
index e372b584e919..e372b584e919 100644
--- a/arch/i386/Makefile.cpu
+++ b/arch/x86/Makefile_32.cpu
diff --git a/arch/x86_64/Makefile b/arch/x86/Makefile_64
index 20eb69bd5a6d..57e714a47af7 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86/Makefile_64
@@ -1,5 +1,5 @@
1# 1#
2# x86_64/Makefile 2# x86_64 Makefile
3# 3#
4# This file is included by the global makefile so that you can add your own 4# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies. Remember to do have actions 5# architecture-specific flags and dependencies. Remember to do have actions
@@ -21,9 +21,6 @@
21# 21#
22# $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $ 22# $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $
23 23
24# Fill in SRCARCH
25SRCARCH := x86
26
27# BITS is used as extension for files which are available in a 32 bit 24# BITS is used as extension for files which are available in a 32 bit
28# and a 64 bit version to simplify shared Makefiles. 25# and a 64 bit version to simplify shared Makefiles.
29# e.g.: obj-y += foo_$(BITS).o 26# e.g.: obj-y += foo_$(BITS).o
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index 5f9a2e72a731..d2b5adf46512 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -17,6 +17,8 @@
17#ifndef BOOT_BOOT_H 17#ifndef BOOT_BOOT_H
18#define BOOT_BOOT_H 18#define BOOT_BOOT_H
19 19
20#define STACK_SIZE 512 /* Minimum number of bytes for stack */
21
20#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
21 23
22#include <stdarg.h> 24#include <stdarg.h>
@@ -198,8 +200,6 @@ static inline int isdigit(int ch)
198} 200}
199 201
200/* Heap -- available for dynamic lists. */ 202/* Heap -- available for dynamic lists. */
201#define STACK_SIZE 512 /* Minimum number of bytes for stack */
202
203extern char _end[]; 203extern char _end[];
204extern char *HEAP; 204extern char *HEAP;
205extern char *heap_end; 205extern char *heap_end;
@@ -216,9 +216,9 @@ static inline char *__get_heap(size_t s, size_t a, size_t n)
216#define GET_HEAP(type, n) \ 216#define GET_HEAP(type, n) \
217 ((type *)__get_heap(sizeof(type),__alignof__(type),(n))) 217 ((type *)__get_heap(sizeof(type),__alignof__(type),(n)))
218 218
219static inline int heap_free(void) 219static inline bool heap_free(size_t n)
220{ 220{
221 return heap_end-HEAP; 221 return (int)(heap_end-HEAP) >= (int)n;
222} 222}
223 223
224/* copy.S */ 224/* copy.S */
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
index a0ae2e7f6cec..036e635f18a3 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -33,24 +33,20 @@
33 .globl startup_32 33 .globl startup_32
34 34
35startup_32: 35startup_32:
36 /* check to see if KEEP_SEGMENTS flag is meaningful */ 36 cld
37 cmpw $0x207, BP_version(%esi)
38 jb 1f
39
40 /* test KEEP_SEGMENTS flag to see if the bootloader is asking 37 /* test KEEP_SEGMENTS flag to see if the bootloader is asking
41 * us to not reload segments */ 38 * us to not reload segments */
42 testb $(1<<6), BP_loadflags(%esi) 39 testb $(1<<6), BP_loadflags(%esi)
43 jnz 2f 40 jnz 1f
44 41
451: cli 42 cli
46 movl $(__BOOT_DS),%eax 43 movl $(__BOOT_DS),%eax
47 movl %eax,%ds 44 movl %eax,%ds
48 movl %eax,%es 45 movl %eax,%es
49 movl %eax,%fs 46 movl %eax,%fs
50 movl %eax,%gs 47 movl %eax,%gs
51 movl %eax,%ss 48 movl %eax,%ss
52 491:
532: cld
54 50
55/* Calculate the delta between where we were compiled to run 51/* Calculate the delta between where we were compiled to run
56 * at and where we were actually loaded at. This can only be done 52 * at and where we were actually loaded at. This can only be done
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index 49467640751f..1ccb38a7f0d2 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -29,6 +29,7 @@
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/page.h> 30#include <asm/page.h>
31#include <asm/msr.h> 31#include <asm/msr.h>
32#include <asm/asm-offsets.h>
32 33
33.section ".text.head" 34.section ".text.head"
34 .code32 35 .code32
@@ -36,11 +37,17 @@
36 37
37startup_32: 38startup_32:
38 cld 39 cld
40 /* test KEEP_SEGMENTS flag to see if the bootloader is asking
41 * us to not reload segments */
42 testb $(1<<6), BP_loadflags(%esi)
43 jnz 1f
44
39 cli 45 cli
40 movl $(__KERNEL_DS), %eax 46 movl $(__KERNEL_DS), %eax
41 movl %eax, %ds 47 movl %eax, %ds
42 movl %eax, %es 48 movl %eax, %es
43 movl %eax, %ss 49 movl %eax, %ss
501:
44 51
45/* Calculate the delta between where we were compiled to run 52/* Calculate the delta between where we were compiled to run
46 * at and where we were actually loaded at. This can only be done 53 * at and where we were actually loaded at. This can only be done
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 8353c81c41c0..6ef5a060fa11 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -173,7 +173,8 @@ ramdisk_size: .long 0 # its size in bytes
173bootsect_kludge: 173bootsect_kludge:
174 .long 0 # obsolete 174 .long 0 # obsolete
175 175
176heap_end_ptr: .word _end+1024 # (Header version 0x0201 or later) 176heap_end_ptr: .word _end+STACK_SIZE-512
177 # (Header version 0x0201 or later)
177 # space from here (exclusive) down to 178 # space from here (exclusive) down to
178 # end of setup code can be used by setup 179 # end of setup code can be used by setup
179 # for local heap purposes. 180 # for local heap purposes.
@@ -230,28 +231,53 @@ start_of_setup:
230 int $0x13 231 int $0x13
231#endif 232#endif
232 233
233# We will have entered with %cs = %ds+0x20, normalize %cs so
234# it is on par with the other segments.
235 pushw %ds
236 pushw $setup2
237 lretw
238
239setup2:
240# Force %es = %ds 234# Force %es = %ds
241 movw %ds, %ax 235 movw %ds, %ax
242 movw %ax, %es 236 movw %ax, %es
243 cld 237 cld
244 238
245# Stack paranoia: align the stack and make sure it is good 239# Apparently some ancient versions of LILO invoked the kernel
246# for both 16- and 32-bit references. In particular, if we 240# with %ss != %ds, which happened to work by accident for the
247# were meant to have been using the full 16-bit segment, the 241# old code. If the CAN_USE_HEAP flag is set in loadflags, or
248# caller might have set %sp to zero, which breaks %esp-based 242# %ss != %ds, then adjust the stack pointer.
249# references. 243
250 andw $~3, %sp # dword align (might as well...) 244 # Smallest possible stack we can tolerate
251 jnz 1f 245 movw $(_end+STACK_SIZE), %cx
252 movw $0xfffc, %sp # Make sure we're not zero 246
2531: movzwl %sp, %esp # Clear upper half of %esp 247 movw heap_end_ptr, %dx
254 sti 248 addw $512, %dx
249 jnc 1f
250 xorw %dx, %dx # Wraparound - whole segment available
2511: testb $CAN_USE_HEAP, loadflags
252 jnz 2f
253
254 # No CAN_USE_HEAP
255 movw %ss, %dx
256 cmpw %ax, %dx # %ds == %ss?
257 movw %sp, %dx
258 # If so, assume %sp is reasonably set, otherwise use
259 # the smallest possible stack.
260 jne 4f # -> Smallest possible stack...
261
262 # Make sure the stack is at least minimum size. Take a value
263 # of zero to mean "full segment."
2642:
265 andw $~3, %dx # dword align (might as well...)
266 jnz 3f
267 movw $0xfffc, %dx # Make sure we're not zero
2683: cmpw %cx, %dx
269 jnb 5f
2704: movw %cx, %dx # Minimum value we can possibly use
2715: movw %ax, %ss
272 movzwl %dx, %esp # Clear upper half of %esp
273 sti # Now we should have a working stack
274
275# We will have entered with %cs = %ds+0x20, normalize %cs so
276# it is on par with the other segments.
277 pushw %ds
278 pushw $6f
279 lretw
2806:
255 281
256# Check signature at end of setup 282# Check signature at end of setup
257 cmpl $0x5a5aaa55, setup_sig 283 cmpl $0x5a5aaa55, setup_sig
diff --git a/arch/x86/boot/video-bios.c b/arch/x86/boot/video-bios.c
index 68e65d95cdfd..ed0672a81870 100644
--- a/arch/x86/boot/video-bios.c
+++ b/arch/x86/boot/video-bios.c
@@ -79,7 +79,7 @@ static int bios_probe(void)
79 video_bios.modes = GET_HEAP(struct mode_info, 0); 79 video_bios.modes = GET_HEAP(struct mode_info, 0);
80 80
81 for (mode = 0x14; mode <= 0x7f; mode++) { 81 for (mode = 0x14; mode <= 0x7f; mode++) {
82 if (heap_free() < sizeof(struct mode_info)) 82 if (!heap_free(sizeof(struct mode_info)))
83 break; 83 break;
84 84
85 if (mode_defined(VIDEO_FIRST_BIOS+mode)) 85 if (mode_defined(VIDEO_FIRST_BIOS+mode))
diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c
index 192190710710..4716b9a96357 100644
--- a/arch/x86/boot/video-vesa.c
+++ b/arch/x86/boot/video-vesa.c
@@ -57,7 +57,7 @@ static int vesa_probe(void)
57 while ((mode = rdfs16(mode_ptr)) != 0xffff) { 57 while ((mode = rdfs16(mode_ptr)) != 0xffff) {
58 mode_ptr += 2; 58 mode_ptr += 2;
59 59
60 if (heap_free() < sizeof(struct mode_info)) 60 if (!heap_free(sizeof(struct mode_info)))
61 break; /* Heap full, can't save mode info */ 61 break; /* Heap full, can't save mode info */
62 62
63 if (mode & ~0x1ff) 63 if (mode & ~0x1ff)
diff --git a/arch/x86/boot/video.c b/arch/x86/boot/video.c
index e4ba897bf9a3..ad9712f01739 100644
--- a/arch/x86/boot/video.c
+++ b/arch/x86/boot/video.c
@@ -371,7 +371,7 @@ static void save_screen(void)
371 saved.curx = boot_params.screen_info.orig_x; 371 saved.curx = boot_params.screen_info.orig_x;
372 saved.cury = boot_params.screen_info.orig_y; 372 saved.cury = boot_params.screen_info.orig_y;
373 373
374 if (heap_free() < saved.x*saved.y*sizeof(u16)+512) 374 if (!heap_free(saved.x*saved.y*sizeof(u16)+512))
375 return; /* Not enough heap to save the screen */ 375 return; /* Not enough heap to save the screen */
376 376
377 saved.data = GET_HEAP(u16, saved.x*saved.y); 377 saved.data = GET_HEAP(u16, saved.x*saved.y);
diff --git a/arch/i386/defconfig b/arch/x86/configs/i386_defconfig
index 54ee1764fdae..54ee1764fdae 100644
--- a/arch/i386/defconfig
+++ b/arch/x86/configs/i386_defconfig
diff --git a/arch/x86_64/defconfig b/arch/x86/configs/x86_64_defconfig
index b091c5e35558..38a83f9c966f 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -170,7 +170,7 @@ CONFIG_HOTPLUG_CPU=y
170CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 170CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
171CONFIG_HPET_TIMER=y 171CONFIG_HPET_TIMER=y
172CONFIG_HPET_EMULATE_RTC=y 172CONFIG_HPET_EMULATE_RTC=y
173CONFIG_IOMMU=y 173CONFIG_GART_IOMMU=y
174# CONFIG_CALGARY_IOMMU is not set 174# CONFIG_CALGARY_IOMMU is not set
175CONFIG_SWIOTLB=y 175CONFIG_SWIOTLB=y
176CONFIG_X86_MCE=y 176CONFIG_X86_MCE=y
diff --git a/arch/x86/kernel/Makefile_64 b/arch/x86/kernel/Makefile_64
index 466337ae9a1e..24671c3838b3 100644
--- a/arch/x86/kernel/Makefile_64
+++ b/arch/x86/kernel/Makefile_64
@@ -25,7 +25,7 @@ obj-$(CONFIG_CRASH_DUMP) += crash_dump_64.o
25obj-$(CONFIG_PM) += suspend_64.o 25obj-$(CONFIG_PM) += suspend_64.o
26obj-$(CONFIG_HIBERNATION) += suspend_asm_64.o 26obj-$(CONFIG_HIBERNATION) += suspend_asm_64.o
27obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 27obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
28obj-$(CONFIG_IOMMU) += pci-gart_64.o aperture_64.o 28obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o
29obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o 29obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o
30obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o 30obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o
31obj-$(CONFIG_KPROBES) += kprobes_64.o 31obj-$(CONFIG_KPROBES) += kprobes_64.o
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
index 2ed0a4ce62f0..f63e5ff0aca1 100644
--- a/arch/x86/kernel/acpi/processor.c
+++ b/arch/x86/kernel/acpi/processor.c
@@ -62,8 +62,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
62/* Initialize _PDC data based on the CPU vendor */ 62/* Initialize _PDC data based on the CPU vendor */
63void arch_acpi_processor_init_pdc(struct acpi_processor *pr) 63void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
64{ 64{
65 unsigned int cpu = pr->id; 65 struct cpuinfo_x86 *c = &cpu_data(pr->id);
66 struct cpuinfo_x86 *c = &cpu_data(cpu);
67 66
68 pr->pdc = NULL; 67 pr->pdc = NULL;
69 if (c->x86_vendor == X86_VENDOR_INTEL) 68 if (c->x86_vendor == X86_VENDOR_INTEL)
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 8f681cae7bf7..5b6992799c9d 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -20,14 +20,14 @@
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <asm/e820.h> 21#include <asm/e820.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/iommu.h> 23#include <asm/gart.h>
24#include <asm/pci-direct.h> 24#include <asm/pci-direct.h>
25#include <asm/dma.h> 25#include <asm/dma.h>
26#include <asm/k8.h> 26#include <asm/k8.h>
27 27
28int iommu_aperture; 28int gart_iommu_aperture;
29int iommu_aperture_disabled __initdata = 0; 29int gart_iommu_aperture_disabled __initdata = 0;
30int iommu_aperture_allowed __initdata = 0; 30int gart_iommu_aperture_allowed __initdata = 0;
31 31
32int fallback_aper_order __initdata = 1; /* 64MB */ 32int fallback_aper_order __initdata = 1; /* 64MB */
33int fallback_aper_force __initdata = 0; 33int fallback_aper_force __initdata = 0;
@@ -204,14 +204,15 @@ static __u32 __init search_agp_bridge(u32 *order, int *valid_agp)
204 return 0; 204 return 0;
205} 205}
206 206
207void __init iommu_hole_init(void) 207void __init gart_iommu_hole_init(void)
208{ 208{
209 int fix, num; 209 int fix, num;
210 u32 aper_size, aper_alloc = 0, aper_order = 0, last_aper_order = 0; 210 u32 aper_size, aper_alloc = 0, aper_order = 0, last_aper_order = 0;
211 u64 aper_base, last_aper_base = 0; 211 u64 aper_base, last_aper_base = 0;
212 int valid_agp = 0; 212 int valid_agp = 0;
213 213
214 if (iommu_aperture_disabled || !fix_aperture || !early_pci_allowed()) 214 if (gart_iommu_aperture_disabled || !fix_aperture ||
215 !early_pci_allowed())
215 return; 216 return;
216 217
217 printk(KERN_INFO "Checking aperture...\n"); 218 printk(KERN_INFO "Checking aperture...\n");
@@ -222,7 +223,7 @@ void __init iommu_hole_init(void)
222 continue; 223 continue;
223 224
224 iommu_detected = 1; 225 iommu_detected = 1;
225 iommu_aperture = 1; 226 gart_iommu_aperture = 1;
226 227
227 aper_order = (read_pci_config(0, num, 3, 0x90) >> 1) & 7; 228 aper_order = (read_pci_config(0, num, 3, 0x90) >> 1) & 7;
228 aper_size = (32 * 1024 * 1024) << aper_order; 229 aper_size = (32 * 1024 * 1024) << aper_order;
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 7e50bda565b4..d1b6ed98774e 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -15,12 +15,16 @@
15#include <asm/segment.h> 15#include <asm/segment.h>
16#include <asm/thread_info.h> 16#include <asm/thread_info.h>
17#include <asm/ia32.h> 17#include <asm/ia32.h>
18#include <asm/bootparam.h>
18 19
19#define DEFINE(sym, val) \ 20#define DEFINE(sym, val) \
20 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 21 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
21 22
22#define BLANK() asm volatile("\n->" : : ) 23#define BLANK() asm volatile("\n->" : : )
23 24
25#define OFFSET(sym, str, mem) \
26 DEFINE(sym, offsetof(struct str, mem))
27
24#define __NO_STUBS 1 28#define __NO_STUBS 1
25#undef __SYSCALL 29#undef __SYSCALL
26#undef _ASM_X86_64_UNISTD_H_ 30#undef _ASM_X86_64_UNISTD_H_
@@ -109,5 +113,11 @@ int main(void)
109 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx)); 113 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
110 BLANK(); 114 BLANK();
111 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1); 115 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
116
117 BLANK();
118 OFFSET(BP_scratch, boot_params, scratch);
119 OFFSET(BP_loadflags, boot_params, hdr.loadflags);
120 OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
121 OFFSET(BP_version, boot_params, hdr.version);
112 return 0; 122 return 0;
113} 123}
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 2d42b414b777..066f8c6af4df 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -49,7 +49,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
49 /* Intel-defined (#2) */ 49 /* Intel-defined (#2) */
50 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", 50 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est",
51 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, 51 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL,
52 NULL, NULL, "dca", NULL, NULL, NULL, NULL, "popcnt", 52 NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt",
53 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 53 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
54 54
55 /* VIA/Cyrix/Centaur-defined */ 55 /* VIA/Cyrix/Centaur-defined */
@@ -59,10 +59,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
59 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 59 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
60 60
61 /* AMD-defined (#2) */ 61 /* AMD-defined (#2) */
62 "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy", 62 "lahf_lm", "cmp_legacy", "svm", "extapic",
63 "altmovcr8", "abm", "sse4a", 63 "cr8_legacy", "abm", "sse4a", "misalignsse",
64 "misalignsse", "3dnowprefetch", 64 "3dnowprefetch", "osvw", "ibs", "sse5",
65 "osvw", "ibs", NULL, NULL, NULL, NULL, 65 "skinit", "wdt", NULL, NULL,
66 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 66 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
67 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 67 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
68 68
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index af0253f94a9a..8bb482ff091b 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -25,7 +25,7 @@
25#include <linux/kdebug.h> 25#include <linux/kdebug.h>
26#include <asm/smp.h> 26#include <asm/smp.h>
27 27
28#ifdef X86_32 28#ifdef CONFIG_X86_32
29#include <mach_ipi.h> 29#include <mach_ipi.h>
30#else 30#else
31#include <asm/mach_apic.h> 31#include <asm/mach_apic.h>
@@ -41,7 +41,7 @@ static int crash_nmi_callback(struct notifier_block *self,
41 unsigned long val, void *data) 41 unsigned long val, void *data)
42{ 42{
43 struct pt_regs *regs; 43 struct pt_regs *regs;
44#ifdef X86_32 44#ifdef CONFIG_X86_32
45 struct pt_regs fixed_regs; 45 struct pt_regs fixed_regs;
46#endif 46#endif
47 int cpu; 47 int cpu;
@@ -60,7 +60,7 @@ static int crash_nmi_callback(struct notifier_block *self,
60 return NOTIFY_STOP; 60 return NOTIFY_STOP;
61 local_irq_disable(); 61 local_irq_disable();
62 62
63#ifdef X86_32 63#ifdef CONFIG_X86_32
64 if (!user_mode_vm(regs)) { 64 if (!user_mode_vm(regs)) {
65 crash_fixup_ss_esp(&fixed_regs, regs); 65 crash_fixup_ss_esp(&fixed_regs, regs);
66 regs = &fixed_regs; 66 regs = &fixed_regs;
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index dc34acbd54aa..88bb83ec895f 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -17,30 +17,32 @@
17#include <asm/io_apic.h> 17#include <asm/io_apic.h>
18#include <asm/apic.h> 18#include <asm/apic.h>
19 19
20#ifdef CONFIG_IOMMU 20#ifdef CONFIG_GART_IOMMU
21#include <asm/iommu.h> 21#include <asm/gart.h>
22#endif 22#endif
23 23
24static void __init via_bugs(void) 24static void __init via_bugs(void)
25{ 25{
26#ifdef CONFIG_IOMMU 26#ifdef CONFIG_GART_IOMMU
27 if ((end_pfn > MAX_DMA32_PFN || force_iommu) && 27 if ((end_pfn > MAX_DMA32_PFN || force_iommu) &&
28 !iommu_aperture_allowed) { 28 !gart_iommu_aperture_allowed) {
29 printk(KERN_INFO 29 printk(KERN_INFO
30 "Looks like a VIA chipset. Disabling IOMMU." 30 "Looks like a VIA chipset. Disabling IOMMU."
31 " Override with iommu=allowed\n"); 31 " Override with iommu=allowed\n");
32 iommu_aperture_disabled = 1; 32 gart_iommu_aperture_disabled = 1;
33 } 33 }
34#endif 34#endif
35} 35}
36 36
37#ifdef CONFIG_ACPI 37#ifdef CONFIG_ACPI
38#ifdef CONFIG_X86_IO_APIC
38 39
39static int __init nvidia_hpet_check(struct acpi_table_header *header) 40static int __init nvidia_hpet_check(struct acpi_table_header *header)
40{ 41{
41 return 0; 42 return 0;
42} 43}
43#endif 44#endif /* CONFIG_X86_IO_APIC */
45#endif /* CONFIG_ACPI */
44 46
45static void __init nvidia_bugs(void) 47static void __init nvidia_bugs(void)
46{ 48{
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 0d8577f05422..aa3d2c8f7737 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -233,6 +233,8 @@ NORET_TYPE void machine_kexec(struct kimage *image)
233 233
234void arch_crash_save_vmcoreinfo(void) 234void arch_crash_save_vmcoreinfo(void)
235{ 235{
236 VMCOREINFO_SYMBOL(init_level4_pgt);
237
236#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE 238#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
237 VMCOREINFO_SYMBOL(node_data); 239 VMCOREINFO_SYMBOL(node_data);
238 VMCOREINFO_LENGTH(node_data, MAX_NUMNODES); 240 VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 1a20fe31338b..6bf1f716909d 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -36,7 +36,7 @@
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/scatterlist.h> 38#include <linux/scatterlist.h>
39#include <asm/iommu.h> 39#include <asm/gart.h>
40#include <asm/calgary.h> 40#include <asm/calgary.h>
41#include <asm/tce.h> 41#include <asm/tce.h>
42#include <asm/pci-direct.h> 42#include <asm/pci-direct.h>
diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index 393e2725a6e3..aa805b11b24f 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -9,7 +9,7 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/dmar.h> 10#include <linux/dmar.h>
11#include <asm/io.h> 11#include <asm/io.h>
12#include <asm/iommu.h> 12#include <asm/gart.h>
13#include <asm/calgary.h> 13#include <asm/calgary.h>
14 14
15int iommu_merge __read_mostly = 1; 15int iommu_merge __read_mostly = 1;
@@ -275,7 +275,7 @@ __init int iommu_setup(char *p)
275 swiotlb = 1; 275 swiotlb = 1;
276#endif 276#endif
277 277
278#ifdef CONFIG_IOMMU 278#ifdef CONFIG_GART_IOMMU
279 gart_parse_options(p); 279 gart_parse_options(p);
280#endif 280#endif
281 281
@@ -298,8 +298,8 @@ void __init pci_iommu_alloc(void)
298 * The order of these functions is important for 298 * The order of these functions is important for
299 * fall-back/fail-over reasons 299 * fall-back/fail-over reasons
300 */ 300 */
301#ifdef CONFIG_IOMMU 301#ifdef CONFIG_GART_IOMMU
302 iommu_hole_init(); 302 gart_iommu_hole_init();
303#endif 303#endif
304 304
305#ifdef CONFIG_CALGARY_IOMMU 305#ifdef CONFIG_CALGARY_IOMMU
@@ -321,7 +321,7 @@ static int __init pci_iommu_init(void)
321 321
322 intel_iommu_init(); 322 intel_iommu_init();
323 323
324#ifdef CONFIG_IOMMU 324#ifdef CONFIG_GART_IOMMU
325 gart_iommu_init(); 325 gart_iommu_init();
326#endif 326#endif
327 327
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index c56e9ee64964..06bcba536045 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -30,17 +30,17 @@
30#include <asm/mtrr.h> 30#include <asm/mtrr.h>
31#include <asm/pgtable.h> 31#include <asm/pgtable.h>
32#include <asm/proto.h> 32#include <asm/proto.h>
33#include <asm/iommu.h> 33#include <asm/gart.h>
34#include <asm/cacheflush.h> 34#include <asm/cacheflush.h>
35#include <asm/swiotlb.h> 35#include <asm/swiotlb.h>
36#include <asm/dma.h> 36#include <asm/dma.h>
37#include <asm/k8.h> 37#include <asm/k8.h>
38 38
39unsigned long iommu_bus_base; /* GART remapping area (physical) */ 39static unsigned long iommu_bus_base; /* GART remapping area (physical) */
40static unsigned long iommu_size; /* size of remapping area bytes */ 40static unsigned long iommu_size; /* size of remapping area bytes */
41static unsigned long iommu_pages; /* .. and in pages */ 41static unsigned long iommu_pages; /* .. and in pages */
42 42
43u32 *iommu_gatt_base; /* Remapping table */ 43static u32 *iommu_gatt_base; /* Remapping table */
44 44
45/* If this is disabled the IOMMU will use an optimized flushing strategy 45/* If this is disabled the IOMMU will use an optimized flushing strategy
46 of only flushing when an mapping is reused. With it true the GART is flushed 46 of only flushing when an mapping is reused. With it true the GART is flushed
@@ -135,8 +135,8 @@ static void flush_gart(void)
135/* Debugging aid for drivers that don't free their IOMMU tables */ 135/* Debugging aid for drivers that don't free their IOMMU tables */
136static void **iommu_leak_tab; 136static void **iommu_leak_tab;
137static int leak_trace; 137static int leak_trace;
138int iommu_leak_pages = 20; 138static int iommu_leak_pages = 20;
139void dump_leak(void) 139static void dump_leak(void)
140{ 140{
141 int i; 141 int i;
142 static int dump; 142 static int dump;
@@ -338,7 +338,6 @@ static int __dma_map_cont(struct scatterlist *start, int nelems,
338 338
339 BUG_ON(s != start && s->offset); 339 BUG_ON(s != start && s->offset);
340 if (s == start) { 340 if (s == start) {
341 *sout = *s;
342 sout->dma_address = iommu_bus_base; 341 sout->dma_address = iommu_bus_base;
343 sout->dma_address += iommu_page*PAGE_SIZE + s->offset; 342 sout->dma_address += iommu_page*PAGE_SIZE + s->offset;
344 sout->dma_length = s->length; 343 sout->dma_length = s->length;
@@ -365,7 +364,7 @@ static inline int dma_map_cont(struct scatterlist *start, int nelems,
365{ 364{
366 if (!need) { 365 if (!need) {
367 BUG_ON(nelems != 1); 366 BUG_ON(nelems != 1);
368 *sout = *start; 367 sout->dma_address = start->dma_address;
369 sout->dma_length = start->length; 368 sout->dma_length = start->length;
370 return 0; 369 return 0;
371 } 370 }
@@ -436,7 +435,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents,
436 435
437error: 436error:
438 flush_gart(); 437 flush_gart();
439 gart_unmap_sg(dev, sg, nents, dir); 438 gart_unmap_sg(dev, sg, out, dir);
440 /* When it was forced or merged try again in a dumb way */ 439 /* When it was forced or merged try again in a dumb way */
441 if (force_iommu || iommu_merge) { 440 if (force_iommu || iommu_merge) {
442 out = dma_map_sg_nonforce(dev, sg, nents, dir); 441 out = dma_map_sg_nonforce(dev, sg, nents, dir);
@@ -628,12 +627,12 @@ void __init gart_iommu_init(void)
628 return; 627 return;
629 628
630 /* Did we detect a different HW IOMMU? */ 629 /* Did we detect a different HW IOMMU? */
631 if (iommu_detected && !iommu_aperture) 630 if (iommu_detected && !gart_iommu_aperture)
632 return; 631 return;
633 632
634 if (no_iommu || 633 if (no_iommu ||
635 (!force_iommu && end_pfn <= MAX_DMA32_PFN) || 634 (!force_iommu && end_pfn <= MAX_DMA32_PFN) ||
636 !iommu_aperture || 635 !gart_iommu_aperture ||
637 (no_agp && init_k8_gatt(&info) < 0)) { 636 (no_agp && init_k8_gatt(&info) < 0)) {
638 if (end_pfn > MAX_DMA32_PFN) { 637 if (end_pfn > MAX_DMA32_PFN) {
639 printk(KERN_ERR "WARNING more than 4GB of memory " 638 printk(KERN_ERR "WARNING more than 4GB of memory "
@@ -734,9 +733,9 @@ void __init gart_parse_options(char *p)
734 fix_aperture = 0; 733 fix_aperture = 0;
735 /* duplicated from pci-dma.c */ 734 /* duplicated from pci-dma.c */
736 if (!strncmp(p,"force",5)) 735 if (!strncmp(p,"force",5))
737 iommu_aperture_allowed = 1; 736 gart_iommu_aperture_allowed = 1;
738 if (!strncmp(p,"allowed",7)) 737 if (!strncmp(p,"allowed",7))
739 iommu_aperture_allowed = 1; 738 gart_iommu_aperture_allowed = 1;
740 if (!strncmp(p, "memaper", 7)) { 739 if (!strncmp(p, "memaper", 7)) {
741 fallback_aper_force = 1; 740 fallback_aper_force = 1;
742 p += 7; 741 p += 7;
diff --git a/arch/x86/kernel/pci-nommu_64.c b/arch/x86/kernel/pci-nommu_64.c
index faf70bdca335..ab08e1832228 100644
--- a/arch/x86/kernel/pci-nommu_64.c
+++ b/arch/x86/kernel/pci-nommu_64.c
@@ -7,7 +7,7 @@
7#include <linux/dma-mapping.h> 7#include <linux/dma-mapping.h>
8#include <linux/scatterlist.h> 8#include <linux/scatterlist.h>
9 9
10#include <asm/iommu.h> 10#include <asm/gart.h>
11#include <asm/processor.h> 11#include <asm/processor.h>
12#include <asm/dma.h> 12#include <asm/dma.h>
13 13
diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index b2f405ea7c85..102866d729a5 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -5,7 +5,7 @@
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/dma-mapping.h> 6#include <linux/dma-mapping.h>
7 7
8#include <asm/iommu.h> 8#include <asm/gart.h>
9#include <asm/swiotlb.h> 9#include <asm/swiotlb.h>
10#include <asm/dma.h> 10#include <asm/dma.h>
11 11
diff --git a/arch/x86/kernel/reboot_64.c b/arch/x86/kernel/reboot_64.c
index 776eb06b6512..71b13c5f5817 100644
--- a/arch/x86/kernel/reboot_64.c
+++ b/arch/x86/kernel/reboot_64.c
@@ -17,7 +17,7 @@
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
19#include <asm/apic.h> 19#include <asm/apic.h>
20#include <asm/iommu.h> 20#include <asm/gart.h>
21 21
22/* 22/*
23 * Power off function, if any 23 * Power off function, if any
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index cc0e91447b76..e1e18c34c821 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -86,9 +86,6 @@ unsigned long mmu_cr4_features;
86 86
87/* for MCA, but anyone else can use it if they want */ 87/* for MCA, but anyone else can use it if they want */
88unsigned int machine_id; 88unsigned int machine_id;
89#ifdef CONFIG_MCA
90EXPORT_SYMBOL(machine_id);
91#endif
92unsigned int machine_submodel_id; 89unsigned int machine_submodel_id;
93unsigned int BIOS_revision; 90unsigned int BIOS_revision;
94unsigned int mca_pentium_flag; 91unsigned int mca_pentium_flag;
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index e7a9e36bd52d..238633d3d09a 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -1040,7 +1040,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1040 /* Intel-defined (#2) */ 1040 /* Intel-defined (#2) */
1041 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", 1041 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est",
1042 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, 1042 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL,
1043 NULL, NULL, "dca", NULL, NULL, NULL, NULL, "popcnt", 1043 NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt",
1044 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1044 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1045 1045
1046 /* VIA/Cyrix/Centaur-defined */ 1046 /* VIA/Cyrix/Centaur-defined */
@@ -1050,10 +1050,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1050 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1050 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1051 1051
1052 /* AMD-defined (#2) */ 1052 /* AMD-defined (#2) */
1053 "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy", 1053 "lahf_lm", "cmp_legacy", "svm", "extapic",
1054 "altmovcr8", "abm", "sse4a", 1054 "cr8_legacy", "abm", "sse4a", "misalignsse",
1055 "misalignsse", "3dnowprefetch", 1055 "3dnowprefetch", "osvw", "ibs", "sse5",
1056 "osvw", "ibs", NULL, NULL, NULL, NULL, 1056 "skinit", "wdt", NULL, NULL,
1057 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1057 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1058 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1058 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1059 1059
diff --git a/arch/x86/kernel/smp_32.c b/arch/x86/kernel/smp_32.c
index f32115308399..fcaa026eb807 100644
--- a/arch/x86/kernel/smp_32.c
+++ b/arch/x86/kernel/smp_32.c
@@ -708,10 +708,4 @@ struct smp_ops smp_ops = {
708 .smp_send_reschedule = native_smp_send_reschedule, 708 .smp_send_reschedule = native_smp_send_reschedule,
709 .smp_call_function_mask = native_smp_call_function_mask, 709 .smp_call_function_mask = native_smp_call_function_mask,
710}; 710};
711 711EXPORT_SYMBOL_GPL(smp_ops);
712int smp_call_function_mask(cpumask_t mask, void (*func) (void *info),
713 void *info, int wait)
714{
715 return smp_ops.smp_call_function_mask(mask, func, info, wait);
716}
717EXPORT_SYMBOL(smp_call_function_mask);
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index d2235db4085f..a55b0902f9d3 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -56,6 +56,7 @@
56#include <linux/lguest.h> 56#include <linux/lguest.h>
57#include <linux/lguest_launcher.h> 57#include <linux/lguest_launcher.h>
58#include <linux/virtio_console.h> 58#include <linux/virtio_console.h>
59#include <linux/pm.h>
59#include <asm/paravirt.h> 60#include <asm/paravirt.h>
60#include <asm/param.h> 61#include <asm/param.h>
61#include <asm/page.h> 62#include <asm/page.h>
@@ -98,7 +99,7 @@ static cycle_t clock_base;
98 * When lazy_mode is set, it means we're allowed to defer all hypercalls and do 99 * When lazy_mode is set, it means we're allowed to defer all hypercalls and do
99 * them as a batch when lazy_mode is eventually turned off. Because hypercalls 100 * them as a batch when lazy_mode is eventually turned off. Because hypercalls
100 * are reasonably expensive, batching them up makes sense. For example, a 101 * are reasonably expensive, batching them up makes sense. For example, a
101 * large mmap might update dozens of page table entries: that code calls 102 * large munmap might update dozens of page table entries: that code calls
102 * paravirt_enter_lazy_mmu(), does the dozen updates, then calls 103 * paravirt_enter_lazy_mmu(), does the dozen updates, then calls
103 * lguest_leave_lazy_mode(). 104 * lguest_leave_lazy_mode().
104 * 105 *
@@ -163,8 +164,8 @@ void async_hcall(unsigned long call,
163/*:*/ 164/*:*/
164 165
165/*G:033 166/*G:033
166 * Here are our first native-instruction replacements: four functions for 167 * After that diversion we return to our first native-instruction
167 * interrupt control. 168 * replacements: four functions for interrupt control.
168 * 169 *
169 * The simplest way of implementing these would be to have "turn interrupts 170 * The simplest way of implementing these would be to have "turn interrupts
170 * off" and "turn interrupts on" hypercalls. Unfortunately, this is too slow: 171 * off" and "turn interrupts on" hypercalls. Unfortunately, this is too slow:
@@ -183,7 +184,7 @@ static unsigned long save_fl(void)
183 return lguest_data.irq_enabled; 184 return lguest_data.irq_enabled;
184} 185}
185 186
186/* "restore_flags" just sets the flags back to the value given. */ 187/* restore_flags() just sets the flags back to the value given. */
187static void restore_fl(unsigned long flags) 188static void restore_fl(unsigned long flags)
188{ 189{
189 lguest_data.irq_enabled = flags; 190 lguest_data.irq_enabled = flags;
@@ -356,7 +357,7 @@ static void lguest_cpuid(unsigned int *eax, unsigned int *ebx,
356 * it. The Host needs to know when the Guest wants to change them, so we have 357 * it. The Host needs to know when the Guest wants to change them, so we have
357 * a whole series of functions like read_cr0() and write_cr0(). 358 * a whole series of functions like read_cr0() and write_cr0().
358 * 359 *
359 * We start with CR0. CR0 allows you to turn on and off all kinds of basic 360 * We start with cr0. cr0 allows you to turn on and off all kinds of basic
360 * features, but Linux only really cares about one: the horrifically-named Task 361 * features, but Linux only really cares about one: the horrifically-named Task
361 * Switched (TS) bit at bit 3 (ie. 8) 362 * Switched (TS) bit at bit 3 (ie. 8)
362 * 363 *
@@ -371,8 +372,7 @@ static void lguest_cpuid(unsigned int *eax, unsigned int *ebx,
371static unsigned long current_cr0, current_cr3; 372static unsigned long current_cr0, current_cr3;
372static void lguest_write_cr0(unsigned long val) 373static void lguest_write_cr0(unsigned long val)
373{ 374{
374 /* 8 == TS bit. */ 375 lazy_hcall(LHCALL_TS, val & X86_CR0_TS, 0, 0);
375 lazy_hcall(LHCALL_TS, val & 8, 0, 0);
376 current_cr0 = val; 376 current_cr0 = val;
377} 377}
378 378
@@ -387,10 +387,10 @@ static unsigned long lguest_read_cr0(void)
387static void lguest_clts(void) 387static void lguest_clts(void)
388{ 388{
389 lazy_hcall(LHCALL_TS, 0, 0, 0); 389 lazy_hcall(LHCALL_TS, 0, 0, 0);
390 current_cr0 &= ~8U; 390 current_cr0 &= ~X86_CR0_TS;
391} 391}
392 392
393/* CR2 is the virtual address of the last page fault, which the Guest only ever 393/* cr2 is the virtual address of the last page fault, which the Guest only ever
394 * reads. The Host kindly writes this into our "struct lguest_data", so we 394 * reads. The Host kindly writes this into our "struct lguest_data", so we
395 * just read it out of there. */ 395 * just read it out of there. */
396static unsigned long lguest_read_cr2(void) 396static unsigned long lguest_read_cr2(void)
@@ -398,7 +398,7 @@ static unsigned long lguest_read_cr2(void)
398 return lguest_data.cr2; 398 return lguest_data.cr2;
399} 399}
400 400
401/* CR3 is the current toplevel pagetable page: the principle is the same as 401/* cr3 is the current toplevel pagetable page: the principle is the same as
402 * cr0. Keep a local copy, and tell the Host when it changes. */ 402 * cr0. Keep a local copy, and tell the Host when it changes. */
403static void lguest_write_cr3(unsigned long cr3) 403static void lguest_write_cr3(unsigned long cr3)
404{ 404{
@@ -411,7 +411,7 @@ static unsigned long lguest_read_cr3(void)
411 return current_cr3; 411 return current_cr3;
412} 412}
413 413
414/* CR4 is used to enable and disable PGE, but we don't care. */ 414/* cr4 is used to enable and disable PGE, but we don't care. */
415static unsigned long lguest_read_cr4(void) 415static unsigned long lguest_read_cr4(void)
416{ 416{
417 return 0; 417 return 0;
@@ -432,7 +432,7 @@ static void lguest_write_cr4(unsigned long val)
432 * maps virtual addresses to physical addresses using "page tables". We could 432 * maps virtual addresses to physical addresses using "page tables". We could
433 * use one huge index of 1 million entries: each address is 4 bytes, so that's 433 * use one huge index of 1 million entries: each address is 4 bytes, so that's
434 * 1024 pages just to hold the page tables. But since most virtual addresses 434 * 1024 pages just to hold the page tables. But since most virtual addresses
435 * are unused, we use a two level index which saves space. The CR3 register 435 * are unused, we use a two level index which saves space. The cr3 register
436 * contains the physical address of the top level "page directory" page, which 436 * contains the physical address of the top level "page directory" page, which
437 * contains physical addresses of up to 1024 second-level pages. Each of these 437 * contains physical addresses of up to 1024 second-level pages. Each of these
438 * second level pages contains up to 1024 physical addresses of actual pages, 438 * second level pages contains up to 1024 physical addresses of actual pages,
@@ -440,7 +440,7 @@ static void lguest_write_cr4(unsigned long val)
440 * 440 *
441 * Here's a diagram, where arrows indicate physical addresses: 441 * Here's a diagram, where arrows indicate physical addresses:
442 * 442 *
443 * CR3 ---> +---------+ 443 * cr3 ---> +---------+
444 * | --------->+---------+ 444 * | --------->+---------+
445 * | | | PADDR1 | 445 * | | | PADDR1 |
446 * Top-level | | PADDR2 | 446 * Top-level | | PADDR2 |
@@ -498,8 +498,7 @@ static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval)
498 * 498 *
499 * ... except in early boot when the kernel sets up the initial pagetables, 499 * ... except in early boot when the kernel sets up the initial pagetables,
500 * which makes booting astonishingly slow. So we don't even tell the Host 500 * which makes booting astonishingly slow. So we don't even tell the Host
501 * anything changed until we've done the first page table switch. 501 * anything changed until we've done the first page table switch. */
502 */
503static void lguest_set_pte(pte_t *ptep, pte_t pteval) 502static void lguest_set_pte(pte_t *ptep, pte_t pteval)
504{ 503{
505 *ptep = pteval; 504 *ptep = pteval;
@@ -720,10 +719,10 @@ static void lguest_time_init(void)
720 /* Set up the timer interrupt (0) to go to our simple timer routine */ 719 /* Set up the timer interrupt (0) to go to our simple timer routine */
721 set_irq_handler(0, lguest_time_irq); 720 set_irq_handler(0, lguest_time_irq);
722 721
723 /* Our clock structure look like arch/i386/kernel/tsc.c if we can use 722 /* Our clock structure looks like arch/x86/kernel/tsc_32.c if we can
724 * the TSC, otherwise it's a dumb nanosecond-resolution clock. Either 723 * use the TSC, otherwise it's a dumb nanosecond-resolution clock.
725 * way, the "rating" is initialized so high that it's always chosen 724 * Either way, the "rating" is set so high that it's always chosen over
726 * over any other clocksource. */ 725 * any other clocksource. */
727 if (lguest_data.tsc_khz) 726 if (lguest_data.tsc_khz)
728 lguest_clock.mult = clocksource_khz2mult(lguest_data.tsc_khz, 727 lguest_clock.mult = clocksource_khz2mult(lguest_data.tsc_khz,
729 lguest_clock.shift); 728 lguest_clock.shift);
@@ -749,7 +748,7 @@ static void lguest_time_init(void)
749 * to work. They're pretty simple. 748 * to work. They're pretty simple.
750 */ 749 */
751 750
752/* The Guest needs to tell the host what stack it expects traps to use. For 751/* The Guest needs to tell the Host what stack it expects traps to use. For
753 * native hardware, this is part of the Task State Segment mentioned above in 752 * native hardware, this is part of the Task State Segment mentioned above in
754 * lguest_load_tr_desc(), but to help hypervisors there's this special call. 753 * lguest_load_tr_desc(), but to help hypervisors there's this special call.
755 * 754 *
@@ -850,13 +849,16 @@ static __init char *lguest_memory_setup(void)
850 return "LGUEST"; 849 return "LGUEST";
851} 850}
852 851
853/* Before virtqueues are set up, we use LHCALL_NOTIFY on normal memory to 852/* We will eventually use the virtio console device to produce console output,
854 * produce console output. */ 853 * but before that is set up we use LHCALL_NOTIFY on normal memory to produce
854 * console output. */
855static __init int early_put_chars(u32 vtermno, const char *buf, int count) 855static __init int early_put_chars(u32 vtermno, const char *buf, int count)
856{ 856{
857 char scratch[17]; 857 char scratch[17];
858 unsigned int len = count; 858 unsigned int len = count;
859 859
860 /* We use a nul-terminated string, so we have to make a copy. Icky,
861 * huh? */
860 if (len > sizeof(scratch) - 1) 862 if (len > sizeof(scratch) - 1)
861 len = sizeof(scratch) - 1; 863 len = sizeof(scratch) - 1;
862 scratch[len] = '\0'; 864 scratch[len] = '\0';
@@ -883,7 +885,7 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count)
883 * Our current solution is to allow the paravirt back end to optionally patch 885 * Our current solution is to allow the paravirt back end to optionally patch
884 * over the indirect calls to replace them with something more efficient. We 886 * over the indirect calls to replace them with something more efficient. We
885 * patch the four most commonly called functions: disable interrupts, enable 887 * patch the four most commonly called functions: disable interrupts, enable
886 * interrupts, restore interrupts and save interrupts. We usually have 10 888 * interrupts, restore interrupts and save interrupts. We usually have 6 or 10
887 * bytes to patch into: the Guest versions of these operations are small enough 889 * bytes to patch into: the Guest versions of these operations are small enough
888 * that we can fit comfortably. 890 * that we can fit comfortably.
889 * 891 *
@@ -1015,7 +1017,7 @@ __init void lguest_init(void)
1015 asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_DS) : "memory"); 1017 asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_DS) : "memory");
1016 1018
1017 /* The Host uses the top of the Guest's virtual address space for the 1019 /* The Host uses the top of the Guest's virtual address space for the
1018 * Host<->Guest Switcher, and it tells us how much it needs in 1020 * Host<->Guest Switcher, and it tells us how big that is in
1019 * lguest_data.reserve_mem, set up on the LGUEST_INIT hypercall. */ 1021 * lguest_data.reserve_mem, set up on the LGUEST_INIT hypercall. */
1020 reserve_top_address(lguest_data.reserve_mem); 1022 reserve_top_address(lguest_data.reserve_mem);
1021 1023
@@ -1065,6 +1067,6 @@ __init void lguest_init(void)
1065/* 1067/*
1066 * This marks the end of stage II of our journey, The Guest. 1068 * This marks the end of stage II of our journey, The Guest.
1067 * 1069 *
1068 * It is now time for us to explore the nooks and crannies of the three Guest 1070 * It is now time for us to explore the layer of virtual drivers and complete
1069 * devices and complete our understanding of the Guest in "make Drivers". 1071 * our understanding of the Guest in "make Drivers".
1070 */ 1072 */
diff --git a/arch/x86/lguest/i386_head.S b/arch/x86/lguest/i386_head.S
index ebc6ac733899..95b6fbcded63 100644
--- a/arch/x86/lguest/i386_head.S
+++ b/arch/x86/lguest/i386_head.S
@@ -6,7 +6,7 @@
6#include <asm/processor-flags.h> 6#include <asm/processor-flags.h>
7 7
8/*G:020 This is where we begin: head.S notes that the boot header's platform 8/*G:020 This is where we begin: head.S notes that the boot header's platform
9 * type field is "1" (lguest), so calls us here. The boot header is in %esi. 9 * type field is "1" (lguest), so calls us here.
10 * 10 *
11 * WARNING: be very careful here! We're running at addresses equal to physical 11 * WARNING: be very careful here! We're running at addresses equal to physical
12 * addesses (around 0), not above PAGE_OFFSET as most code expectes 12 * addesses (around 0), not above PAGE_OFFSET as most code expectes
@@ -17,13 +17,15 @@
17 * boot. */ 17 * boot. */
18.section .init.text, "ax", @progbits 18.section .init.text, "ax", @progbits
19ENTRY(lguest_entry) 19ENTRY(lguest_entry)
20 /* Make initial hypercall now, so we can set up the pagetables. */ 20 /* We make the "initialization" hypercall now to tell the Host about
21 * us, and also find out where it put our page tables. */
21 movl $LHCALL_LGUEST_INIT, %eax 22 movl $LHCALL_LGUEST_INIT, %eax
22 movl $lguest_data - __PAGE_OFFSET, %edx 23 movl $lguest_data - __PAGE_OFFSET, %edx
23 int $LGUEST_TRAP_ENTRY 24 int $LGUEST_TRAP_ENTRY
24 25
25 /* The Host put the toplevel pagetable in lguest_data.pgdir. The movsl 26 /* The Host put the toplevel pagetable in lguest_data.pgdir. The movsl
26 * instruction uses %esi implicitly. */ 27 * instruction uses %esi implicitly as the source for the copy we'
28 * about to do. */
27 movl lguest_data - __PAGE_OFFSET + LGUEST_DATA_pgdir, %esi 29 movl lguest_data - __PAGE_OFFSET + LGUEST_DATA_pgdir, %esi
28 30
29 /* Copy first 32 entries of page directory to __PAGE_OFFSET entries. 31 /* Copy first 32 entries of page directory to __PAGE_OFFSET entries.
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 361ac5107b33..69371434b0cf 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -29,14 +29,14 @@
29#include <asm/arch_hooks.h> 29#include <asm/arch_hooks.h>
30 30
31/* TLB state -- visible externally, indexed physically */ 31/* TLB state -- visible externally, indexed physically */
32DEFINE_PER_CPU(struct tlb_state, cpu_tlbstate) ____cacheline_aligned = { &init_mm, 0 }; 32DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) = { &init_mm, 0 };
33 33
34/* CPU IRQ affinity -- set to all ones initially */ 34/* CPU IRQ affinity -- set to all ones initially */
35static unsigned long cpu_irq_affinity[NR_CPUS] __cacheline_aligned = { [0 ... NR_CPUS-1] = ~0UL }; 35static unsigned long cpu_irq_affinity[NR_CPUS] __cacheline_aligned = { [0 ... NR_CPUS-1] = ~0UL };
36 36
37/* per CPU data structure (for /proc/cpuinfo et al), visible externally 37/* per CPU data structure (for /proc/cpuinfo et al), visible externally
38 * indexed physically */ 38 * indexed physically */
39DEFINE_PER_CPU(cpuinfo_x86, cpu_info) __cacheline_aligned; 39DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
40EXPORT_PER_CPU_SYMBOL(cpu_info); 40EXPORT_PER_CPU_SYMBOL(cpu_info);
41 41
42/* physical ID of the CPU used to boot the system */ 42/* physical ID of the CPU used to boot the system */
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index fe608a45ffb6..13a474d3c6e9 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -40,7 +40,7 @@
40 40
41struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; 41struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
42EXPORT_SYMBOL(node_data); 42EXPORT_SYMBOL(node_data);
43bootmem_data_t node0_bdata; 43static bootmem_data_t node0_bdata;
44 44
45/* 45/*
46 * numa interface - we expect the numa architecture specific code to have 46 * numa interface - we expect the numa architecture specific code to have
@@ -404,7 +404,7 @@ void __init set_highmem_pages_init(int bad_ppro)
404} 404}
405 405
406#ifdef CONFIG_MEMORY_HOTPLUG 406#ifdef CONFIG_MEMORY_HOTPLUG
407int paddr_to_nid(u64 addr) 407static int paddr_to_nid(u64 addr)
408{ 408{
409 int nid; 409 int nid;
410 unsigned long pfn = PFN_DOWN(addr); 410 unsigned long pfn = PFN_DOWN(addr);
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c
index 2e542e89a3e2..a2273d44aa27 100644
--- a/arch/x86/mm/fault_32.c
+++ b/arch/x86/mm/fault_32.c
@@ -555,7 +555,7 @@ no_context:
555 page &= PAGE_MASK; 555 page &= PAGE_MASK;
556 page = ((__typeof__(page) *) __va(page))[(address >> PMD_SHIFT) 556 page = ((__typeof__(page) *) __va(page))[(address >> PMD_SHIFT)
557 & (PTRS_PER_PMD - 1)]; 557 & (PTRS_PER_PMD - 1)];
558 printk(KERN_ALERT "*pde = %016Lx ", page); 558 printk(KERN_CONT "*pde = %016Lx ", page);
559 page &= ~_PAGE_NX; 559 page &= ~_PAGE_NX;
560 } 560 }
561#else 561#else
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 1e3862e41065..a7308b2cd058 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -728,12 +728,6 @@ int in_gate_area_no_task(unsigned long addr)
728 return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END); 728 return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END);
729} 729}
730 730
731void * __init alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
732{
733 return __alloc_bootmem_core(pgdat->bdata, size,
734 SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0);
735}
736
737const char *arch_vma_name(struct vm_area_struct *vma) 731const char *arch_vma_name(struct vm_area_struct *vma)
738{ 732{
739 if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso) 733 if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
diff --git a/arch/x86_64/.gitignore b/arch/x86_64/.gitignore
deleted file mode 100644
index 36ef4c374d25..000000000000
--- a/arch/x86_64/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
1boot
diff --git a/arch/x86_64/Kconfig.debug b/arch/x86_64/Kconfig.debug
deleted file mode 100644
index 775d211a5cf9..000000000000
--- a/arch/x86_64/Kconfig.debug
+++ /dev/null
@@ -1,61 +0,0 @@
1menu "Kernel hacking"
2
3config TRACE_IRQFLAGS_SUPPORT
4 bool
5 default y
6
7source "lib/Kconfig.debug"
8
9config DEBUG_RODATA
10 bool "Write protect kernel read-only data structures"
11 depends on DEBUG_KERNEL
12 help
13 Mark the kernel read-only data as write-protected in the pagetables,
14 in order to catch accidental (and incorrect) writes to such const data.
15 This option may have a slight performance impact because a portion
16 of the kernel code won't be covered by a 2MB TLB anymore.
17 If in doubt, say "N".
18
19config IOMMU_DEBUG
20 depends on IOMMU && DEBUG_KERNEL
21 bool "Enable IOMMU debugging"
22 help
23 Force the IOMMU to on even when you have less than 4GB of
24 memory and add debugging code. On overflow always panic. And
25 allow to enable IOMMU leak tracing. Can be disabled at boot
26 time with iommu=noforce. This will also enable scatter gather
27 list merging. Currently not recommended for production
28 code. When you use it make sure you have a big enough
29 IOMMU/AGP aperture. Most of the options enabled by this can
30 be set more finegrained using the iommu= command line
31 options. See Documentation/x86_64/boot-options.txt for more
32 details.
33
34config IOMMU_LEAK
35 bool "IOMMU leak tracing"
36 depends on DEBUG_KERNEL
37 depends on IOMMU_DEBUG
38 help
39 Add a simple leak tracer to the IOMMU code. This is useful when you
40 are debugging a buggy device driver that leaks IOMMU mappings.
41
42config DEBUG_STACKOVERFLOW
43 bool "Check for stack overflows"
44 depends on DEBUG_KERNEL
45 help
46 This option will cause messages to be printed if free stack space
47 drops below a certain limit.
48
49config DEBUG_STACK_USAGE
50 bool "Stack utilization instrumentation"
51 depends on DEBUG_KERNEL
52 help
53 Enables the display of the minimum amount of free stack which each
54 task has ever had available in the sysrq-T and sysrq-P debug output.
55
56 This option will slow down process creation somewhat.
57
58#config X86_REMOTE_DEBUG
59# bool "kgdb debugging stub"
60
61endmenu
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 85ffbb491490..d3cb3d6af4c8 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -1,5 +1,5 @@
1# For a description of the syntax of this configuration file, 1# For a description of the syntax of this configuration file,
2# see Documentation/kbuild/config-language.txt. 2# see Documentation/kbuild/kconfig-language.txt.
3 3
4mainmenu "Linux/Xtensa Kernel Configuration" 4mainmenu "Linux/Xtensa Kernel Configuration"
5 5
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 54dc05439009..e47a9309eb48 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1443,8 +1443,11 @@ cfq_get_queue(struct cfq_data *cfqd, int is_sync, struct task_struct *tsk,
1443 cfqq = *async_cfqq; 1443 cfqq = *async_cfqq;
1444 } 1444 }
1445 1445
1446 if (!cfqq) 1446 if (!cfqq) {
1447 cfqq = cfq_find_alloc_queue(cfqd, is_sync, tsk, gfp_mask); 1447 cfqq = cfq_find_alloc_queue(cfqd, is_sync, tsk, gfp_mask);
1448 if (!cfqq)
1449 return NULL;
1450 }
1448 1451
1449 /* 1452 /*
1450 * pin the queue now that it's allocated, scheduler exit will prune it 1453 * pin the queue now that it's allocated, scheduler exit will prune it
@@ -2053,7 +2056,7 @@ static void cfq_shutdown_timer_wq(struct cfq_data *cfqd)
2053{ 2056{
2054 del_timer_sync(&cfqd->idle_slice_timer); 2057 del_timer_sync(&cfqd->idle_slice_timer);
2055 del_timer_sync(&cfqd->idle_class_timer); 2058 del_timer_sync(&cfqd->idle_class_timer);
2056 blk_sync_queue(cfqd->queue); 2059 kblockd_flush_work(&cfqd->unplug_work);
2057} 2060}
2058 2061
2059static void cfq_put_async_queues(struct cfq_data *cfqd) 2062static void cfq_put_async_queues(struct cfq_data *cfqd)
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index f84093b97f70..cae0a852619e 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -581,7 +581,7 @@ static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file,
581{ 581{
582 int ret; 582 int ret;
583 583
584 switch (arg) { 584 switch (cmd) {
585 case HDIO_GET_UNMASKINTR: 585 case HDIO_GET_UNMASKINTR:
586 case HDIO_GET_MULTCOUNT: 586 case HDIO_GET_MULTCOUNT:
587 case HDIO_GET_KEEPSETTINGS: 587 case HDIO_GET_KEEPSETTINGS:
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index de5ba479c224..56f2646612e6 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -39,7 +39,7 @@
39 39
40static void blk_unplug_work(struct work_struct *work); 40static void blk_unplug_work(struct work_struct *work);
41static void blk_unplug_timeout(unsigned long data); 41static void blk_unplug_timeout(unsigned long data);
42static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io); 42static void drive_stat_acct(struct request *rq, int new_io);
43static void init_request_from_bio(struct request *req, struct bio *bio); 43static void init_request_from_bio(struct request *req, struct bio *bio);
44static int __make_request(struct request_queue *q, struct bio *bio); 44static int __make_request(struct request_queue *q, struct bio *bio);
45static struct io_context *current_io_context(gfp_t gfp_flags, int node); 45static struct io_context *current_io_context(gfp_t gfp_flags, int node);
@@ -791,7 +791,6 @@ static int __blk_free_tags(struct blk_queue_tag *bqt)
791 retval = atomic_dec_and_test(&bqt->refcnt); 791 retval = atomic_dec_and_test(&bqt->refcnt);
792 if (retval) { 792 if (retval) {
793 BUG_ON(bqt->busy); 793 BUG_ON(bqt->busy);
794 BUG_ON(!list_empty(&bqt->busy_list));
795 794
796 kfree(bqt->tag_index); 795 kfree(bqt->tag_index);
797 bqt->tag_index = NULL; 796 bqt->tag_index = NULL;
@@ -903,7 +902,6 @@ static struct blk_queue_tag *__blk_queue_init_tags(struct request_queue *q,
903 if (init_tag_map(q, tags, depth)) 902 if (init_tag_map(q, tags, depth))
904 goto fail; 903 goto fail;
905 904
906 INIT_LIST_HEAD(&tags->busy_list);
907 tags->busy = 0; 905 tags->busy = 0;
908 atomic_set(&tags->refcnt, 1); 906 atomic_set(&tags->refcnt, 1);
909 return tags; 907 return tags;
@@ -954,6 +952,7 @@ int blk_queue_init_tags(struct request_queue *q, int depth,
954 */ 952 */
955 q->queue_tags = tags; 953 q->queue_tags = tags;
956 q->queue_flags |= (1 << QUEUE_FLAG_QUEUED); 954 q->queue_flags |= (1 << QUEUE_FLAG_QUEUED);
955 INIT_LIST_HEAD(&q->tag_busy_list);
957 return 0; 956 return 0;
958fail: 957fail:
959 kfree(tags); 958 kfree(tags);
@@ -1057,18 +1056,16 @@ void blk_queue_end_tag(struct request_queue *q, struct request *rq)
1057 1056
1058 bqt->tag_index[tag] = NULL; 1057 bqt->tag_index[tag] = NULL;
1059 1058
1060 /* 1059 if (unlikely(!test_bit(tag, bqt->tag_map))) {
1061 * We use test_and_clear_bit's memory ordering properties here.
1062 * The tag_map bit acts as a lock for tag_index[bit], so we need
1063 * a barrer before clearing the bit (precisely: release semantics).
1064 * Could use clear_bit_unlock when it is merged.
1065 */
1066 if (unlikely(!test_and_clear_bit(tag, bqt->tag_map))) {
1067 printk(KERN_ERR "%s: attempt to clear non-busy tag (%d)\n", 1060 printk(KERN_ERR "%s: attempt to clear non-busy tag (%d)\n",
1068 __FUNCTION__, tag); 1061 __FUNCTION__, tag);
1069 return; 1062 return;
1070 } 1063 }
1071 1064 /*
1065 * The tag_map bit acts as a lock for tag_index[bit], so we need
1066 * unlock memory barrier semantics.
1067 */
1068 clear_bit_unlock(tag, bqt->tag_map);
1072 bqt->busy--; 1069 bqt->busy--;
1073} 1070}
1074 1071
@@ -1114,17 +1111,17 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq)
1114 if (tag >= bqt->max_depth) 1111 if (tag >= bqt->max_depth)
1115 return 1; 1112 return 1;
1116 1113
1117 } while (test_and_set_bit(tag, bqt->tag_map)); 1114 } while (test_and_set_bit_lock(tag, bqt->tag_map));
1118 /* 1115 /*
1119 * We rely on test_and_set_bit providing lock memory ordering semantics 1116 * We need lock ordering semantics given by test_and_set_bit_lock.
1120 * (could use test_and_set_bit_lock when it is merged). 1117 * See blk_queue_end_tag for details.
1121 */ 1118 */
1122 1119
1123 rq->cmd_flags |= REQ_QUEUED; 1120 rq->cmd_flags |= REQ_QUEUED;
1124 rq->tag = tag; 1121 rq->tag = tag;
1125 bqt->tag_index[tag] = rq; 1122 bqt->tag_index[tag] = rq;
1126 blkdev_dequeue_request(rq); 1123 blkdev_dequeue_request(rq);
1127 list_add(&rq->queuelist, &bqt->busy_list); 1124 list_add(&rq->queuelist, &q->tag_busy_list);
1128 bqt->busy++; 1125 bqt->busy++;
1129 return 0; 1126 return 0;
1130} 1127}
@@ -1145,11 +1142,10 @@ EXPORT_SYMBOL(blk_queue_start_tag);
1145 **/ 1142 **/
1146void blk_queue_invalidate_tags(struct request_queue *q) 1143void blk_queue_invalidate_tags(struct request_queue *q)
1147{ 1144{
1148 struct blk_queue_tag *bqt = q->queue_tags;
1149 struct list_head *tmp, *n; 1145 struct list_head *tmp, *n;
1150 struct request *rq; 1146 struct request *rq;
1151 1147
1152 list_for_each_safe(tmp, n, &bqt->busy_list) { 1148 list_for_each_safe(tmp, n, &q->tag_busy_list) {
1153 rq = list_entry_rq(tmp); 1149 rq = list_entry_rq(tmp);
1154 1150
1155 if (rq->tag == -1) { 1151 if (rq->tag == -1) {
@@ -1366,9 +1362,7 @@ new_segment:
1366 sg = sg_next(sg); 1362 sg = sg_next(sg);
1367 } 1363 }
1368 1364
1369 sg_set_page(sg, bvec->bv_page); 1365 sg_set_page(sg, bvec->bv_page, nbytes, bvec->bv_offset);
1370 sg->length = nbytes;
1371 sg->offset = bvec->bv_offset;
1372 nsegs++; 1366 nsegs++;
1373 } 1367 }
1374 bvprv = bvec; 1368 bvprv = bvec;
@@ -1740,6 +1734,7 @@ EXPORT_SYMBOL(blk_stop_queue);
1740void blk_sync_queue(struct request_queue *q) 1734void blk_sync_queue(struct request_queue *q)
1741{ 1735{
1742 del_timer_sync(&q->unplug_timer); 1736 del_timer_sync(&q->unplug_timer);
1737 kblockd_flush_work(&q->unplug_work);
1743} 1738}
1744EXPORT_SYMBOL(blk_sync_queue); 1739EXPORT_SYMBOL(blk_sync_queue);
1745 1740
@@ -2343,7 +2338,7 @@ void blk_insert_request(struct request_queue *q, struct request *rq,
2343 if (blk_rq_tagged(rq)) 2338 if (blk_rq_tagged(rq))
2344 blk_queue_end_tag(q, rq); 2339 blk_queue_end_tag(q, rq);
2345 2340
2346 drive_stat_acct(rq, rq->nr_sectors, 1); 2341 drive_stat_acct(rq, 1);
2347 __elv_add_request(q, rq, where, 0); 2342 __elv_add_request(q, rq, where, 0);
2348 blk_start_queueing(q); 2343 blk_start_queueing(q);
2349 spin_unlock_irqrestore(q->queue_lock, flags); 2344 spin_unlock_irqrestore(q->queue_lock, flags);
@@ -2738,7 +2733,7 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector)
2738 2733
2739EXPORT_SYMBOL(blkdev_issue_flush); 2734EXPORT_SYMBOL(blkdev_issue_flush);
2740 2735
2741static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io) 2736static void drive_stat_acct(struct request *rq, int new_io)
2742{ 2737{
2743 int rw = rq_data_dir(rq); 2738 int rw = rq_data_dir(rq);
2744 2739
@@ -2760,7 +2755,7 @@ static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io)
2760 */ 2755 */
2761static inline void add_request(struct request_queue * q, struct request * req) 2756static inline void add_request(struct request_queue * q, struct request * req)
2762{ 2757{
2763 drive_stat_acct(req, req->nr_sectors, 1); 2758 drive_stat_acct(req, 1);
2764 2759
2765 /* 2760 /*
2766 * elevator indicated where it wants this request to be 2761 * elevator indicated where it wants this request to be
@@ -3017,7 +3012,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
3017 req->biotail = bio; 3012 req->biotail = bio;
3018 req->nr_sectors = req->hard_nr_sectors += nr_sectors; 3013 req->nr_sectors = req->hard_nr_sectors += nr_sectors;
3019 req->ioprio = ioprio_best(req->ioprio, prio); 3014 req->ioprio = ioprio_best(req->ioprio, prio);
3020 drive_stat_acct(req, nr_sectors, 0); 3015 drive_stat_acct(req, 0);
3021 if (!attempt_back_merge(q, req)) 3016 if (!attempt_back_merge(q, req))
3022 elv_merged_request(q, req, el_ret); 3017 elv_merged_request(q, req, el_ret);
3023 goto out; 3018 goto out;
@@ -3044,7 +3039,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
3044 req->sector = req->hard_sector = bio->bi_sector; 3039 req->sector = req->hard_sector = bio->bi_sector;
3045 req->nr_sectors = req->hard_nr_sectors += nr_sectors; 3040 req->nr_sectors = req->hard_nr_sectors += nr_sectors;
3046 req->ioprio = ioprio_best(req->ioprio, prio); 3041 req->ioprio = ioprio_best(req->ioprio, prio);
3047 drive_stat_acct(req, nr_sectors, 0); 3042 drive_stat_acct(req, 0);
3048 if (!attempt_front_merge(q, req)) 3043 if (!attempt_front_merge(q, req))
3049 elv_merged_request(q, req, el_ret); 3044 elv_merged_request(q, req, el_ret);
3050 goto out; 3045 goto out;
diff --git a/crypto/hmac.c b/crypto/hmac.c
index e4eb6ac53b5c..0f05be769c34 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -61,7 +61,7 @@ static int hmac_setkey(struct crypto_hash *parent,
61 desc.tfm = tfm; 61 desc.tfm = tfm;
62 desc.flags = crypto_hash_get_flags(parent); 62 desc.flags = crypto_hash_get_flags(parent);
63 desc.flags &= CRYPTO_TFM_REQ_MAY_SLEEP; 63 desc.flags &= CRYPTO_TFM_REQ_MAY_SLEEP;
64 sg_set_buf(&tmp, inkey, keylen); 64 sg_init_one(&tmp, inkey, keylen);
65 65
66 err = crypto_hash_digest(&desc, &tmp, keylen, digest); 66 err = crypto_hash_digest(&desc, &tmp, keylen, digest);
67 if (err) 67 if (err)
@@ -96,7 +96,7 @@ static int hmac_init(struct hash_desc *pdesc)
96 96
97 desc.tfm = ctx->child; 97 desc.tfm = ctx->child;
98 desc.flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP; 98 desc.flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
99 sg_set_buf(&tmp, ipad, bs); 99 sg_init_one(&tmp, ipad, bs);
100 100
101 err = crypto_hash_init(&desc); 101 err = crypto_hash_init(&desc);
102 if (unlikely(err)) 102 if (unlikely(err))
@@ -131,7 +131,7 @@ static int hmac_final(struct hash_desc *pdesc, u8 *out)
131 131
132 desc.tfm = ctx->child; 132 desc.tfm = ctx->child;
133 desc.flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP; 133 desc.flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
134 sg_set_buf(&tmp, opad, bs + ds); 134 sg_init_one(&tmp, opad, bs + ds);
135 135
136 err = crypto_hash_final(&desc, digest); 136 err = crypto_hash_final(&desc, digest);
137 if (unlikely(err)) 137 if (unlikely(err))
@@ -158,10 +158,11 @@ static int hmac_digest(struct hash_desc *pdesc, struct scatterlist *sg,
158 desc.tfm = ctx->child; 158 desc.tfm = ctx->child;
159 desc.flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP; 159 desc.flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
160 160
161 sg_init_table(sg1, 2);
161 sg_set_buf(sg1, ipad, bs); 162 sg_set_buf(sg1, ipad, bs);
163 sg_set_page(&sg1[1], (void *) sg, 0, 0);
162 164
163 sg_set_page(&sg[1], (void *) sg); 165 sg_init_table(sg2, 1);
164 sg1[1].length = 0;
165 sg_set_buf(sg2, opad, bs + ds); 166 sg_set_buf(sg2, opad, bs + ds);
166 167
167 err = crypto_hash_digest(&desc, sg1, nbytes + bs, digest); 168 err = crypto_hash_digest(&desc, sg1, nbytes + bs, digest);
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index d741c63af42c..24141fb6f5cb 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -139,7 +139,7 @@ static void test_hash(char *algo, struct hash_testvec *template,
139 printk("test %u:\n", i + 1); 139 printk("test %u:\n", i + 1);
140 memset(result, 0, 64); 140 memset(result, 0, 64);
141 141
142 sg_set_buf(&sg[0], hash_tv[i].plaintext, hash_tv[i].psize); 142 sg_init_one(&sg[0], hash_tv[i].plaintext, hash_tv[i].psize);
143 143
144 if (hash_tv[i].ksize) { 144 if (hash_tv[i].ksize) {
145 ret = crypto_hash_setkey(tfm, hash_tv[i].key, 145 ret = crypto_hash_setkey(tfm, hash_tv[i].key,
@@ -176,6 +176,7 @@ static void test_hash(char *algo, struct hash_testvec *template,
176 memset(result, 0, 64); 176 memset(result, 0, 64);
177 177
178 temp = 0; 178 temp = 0;
179 sg_init_table(sg, hash_tv[i].np);
179 for (k = 0; k < hash_tv[i].np; k++) { 180 for (k = 0; k < hash_tv[i].np; k++) {
180 memcpy(&xbuf[IDX[k]], 181 memcpy(&xbuf[IDX[k]],
181 hash_tv[i].plaintext + temp, 182 hash_tv[i].plaintext + temp,
@@ -289,8 +290,8 @@ static void test_cipher(char *algo, int enc,
289 goto out; 290 goto out;
290 } 291 }
291 292
292 sg_set_buf(&sg[0], cipher_tv[i].input, 293 sg_init_one(&sg[0], cipher_tv[i].input,
293 cipher_tv[i].ilen); 294 cipher_tv[i].ilen);
294 295
295 ablkcipher_request_set_crypt(req, sg, sg, 296 ablkcipher_request_set_crypt(req, sg, sg,
296 cipher_tv[i].ilen, 297 cipher_tv[i].ilen,
@@ -353,6 +354,7 @@ static void test_cipher(char *algo, int enc,
353 } 354 }
354 355
355 temp = 0; 356 temp = 0;
357 sg_init_table(sg, cipher_tv[i].np);
356 for (k = 0; k < cipher_tv[i].np; k++) { 358 for (k = 0; k < cipher_tv[i].np; k++) {
357 memcpy(&xbuf[IDX[k]], 359 memcpy(&xbuf[IDX[k]],
358 cipher_tv[i].input + temp, 360 cipher_tv[i].input + temp,
@@ -414,7 +416,7 @@ static int test_cipher_jiffies(struct blkcipher_desc *desc, int enc, char *p,
414 int bcount; 416 int bcount;
415 int ret; 417 int ret;
416 418
417 sg_set_buf(sg, p, blen); 419 sg_init_one(sg, p, blen);
418 420
419 for (start = jiffies, end = start + sec * HZ, bcount = 0; 421 for (start = jiffies, end = start + sec * HZ, bcount = 0;
420 time_before(jiffies, end); bcount++) { 422 time_before(jiffies, end); bcount++) {
@@ -440,7 +442,7 @@ static int test_cipher_cycles(struct blkcipher_desc *desc, int enc, char *p,
440 int ret = 0; 442 int ret = 0;
441 int i; 443 int i;
442 444
443 sg_set_buf(sg, p, blen); 445 sg_init_one(sg, p, blen);
444 446
445 local_bh_disable(); 447 local_bh_disable();
446 local_irq_disable(); 448 local_irq_disable();
@@ -570,6 +572,8 @@ static int test_hash_jiffies_digest(struct hash_desc *desc, char *p, int blen,
570 int bcount; 572 int bcount;
571 int ret; 573 int ret;
572 574
575 sg_init_table(sg, 1);
576
573 for (start = jiffies, end = start + sec * HZ, bcount = 0; 577 for (start = jiffies, end = start + sec * HZ, bcount = 0;
574 time_before(jiffies, end); bcount++) { 578 time_before(jiffies, end); bcount++) {
575 sg_set_buf(sg, p, blen); 579 sg_set_buf(sg, p, blen);
@@ -595,6 +599,8 @@ static int test_hash_jiffies(struct hash_desc *desc, char *p, int blen,
595 if (plen == blen) 599 if (plen == blen)
596 return test_hash_jiffies_digest(desc, p, blen, out, sec); 600 return test_hash_jiffies_digest(desc, p, blen, out, sec);
597 601
602 sg_init_table(sg, 1);
603
598 for (start = jiffies, end = start + sec * HZ, bcount = 0; 604 for (start = jiffies, end = start + sec * HZ, bcount = 0;
599 time_before(jiffies, end); bcount++) { 605 time_before(jiffies, end); bcount++) {
600 ret = crypto_hash_init(desc); 606 ret = crypto_hash_init(desc);
@@ -626,6 +632,8 @@ static int test_hash_cycles_digest(struct hash_desc *desc, char *p, int blen,
626 int i; 632 int i;
627 int ret; 633 int ret;
628 634
635 sg_init_table(sg, 1);
636
629 local_bh_disable(); 637 local_bh_disable();
630 local_irq_disable(); 638 local_irq_disable();
631 639
@@ -677,6 +685,8 @@ static int test_hash_cycles(struct hash_desc *desc, char *p, int blen,
677 if (plen == blen) 685 if (plen == blen)
678 return test_hash_cycles_digest(desc, p, blen, out); 686 return test_hash_cycles_digest(desc, p, blen, out);
679 687
688 sg_init_table(sg, 1);
689
680 local_bh_disable(); 690 local_bh_disable();
681 local_irq_disable(); 691 local_irq_disable();
682 692
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 5d0e26a5c34c..da3a08fa9e4f 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4 4
5menuconfig ACPI 5menuconfig ACPI
6 bool "ACPI Support (Advanced Configuration and Power Interface) Support" 6 bool "ACPI (Advanced Configuration and Power Interface) Support"
7 depends on !X86_NUMAQ 7 depends on !X86_NUMAQ
8 depends on !X86_VISWS 8 depends on !X86_VISWS
9 depends on !IA64_HP_SIM 9 depends on !IA64_HP_SIM
@@ -88,7 +88,8 @@ config ACPI_PROC_EVENT
88 88
89config ACPI_AC 89config ACPI_AC
90 tristate "AC Adapter" 90 tristate "AC Adapter"
91 depends on X86 && POWER_SUPPLY 91 depends on X86
92 select POWER_SUPPLY
92 default y 93 default y
93 help 94 help
94 This driver adds support for the AC Adapter object, which indicates 95 This driver adds support for the AC Adapter object, which indicates
@@ -97,7 +98,8 @@ config ACPI_AC
97 98
98config ACPI_BATTERY 99config ACPI_BATTERY
99 tristate "Battery" 100 tristate "Battery"
100 depends on X86 && POWER_SUPPLY 101 depends on X86
102 select POWER_SUPPLY
101 default y 103 default y
102 help 104 help
103 This driver adds support for battery information through 105 This driver adds support for battery information through
@@ -352,7 +354,7 @@ config ACPI_HOTPLUG_MEMORY
352config ACPI_SBS 354config ACPI_SBS
353 tristate "Smart Battery System" 355 tristate "Smart Battery System"
354 depends on X86 356 depends on X86
355 depends on POWER_SUPPLY 357 select POWER_SUPPLY
356 help 358 help
357 This driver adds support for the Smart Battery System, another 359 This driver adds support for the Smart Battery System, another
358 type of access to battery information, found on some laptops. 360 type of access to battery information, found on some laptops.
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 681e26b56b11..c2ce0ad21693 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -125,11 +125,15 @@ static int acpi_battery_technology(struct acpi_battery *battery)
125 return POWER_SUPPLY_TECHNOLOGY_NiMH; 125 return POWER_SUPPLY_TECHNOLOGY_NiMH;
126 if (!strcasecmp("LION", battery->type)) 126 if (!strcasecmp("LION", battery->type))
127 return POWER_SUPPLY_TECHNOLOGY_LION; 127 return POWER_SUPPLY_TECHNOLOGY_LION;
128 if (!strcasecmp("LI-ION", battery->type))
129 return POWER_SUPPLY_TECHNOLOGY_LION;
128 if (!strcasecmp("LiP", battery->type)) 130 if (!strcasecmp("LiP", battery->type))
129 return POWER_SUPPLY_TECHNOLOGY_LIPO; 131 return POWER_SUPPLY_TECHNOLOGY_LIPO;
130 return POWER_SUPPLY_TECHNOLOGY_UNKNOWN; 132 return POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
131} 133}
132 134
135static int acpi_battery_update(struct acpi_battery *battery);
136
133static int acpi_battery_get_property(struct power_supply *psy, 137static int acpi_battery_get_property(struct power_supply *psy,
134 enum power_supply_property psp, 138 enum power_supply_property psp,
135 union power_supply_propval *val) 139 union power_supply_propval *val)
@@ -139,6 +143,7 @@ static int acpi_battery_get_property(struct power_supply *psy,
139 if ((!acpi_battery_present(battery)) && 143 if ((!acpi_battery_present(battery)) &&
140 psp != POWER_SUPPLY_PROP_PRESENT) 144 psp != POWER_SUPPLY_PROP_PRESENT)
141 return -ENODEV; 145 return -ENODEV;
146 acpi_battery_update(battery);
142 switch (psp) { 147 switch (psp) {
143 case POWER_SUPPLY_PROP_STATUS: 148 case POWER_SUPPLY_PROP_STATUS:
144 if (battery->state & 0x01) 149 if (battery->state & 0x01)
@@ -257,7 +262,7 @@ static int extract_package(struct acpi_battery *battery,
257 union acpi_object *package, 262 union acpi_object *package,
258 struct acpi_offsets *offsets, int num) 263 struct acpi_offsets *offsets, int num)
259{ 264{
260 int i, *x; 265 int i;
261 union acpi_object *element; 266 union acpi_object *element;
262 if (package->type != ACPI_TYPE_PACKAGE) 267 if (package->type != ACPI_TYPE_PACKAGE)
263 return -EFAULT; 268 return -EFAULT;
@@ -266,16 +271,21 @@ static int extract_package(struct acpi_battery *battery,
266 return -EFAULT; 271 return -EFAULT;
267 element = &package->package.elements[i]; 272 element = &package->package.elements[i];
268 if (offsets[i].mode) { 273 if (offsets[i].mode) {
269 if (element->type != ACPI_TYPE_STRING && 274 u8 *ptr = (u8 *)battery + offsets[i].offset;
270 element->type != ACPI_TYPE_BUFFER) 275 if (element->type == ACPI_TYPE_STRING ||
271 return -EFAULT; 276 element->type == ACPI_TYPE_BUFFER)
272 strncpy((u8 *)battery + offsets[i].offset, 277 strncpy(ptr, element->string.pointer, 32);
273 element->string.pointer, 32); 278 else if (element->type == ACPI_TYPE_INTEGER) {
279 strncpy(ptr, (u8 *)&element->integer.value,
280 sizeof(acpi_integer));
281 ptr[sizeof(acpi_integer)] = 0;
282 } else return -EFAULT;
274 } else { 283 } else {
275 if (element->type != ACPI_TYPE_INTEGER) 284 if (element->type == ACPI_TYPE_INTEGER) {
276 return -EFAULT; 285 int *x = (int *)((u8 *)battery +
277 x = (int *)((u8 *)battery + offsets[i].offset); 286 offsets[i].offset);
278 *x = element->integer.value; 287 *x = element->integer.value;
288 } else return -EFAULT;
279 } 289 }
280 } 290 }
281 return 0; 291 return 0;
@@ -385,29 +395,81 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery)
385 return acpi_battery_set_alarm(battery); 395 return acpi_battery_set_alarm(battery);
386} 396}
387 397
398static ssize_t acpi_battery_alarm_show(struct device *dev,
399 struct device_attribute *attr,
400 char *buf)
401{
402 struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
403 return sprintf(buf, "%d\n", battery->alarm * 1000);
404}
405
406static ssize_t acpi_battery_alarm_store(struct device *dev,
407 struct device_attribute *attr,
408 const char *buf, size_t count)
409{
410 unsigned long x;
411 struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
412 if (sscanf(buf, "%ld\n", &x) == 1)
413 battery->alarm = x/1000;
414 if (acpi_battery_present(battery))
415 acpi_battery_set_alarm(battery);
416 return count;
417}
418
419static struct device_attribute alarm_attr = {
420 .attr = {.name = "alarm", .mode = 0644, .owner = THIS_MODULE},
421 .show = acpi_battery_alarm_show,
422 .store = acpi_battery_alarm_store,
423};
424
425static int sysfs_add_battery(struct acpi_battery *battery)
426{
427 int result;
428
429 battery->update_time = 0;
430 result = acpi_battery_get_info(battery);
431 acpi_battery_init_alarm(battery);
432 if (result)
433 return result;
434 if (battery->power_unit) {
435 battery->bat.properties = charge_battery_props;
436 battery->bat.num_properties =
437 ARRAY_SIZE(charge_battery_props);
438 } else {
439 battery->bat.properties = energy_battery_props;
440 battery->bat.num_properties =
441 ARRAY_SIZE(energy_battery_props);
442 }
443
444 battery->bat.name = acpi_device_bid(battery->device);
445 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
446 battery->bat.get_property = acpi_battery_get_property;
447
448 result = power_supply_register(&battery->device->dev, &battery->bat);
449 if (result)
450 return result;
451 return device_create_file(battery->bat.dev, &alarm_attr);
452}
453
454static void sysfs_remove_battery(struct acpi_battery *battery)
455{
456 if (!battery->bat.dev)
457 return;
458 device_remove_file(battery->bat.dev, &alarm_attr);
459 power_supply_unregister(&battery->bat);
460}
461
388static int acpi_battery_update(struct acpi_battery *battery) 462static int acpi_battery_update(struct acpi_battery *battery)
389{ 463{
390 int saved_present = acpi_battery_present(battery);
391 int result = acpi_battery_get_status(battery); 464 int result = acpi_battery_get_status(battery);
392 if (result || !acpi_battery_present(battery)) 465 if (result)
393 return result; 466 return result;
394 if (saved_present != acpi_battery_present(battery) || 467 if (!acpi_battery_present(battery)) {
395 !battery->update_time) { 468 sysfs_remove_battery(battery);
396 battery->update_time = 0; 469 return 0;
397 result = acpi_battery_get_info(battery);
398 if (result)
399 return result;
400 if (battery->power_unit) {
401 battery->bat.properties = charge_battery_props;
402 battery->bat.num_properties =
403 ARRAY_SIZE(charge_battery_props);
404 } else {
405 battery->bat.properties = energy_battery_props;
406 battery->bat.num_properties =
407 ARRAY_SIZE(energy_battery_props);
408 }
409 acpi_battery_init_alarm(battery);
410 } 470 }
471 if (!battery->bat.dev)
472 sysfs_add_battery(battery);
411 return acpi_battery_get_state(battery); 473 return acpi_battery_get_state(battery);
412} 474}
413 475
@@ -554,10 +616,6 @@ static ssize_t acpi_battery_write_alarm(struct file *file,
554 616
555 if (!battery || (count > sizeof(alarm_string) - 1)) 617 if (!battery || (count > sizeof(alarm_string) - 1))
556 return -EINVAL; 618 return -EINVAL;
557 if (result) {
558 result = -ENODEV;
559 goto end;
560 }
561 if (!acpi_battery_present(battery)) { 619 if (!acpi_battery_present(battery)) {
562 result = -ENODEV; 620 result = -ENODEV;
563 goto end; 621 goto end;
@@ -688,33 +746,6 @@ static void acpi_battery_remove_fs(struct acpi_device *device)
688 746
689#endif 747#endif
690 748
691static ssize_t acpi_battery_alarm_show(struct device *dev,
692 struct device_attribute *attr,
693 char *buf)
694{
695 struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
696 return sprintf(buf, "%d\n", battery->alarm * 1000);
697}
698
699static ssize_t acpi_battery_alarm_store(struct device *dev,
700 struct device_attribute *attr,
701 const char *buf, size_t count)
702{
703 unsigned long x;
704 struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
705 if (sscanf(buf, "%ld\n", &x) == 1)
706 battery->alarm = x/1000;
707 if (acpi_battery_present(battery))
708 acpi_battery_set_alarm(battery);
709 return count;
710}
711
712static struct device_attribute alarm_attr = {
713 .attr = {.name = "alarm", .mode = 0644, .owner = THIS_MODULE},
714 .show = acpi_battery_alarm_show,
715 .store = acpi_battery_alarm_store,
716};
717
718/* -------------------------------------------------------------------------- 749/* --------------------------------------------------------------------------
719 Driver Interface 750 Driver Interface
720 -------------------------------------------------------------------------- */ 751 -------------------------------------------------------------------------- */
@@ -732,7 +763,9 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
732 acpi_bus_generate_netlink_event(device->pnp.device_class, 763 acpi_bus_generate_netlink_event(device->pnp.device_class,
733 device->dev.bus_id, event, 764 device->dev.bus_id, event,
734 acpi_battery_present(battery)); 765 acpi_battery_present(battery));
735 kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); 766 /* acpi_batter_update could remove power_supply object */
767 if (battery->bat.dev)
768 kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE);
736} 769}
737 770
738static int acpi_battery_add(struct acpi_device *device) 771static int acpi_battery_add(struct acpi_device *device)
@@ -756,11 +789,6 @@ static int acpi_battery_add(struct acpi_device *device)
756 if (result) 789 if (result)
757 goto end; 790 goto end;
758#endif 791#endif
759 battery->bat.name = acpi_device_bid(device);
760 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
761 battery->bat.get_property = acpi_battery_get_property;
762 result = power_supply_register(&battery->device->dev, &battery->bat);
763 result = device_create_file(battery->bat.dev, &alarm_attr);
764 status = acpi_install_notify_handler(device->handle, 792 status = acpi_install_notify_handler(device->handle,
765 ACPI_ALL_NOTIFY, 793 ACPI_ALL_NOTIFY,
766 acpi_battery_notify, battery); 794 acpi_battery_notify, battery);
@@ -796,10 +824,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
796#ifdef CONFIG_ACPI_PROCFS 824#ifdef CONFIG_ACPI_PROCFS
797 acpi_battery_remove_fs(device); 825 acpi_battery_remove_fs(device);
798#endif 826#endif
799 if (battery->bat.dev) { 827 sysfs_remove_battery(battery);
800 device_remove_file(battery->bat.dev, &alarm_attr);
801 power_supply_unregister(&battery->bat);
802 }
803 mutex_destroy(&battery->lock); 828 mutex_destroy(&battery->lock);
804 kfree(battery); 829 kfree(battery);
805 return 0; 830 return 0;
@@ -813,6 +838,7 @@ static int acpi_battery_resume(struct acpi_device *device)
813 return -EINVAL; 838 return -EINVAL;
814 battery = acpi_driver_data(device); 839 battery = acpi_driver_data(device);
815 battery->update_time = 0; 840 battery->update_time = 0;
841 acpi_battery_update(battery);
816 return 0; 842 return 0;
817} 843}
818 844
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index fb2cff9a2d24..49d432d0a12c 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -198,12 +198,10 @@ int acpi_bus_set_power(acpi_handle handle, int state)
198 return -ENODEV; 198 return -ENODEV;
199 } 199 }
200 /* 200 /*
201 * Get device's current power state if it's unknown 201 * Get device's current power state
202 * This means device power state isn't initialized or previous setting failed
203 */ 202 */
204 if ((device->power.state == ACPI_STATE_UNKNOWN) || device->flags.force_power_state) 203 acpi_bus_get_power(device->handle, &device->power.state);
205 acpi_bus_get_power(device->handle, &device->power.state); 204 if (state == device->power.state) {
206 if ((state == device->power.state) && !device->flags.force_power_state) {
207 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", 205 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
208 state)); 206 state));
209 return 0; 207 return 0;
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 301e832e6961..24a7865a57cb 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -78,6 +78,7 @@ MODULE_DEVICE_TABLE(acpi, button_device_ids);
78 78
79static int acpi_button_add(struct acpi_device *device); 79static int acpi_button_add(struct acpi_device *device);
80static int acpi_button_remove(struct acpi_device *device, int type); 80static int acpi_button_remove(struct acpi_device *device, int type);
81static int acpi_button_resume(struct acpi_device *device);
81static int acpi_button_info_open_fs(struct inode *inode, struct file *file); 82static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
82static int acpi_button_state_open_fs(struct inode *inode, struct file *file); 83static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
83 84
@@ -87,6 +88,7 @@ static struct acpi_driver acpi_button_driver = {
87 .ids = button_device_ids, 88 .ids = button_device_ids,
88 .ops = { 89 .ops = {
89 .add = acpi_button_add, 90 .add = acpi_button_add,
91 .resume = acpi_button_resume,
90 .remove = acpi_button_remove, 92 .remove = acpi_button_remove,
91 }, 93 },
92}; 94};
@@ -253,6 +255,19 @@ static int acpi_button_remove_fs(struct acpi_device *device)
253/* -------------------------------------------------------------------------- 255/* --------------------------------------------------------------------------
254 Driver Interface 256 Driver Interface
255 -------------------------------------------------------------------------- */ 257 -------------------------------------------------------------------------- */
258static int acpi_lid_send_state(struct acpi_button *button)
259{
260 unsigned long state;
261 acpi_status status;
262
263 status = acpi_evaluate_integer(button->device->handle, "_LID", NULL,
264 &state);
265 if (ACPI_FAILURE(status))
266 return -ENODEV;
267 /* input layer checks if event is redundant */
268 input_report_switch(button->input, SW_LID, !state);
269 return 0;
270}
256 271
257static void acpi_button_notify(acpi_handle handle, u32 event, void *data) 272static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
258{ 273{
@@ -265,15 +280,8 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
265 switch (event) { 280 switch (event) {
266 case ACPI_BUTTON_NOTIFY_STATUS: 281 case ACPI_BUTTON_NOTIFY_STATUS:
267 input = button->input; 282 input = button->input;
268
269 if (button->type == ACPI_BUTTON_TYPE_LID) { 283 if (button->type == ACPI_BUTTON_TYPE_LID) {
270 struct acpi_handle *handle = button->device->handle; 284 acpi_lid_send_state(button);
271 unsigned long state;
272
273 if (!ACPI_FAILURE(acpi_evaluate_integer(handle, "_LID",
274 NULL, &state)))
275 input_report_switch(input, SW_LID, !state);
276
277 } else { 285 } else {
278 int keycode = test_bit(KEY_SLEEP, input->keybit) ? 286 int keycode = test_bit(KEY_SLEEP, input->keybit) ?
279 KEY_SLEEP : KEY_POWER; 287 KEY_SLEEP : KEY_POWER;
@@ -336,6 +344,17 @@ static int acpi_button_install_notify_handlers(struct acpi_button *button)
336 return ACPI_FAILURE(status) ? -ENODEV : 0; 344 return ACPI_FAILURE(status) ? -ENODEV : 0;
337} 345}
338 346
347static int acpi_button_resume(struct acpi_device *device)
348{
349 struct acpi_button *button;
350 if (!device)
351 return -EINVAL;
352 button = acpi_driver_data(device);
353 if (button && button->type == ACPI_BUTTON_TYPE_LID)
354 return acpi_lid_send_state(button);
355 return 0;
356}
357
339static void acpi_button_remove_notify_handlers(struct acpi_button *button) 358static void acpi_button_remove_notify_handlers(struct acpi_button *button)
340{ 359{
341 switch (button->type) { 360 switch (button->type) {
@@ -453,6 +472,8 @@ static int acpi_button_add(struct acpi_device *device)
453 error = input_register_device(input); 472 error = input_register_device(input);
454 if (error) 473 if (error)
455 goto err_remove_handlers; 474 goto err_remove_handlers;
475 if (button->type == ACPI_BUTTON_TYPE_LID)
476 acpi_lid_send_state(button);
456 477
457 if (device->wakeup.flags.valid) { 478 if (device->wakeup.flags.valid) {
458 /* Button's GPE is run-wake GPE */ 479 /* Button's GPE is run-wake GPE */
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 7b4178393e34..06b78e5e33a1 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -65,16 +65,18 @@ enum ec_command {
65/* EC events */ 65/* EC events */
66enum ec_event { 66enum ec_event {
67 ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ 67 ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */
68 ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ 68 ACPI_EC_EVENT_IBF_0, /* Input buffer empty */
69}; 69};
70 70
71#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ 71#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
72#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ 72#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
73 73
74static enum ec_mode { 74enum {
75 EC_INTR = 1, /* Output buffer full */ 75 EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */
76 EC_POLL, /* Input buffer empty */ 76 EC_FLAGS_QUERY_PENDING, /* Query is pending */
77} acpi_ec_mode = EC_INTR; 77 EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */
78 EC_FLAGS_ONLY_IBF_GPE, /* Expect GPE only for IBF = 0 event */
79};
78 80
79static int acpi_ec_remove(struct acpi_device *device, int type); 81static int acpi_ec_remove(struct acpi_device *device, int type);
80static int acpi_ec_start(struct acpi_device *device); 82static int acpi_ec_start(struct acpi_device *device);
@@ -116,9 +118,8 @@ static struct acpi_ec {
116 unsigned long command_addr; 118 unsigned long command_addr;
117 unsigned long data_addr; 119 unsigned long data_addr;
118 unsigned long global_lock; 120 unsigned long global_lock;
121 unsigned long flags;
119 struct mutex lock; 122 struct mutex lock;
120 atomic_t query_pending;
121 atomic_t event_count;
122 wait_queue_head_t wait; 123 wait_queue_head_t wait;
123 struct list_head list; 124 struct list_head list;
124 u8 handlers_installed; 125 u8 handlers_installed;
@@ -148,45 +149,54 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
148 outb(data, ec->data_addr); 149 outb(data, ec->data_addr);
149} 150}
150 151
151static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event, 152static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event)
152 unsigned old_count)
153{ 153{
154 u8 status = acpi_ec_read_status(ec); 154 if (test_bit(EC_FLAGS_WAIT_GPE, &ec->flags))
155 if (old_count == atomic_read(&ec->event_count))
156 return 0; 155 return 0;
157 if (event == ACPI_EC_EVENT_OBF_1) { 156 if (event == ACPI_EC_EVENT_OBF_1) {
158 if (status & ACPI_EC_FLAG_OBF) 157 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF)
159 return 1; 158 return 1;
160 } else if (event == ACPI_EC_EVENT_IBF_0) { 159 } else if (event == ACPI_EC_EVENT_IBF_0) {
161 if (!(status & ACPI_EC_FLAG_IBF)) 160 if (!(acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF))
162 return 1; 161 return 1;
163 } 162 }
164 163
165 return 0; 164 return 0;
166} 165}
167 166
168static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, 167static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
169 unsigned count, int force_poll)
170{ 168{
171 if (unlikely(force_poll) || acpi_ec_mode == EC_POLL) { 169 if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) &&
170 likely(!force_poll)) {
171 if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event),
172 msecs_to_jiffies(ACPI_EC_DELAY)))
173 return 0;
174 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
175 if (acpi_ec_check_status(ec, event)) {
176 if (event == ACPI_EC_EVENT_OBF_1) {
177 /* miss OBF = 1 GPE, don't expect it anymore */
178 printk(KERN_INFO PREFIX "missing OBF_1 confirmation,"
179 "switching to degraded mode.\n");
180 set_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags);
181 } else {
182 /* missing GPEs, switch back to poll mode */
183 printk(KERN_INFO PREFIX "missing IBF_1 confirmations,"
184 "switch off interrupt mode.\n");
185 clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
186 }
187 return 0;
188 }
189 } else {
172 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); 190 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
191 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
173 while (time_before(jiffies, delay)) { 192 while (time_before(jiffies, delay)) {
174 if (acpi_ec_check_status(ec, event, 0)) 193 if (acpi_ec_check_status(ec, event))
175 return 0; 194 return 0;
176 } 195 }
177 } else { 196 }
178 if (wait_event_timeout(ec->wait, 197 printk(KERN_ERR PREFIX "acpi_ec_wait timeout,"
179 acpi_ec_check_status(ec, event, count),
180 msecs_to_jiffies(ACPI_EC_DELAY)) ||
181 acpi_ec_check_status(ec, event, 0)) {
182 return 0;
183 } else {
184 printk(KERN_ERR PREFIX "acpi_ec_wait timeout,"
185 " status = %d, expect_event = %d\n", 198 " status = %d, expect_event = %d\n",
186 acpi_ec_read_status(ec), event); 199 acpi_ec_read_status(ec), event);
187 }
188 }
189
190 return -ETIME; 200 return -ETIME;
191} 201}
192 202
@@ -196,39 +206,42 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
196 int force_poll) 206 int force_poll)
197{ 207{
198 int result = 0; 208 int result = 0;
199 unsigned count = atomic_read(&ec->event_count); 209 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
200 acpi_ec_write_cmd(ec, command); 210 acpi_ec_write_cmd(ec, command);
201 211
202 for (; wdata_len > 0; --wdata_len) { 212 for (; wdata_len > 0; --wdata_len) {
203 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll); 213 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll);
204 if (result) { 214 if (result) {
205 printk(KERN_ERR PREFIX 215 printk(KERN_ERR PREFIX
206 "write_cmd timeout, command = %d\n", command); 216 "write_cmd timeout, command = %d\n", command);
207 goto end; 217 goto end;
208 } 218 }
209 count = atomic_read(&ec->event_count); 219 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
210 acpi_ec_write_data(ec, *(wdata++)); 220 acpi_ec_write_data(ec, *(wdata++));
211 } 221 }
212 222
213 if (!rdata_len) { 223 if (!rdata_len) {
214 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll); 224 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll);
215 if (result) { 225 if (result) {
216 printk(KERN_ERR PREFIX 226 printk(KERN_ERR PREFIX
217 "finish-write timeout, command = %d\n", command); 227 "finish-write timeout, command = %d\n", command);
218 goto end; 228 goto end;
219 } 229 }
220 } else if (command == ACPI_EC_COMMAND_QUERY) { 230 } else if (command == ACPI_EC_COMMAND_QUERY)
221 atomic_set(&ec->query_pending, 0); 231 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
222 }
223 232
224 for (; rdata_len > 0; --rdata_len) { 233 for (; rdata_len > 0; --rdata_len) {
225 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count, force_poll); 234 if (test_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags))
235 force_poll = 1;
236 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll);
226 if (result) { 237 if (result) {
227 printk(KERN_ERR PREFIX "read timeout, command = %d\n", 238 printk(KERN_ERR PREFIX "read timeout, command = %d\n",
228 command); 239 command);
229 goto end; 240 goto end;
230 } 241 }
231 count = atomic_read(&ec->event_count); 242 /* Don't expect GPE after last read */
243 if (rdata_len > 1)
244 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
232 *(rdata++) = acpi_ec_read_data(ec); 245 *(rdata++) = acpi_ec_read_data(ec);
233 } 246 }
234 end: 247 end:
@@ -258,10 +271,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
258 } 271 }
259 } 272 }
260 273
261 /* Make sure GPE is enabled before doing transaction */ 274 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0);
262 acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
263
264 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0, 0);
265 if (status) { 275 if (status) {
266 printk(KERN_ERR PREFIX 276 printk(KERN_ERR PREFIX
267 "input buffer is not empty, aborting transaction\n"); 277 "input buffer is not empty, aborting transaction\n");
@@ -435,9 +445,9 @@ EXPORT_SYMBOL_GPL(acpi_ec_add_query_handler);
435 445
436void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) 446void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
437{ 447{
438 struct acpi_ec_query_handler *handler; 448 struct acpi_ec_query_handler *handler, *tmp;
439 mutex_lock(&ec->lock); 449 mutex_lock(&ec->lock);
440 list_for_each_entry(handler, &ec->list, node) { 450 list_for_each_entry_safe(handler, tmp, &ec->list, node) {
441 if (query_bit == handler->query_bit) { 451 if (query_bit == handler->query_bit) {
442 list_del(&handler->node); 452 list_del(&handler->node);
443 kfree(handler); 453 kfree(handler);
@@ -476,23 +486,24 @@ static void acpi_ec_gpe_query(void *ec_cxt)
476static u32 acpi_ec_gpe_handler(void *data) 486static u32 acpi_ec_gpe_handler(void *data)
477{ 487{
478 acpi_status status = AE_OK; 488 acpi_status status = AE_OK;
479 u8 value;
480 struct acpi_ec *ec = data; 489 struct acpi_ec *ec = data;
481 490
482 atomic_inc(&ec->event_count); 491 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
483 492 if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))
484 if (acpi_ec_mode == EC_INTR) {
485 wake_up(&ec->wait); 493 wake_up(&ec->wait);
486 }
487 494
488 value = acpi_ec_read_status(ec); 495 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) {
489 if ((value & ACPI_EC_FLAG_SCI) && !atomic_read(&ec->query_pending)) { 496 if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
490 atomic_set(&ec->query_pending, 1); 497 status = acpi_os_execute(OSL_EC_BURST_HANDLER,
491 status = 498 acpi_ec_gpe_query, ec);
492 acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec); 499 } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) {
500 /* this is non-query, must be confirmation */
501 printk(KERN_INFO PREFIX "non-query interrupt received,"
502 " switching to interrupt mode\n");
503 set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
493 } 504 }
494 505
495 return status == AE_OK ? 506 return ACPI_SUCCESS(status) ?
496 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; 507 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
497} 508}
498 509
@@ -641,13 +652,10 @@ static struct acpi_ec *make_acpi_ec(void)
641 struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL); 652 struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
642 if (!ec) 653 if (!ec)
643 return NULL; 654 return NULL;
644 655 ec->flags = 1 << EC_FLAGS_QUERY_PENDING;
645 atomic_set(&ec->query_pending, 1);
646 atomic_set(&ec->event_count, 1);
647 mutex_init(&ec->lock); 656 mutex_init(&ec->lock);
648 init_waitqueue_head(&ec->wait); 657 init_waitqueue_head(&ec->wait);
649 INIT_LIST_HEAD(&ec->list); 658 INIT_LIST_HEAD(&ec->list);
650
651 return ec; 659 return ec;
652} 660}
653 661
@@ -741,6 +749,8 @@ static int acpi_ec_add(struct acpi_device *device)
741 acpi_ec_add_fs(device); 749 acpi_ec_add_fs(device);
742 printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", 750 printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
743 ec->gpe, ec->command_addr, ec->data_addr); 751 ec->gpe, ec->command_addr, ec->data_addr);
752 printk(KERN_INFO PREFIX "driver started in %s mode\n",
753 (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll");
744 return 0; 754 return 0;
745} 755}
746 756
@@ -833,7 +843,7 @@ static int acpi_ec_start(struct acpi_device *device)
833 ret = ec_install_handlers(ec); 843 ret = ec_install_handlers(ec);
834 844
835 /* EC is fully operational, allow queries */ 845 /* EC is fully operational, allow queries */
836 atomic_set(&ec->query_pending, 0); 846 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
837 return ret; 847 return ret;
838} 848}
839 849
@@ -924,20 +934,4 @@ static void __exit acpi_ec_exit(void)
924 934
925 return; 935 return;
926} 936}
927#endif /* 0 */ 937#endif /* 0 */
928
929static int __init acpi_ec_set_intr_mode(char *str)
930{
931 int intr;
932
933 if (!get_option(&str, &intr))
934 return 0;
935
936 acpi_ec_mode = (intr) ? EC_INTR : EC_POLL;
937
938 printk(KERN_NOTICE PREFIX "%s mode.\n", intr ? "interrupt" : "polling");
939
940 return 1;
941}
942
943__setup("ec_intr=", acpi_ec_set_intr_mode);
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index c81f6bdb68b8..a5a5532db268 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -47,8 +47,6 @@ MODULE_LICENSE("GPL");
47 47
48static int acpi_fan_add(struct acpi_device *device); 48static int acpi_fan_add(struct acpi_device *device);
49static int acpi_fan_remove(struct acpi_device *device, int type); 49static int acpi_fan_remove(struct acpi_device *device, int type);
50static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state);
51static int acpi_fan_resume(struct acpi_device *device);
52 50
53static const struct acpi_device_id fan_device_ids[] = { 51static const struct acpi_device_id fan_device_ids[] = {
54 {"PNP0C0B", 0}, 52 {"PNP0C0B", 0},
@@ -63,15 +61,9 @@ static struct acpi_driver acpi_fan_driver = {
63 .ops = { 61 .ops = {
64 .add = acpi_fan_add, 62 .add = acpi_fan_add,
65 .remove = acpi_fan_remove, 63 .remove = acpi_fan_remove,
66 .suspend = acpi_fan_suspend,
67 .resume = acpi_fan_resume,
68 }, 64 },
69}; 65};
70 66
71struct acpi_fan {
72 struct acpi_device * device;
73};
74
75/* -------------------------------------------------------------------------- 67/* --------------------------------------------------------------------------
76 FS Interface (/proc) 68 FS Interface (/proc)
77 -------------------------------------------------------------------------- */ 69 -------------------------------------------------------------------------- */
@@ -80,12 +72,12 @@ static struct proc_dir_entry *acpi_fan_dir;
80 72
81static int acpi_fan_read_state(struct seq_file *seq, void *offset) 73static int acpi_fan_read_state(struct seq_file *seq, void *offset)
82{ 74{
83 struct acpi_fan *fan = seq->private; 75 struct acpi_device *device = seq->private;
84 int state = 0; 76 int state = 0;
85 77
86 78
87 if (fan) { 79 if (device) {
88 if (acpi_bus_get_power(fan->device->handle, &state)) 80 if (acpi_bus_get_power(device->handle, &state))
89 seq_printf(seq, "status: ERROR\n"); 81 seq_printf(seq, "status: ERROR\n");
90 else 82 else
91 seq_printf(seq, "status: %s\n", 83 seq_printf(seq, "status: %s\n",
@@ -105,11 +97,10 @@ acpi_fan_write_state(struct file *file, const char __user * buffer,
105{ 97{
106 int result = 0; 98 int result = 0;
107 struct seq_file *m = file->private_data; 99 struct seq_file *m = file->private_data;
108 struct acpi_fan *fan = m->private; 100 struct acpi_device *device = m->private;
109 char state_string[12] = { '\0' }; 101 char state_string[12] = { '\0' };
110 102
111 103 if (count > sizeof(state_string) - 1)
112 if (!fan || (count > sizeof(state_string) - 1))
113 return -EINVAL; 104 return -EINVAL;
114 105
115 if (copy_from_user(state_string, buffer, count)) 106 if (copy_from_user(state_string, buffer, count))
@@ -117,7 +108,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer,
117 108
118 state_string[count] = '\0'; 109 state_string[count] = '\0';
119 110
120 result = acpi_bus_set_power(fan->device->handle, 111 result = acpi_bus_set_power(device->handle,
121 simple_strtoul(state_string, NULL, 0)); 112 simple_strtoul(state_string, NULL, 0));
122 if (result) 113 if (result)
123 return result; 114 return result;
@@ -158,7 +149,7 @@ static int acpi_fan_add_fs(struct acpi_device *device)
158 return -ENODEV; 149 return -ENODEV;
159 else { 150 else {
160 entry->proc_fops = &acpi_fan_state_ops; 151 entry->proc_fops = &acpi_fan_state_ops;
161 entry->data = acpi_driver_data(device); 152 entry->data = device;
162 entry->owner = THIS_MODULE; 153 entry->owner = THIS_MODULE;
163 } 154 }
164 155
@@ -191,14 +182,8 @@ static int acpi_fan_add(struct acpi_device *device)
191 if (!device) 182 if (!device)
192 return -EINVAL; 183 return -EINVAL;
193 184
194 fan = kzalloc(sizeof(struct acpi_fan), GFP_KERNEL);
195 if (!fan)
196 return -ENOMEM;
197
198 fan->device = device;
199 strcpy(acpi_device_name(device), "Fan"); 185 strcpy(acpi_device_name(device), "Fan");
200 strcpy(acpi_device_class(device), ACPI_FAN_CLASS); 186 strcpy(acpi_device_class(device), ACPI_FAN_CLASS);
201 acpi_driver_data(device) = fan;
202 187
203 result = acpi_bus_get_power(device->handle, &state); 188 result = acpi_bus_get_power(device->handle, &state);
204 if (result) { 189 if (result) {
@@ -206,10 +191,6 @@ static int acpi_fan_add(struct acpi_device *device)
206 goto end; 191 goto end;
207 } 192 }
208 193
209 device->flags.force_power_state = 1;
210 acpi_bus_set_power(device->handle, state);
211 device->flags.force_power_state = 0;
212
213 result = acpi_fan_add_fs(device); 194 result = acpi_fan_add_fs(device);
214 if (result) 195 if (result)
215 goto end; 196 goto end;
@@ -227,53 +208,14 @@ static int acpi_fan_add(struct acpi_device *device)
227 208
228static int acpi_fan_remove(struct acpi_device *device, int type) 209static int acpi_fan_remove(struct acpi_device *device, int type)
229{ 210{
230 struct acpi_fan *fan = NULL;
231
232
233 if (!device || !acpi_driver_data(device)) 211 if (!device || !acpi_driver_data(device))
234 return -EINVAL; 212 return -EINVAL;
235 213
236 fan = acpi_driver_data(device);
237
238 acpi_fan_remove_fs(device); 214 acpi_fan_remove_fs(device);
239 215
240 kfree(fan);
241
242 return 0; 216 return 0;
243} 217}
244 218
245static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state)
246{
247 if (!device)
248 return -EINVAL;
249
250 acpi_bus_set_power(device->handle, ACPI_STATE_D0);
251
252 return AE_OK;
253}
254
255static int acpi_fan_resume(struct acpi_device *device)
256{
257 int result = 0;
258 int power_state = 0;
259
260 if (!device)
261 return -EINVAL;
262
263 result = acpi_bus_get_power(device->handle, &power_state);
264 if (result) {
265 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
266 "Error reading fan power state\n"));
267 return result;
268 }
269
270 device->flags.force_power_state = 1;
271 acpi_bus_set_power(device->handle, power_state);
272 device->flags.force_power_state = 0;
273
274 return result;
275}
276
277static int __init acpi_fan_init(void) 219static int __init acpi_fan_init(void)
278{ 220{
279 int result = 0; 221 int result = 0;
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 57b9a2998fd0..af1769a20c7a 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -86,7 +86,6 @@ struct acpi_power_resource {
86 acpi_bus_id name; 86 acpi_bus_id name;
87 u32 system_level; 87 u32 system_level;
88 u32 order; 88 u32 order;
89 int state;
90 struct mutex resource_lock; 89 struct mutex resource_lock;
91 struct list_head reference; 90 struct list_head reference;
92}; 91};
@@ -128,33 +127,31 @@ acpi_power_get_context(acpi_handle handle,
128 return 0; 127 return 0;
129} 128}
130 129
131static int acpi_power_get_state(struct acpi_power_resource *resource) 130static int acpi_power_get_state(struct acpi_power_resource *resource, int *state)
132{ 131{
133 acpi_status status = AE_OK; 132 acpi_status status = AE_OK;
134 unsigned long sta = 0; 133 unsigned long sta = 0;
135 134
136 135
137 if (!resource) 136 if (!resource || !state)
138 return -EINVAL; 137 return -EINVAL;
139 138
140 status = acpi_evaluate_integer(resource->device->handle, "_STA", NULL, &sta); 139 status = acpi_evaluate_integer(resource->device->handle, "_STA", NULL, &sta);
141 if (ACPI_FAILURE(status)) 140 if (ACPI_FAILURE(status))
142 return -ENODEV; 141 return -ENODEV;
143 142
144 if (sta & 0x01) 143 *state = (sta & 0x01)?ACPI_POWER_RESOURCE_STATE_ON:
145 resource->state = ACPI_POWER_RESOURCE_STATE_ON; 144 ACPI_POWER_RESOURCE_STATE_OFF;
146 else
147 resource->state = ACPI_POWER_RESOURCE_STATE_OFF;
148 145
149 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", 146 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n",
150 resource->name, resource->state ? "on" : "off")); 147 resource->name, state ? "on" : "off"));
151 148
152 return 0; 149 return 0;
153} 150}
154 151
155static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) 152static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
156{ 153{
157 int result = 0; 154 int result = 0, state1;
158 struct acpi_power_resource *resource = NULL; 155 struct acpi_power_resource *resource = NULL;
159 u32 i = 0; 156 u32 i = 0;
160 157
@@ -168,11 +165,11 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
168 result = acpi_power_get_context(list->handles[i], &resource); 165 result = acpi_power_get_context(list->handles[i], &resource);
169 if (result) 166 if (result)
170 return result; 167 return result;
171 result = acpi_power_get_state(resource); 168 result = acpi_power_get_state(resource, &state1);
172 if (result) 169 if (result)
173 return result; 170 return result;
174 171
175 *state = resource->state; 172 *state = state1;
176 173
177 if (*state != ACPI_POWER_RESOURCE_STATE_ON) 174 if (*state != ACPI_POWER_RESOURCE_STATE_ON)
178 break; 175 break;
@@ -186,7 +183,7 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
186 183
187static int acpi_power_on(acpi_handle handle, struct acpi_device *dev) 184static int acpi_power_on(acpi_handle handle, struct acpi_device *dev)
188{ 185{
189 int result = 0; 186 int result = 0, state;
190 int found = 0; 187 int found = 0;
191 acpi_status status = AE_OK; 188 acpi_status status = AE_OK;
192 struct acpi_power_resource *resource = NULL; 189 struct acpi_power_resource *resource = NULL;
@@ -224,20 +221,14 @@ static int acpi_power_on(acpi_handle handle, struct acpi_device *dev)
224 } 221 }
225 mutex_unlock(&resource->resource_lock); 222 mutex_unlock(&resource->resource_lock);
226 223
227 if (resource->state == ACPI_POWER_RESOURCE_STATE_ON) {
228 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n",
229 resource->name));
230 return 0;
231 }
232
233 status = acpi_evaluate_object(resource->device->handle, "_ON", NULL, NULL); 224 status = acpi_evaluate_object(resource->device->handle, "_ON", NULL, NULL);
234 if (ACPI_FAILURE(status)) 225 if (ACPI_FAILURE(status))
235 return -ENODEV; 226 return -ENODEV;
236 227
237 result = acpi_power_get_state(resource); 228 result = acpi_power_get_state(resource, &state);
238 if (result) 229 if (result)
239 return result; 230 return result;
240 if (resource->state != ACPI_POWER_RESOURCE_STATE_ON) 231 if (state != ACPI_POWER_RESOURCE_STATE_ON)
241 return -ENOEXEC; 232 return -ENOEXEC;
242 233
243 /* Update the power resource's _device_ power state */ 234 /* Update the power resource's _device_ power state */
@@ -250,7 +241,7 @@ static int acpi_power_on(acpi_handle handle, struct acpi_device *dev)
250 241
251static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev) 242static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev)
252{ 243{
253 int result = 0; 244 int result = 0, state;
254 acpi_status status = AE_OK; 245 acpi_status status = AE_OK;
255 struct acpi_power_resource *resource = NULL; 246 struct acpi_power_resource *resource = NULL;
256 struct list_head *node, *next; 247 struct list_head *node, *next;
@@ -281,20 +272,14 @@ static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev)
281 } 272 }
282 mutex_unlock(&resource->resource_lock); 273 mutex_unlock(&resource->resource_lock);
283 274
284 if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) {
285 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n",
286 resource->name));
287 return 0;
288 }
289
290 status = acpi_evaluate_object(resource->device->handle, "_OFF", NULL, NULL); 275 status = acpi_evaluate_object(resource->device->handle, "_OFF", NULL, NULL);
291 if (ACPI_FAILURE(status)) 276 if (ACPI_FAILURE(status))
292 return -ENODEV; 277 return -ENODEV;
293 278
294 result = acpi_power_get_state(resource); 279 result = acpi_power_get_state(resource, &state);
295 if (result) 280 if (result)
296 return result; 281 return result;
297 if (resource->state != ACPI_POWER_RESOURCE_STATE_OFF) 282 if (state != ACPI_POWER_RESOURCE_STATE_OFF)
298 return -ENOEXEC; 283 return -ENOEXEC;
299 284
300 /* Update the power resource's _device_ power state */ 285 /* Update the power resource's _device_ power state */
@@ -494,7 +479,7 @@ static struct proc_dir_entry *acpi_power_dir;
494static int acpi_power_seq_show(struct seq_file *seq, void *offset) 479static int acpi_power_seq_show(struct seq_file *seq, void *offset)
495{ 480{
496 int count = 0; 481 int count = 0;
497 int result = 0; 482 int result = 0, state;
498 struct acpi_power_resource *resource = NULL; 483 struct acpi_power_resource *resource = NULL;
499 struct list_head *node, *next; 484 struct list_head *node, *next;
500 struct acpi_power_reference *ref; 485 struct acpi_power_reference *ref;
@@ -505,12 +490,12 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset)
505 if (!resource) 490 if (!resource)
506 goto end; 491 goto end;
507 492
508 result = acpi_power_get_state(resource); 493 result = acpi_power_get_state(resource, &state);
509 if (result) 494 if (result)
510 goto end; 495 goto end;
511 496
512 seq_puts(seq, "state: "); 497 seq_puts(seq, "state: ");
513 switch (resource->state) { 498 switch (state) {
514 case ACPI_POWER_RESOURCE_STATE_ON: 499 case ACPI_POWER_RESOURCE_STATE_ON:
515 seq_puts(seq, "on\n"); 500 seq_puts(seq, "on\n");
516 break; 501 break;
@@ -591,7 +576,7 @@ static int acpi_power_remove_fs(struct acpi_device *device)
591 576
592static int acpi_power_add(struct acpi_device *device) 577static int acpi_power_add(struct acpi_device *device)
593{ 578{
594 int result = 0; 579 int result = 0, state;
595 acpi_status status = AE_OK; 580 acpi_status status = AE_OK;
596 struct acpi_power_resource *resource = NULL; 581 struct acpi_power_resource *resource = NULL;
597 union acpi_object acpi_object; 582 union acpi_object acpi_object;
@@ -622,11 +607,11 @@ static int acpi_power_add(struct acpi_device *device)
622 resource->system_level = acpi_object.power_resource.system_level; 607 resource->system_level = acpi_object.power_resource.system_level;
623 resource->order = acpi_object.power_resource.resource_order; 608 resource->order = acpi_object.power_resource.resource_order;
624 609
625 result = acpi_power_get_state(resource); 610 result = acpi_power_get_state(resource, &state);
626 if (result) 611 if (result)
627 goto end; 612 goto end;
628 613
629 switch (resource->state) { 614 switch (state) {
630 case ACPI_POWER_RESOURCE_STATE_ON: 615 case ACPI_POWER_RESOURCE_STATE_ON:
631 device->power.state = ACPI_STATE_D0; 616 device->power.state = ACPI_STATE_D0;
632 break; 617 break;
@@ -643,7 +628,7 @@ static int acpi_power_add(struct acpi_device *device)
643 goto end; 628 goto end;
644 629
645 printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), 630 printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device),
646 acpi_device_bid(device), resource->state ? "on" : "off"); 631 acpi_device_bid(device), state ? "on" : "off");
647 632
648 end: 633 end:
649 if (result) 634 if (result)
@@ -680,7 +665,7 @@ static int acpi_power_remove(struct acpi_device *device, int type)
680 665
681static int acpi_power_resume(struct acpi_device *device) 666static int acpi_power_resume(struct acpi_device *device)
682{ 667{
683 int result = 0; 668 int result = 0, state;
684 struct acpi_power_resource *resource = NULL; 669 struct acpi_power_resource *resource = NULL;
685 struct acpi_power_reference *ref; 670 struct acpi_power_reference *ref;
686 671
@@ -689,12 +674,12 @@ static int acpi_power_resume(struct acpi_device *device)
689 674
690 resource = (struct acpi_power_resource *)acpi_driver_data(device); 675 resource = (struct acpi_power_resource *)acpi_driver_data(device);
691 676
692 result = acpi_power_get_state(resource); 677 result = acpi_power_get_state(resource, &state);
693 if (result) 678 if (result)
694 return result; 679 return result;
695 680
696 mutex_lock(&resource->resource_lock); 681 mutex_lock(&resource->resource_lock);
697 if ((resource->state == ACPI_POWER_RESOURCE_STATE_OFF) && 682 if (state == ACPI_POWER_RESOURCE_STATE_OFF &&
698 !list_empty(&resource->reference)) { 683 !list_empty(&resource->reference)) {
699 ref = container_of(resource->reference.next, struct acpi_power_reference, node); 684 ref = container_of(resource->reference.next, struct acpi_power_reference, node);
700 mutex_unlock(&resource->resource_lock); 685 mutex_unlock(&resource->resource_lock);
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index f3d3867303ec..2c0b6630f8ba 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -167,8 +167,8 @@ static void acpi_pm_finish(void)
167{ 167{
168 u32 acpi_state = acpi_target_sleep_state; 168 u32 acpi_state = acpi_target_sleep_state;
169 169
170 acpi_leave_sleep_state(acpi_state);
171 acpi_disable_wakeup_device(acpi_state); 170 acpi_disable_wakeup_device(acpi_state);
171 acpi_leave_sleep_state(acpi_state);
172 172
173 /* reset firmware waking vector */ 173 /* reset firmware waking vector */
174 acpi_set_firmware_waking_vector((acpi_physical_address) 0); 174 acpi_set_firmware_waking_vector((acpi_physical_address) 0);
@@ -272,8 +272,8 @@ static void acpi_hibernation_finish(void)
272 * enable it here. 272 * enable it here.
273 */ 273 */
274 acpi_enable(); 274 acpi_enable();
275 acpi_leave_sleep_state(ACPI_STATE_S4);
276 acpi_disable_wakeup_device(ACPI_STATE_S4); 275 acpi_disable_wakeup_device(ACPI_STATE_S4);
276 acpi_leave_sleep_state(ACPI_STATE_S4);
277 277
278 /* reset firmware waking vector */ 278 /* reset firmware waking vector */
279 acpi_set_firmware_waking_vector((acpi_physical_address) 0); 279 acpi_set_firmware_waking_vector((acpi_physical_address) 0);
@@ -410,6 +410,7 @@ static void acpi_power_off(void)
410 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ 410 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
411 printk("%s called\n", __FUNCTION__); 411 printk("%s called\n", __FUNCTION__);
412 local_irq_disable(); 412 local_irq_disable();
413 acpi_enable_wakeup_device(ACPI_STATE_S5);
413 acpi_enter_sleep_state(ACPI_STATE_S5); 414 acpi_enter_sleep_state(ACPI_STATE_S5);
414} 415}
415 416
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index 3839efd5eaea..1538355c266b 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -194,6 +194,23 @@ static int get_date_field(char **p, u32 * value)
194 return result; 194 return result;
195} 195}
196 196
197/* Read a possibly BCD register, always return binary */
198static u32 cmos_bcd_read(int offset, int rtc_control)
199{
200 u32 val = CMOS_READ(offset);
201 if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
202 BCD_TO_BIN(val);
203 return val;
204}
205
206/* Write binary value into possibly BCD register */
207static void cmos_bcd_write(u32 val, int offset, int rtc_control)
208{
209 if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
210 BIN_TO_BCD(val);
211 CMOS_WRITE(val, offset);
212}
213
197static ssize_t 214static ssize_t
198acpi_system_write_alarm(struct file *file, 215acpi_system_write_alarm(struct file *file,
199 const char __user * buffer, size_t count, loff_t * ppos) 216 const char __user * buffer, size_t count, loff_t * ppos)
@@ -258,35 +275,18 @@ acpi_system_write_alarm(struct file *file,
258 spin_lock_irq(&rtc_lock); 275 spin_lock_irq(&rtc_lock);
259 276
260 rtc_control = CMOS_READ(RTC_CONTROL); 277 rtc_control = CMOS_READ(RTC_CONTROL);
261 if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
262 BIN_TO_BCD(yr);
263 BIN_TO_BCD(mo);
264 BIN_TO_BCD(day);
265 BIN_TO_BCD(hr);
266 BIN_TO_BCD(min);
267 BIN_TO_BCD(sec);
268 }
269 278
270 if (adjust) { 279 if (adjust) {
271 yr += CMOS_READ(RTC_YEAR); 280 yr += cmos_bcd_read(RTC_YEAR, rtc_control);
272 mo += CMOS_READ(RTC_MONTH); 281 mo += cmos_bcd_read(RTC_MONTH, rtc_control);
273 day += CMOS_READ(RTC_DAY_OF_MONTH); 282 day += cmos_bcd_read(RTC_DAY_OF_MONTH, rtc_control);
274 hr += CMOS_READ(RTC_HOURS); 283 hr += cmos_bcd_read(RTC_HOURS, rtc_control);
275 min += CMOS_READ(RTC_MINUTES); 284 min += cmos_bcd_read(RTC_MINUTES, rtc_control);
276 sec += CMOS_READ(RTC_SECONDS); 285 sec += cmos_bcd_read(RTC_SECONDS, rtc_control);
277 } 286 }
278 287
279 spin_unlock_irq(&rtc_lock); 288 spin_unlock_irq(&rtc_lock);
280 289
281 if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
282 BCD_TO_BIN(yr);
283 BCD_TO_BIN(mo);
284 BCD_TO_BIN(day);
285 BCD_TO_BIN(hr);
286 BCD_TO_BIN(min);
287 BCD_TO_BIN(sec);
288 }
289
290 if (sec > 59) { 290 if (sec > 59) {
291 min++; 291 min++;
292 sec -= 60; 292 sec -= 60;
@@ -307,14 +307,6 @@ acpi_system_write_alarm(struct file *file,
307 yr++; 307 yr++;
308 mo -= 12; 308 mo -= 12;
309 } 309 }
310 if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
311 BIN_TO_BCD(yr);
312 BIN_TO_BCD(mo);
313 BIN_TO_BCD(day);
314 BIN_TO_BCD(hr);
315 BIN_TO_BCD(min);
316 BIN_TO_BCD(sec);
317 }
318 310
319 spin_lock_irq(&rtc_lock); 311 spin_lock_irq(&rtc_lock);
320 /* 312 /*
@@ -326,9 +318,9 @@ acpi_system_write_alarm(struct file *file,
326 CMOS_READ(RTC_INTR_FLAGS); 318 CMOS_READ(RTC_INTR_FLAGS);
327 319
328 /* write the fields the rtc knows about */ 320 /* write the fields the rtc knows about */
329 CMOS_WRITE(hr, RTC_HOURS_ALARM); 321 cmos_bcd_write(hr, RTC_HOURS_ALARM, rtc_control);
330 CMOS_WRITE(min, RTC_MINUTES_ALARM); 322 cmos_bcd_write(min, RTC_MINUTES_ALARM, rtc_control);
331 CMOS_WRITE(sec, RTC_SECONDS_ALARM); 323 cmos_bcd_write(sec, RTC_SECONDS_ALARM, rtc_control);
332 324
333 /* 325 /*
334 * If the system supports an enhanced alarm it will have non-zero 326 * If the system supports an enhanced alarm it will have non-zero
@@ -336,11 +328,11 @@ acpi_system_write_alarm(struct file *file,
336 * to the RTC area of memory. 328 * to the RTC area of memory.
337 */ 329 */
338 if (acpi_gbl_FADT.day_alarm) 330 if (acpi_gbl_FADT.day_alarm)
339 CMOS_WRITE(day, acpi_gbl_FADT.day_alarm); 331 cmos_bcd_write(day, acpi_gbl_FADT.day_alarm, rtc_control);
340 if (acpi_gbl_FADT.month_alarm) 332 if (acpi_gbl_FADT.month_alarm)
341 CMOS_WRITE(mo, acpi_gbl_FADT.month_alarm); 333 cmos_bcd_write(mo, acpi_gbl_FADT.month_alarm, rtc_control);
342 if (acpi_gbl_FADT.century) 334 if (acpi_gbl_FADT.century)
343 CMOS_WRITE(yr / 100, acpi_gbl_FADT.century); 335 cmos_bcd_write(yr / 100, acpi_gbl_FADT.century, rtc_control);
344 /* enable the rtc alarm interrupt */ 336 /* enable the rtc alarm interrupt */
345 rtc_control |= RTC_AIE; 337 rtc_control |= RTC_AIE;
346 CMOS_WRITE(rtc_control, RTC_CONTROL); 338 CMOS_WRITE(rtc_control, RTC_CONTROL);
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 95229e77bffe..ed9b407e42d4 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -41,6 +41,7 @@
41#include <linux/interrupt.h> 41#include <linux/interrupt.h>
42#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
43#include <linux/device.h> 43#include <linux/device.h>
44#include <linux/dmi.h>
44#include <scsi/scsi_host.h> 45#include <scsi/scsi_host.h>
45#include <scsi/scsi_cmnd.h> 46#include <scsi/scsi_cmnd.h>
46#include <linux/libata.h> 47#include <linux/libata.h>
@@ -48,6 +49,9 @@
48#define DRV_NAME "ahci" 49#define DRV_NAME "ahci"
49#define DRV_VERSION "3.0" 50#define DRV_VERSION "3.0"
50 51
52static int ahci_enable_alpm(struct ata_port *ap,
53 enum link_pm policy);
54static void ahci_disable_alpm(struct ata_port *ap);
51 55
52enum { 56enum {
53 AHCI_PCI_BAR = 5, 57 AHCI_PCI_BAR = 5,
@@ -98,6 +102,7 @@ enum {
98 HOST_CAP_SSC = (1 << 14), /* Slumber capable */ 102 HOST_CAP_SSC = (1 << 14), /* Slumber capable */
99 HOST_CAP_PMP = (1 << 17), /* Port Multiplier support */ 103 HOST_CAP_PMP = (1 << 17), /* Port Multiplier support */
100 HOST_CAP_CLO = (1 << 24), /* Command List Override support */ 104 HOST_CAP_CLO = (1 << 24), /* Command List Override support */
105 HOST_CAP_ALPM = (1 << 26), /* Aggressive Link PM support */
101 HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */ 106 HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */
102 HOST_CAP_SNTF = (1 << 29), /* SNotification register */ 107 HOST_CAP_SNTF = (1 << 29), /* SNotification register */
103 HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */ 108 HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */
@@ -154,6 +159,8 @@ enum {
154 PORT_IRQ_PIOS_FIS | PORT_IRQ_D2H_REG_FIS, 159 PORT_IRQ_PIOS_FIS | PORT_IRQ_D2H_REG_FIS,
155 160
156 /* PORT_CMD bits */ 161 /* PORT_CMD bits */
162 PORT_CMD_ASP = (1 << 27), /* Aggressive Slumber/Partial */
163 PORT_CMD_ALPE = (1 << 26), /* Aggressive Link PM enable */
157 PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ 164 PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */
158 PORT_CMD_PMP = (1 << 17), /* PMP attached */ 165 PORT_CMD_PMP = (1 << 17), /* PMP attached */
159 PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ 166 PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */
@@ -177,13 +184,14 @@ enum {
177 AHCI_HFLAG_MV_PATA = (1 << 4), /* PATA port */ 184 AHCI_HFLAG_MV_PATA = (1 << 4), /* PATA port */
178 AHCI_HFLAG_NO_MSI = (1 << 5), /* no PCI MSI */ 185 AHCI_HFLAG_NO_MSI = (1 << 5), /* no PCI MSI */
179 AHCI_HFLAG_NO_PMP = (1 << 6), /* no PMP */ 186 AHCI_HFLAG_NO_PMP = (1 << 6), /* no PMP */
187 AHCI_HFLAG_NO_HOTPLUG = (1 << 7), /* ignore PxSERR.DIAG.N */
180 188
181 /* ap->flags bits */ 189 /* ap->flags bits */
182 AHCI_FLAG_NO_HOTPLUG = (1 << 24), /* ignore PxSERR.DIAG.N */
183 190
184 AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 191 AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
185 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 192 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
186 ATA_FLAG_ACPI_SATA | ATA_FLAG_AN, 193 ATA_FLAG_ACPI_SATA | ATA_FLAG_AN |
194 ATA_FLAG_IPM,
187 AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY, 195 AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY,
188}; 196};
189 197
@@ -241,6 +249,7 @@ static void ahci_pmp_attach(struct ata_port *ap);
241static void ahci_pmp_detach(struct ata_port *ap); 249static void ahci_pmp_detach(struct ata_port *ap);
242static void ahci_error_handler(struct ata_port *ap); 250static void ahci_error_handler(struct ata_port *ap);
243static void ahci_vt8251_error_handler(struct ata_port *ap); 251static void ahci_vt8251_error_handler(struct ata_port *ap);
252static void ahci_p5wdh_error_handler(struct ata_port *ap);
244static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); 253static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
245static int ahci_port_resume(struct ata_port *ap); 254static int ahci_port_resume(struct ata_port *ap);
246static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl); 255static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl);
@@ -252,6 +261,11 @@ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
252static int ahci_pci_device_resume(struct pci_dev *pdev); 261static int ahci_pci_device_resume(struct pci_dev *pdev);
253#endif 262#endif
254 263
264static struct class_device_attribute *ahci_shost_attrs[] = {
265 &class_device_attr_link_power_management_policy,
266 NULL
267};
268
255static struct scsi_host_template ahci_sht = { 269static struct scsi_host_template ahci_sht = {
256 .module = THIS_MODULE, 270 .module = THIS_MODULE,
257 .name = DRV_NAME, 271 .name = DRV_NAME,
@@ -269,6 +283,7 @@ static struct scsi_host_template ahci_sht = {
269 .slave_configure = ata_scsi_slave_config, 283 .slave_configure = ata_scsi_slave_config,
270 .slave_destroy = ata_scsi_slave_destroy, 284 .slave_destroy = ata_scsi_slave_destroy,
271 .bios_param = ata_std_bios_param, 285 .bios_param = ata_std_bios_param,
286 .shost_attrs = ahci_shost_attrs,
272}; 287};
273 288
274static const struct ata_port_operations ahci_ops = { 289static const struct ata_port_operations ahci_ops = {
@@ -300,6 +315,8 @@ static const struct ata_port_operations ahci_ops = {
300 .port_suspend = ahci_port_suspend, 315 .port_suspend = ahci_port_suspend,
301 .port_resume = ahci_port_resume, 316 .port_resume = ahci_port_resume,
302#endif 317#endif
318 .enable_pm = ahci_enable_alpm,
319 .disable_pm = ahci_disable_alpm,
303 320
304 .port_start = ahci_port_start, 321 .port_start = ahci_port_start,
305 .port_stop = ahci_port_stop, 322 .port_stop = ahci_port_stop,
@@ -339,6 +356,40 @@ static const struct ata_port_operations ahci_vt8251_ops = {
339 .port_stop = ahci_port_stop, 356 .port_stop = ahci_port_stop,
340}; 357};
341 358
359static const struct ata_port_operations ahci_p5wdh_ops = {
360 .check_status = ahci_check_status,
361 .check_altstatus = ahci_check_status,
362 .dev_select = ata_noop_dev_select,
363
364 .tf_read = ahci_tf_read,
365
366 .qc_defer = sata_pmp_qc_defer_cmd_switch,
367 .qc_prep = ahci_qc_prep,
368 .qc_issue = ahci_qc_issue,
369
370 .irq_clear = ahci_irq_clear,
371
372 .scr_read = ahci_scr_read,
373 .scr_write = ahci_scr_write,
374
375 .freeze = ahci_freeze,
376 .thaw = ahci_thaw,
377
378 .error_handler = ahci_p5wdh_error_handler,
379 .post_internal_cmd = ahci_post_internal_cmd,
380
381 .pmp_attach = ahci_pmp_attach,
382 .pmp_detach = ahci_pmp_detach,
383
384#ifdef CONFIG_PM
385 .port_suspend = ahci_port_suspend,
386 .port_resume = ahci_port_resume,
387#endif
388
389 .port_start = ahci_port_start,
390 .port_stop = ahci_port_stop,
391};
392
342#define AHCI_HFLAGS(flags) .private_data = (void *)(flags) 393#define AHCI_HFLAGS(flags) .private_data = (void *)(flags)
343 394
344static const struct ata_port_info ahci_port_info[] = { 395static const struct ata_port_info ahci_port_info[] = {
@@ -800,6 +851,130 @@ static void ahci_power_up(struct ata_port *ap)
800 writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD); 851 writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD);
801} 852}
802 853
854static void ahci_disable_alpm(struct ata_port *ap)
855{
856 struct ahci_host_priv *hpriv = ap->host->private_data;
857 void __iomem *port_mmio = ahci_port_base(ap);
858 u32 cmd;
859 struct ahci_port_priv *pp = ap->private_data;
860
861 /* IPM bits should be disabled by libata-core */
862 /* get the existing command bits */
863 cmd = readl(port_mmio + PORT_CMD);
864
865 /* disable ALPM and ASP */
866 cmd &= ~PORT_CMD_ASP;
867 cmd &= ~PORT_CMD_ALPE;
868
869 /* force the interface back to active */
870 cmd |= PORT_CMD_ICC_ACTIVE;
871
872 /* write out new cmd value */
873 writel(cmd, port_mmio + PORT_CMD);
874 cmd = readl(port_mmio + PORT_CMD);
875
876 /* wait 10ms to be sure we've come out of any low power state */
877 msleep(10);
878
879 /* clear out any PhyRdy stuff from interrupt status */
880 writel(PORT_IRQ_PHYRDY, port_mmio + PORT_IRQ_STAT);
881
882 /* go ahead and clean out PhyRdy Change from Serror too */
883 ahci_scr_write(ap, SCR_ERROR, ((1 << 16) | (1 << 18)));
884
885 /*
886 * Clear flag to indicate that we should ignore all PhyRdy
887 * state changes
888 */
889 hpriv->flags &= ~AHCI_HFLAG_NO_HOTPLUG;
890
891 /*
892 * Enable interrupts on Phy Ready.
893 */
894 pp->intr_mask |= PORT_IRQ_PHYRDY;
895 writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
896
897 /*
898 * don't change the link pm policy - we can be called
899 * just to turn of link pm temporarily
900 */
901}
902
903static int ahci_enable_alpm(struct ata_port *ap,
904 enum link_pm policy)
905{
906 struct ahci_host_priv *hpriv = ap->host->private_data;
907 void __iomem *port_mmio = ahci_port_base(ap);
908 u32 cmd;
909 struct ahci_port_priv *pp = ap->private_data;
910 u32 asp;
911
912 /* Make sure the host is capable of link power management */
913 if (!(hpriv->cap & HOST_CAP_ALPM))
914 return -EINVAL;
915
916 switch (policy) {
917 case MAX_PERFORMANCE:
918 case NOT_AVAILABLE:
919 /*
920 * if we came here with NOT_AVAILABLE,
921 * it just means this is the first time we
922 * have tried to enable - default to max performance,
923 * and let the user go to lower power modes on request.
924 */
925 ahci_disable_alpm(ap);
926 return 0;
927 case MIN_POWER:
928 /* configure HBA to enter SLUMBER */
929 asp = PORT_CMD_ASP;
930 break;
931 case MEDIUM_POWER:
932 /* configure HBA to enter PARTIAL */
933 asp = 0;
934 break;
935 default:
936 return -EINVAL;
937 }
938
939 /*
940 * Disable interrupts on Phy Ready. This keeps us from
941 * getting woken up due to spurious phy ready interrupts
942 * TBD - Hot plug should be done via polling now, is
943 * that even supported?
944 */
945 pp->intr_mask &= ~PORT_IRQ_PHYRDY;
946 writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
947
948 /*
949 * Set a flag to indicate that we should ignore all PhyRdy
950 * state changes since these can happen now whenever we
951 * change link state
952 */
953 hpriv->flags |= AHCI_HFLAG_NO_HOTPLUG;
954
955 /* get the existing command bits */
956 cmd = readl(port_mmio + PORT_CMD);
957
958 /*
959 * Set ASP based on Policy
960 */
961 cmd |= asp;
962
963 /*
964 * Setting this bit will instruct the HBA to aggressively
965 * enter a lower power link state when it's appropriate and
966 * based on the value set above for ASP
967 */
968 cmd |= PORT_CMD_ALPE;
969
970 /* write out new cmd value */
971 writel(cmd, port_mmio + PORT_CMD);
972 cmd = readl(port_mmio + PORT_CMD);
973
974 /* IPM bits should be set by libata-core */
975 return 0;
976}
977
803#ifdef CONFIG_PM 978#ifdef CONFIG_PM
804static void ahci_power_down(struct ata_port *ap) 979static void ahci_power_down(struct ata_port *ap)
805{ 980{
@@ -862,8 +1037,10 @@ static int ahci_reset_controller(struct ata_host *host)
862 * AHCI-specific, such as HOST_RESET. 1037 * AHCI-specific, such as HOST_RESET.
863 */ 1038 */
864 tmp = readl(mmio + HOST_CTL); 1039 tmp = readl(mmio + HOST_CTL);
865 if (!(tmp & HOST_AHCI_EN)) 1040 if (!(tmp & HOST_AHCI_EN)) {
866 writel(tmp | HOST_AHCI_EN, mmio + HOST_CTL); 1041 tmp |= HOST_AHCI_EN;
1042 writel(tmp, mmio + HOST_CTL);
1043 }
867 1044
868 /* global controller reset */ 1045 /* global controller reset */
869 if ((tmp & HOST_RESET) == 0) { 1046 if ((tmp & HOST_RESET) == 0) {
@@ -1117,15 +1294,8 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1117 tf.ctl &= ~ATA_SRST; 1294 tf.ctl &= ~ATA_SRST;
1118 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); 1295 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0);
1119 1296
1120 /* spec mandates ">= 2ms" before checking status. 1297 /* wait a while before checking status */
1121 * We wait 150ms, because that was the magic delay used for 1298 ata_wait_after_reset(ap, deadline);
1122 * ATAPI devices in Hale Landis's ATADRVR, for the period of time
1123 * between when the ATA command register is written, and then
1124 * status is checked. Because waiting for "a while" before
1125 * checking status is fine, post SRST, we perform this magic
1126 * delay here as well.
1127 */
1128 msleep(150);
1129 1299
1130 rc = ata_wait_ready(ap, deadline); 1300 rc = ata_wait_ready(ap, deadline);
1131 /* link occupied, -ENODEV too is an error */ 1301 /* link occupied, -ENODEV too is an error */
@@ -1213,6 +1383,53 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
1213 return rc ?: -EAGAIN; 1383 return rc ?: -EAGAIN;
1214} 1384}
1215 1385
1386static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
1387 unsigned long deadline)
1388{
1389 struct ata_port *ap = link->ap;
1390 struct ahci_port_priv *pp = ap->private_data;
1391 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
1392 struct ata_taskfile tf;
1393 int rc;
1394
1395 ahci_stop_engine(ap);
1396
1397 /* clear D2H reception area to properly wait for D2H FIS */
1398 ata_tf_init(link->device, &tf);
1399 tf.command = 0x80;
1400 ata_tf_to_fis(&tf, 0, 0, d2h_fis);
1401
1402 rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context),
1403 deadline);
1404
1405 ahci_start_engine(ap);
1406
1407 if (rc || ata_link_offline(link))
1408 return rc;
1409
1410 /* spec mandates ">= 2ms" before checking status */
1411 msleep(150);
1412
1413 /* The pseudo configuration device on SIMG4726 attached to
1414 * ASUS P5W-DH Deluxe doesn't send signature FIS after
1415 * hardreset if no device is attached to the first downstream
1416 * port && the pseudo device locks up on SRST w/ PMP==0. To
1417 * work around this, wait for !BSY only briefly. If BSY isn't
1418 * cleared, perform CLO and proceed to IDENTIFY (achieved by
1419 * ATA_LFLAG_NO_SRST and ATA_LFLAG_ASSUME_ATA).
1420 *
1421 * Wait for two seconds. Devices attached to downstream port
1422 * which can't process the following IDENTIFY after this will
1423 * have to be reset again. For most cases, this should
1424 * suffice while making probing snappish enough.
1425 */
1426 rc = ata_wait_ready(ap, jiffies + 2 * HZ);
1427 if (rc)
1428 ahci_kick_engine(ap, 0);
1429
1430 return 0;
1431}
1432
1216static void ahci_postreset(struct ata_link *link, unsigned int *class) 1433static void ahci_postreset(struct ata_link *link, unsigned int *class)
1217{ 1434{
1218 struct ata_port *ap = link->ap; 1435 struct ata_port *ap = link->ap;
@@ -1426,6 +1643,17 @@ static void ahci_port_intr(struct ata_port *ap)
1426 if (unlikely(resetting)) 1643 if (unlikely(resetting))
1427 status &= ~PORT_IRQ_BAD_PMP; 1644 status &= ~PORT_IRQ_BAD_PMP;
1428 1645
1646 /* If we are getting PhyRdy, this is
1647 * just a power state change, we should
1648 * clear out this, plus the PhyRdy/Comm
1649 * Wake bits from Serror
1650 */
1651 if ((hpriv->flags & AHCI_HFLAG_NO_HOTPLUG) &&
1652 (status & PORT_IRQ_PHYRDY)) {
1653 status &= ~PORT_IRQ_PHYRDY;
1654 ahci_scr_write(ap, SCR_ERROR, ((1 << 16) | (1 << 18)));
1655 }
1656
1429 if (unlikely(status & PORT_IRQ_ERROR)) { 1657 if (unlikely(status & PORT_IRQ_ERROR)) {
1430 ahci_error_intr(ap, status); 1658 ahci_error_intr(ap, status);
1431 return; 1659 return;
@@ -1670,6 +1898,19 @@ static void ahci_vt8251_error_handler(struct ata_port *ap)
1670 ahci_postreset); 1898 ahci_postreset);
1671} 1899}
1672 1900
1901static void ahci_p5wdh_error_handler(struct ata_port *ap)
1902{
1903 if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
1904 /* restart engine */
1905 ahci_stop_engine(ap);
1906 ahci_start_engine(ap);
1907 }
1908
1909 /* perform recovery */
1910 ata_do_eh(ap, ata_std_prereset, ahci_softreset, ahci_p5wdh_hardreset,
1911 ahci_postreset);
1912}
1913
1673static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) 1914static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
1674{ 1915{
1675 struct ata_port *ap = qc->ap; 1916 struct ata_port *ap = qc->ap;
@@ -1955,6 +2196,51 @@ static void ahci_print_info(struct ata_host *host)
1955 ); 2196 );
1956} 2197}
1957 2198
2199/* On ASUS P5W DH Deluxe, the second port of PCI device 00:1f.2 is
2200 * hardwired to on-board SIMG 4726. The chipset is ICH8 and doesn't
2201 * support PMP and the 4726 either directly exports the device
2202 * attached to the first downstream port or acts as a hardware storage
2203 * controller and emulate a single ATA device (can be RAID 0/1 or some
2204 * other configuration).
2205 *
2206 * When there's no device attached to the first downstream port of the
2207 * 4726, "Config Disk" appears, which is a pseudo ATA device to
2208 * configure the 4726. However, ATA emulation of the device is very
2209 * lame. It doesn't send signature D2H Reg FIS after the initial
2210 * hardreset, pukes on SRST w/ PMP==0 and has bunch of other issues.
2211 *
2212 * The following function works around the problem by always using
2213 * hardreset on the port and not depending on receiving signature FIS
2214 * afterward. If signature FIS isn't received soon, ATA class is
2215 * assumed without follow-up softreset.
2216 */
2217static void ahci_p5wdh_workaround(struct ata_host *host)
2218{
2219 static struct dmi_system_id sysids[] = {
2220 {
2221 .ident = "P5W DH Deluxe",
2222 .matches = {
2223 DMI_MATCH(DMI_SYS_VENDOR,
2224 "ASUSTEK COMPUTER INC"),
2225 DMI_MATCH(DMI_PRODUCT_NAME, "P5W DH Deluxe"),
2226 },
2227 },
2228 { }
2229 };
2230 struct pci_dev *pdev = to_pci_dev(host->dev);
2231
2232 if (pdev->bus->number == 0 && pdev->devfn == PCI_DEVFN(0x1f, 2) &&
2233 dmi_check_system(sysids)) {
2234 struct ata_port *ap = host->ports[1];
2235
2236 dev_printk(KERN_INFO, &pdev->dev, "enabling ASUS P5W DH "
2237 "Deluxe on-board SIMG4726 workaround\n");
2238
2239 ap->ops = &ahci_p5wdh_ops;
2240 ap->link.flags |= ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_ATA;
2241 }
2242}
2243
1958static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 2244static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1959{ 2245{
1960 static int printed_version; 2246 static int printed_version;
@@ -2015,6 +2301,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2015 ata_port_pbar_desc(ap, AHCI_PCI_BAR, 2301 ata_port_pbar_desc(ap, AHCI_PCI_BAR,
2016 0x100 + ap->port_no * 0x80, "port"); 2302 0x100 + ap->port_no * 0x80, "port");
2017 2303
2304 /* set initial link pm policy */
2305 ap->pm_policy = NOT_AVAILABLE;
2306
2018 /* standard SATA port setup */ 2307 /* standard SATA port setup */
2019 if (hpriv->port_map & (1 << i)) 2308 if (hpriv->port_map & (1 << i))
2020 ap->ioaddr.cmd_addr = port_mmio; 2309 ap->ioaddr.cmd_addr = port_mmio;
@@ -2024,6 +2313,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2024 ap->ops = &ata_dummy_port_ops; 2313 ap->ops = &ata_dummy_port_ops;
2025 } 2314 }
2026 2315
2316 /* apply workaround for ASUS P5W DH Deluxe mainboard */
2317 ahci_p5wdh_workaround(host);
2318
2027 /* initialize adapter */ 2319 /* initialize adapter */
2028 rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64); 2320 rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64);
2029 if (rc) 2321 if (rc)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 2d147b51c978..164c7d9514f9 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -68,7 +68,8 @@ const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 };
68static unsigned int ata_dev_init_params(struct ata_device *dev, 68static unsigned int ata_dev_init_params(struct ata_device *dev,
69 u16 heads, u16 sectors); 69 u16 heads, u16 sectors);
70static unsigned int ata_dev_set_xfermode(struct ata_device *dev); 70static unsigned int ata_dev_set_xfermode(struct ata_device *dev);
71static unsigned int ata_dev_set_AN(struct ata_device *dev, u8 enable); 71static unsigned int ata_dev_set_feature(struct ata_device *dev,
72 u8 enable, u8 feature);
72static void ata_dev_xfermask(struct ata_device *dev); 73static void ata_dev_xfermask(struct ata_device *dev);
73static unsigned long ata_dev_blacklisted(const struct ata_device *dev); 74static unsigned long ata_dev_blacklisted(const struct ata_device *dev);
74 75
@@ -619,6 +620,181 @@ void ata_dev_disable(struct ata_device *dev)
619 } 620 }
620} 621}
621 622
623static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy)
624{
625 struct ata_link *link = dev->link;
626 struct ata_port *ap = link->ap;
627 u32 scontrol;
628 unsigned int err_mask;
629 int rc;
630
631 /*
632 * disallow DIPM for drivers which haven't set
633 * ATA_FLAG_IPM. This is because when DIPM is enabled,
634 * phy ready will be set in the interrupt status on
635 * state changes, which will cause some drivers to
636 * think there are errors - additionally drivers will
637 * need to disable hot plug.
638 */
639 if (!(ap->flags & ATA_FLAG_IPM) || !ata_dev_enabled(dev)) {
640 ap->pm_policy = NOT_AVAILABLE;
641 return -EINVAL;
642 }
643
644 /*
645 * For DIPM, we will only enable it for the
646 * min_power setting.
647 *
648 * Why? Because Disks are too stupid to know that
649 * If the host rejects a request to go to SLUMBER
650 * they should retry at PARTIAL, and instead it
651 * just would give up. So, for medium_power to
652 * work at all, we need to only allow HIPM.
653 */
654 rc = sata_scr_read(link, SCR_CONTROL, &scontrol);
655 if (rc)
656 return rc;
657
658 switch (policy) {
659 case MIN_POWER:
660 /* no restrictions on IPM transitions */
661 scontrol &= ~(0x3 << 8);
662 rc = sata_scr_write(link, SCR_CONTROL, scontrol);
663 if (rc)
664 return rc;
665
666 /* enable DIPM */
667 if (dev->flags & ATA_DFLAG_DIPM)
668 err_mask = ata_dev_set_feature(dev,
669 SETFEATURES_SATA_ENABLE, SATA_DIPM);
670 break;
671 case MEDIUM_POWER:
672 /* allow IPM to PARTIAL */
673 scontrol &= ~(0x1 << 8);
674 scontrol |= (0x2 << 8);
675 rc = sata_scr_write(link, SCR_CONTROL, scontrol);
676 if (rc)
677 return rc;
678
679 /* disable DIPM */
680 if (ata_dev_enabled(dev) && (dev->flags & ATA_DFLAG_DIPM))
681 err_mask = ata_dev_set_feature(dev,
682 SETFEATURES_SATA_DISABLE, SATA_DIPM);
683 break;
684 case NOT_AVAILABLE:
685 case MAX_PERFORMANCE:
686 /* disable all IPM transitions */
687 scontrol |= (0x3 << 8);
688 rc = sata_scr_write(link, SCR_CONTROL, scontrol);
689 if (rc)
690 return rc;
691
692 /* disable DIPM */
693 if (ata_dev_enabled(dev) && (dev->flags & ATA_DFLAG_DIPM))
694 err_mask = ata_dev_set_feature(dev,
695 SETFEATURES_SATA_DISABLE, SATA_DIPM);
696 break;
697 }
698
699 /* FIXME: handle SET FEATURES failure */
700 (void) err_mask;
701
702 return 0;
703}
704
705/**
706 * ata_dev_enable_pm - enable SATA interface power management
707 * @dev: device to enable power management
708 * @policy: the link power management policy
709 *
710 * Enable SATA Interface power management. This will enable
711 * Device Interface Power Management (DIPM) for min_power
712 * policy, and then call driver specific callbacks for
713 * enabling Host Initiated Power management.
714 *
715 * Locking: Caller.
716 * Returns: -EINVAL if IPM is not supported, 0 otherwise.
717 */
718void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy)
719{
720 int rc = 0;
721 struct ata_port *ap = dev->link->ap;
722
723 /* set HIPM first, then DIPM */
724 if (ap->ops->enable_pm)
725 rc = ap->ops->enable_pm(ap, policy);
726 if (rc)
727 goto enable_pm_out;
728 rc = ata_dev_set_dipm(dev, policy);
729
730enable_pm_out:
731 if (rc)
732 ap->pm_policy = MAX_PERFORMANCE;
733 else
734 ap->pm_policy = policy;
735 return /* rc */; /* hopefully we can use 'rc' eventually */
736}
737
738#ifdef CONFIG_PM
739/**
740 * ata_dev_disable_pm - disable SATA interface power management
741 * @dev: device to disable power management
742 *
743 * Disable SATA Interface power management. This will disable
744 * Device Interface Power Management (DIPM) without changing
745 * policy, call driver specific callbacks for disabling Host
746 * Initiated Power management.
747 *
748 * Locking: Caller.
749 * Returns: void
750 */
751static void ata_dev_disable_pm(struct ata_device *dev)
752{
753 struct ata_port *ap = dev->link->ap;
754
755 ata_dev_set_dipm(dev, MAX_PERFORMANCE);
756 if (ap->ops->disable_pm)
757 ap->ops->disable_pm(ap);
758}
759#endif /* CONFIG_PM */
760
761void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy)
762{
763 ap->pm_policy = policy;
764 ap->link.eh_info.action |= ATA_EHI_LPM;
765 ap->link.eh_info.flags |= ATA_EHI_NO_AUTOPSY;
766 ata_port_schedule_eh(ap);
767}
768
769#ifdef CONFIG_PM
770static void ata_lpm_enable(struct ata_host *host)
771{
772 struct ata_link *link;
773 struct ata_port *ap;
774 struct ata_device *dev;
775 int i;
776
777 for (i = 0; i < host->n_ports; i++) {
778 ap = host->ports[i];
779 ata_port_for_each_link(link, ap) {
780 ata_link_for_each_dev(dev, link)
781 ata_dev_disable_pm(dev);
782 }
783 }
784}
785
786static void ata_lpm_disable(struct ata_host *host)
787{
788 int i;
789
790 for (i = 0; i < host->n_ports; i++) {
791 struct ata_port *ap = host->ports[i];
792 ata_lpm_schedule(ap, ap->pm_policy);
793 }
794}
795#endif /* CONFIG_PM */
796
797
622/** 798/**
623 * ata_devchk - PATA device presence detection 799 * ata_devchk - PATA device presence detection
624 * @ap: ATA channel to examine 800 * @ap: ATA channel to examine
@@ -1799,13 +1975,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
1799 * SET_FEATURES spin-up subcommand before it will accept 1975 * SET_FEATURES spin-up subcommand before it will accept
1800 * anything other than the original IDENTIFY command. 1976 * anything other than the original IDENTIFY command.
1801 */ 1977 */
1802 ata_tf_init(dev, &tf); 1978 err_mask = ata_dev_set_feature(dev, SETFEATURES_SPINUP, 0);
1803 tf.command = ATA_CMD_SET_FEATURES;
1804 tf.feature = SETFEATURES_SPINUP;
1805 tf.protocol = ATA_PROT_NODATA;
1806 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1807 err_mask = ata_exec_internal(dev, &tf, NULL,
1808 DMA_NONE, NULL, 0, 0);
1809 if (err_mask && id[2] != 0x738c) { 1979 if (err_mask && id[2] != 0x738c) {
1810 rc = -EIO; 1980 rc = -EIO;
1811 reason = "SPINUP failed"; 1981 reason = "SPINUP failed";
@@ -2075,7 +2245,8 @@ int ata_dev_configure(struct ata_device *dev)
2075 unsigned int err_mask; 2245 unsigned int err_mask;
2076 2246
2077 /* issue SET feature command to turn this on */ 2247 /* issue SET feature command to turn this on */
2078 err_mask = ata_dev_set_AN(dev, SETFEATURES_SATA_ENABLE); 2248 err_mask = ata_dev_set_feature(dev,
2249 SETFEATURES_SATA_ENABLE, SATA_AN);
2079 if (err_mask) 2250 if (err_mask)
2080 ata_dev_printk(dev, KERN_ERR, 2251 ata_dev_printk(dev, KERN_ERR,
2081 "failed to enable ATAPI AN " 2252 "failed to enable ATAPI AN "
@@ -2105,6 +2276,13 @@ int ata_dev_configure(struct ata_device *dev)
2105 if (dev->flags & ATA_DFLAG_LBA48) 2276 if (dev->flags & ATA_DFLAG_LBA48)
2106 dev->max_sectors = ATA_MAX_SECTORS_LBA48; 2277 dev->max_sectors = ATA_MAX_SECTORS_LBA48;
2107 2278
2279 if (!(dev->horkage & ATA_HORKAGE_IPM)) {
2280 if (ata_id_has_hipm(dev->id))
2281 dev->flags |= ATA_DFLAG_HIPM;
2282 if (ata_id_has_dipm(dev->id))
2283 dev->flags |= ATA_DFLAG_DIPM;
2284 }
2285
2108 if (dev->horkage & ATA_HORKAGE_DIAGNOSTIC) { 2286 if (dev->horkage & ATA_HORKAGE_DIAGNOSTIC) {
2109 /* Let the user know. We don't want to disallow opens for 2287 /* Let the user know. We don't want to disallow opens for
2110 rescue purposes, or in case the vendor is just a blithering 2288 rescue purposes, or in case the vendor is just a blithering
@@ -2126,10 +2304,21 @@ int ata_dev_configure(struct ata_device *dev)
2126 dev->max_sectors = ATA_MAX_SECTORS; 2304 dev->max_sectors = ATA_MAX_SECTORS;
2127 } 2305 }
2128 2306
2307 if ((dev->class == ATA_DEV_ATAPI) &&
2308 (atapi_command_packet_set(id) == TYPE_TAPE))
2309 dev->max_sectors = ATA_MAX_SECTORS_TAPE;
2310
2129 if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) 2311 if (dev->horkage & ATA_HORKAGE_MAX_SEC_128)
2130 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, 2312 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
2131 dev->max_sectors); 2313 dev->max_sectors);
2132 2314
2315 if (ata_dev_blacklisted(dev) & ATA_HORKAGE_IPM) {
2316 dev->horkage |= ATA_HORKAGE_IPM;
2317
2318 /* reset link pm_policy for this port to no pm */
2319 ap->pm_policy = MAX_PERFORMANCE;
2320 }
2321
2133 if (ap->ops->dev_config) 2322 if (ap->ops->dev_config)
2134 ap->ops->dev_config(dev); 2323 ap->ops->dev_config(dev);
2135 2324
@@ -2223,6 +2412,25 @@ int ata_bus_probe(struct ata_port *ap)
2223 tries[dev->devno] = ATA_PROBE_MAX_TRIES; 2412 tries[dev->devno] = ATA_PROBE_MAX_TRIES;
2224 2413
2225 retry: 2414 retry:
2415 ata_link_for_each_dev(dev, &ap->link) {
2416 /* If we issue an SRST then an ATA drive (not ATAPI)
2417 * may change configuration and be in PIO0 timing. If
2418 * we do a hard reset (or are coming from power on)
2419 * this is true for ATA or ATAPI. Until we've set a
2420 * suitable controller mode we should not touch the
2421 * bus as we may be talking too fast.
2422 */
2423 dev->pio_mode = XFER_PIO_0;
2424
2425 /* If the controller has a pio mode setup function
2426 * then use it to set the chipset to rights. Don't
2427 * touch the DMA setup as that will be dealt with when
2428 * configuring devices.
2429 */
2430 if (ap->ops->set_piomode)
2431 ap->ops->set_piomode(ap, dev);
2432 }
2433
2226 /* reset and determine device classes */ 2434 /* reset and determine device classes */
2227 ap->ops->phy_reset(ap); 2435 ap->ops->phy_reset(ap);
2228 2436
@@ -2238,12 +2446,6 @@ int ata_bus_probe(struct ata_port *ap)
2238 2446
2239 ata_port_probe(ap); 2447 ata_port_probe(ap);
2240 2448
2241 /* after the reset the device state is PIO 0 and the controller
2242 state is undefined. Record the mode */
2243
2244 ata_link_for_each_dev(dev, &ap->link)
2245 dev->pio_mode = XFER_PIO_0;
2246
2247 /* read IDENTIFY page and configure devices. We have to do the identify 2449 /* read IDENTIFY page and configure devices. We have to do the identify
2248 specific sequence bass-ackwards so that PDIAG- is released by 2450 specific sequence bass-ackwards so that PDIAG- is released by
2249 the slave device */ 2451 the slave device */
@@ -2549,17 +2751,27 @@ int sata_down_spd_limit(struct ata_link *link)
2549 2751
2550static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol) 2752static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol)
2551{ 2753{
2552 u32 spd, limit; 2754 struct ata_link *host_link = &link->ap->link;
2755 u32 limit, target, spd;
2553 2756
2554 if (link->sata_spd_limit == UINT_MAX) 2757 limit = link->sata_spd_limit;
2555 limit = 0; 2758
2759 /* Don't configure downstream link faster than upstream link.
2760 * It doesn't speed up anything and some PMPs choke on such
2761 * configuration.
2762 */
2763 if (!ata_is_host_link(link) && host_link->sata_spd)
2764 limit &= (1 << host_link->sata_spd) - 1;
2765
2766 if (limit == UINT_MAX)
2767 target = 0;
2556 else 2768 else
2557 limit = fls(link->sata_spd_limit); 2769 target = fls(limit);
2558 2770
2559 spd = (*scontrol >> 4) & 0xf; 2771 spd = (*scontrol >> 4) & 0xf;
2560 *scontrol = (*scontrol & ~0xf0) | ((limit & 0xf) << 4); 2772 *scontrol = (*scontrol & ~0xf0) | ((target & 0xf) << 4);
2561 2773
2562 return spd != limit; 2774 return spd != target;
2563} 2775}
2564 2776
2565/** 2777/**
@@ -2582,7 +2794,7 @@ int sata_set_spd_needed(struct ata_link *link)
2582 u32 scontrol; 2794 u32 scontrol;
2583 2795
2584 if (sata_scr_read(link, SCR_CONTROL, &scontrol)) 2796 if (sata_scr_read(link, SCR_CONTROL, &scontrol))
2585 return 0; 2797 return 1;
2586 2798
2587 return __sata_set_spd_needed(link, &scontrol); 2799 return __sata_set_spd_needed(link, &scontrol);
2588} 2800}
@@ -2886,6 +3098,13 @@ static int ata_dev_set_mode(struct ata_device *dev)
2886 dev->pio_mode <= XFER_PIO_2) 3098 dev->pio_mode <= XFER_PIO_2)
2887 err_mask &= ~AC_ERR_DEV; 3099 err_mask &= ~AC_ERR_DEV;
2888 3100
3101 /* Early MWDMA devices do DMA but don't allow DMA mode setting.
3102 Don't fail an MWDMA0 set IFF the device indicates it is in MWDMA0 */
3103 if (dev->xfer_shift == ATA_SHIFT_MWDMA &&
3104 dev->dma_mode == XFER_MW_DMA_0 &&
3105 (dev->id[63] >> 8) & 1)
3106 err_mask &= ~AC_ERR_DEV;
3107
2889 if (err_mask) { 3108 if (err_mask) {
2890 ata_dev_printk(dev, KERN_ERR, "failed to set xfermode " 3109 ata_dev_printk(dev, KERN_ERR, "failed to set xfermode "
2891 "(err_mask=0x%x)\n", err_mask); 3110 "(err_mask=0x%x)\n", err_mask);
@@ -3115,6 +3334,55 @@ int ata_busy_sleep(struct ata_port *ap,
3115} 3334}
3116 3335
3117/** 3336/**
3337 * ata_wait_after_reset - wait before checking status after reset
3338 * @ap: port containing status register to be polled
3339 * @deadline: deadline jiffies for the operation
3340 *
3341 * After reset, we need to pause a while before reading status.
3342 * Also, certain combination of controller and device report 0xff
3343 * for some duration (e.g. until SATA PHY is up and running)
3344 * which is interpreted as empty port in ATA world. This
3345 * function also waits for such devices to get out of 0xff
3346 * status.
3347 *
3348 * LOCKING:
3349 * Kernel thread context (may sleep).
3350 */
3351void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline)
3352{
3353 unsigned long until = jiffies + ATA_TMOUT_FF_WAIT;
3354
3355 if (time_before(until, deadline))
3356 deadline = until;
3357
3358 /* Spec mandates ">= 2ms" before checking status. We wait
3359 * 150ms, because that was the magic delay used for ATAPI
3360 * devices in Hale Landis's ATADRVR, for the period of time
3361 * between when the ATA command register is written, and then
3362 * status is checked. Because waiting for "a while" before
3363 * checking status is fine, post SRST, we perform this magic
3364 * delay here as well.
3365 *
3366 * Old drivers/ide uses the 2mS rule and then waits for ready.
3367 */
3368 msleep(150);
3369
3370 /* Wait for 0xff to clear. Some SATA devices take a long time
3371 * to clear 0xff after reset. For example, HHD424020F7SV00
3372 * iVDR needs >= 800ms while. Quantum GoVault needs even more
3373 * than that.
3374 */
3375 while (1) {
3376 u8 status = ata_chk_status(ap);
3377
3378 if (status != 0xff || time_after(jiffies, deadline))
3379 return;
3380
3381 msleep(50);
3382 }
3383}
3384
3385/**
3118 * ata_wait_ready - sleep until BSY clears, or timeout 3386 * ata_wait_ready - sleep until BSY clears, or timeout
3119 * @ap: port containing status register to be polled 3387 * @ap: port containing status register to be polled
3120 * @deadline: deadline jiffies for the operation 3388 * @deadline: deadline jiffies for the operation
@@ -3220,8 +3488,6 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
3220 unsigned long deadline) 3488 unsigned long deadline)
3221{ 3489{
3222 struct ata_ioports *ioaddr = &ap->ioaddr; 3490 struct ata_ioports *ioaddr = &ap->ioaddr;
3223 struct ata_device *dev;
3224 int i = 0;
3225 3491
3226 DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); 3492 DPRINTK("ata%u: bus reset via SRST\n", ap->print_id);
3227 3493
@@ -3232,36 +3498,8 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
3232 udelay(20); /* FIXME: flush */ 3498 udelay(20); /* FIXME: flush */
3233 iowrite8(ap->ctl, ioaddr->ctl_addr); 3499 iowrite8(ap->ctl, ioaddr->ctl_addr);
3234 3500
3235 /* If we issued an SRST then an ATA drive (not ATAPI) 3501 /* wait a while before checking status */
3236 * may have changed configuration and be in PIO0 timing. If 3502 ata_wait_after_reset(ap, deadline);
3237 * we did a hard reset (or are coming from power on) this is
3238 * true for ATA or ATAPI. Until we've set a suitable controller
3239 * mode we should not touch the bus as we may be talking too fast.
3240 */
3241
3242 ata_link_for_each_dev(dev, &ap->link)
3243 dev->pio_mode = XFER_PIO_0;
3244
3245 /* If the controller has a pio mode setup function then use
3246 it to set the chipset to rights. Don't touch the DMA setup
3247 as that will be dealt with when revalidating */
3248 if (ap->ops->set_piomode) {
3249 ata_link_for_each_dev(dev, &ap->link)
3250 if (devmask & (1 << i++))
3251 ap->ops->set_piomode(ap, dev);
3252 }
3253
3254 /* spec mandates ">= 2ms" before checking status.
3255 * We wait 150ms, because that was the magic delay used for
3256 * ATAPI devices in Hale Landis's ATADRVR, for the period of time
3257 * between when the ATA command register is written, and then
3258 * status is checked. Because waiting for "a while" before
3259 * checking status is fine, post SRST, we perform this magic
3260 * delay here as well.
3261 *
3262 * Old drivers/ide uses the 2mS rule and then waits for ready
3263 */
3264 msleep(150);
3265 3503
3266 /* Before we perform post reset processing we want to see if 3504 /* Before we perform post reset processing we want to see if
3267 * the bus shows 0xFF because the odd clown forgets the D7 3505 * the bus shows 0xFF because the odd clown forgets the D7
@@ -3688,8 +3926,8 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class,
3688 return 0; 3926 return 0;
3689 } 3927 }
3690 3928
3691 /* wait a while before checking status, see SRST for more info */ 3929 /* wait a while before checking status */
3692 msleep(150); 3930 ata_wait_after_reset(ap, deadline);
3693 3931
3694 /* If PMP is supported, we have to do follow-up SRST. Note 3932 /* If PMP is supported, we have to do follow-up SRST. Note
3695 * that some PMPs don't send D2H Reg FIS after hardreset at 3933 * that some PMPs don't send D2H Reg FIS after hardreset at
@@ -3947,9 +4185,6 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3947 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, 4185 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA },
3948 { "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA }, 4186 { "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA },
3949 { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, 4187 { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA },
3950 { "IOMEGA ZIP 250 ATAPI", NULL, ATA_HORKAGE_NODMA }, /* temporary fix */
3951 { "IOMEGA ZIP 250 ATAPI Floppy",
3952 NULL, ATA_HORKAGE_NODMA },
3953 /* Odd clown on sil3726/4726 PMPs */ 4188 /* Odd clown on sil3726/4726 PMPs */
3954 { "Config Disk", NULL, ATA_HORKAGE_NODMA | 4189 { "Config Disk", NULL, ATA_HORKAGE_NODMA |
3955 ATA_HORKAGE_SKIP_PM }, 4190 ATA_HORKAGE_SKIP_PM },
@@ -3992,6 +4227,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3992 { "ST3160812AS", "3.ADJ", ATA_HORKAGE_NONCQ, }, 4227 { "ST3160812AS", "3.ADJ", ATA_HORKAGE_NONCQ, },
3993 { "ST980813AS", "3.ADB", ATA_HORKAGE_NONCQ, }, 4228 { "ST980813AS", "3.ADB", ATA_HORKAGE_NONCQ, },
3994 { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, }, 4229 { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, },
4230 { "Maxtor 7V300F0", "VA111900", ATA_HORKAGE_NONCQ, },
3995 4231
3996 /* devices which puke on READ_NATIVE_MAX */ 4232 /* devices which puke on READ_NATIVE_MAX */
3997 { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, 4233 { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, },
@@ -4007,7 +4243,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4007 { } 4243 { }
4008}; 4244};
4009 4245
4010int strn_pattern_cmp(const char *patt, const char *name, int wildchar) 4246static int strn_pattern_cmp(const char *patt, const char *name, int wildchar)
4011{ 4247{
4012 const char *p; 4248 const char *p;
4013 int len; 4249 int len;
@@ -4181,15 +4417,14 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev)
4181 DPRINTK("EXIT, err_mask=%x\n", err_mask); 4417 DPRINTK("EXIT, err_mask=%x\n", err_mask);
4182 return err_mask; 4418 return err_mask;
4183} 4419}
4184
4185/** 4420/**
4186 * ata_dev_set_AN - Issue SET FEATURES - SATA FEATURES 4421 * ata_dev_set_feature - Issue SET FEATURES - SATA FEATURES
4187 * @dev: Device to which command will be sent 4422 * @dev: Device to which command will be sent
4188 * @enable: Whether to enable or disable the feature 4423 * @enable: Whether to enable or disable the feature
4424 * @feature: The sector count represents the feature to set
4189 * 4425 *
4190 * Issue SET FEATURES - SATA FEATURES command to device @dev 4426 * Issue SET FEATURES - SATA FEATURES command to device @dev
4191 * on port @ap with sector count set to indicate Asynchronous 4427 * on port @ap with sector count
4192 * Notification feature
4193 * 4428 *
4194 * LOCKING: 4429 * LOCKING:
4195 * PCI/etc. bus probe sem. 4430 * PCI/etc. bus probe sem.
@@ -4197,7 +4432,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev)
4197 * RETURNS: 4432 * RETURNS:
4198 * 0 on success, AC_ERR_* mask otherwise. 4433 * 0 on success, AC_ERR_* mask otherwise.
4199 */ 4434 */
4200static unsigned int ata_dev_set_AN(struct ata_device *dev, u8 enable) 4435static unsigned int ata_dev_set_feature(struct ata_device *dev, u8 enable,
4436 u8 feature)
4201{ 4437{
4202 struct ata_taskfile tf; 4438 struct ata_taskfile tf;
4203 unsigned int err_mask; 4439 unsigned int err_mask;
@@ -4210,7 +4446,7 @@ static unsigned int ata_dev_set_AN(struct ata_device *dev, u8 enable)
4210 tf.feature = enable; 4446 tf.feature = enable;
4211 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 4447 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
4212 tf.protocol = ATA_PROT_NODATA; 4448 tf.protocol = ATA_PROT_NODATA;
4213 tf.nsect = SATA_AN; 4449 tf.nsect = feature;
4214 4450
4215 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); 4451 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
4216 4452
@@ -4689,8 +4925,9 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
4689 * data in this function or read data in ata_sg_clean. 4925 * data in this function or read data in ata_sg_clean.
4690 */ 4926 */
4691 offset = lsg->offset + lsg->length - qc->pad_len; 4927 offset = lsg->offset + lsg->length - qc->pad_len;
4692 sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT)); 4928 sg_init_table(psg, 1);
4693 psg->offset = offset_in_page(offset); 4929 sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT),
4930 qc->pad_len, offset_in_page(offset));
4694 4931
4695 if (qc->tf.flags & ATA_TFLAG_WRITE) { 4932 if (qc->tf.flags & ATA_TFLAG_WRITE) {
4696 void *addr = kmap_atomic(sg_page(psg), KM_IRQ0); 4933 void *addr = kmap_atomic(sg_page(psg), KM_IRQ0);
@@ -5594,6 +5831,9 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
5594 * taken care of. 5831 * taken care of.
5595 */ 5832 */
5596 if (ap->ops->error_handler) { 5833 if (ap->ops->error_handler) {
5834 struct ata_device *dev = qc->dev;
5835 struct ata_eh_info *ehi = &dev->link->eh_info;
5836
5597 WARN_ON(ap->pflags & ATA_PFLAG_FROZEN); 5837 WARN_ON(ap->pflags & ATA_PFLAG_FROZEN);
5598 5838
5599 if (unlikely(qc->err_mask)) 5839 if (unlikely(qc->err_mask))
@@ -5612,6 +5852,27 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
5612 if (qc->flags & ATA_QCFLAG_RESULT_TF) 5852 if (qc->flags & ATA_QCFLAG_RESULT_TF)
5613 fill_result_tf(qc); 5853 fill_result_tf(qc);
5614 5854
5855 /* Some commands need post-processing after successful
5856 * completion.
5857 */
5858 switch (qc->tf.command) {
5859 case ATA_CMD_SET_FEATURES:
5860 if (qc->tf.feature != SETFEATURES_WC_ON &&
5861 qc->tf.feature != SETFEATURES_WC_OFF)
5862 break;
5863 /* fall through */
5864 case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */
5865 case ATA_CMD_SET_MULTI: /* multi_count changed */
5866 /* revalidate device */
5867 ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE;
5868 ata_port_schedule_eh(ap);
5869 break;
5870
5871 case ATA_CMD_SLEEP:
5872 dev->flags |= ATA_DFLAG_SLEEPING;
5873 break;
5874 }
5875
5615 __ata_qc_complete(qc); 5876 __ata_qc_complete(qc);
5616 } else { 5877 } else {
5617 if (qc->flags & ATA_QCFLAG_EH_SCHEDULED) 5878 if (qc->flags & ATA_QCFLAG_EH_SCHEDULED)
@@ -5749,6 +6010,14 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
5749 qc->flags &= ~ATA_QCFLAG_DMAMAP; 6010 qc->flags &= ~ATA_QCFLAG_DMAMAP;
5750 } 6011 }
5751 6012
6013 /* if device is sleeping, schedule softreset and abort the link */
6014 if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) {
6015 link->eh_info.action |= ATA_EH_SOFTRESET;
6016 ata_ehi_push_desc(&link->eh_info, "waking up from sleep");
6017 ata_link_abort(link);
6018 return;
6019 }
6020
5752 ap->ops->qc_prep(qc); 6021 ap->ops->qc_prep(qc);
5753 6022
5754 qc->err_mask |= ap->ops->qc_issue(qc); 6023 qc->err_mask |= ap->ops->qc_issue(qc);
@@ -6296,6 +6565,12 @@ int ata_host_suspend(struct ata_host *host, pm_message_t mesg)
6296{ 6565{
6297 int rc; 6566 int rc;
6298 6567
6568 /*
6569 * disable link pm on all ports before requesting
6570 * any pm activity
6571 */
6572 ata_lpm_enable(host);
6573
6299 rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1); 6574 rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1);
6300 if (rc == 0) 6575 if (rc == 0)
6301 host->dev->power.power_state = mesg; 6576 host->dev->power.power_state = mesg;
@@ -6318,6 +6593,9 @@ void ata_host_resume(struct ata_host *host)
6318 ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET, 6593 ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET,
6319 ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); 6594 ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0);
6320 host->dev->power.power_state = PMSG_ON; 6595 host->dev->power.power_state = PMSG_ON;
6596
6597 /* reenable link pm */
6598 ata_lpm_disable(host);
6321} 6599}
6322#endif 6600#endif
6323 6601
@@ -6860,6 +7138,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
6860 struct ata_port *ap = host->ports[i]; 7138 struct ata_port *ap = host->ports[i];
6861 7139
6862 ata_scsi_scan_host(ap, 1); 7140 ata_scsi_scan_host(ap, 1);
7141 ata_lpm_schedule(ap, ap->pm_policy);
6863 } 7142 }
6864 7143
6865 return 0; 7144 return 0;
@@ -6921,7 +7200,7 @@ int ata_host_activate(struct ata_host *host, int irq,
6921 * LOCKING: 7200 * LOCKING:
6922 * Kernel thread context (may sleep). 7201 * Kernel thread context (may sleep).
6923 */ 7202 */
6924void ata_port_detach(struct ata_port *ap) 7203static void ata_port_detach(struct ata_port *ap)
6925{ 7204{
6926 unsigned long flags; 7205 unsigned long flags;
6927 struct ata_link *link; 7206 struct ata_link *link;
@@ -7256,7 +7535,6 @@ const struct ata_port_info ata_dummy_port_info = {
7256 * likely to change as new drivers are added and updated. 7535 * likely to change as new drivers are added and updated.
7257 * Do not depend on ABI/API stability. 7536 * Do not depend on ABI/API stability.
7258 */ 7537 */
7259
7260EXPORT_SYMBOL_GPL(sata_deb_timing_normal); 7538EXPORT_SYMBOL_GPL(sata_deb_timing_normal);
7261EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug); 7539EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug);
7262EXPORT_SYMBOL_GPL(sata_deb_timing_long); 7540EXPORT_SYMBOL_GPL(sata_deb_timing_long);
@@ -7326,6 +7604,7 @@ EXPORT_SYMBOL_GPL(ata_port_disable);
7326EXPORT_SYMBOL_GPL(ata_ratelimit); 7604EXPORT_SYMBOL_GPL(ata_ratelimit);
7327EXPORT_SYMBOL_GPL(ata_wait_register); 7605EXPORT_SYMBOL_GPL(ata_wait_register);
7328EXPORT_SYMBOL_GPL(ata_busy_sleep); 7606EXPORT_SYMBOL_GPL(ata_busy_sleep);
7607EXPORT_SYMBOL_GPL(ata_wait_after_reset);
7329EXPORT_SYMBOL_GPL(ata_wait_ready); 7608EXPORT_SYMBOL_GPL(ata_wait_ready);
7330EXPORT_SYMBOL_GPL(ata_port_queue_task); 7609EXPORT_SYMBOL_GPL(ata_port_queue_task);
7331EXPORT_SYMBOL_GPL(ata_scsi_ioctl); 7610EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 93e2b545b439..ed8813b222a0 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1747,6 +1747,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1747{ 1747{
1748 struct ata_port *ap = link->ap; 1748 struct ata_port *ap = link->ap;
1749 struct ata_eh_context *ehc = &link->eh_context; 1749 struct ata_eh_context *ehc = &link->eh_context;
1750 struct ata_device *dev;
1750 unsigned int all_err_mask = 0; 1751 unsigned int all_err_mask = 0;
1751 int tag, is_io = 0; 1752 int tag, is_io = 0;
1752 u32 serror; 1753 u32 serror;
@@ -1800,10 +1801,8 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1800 qc->err_mask &= ~AC_ERR_OTHER; 1801 qc->err_mask &= ~AC_ERR_OTHER;
1801 1802
1802 /* SENSE_VALID trumps dev/unknown error and revalidation */ 1803 /* SENSE_VALID trumps dev/unknown error and revalidation */
1803 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { 1804 if (qc->flags & ATA_QCFLAG_SENSE_VALID)
1804 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); 1805 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER);
1805 ehc->i.action &= ~ATA_EH_REVALIDATE;
1806 }
1807 1806
1808 /* accumulate error info */ 1807 /* accumulate error info */
1809 ehc->i.dev = qc->dev; 1808 ehc->i.dev = qc->dev;
@@ -1816,21 +1815,28 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1816 if (ap->pflags & ATA_PFLAG_FROZEN || 1815 if (ap->pflags & ATA_PFLAG_FROZEN ||
1817 all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) 1816 all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT))
1818 ehc->i.action |= ATA_EH_SOFTRESET; 1817 ehc->i.action |= ATA_EH_SOFTRESET;
1819 else if (all_err_mask) 1818 else if ((is_io && all_err_mask) ||
1819 (!is_io && (all_err_mask & ~AC_ERR_DEV)))
1820 ehc->i.action |= ATA_EH_REVALIDATE; 1820 ehc->i.action |= ATA_EH_REVALIDATE;
1821 1821
1822 /* if we have offending qcs and the associated failed device */ 1822 /* If we have offending qcs and the associated failed device,
1823 * perform per-dev EH action only on the offending device.
1824 */
1823 if (ehc->i.dev) { 1825 if (ehc->i.dev) {
1824 /* speed down */
1825 ehc->i.action |= ata_eh_speed_down(ehc->i.dev, is_io,
1826 all_err_mask);
1827
1828 /* perform per-dev EH action only on the offending device */
1829 ehc->i.dev_action[ehc->i.dev->devno] |= 1826 ehc->i.dev_action[ehc->i.dev->devno] |=
1830 ehc->i.action & ATA_EH_PERDEV_MASK; 1827 ehc->i.action & ATA_EH_PERDEV_MASK;
1831 ehc->i.action &= ~ATA_EH_PERDEV_MASK; 1828 ehc->i.action &= ~ATA_EH_PERDEV_MASK;
1832 } 1829 }
1833 1830
1831 /* consider speeding down */
1832 dev = ehc->i.dev;
1833 if (!dev && ata_link_max_devices(link) == 1 &&
1834 ata_dev_enabled(link->device))
1835 dev = link->device;
1836
1837 if (dev)
1838 ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask);
1839
1834 DPRINTK("EXIT\n"); 1840 DPRINTK("EXIT\n");
1835} 1841}
1836 1842
@@ -1879,7 +1885,9 @@ static void ata_eh_link_report(struct ata_link *link)
1879 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { 1885 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
1880 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); 1886 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
1881 1887
1882 if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link) 1888 if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link ||
1889 ((qc->flags & ATA_QCFLAG_QUIET) &&
1890 qc->err_mask == AC_ERR_DEV))
1883 continue; 1891 continue;
1884 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) 1892 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask)
1885 continue; 1893 continue;
@@ -2064,16 +2072,19 @@ int ata_eh_reset(struct ata_link *link, int classify,
2064 ata_prereset_fn_t prereset, ata_reset_fn_t softreset, 2072 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
2065 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) 2073 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset)
2066{ 2074{
2075 const int max_tries = ARRAY_SIZE(ata_eh_reset_timeouts);
2067 struct ata_port *ap = link->ap; 2076 struct ata_port *ap = link->ap;
2068 struct ata_eh_context *ehc = &link->eh_context; 2077 struct ata_eh_context *ehc = &link->eh_context;
2069 unsigned int *classes = ehc->classes; 2078 unsigned int *classes = ehc->classes;
2079 unsigned int lflags = link->flags;
2070 int verbose = !(ehc->i.flags & ATA_EHI_QUIET); 2080 int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
2071 int try = 0; 2081 int try = 0;
2072 struct ata_device *dev; 2082 struct ata_device *dev;
2073 unsigned long deadline; 2083 unsigned long deadline, now;
2074 unsigned int action; 2084 unsigned int tmp_action;
2075 ata_reset_fn_t reset; 2085 ata_reset_fn_t reset;
2076 unsigned long flags; 2086 unsigned long flags;
2087 u32 sstatus;
2077 int rc; 2088 int rc;
2078 2089
2079 /* about to reset */ 2090 /* about to reset */
@@ -2083,17 +2094,36 @@ int ata_eh_reset(struct ata_link *link, int classify,
2083 2094
2084 ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); 2095 ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK);
2085 2096
2097 ata_link_for_each_dev(dev, link) {
2098 /* If we issue an SRST then an ATA drive (not ATAPI)
2099 * may change configuration and be in PIO0 timing. If
2100 * we do a hard reset (or are coming from power on)
2101 * this is true for ATA or ATAPI. Until we've set a
2102 * suitable controller mode we should not touch the
2103 * bus as we may be talking too fast.
2104 */
2105 dev->pio_mode = XFER_PIO_0;
2106
2107 /* If the controller has a pio mode setup function
2108 * then use it to set the chipset to rights. Don't
2109 * touch the DMA setup as that will be dealt with when
2110 * configuring devices.
2111 */
2112 if (ap->ops->set_piomode)
2113 ap->ops->set_piomode(ap, dev);
2114 }
2115
2086 /* Determine which reset to use and record in ehc->i.action. 2116 /* Determine which reset to use and record in ehc->i.action.
2087 * prereset() may examine and modify it. 2117 * prereset() may examine and modify it.
2088 */ 2118 */
2089 action = ehc->i.action; 2119 if (softreset && (!hardreset || (!(lflags & ATA_LFLAG_NO_SRST) &&
2090 ehc->i.action &= ~ATA_EH_RESET_MASK;
2091 if (softreset && (!hardreset || (!(link->flags & ATA_LFLAG_NO_SRST) &&
2092 !sata_set_spd_needed(link) && 2120 !sata_set_spd_needed(link) &&
2093 !(action & ATA_EH_HARDRESET)))) 2121 !(ehc->i.action & ATA_EH_HARDRESET))))
2094 ehc->i.action |= ATA_EH_SOFTRESET; 2122 tmp_action = ATA_EH_SOFTRESET;
2095 else 2123 else
2096 ehc->i.action |= ATA_EH_HARDRESET; 2124 tmp_action = ATA_EH_HARDRESET;
2125
2126 ehc->i.action = (ehc->i.action & ~ATA_EH_RESET_MASK) | tmp_action;
2097 2127
2098 if (prereset) { 2128 if (prereset) {
2099 rc = prereset(link, jiffies + ATA_EH_PRERESET_TIMEOUT); 2129 rc = prereset(link, jiffies + ATA_EH_PRERESET_TIMEOUT);
@@ -2161,80 +2191,64 @@ int ata_eh_reset(struct ata_link *link, int classify,
2161 "follow-up softreset required " 2191 "follow-up softreset required "
2162 "but no softreset avaliable\n"); 2192 "but no softreset avaliable\n");
2163 rc = -EINVAL; 2193 rc = -EINVAL;
2164 goto out; 2194 goto fail;
2165 } 2195 }
2166 2196
2167 ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK); 2197 ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK);
2168 rc = ata_do_reset(link, reset, classes, deadline); 2198 rc = ata_do_reset(link, reset, classes, deadline);
2169
2170 if (rc == 0 && classify && classes[0] == ATA_DEV_UNKNOWN &&
2171 !(link->flags & ATA_LFLAG_ASSUME_CLASS)) {
2172 ata_link_printk(link, KERN_ERR,
2173 "classification failed\n");
2174 rc = -EINVAL;
2175 goto out;
2176 }
2177 } 2199 }
2178 2200
2179 /* if we skipped follow-up srst, clear rc */ 2201 /* -EAGAIN can happen if we skipped followup SRST */
2180 if (rc == -EAGAIN) 2202 if (rc && rc != -EAGAIN)
2181 rc = 0; 2203 goto fail;
2182
2183 if (rc && rc != -ERESTART && try < ARRAY_SIZE(ata_eh_reset_timeouts)) {
2184 unsigned long now = jiffies;
2185
2186 if (time_before(now, deadline)) {
2187 unsigned long delta = deadline - jiffies;
2188
2189 ata_link_printk(link, KERN_WARNING, "reset failed "
2190 "(errno=%d), retrying in %u secs\n",
2191 rc, (jiffies_to_msecs(delta) + 999) / 1000);
2192 2204
2193 while (delta) 2205 /* was classification successful? */
2194 delta = schedule_timeout_uninterruptible(delta); 2206 if (classify && classes[0] == ATA_DEV_UNKNOWN &&
2207 !(lflags & ATA_LFLAG_ASSUME_CLASS)) {
2208 if (try < max_tries) {
2209 ata_link_printk(link, KERN_WARNING,
2210 "classification failed\n");
2211 rc = -EINVAL;
2212 goto fail;
2195 } 2213 }
2196 2214
2197 if (rc == -EPIPE || 2215 ata_link_printk(link, KERN_WARNING,
2198 try == ARRAY_SIZE(ata_eh_reset_timeouts) - 1) 2216 "classfication failed, assuming ATA\n");
2199 sata_down_spd_limit(link); 2217 lflags |= ATA_LFLAG_ASSUME_ATA;
2200 if (hardreset)
2201 reset = hardreset;
2202 goto retry;
2203 } 2218 }
2204 2219
2205 if (rc == 0) { 2220 ata_link_for_each_dev(dev, link) {
2206 u32 sstatus; 2221 /* After the reset, the device state is PIO 0 and the
2222 * controller state is undefined. Reset also wakes up
2223 * drives from sleeping mode.
2224 */
2225 dev->pio_mode = XFER_PIO_0;
2226 dev->flags &= ~ATA_DFLAG_SLEEPING;
2207 2227
2208 ata_link_for_each_dev(dev, link) { 2228 if (ata_link_offline(link))
2209 /* After the reset, the device state is PIO 0 2229 continue;
2210 * and the controller state is undefined.
2211 * Record the mode.
2212 */
2213 dev->pio_mode = XFER_PIO_0;
2214 2230
2215 if (ata_link_offline(link)) 2231 /* apply class override and convert UNKNOWN to NONE */
2216 continue; 2232 if (lflags & ATA_LFLAG_ASSUME_ATA)
2233 classes[dev->devno] = ATA_DEV_ATA;
2234 else if (lflags & ATA_LFLAG_ASSUME_SEMB)
2235 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */
2236 else if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2237 classes[dev->devno] = ATA_DEV_NONE;
2238 }
2217 2239
2218 /* apply class override and convert UNKNOWN to NONE */ 2240 /* record current link speed */
2219 if (link->flags & ATA_LFLAG_ASSUME_ATA) 2241 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0)
2220 classes[dev->devno] = ATA_DEV_ATA; 2242 link->sata_spd = (sstatus >> 4) & 0xf;
2221 else if (link->flags & ATA_LFLAG_ASSUME_SEMB)
2222 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */
2223 else if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2224 classes[dev->devno] = ATA_DEV_NONE;
2225 }
2226 2243
2227 /* record current link speed */ 2244 if (postreset)
2228 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) 2245 postreset(link, classes);
2229 link->sata_spd = (sstatus >> 4) & 0xf;
2230 2246
2231 if (postreset) 2247 /* reset successful, schedule revalidation */
2232 postreset(link, classes); 2248 ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK);
2249 ehc->i.action |= ATA_EH_REVALIDATE;
2233 2250
2234 /* reset successful, schedule revalidation */ 2251 rc = 0;
2235 ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK);
2236 ehc->i.action |= ATA_EH_REVALIDATE;
2237 }
2238 out: 2252 out:
2239 /* clear hotplug flag */ 2253 /* clear hotplug flag */
2240 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; 2254 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED;
@@ -2244,6 +2258,28 @@ int ata_eh_reset(struct ata_link *link, int classify,
2244 spin_unlock_irqrestore(ap->lock, flags); 2258 spin_unlock_irqrestore(ap->lock, flags);
2245 2259
2246 return rc; 2260 return rc;
2261
2262 fail:
2263 if (rc == -ERESTART || try >= max_tries)
2264 goto out;
2265
2266 now = jiffies;
2267 if (time_before(now, deadline)) {
2268 unsigned long delta = deadline - now;
2269
2270 ata_link_printk(link, KERN_WARNING, "reset failed "
2271 "(errno=%d), retrying in %u secs\n",
2272 rc, (jiffies_to_msecs(delta) + 999) / 1000);
2273
2274 while (delta)
2275 delta = schedule_timeout_uninterruptible(delta);
2276 }
2277
2278 if (rc == -EPIPE || try == max_tries - 1)
2279 sata_down_spd_limit(link);
2280 if (hardreset)
2281 reset = hardreset;
2282 goto retry;
2247} 2283}
2248 2284
2249static int ata_eh_revalidate_and_attach(struct ata_link *link, 2285static int ata_eh_revalidate_and_attach(struct ata_link *link,
@@ -2416,7 +2452,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
2416 /* give it just one more chance */ 2452 /* give it just one more chance */
2417 ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); 2453 ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
2418 case -EIO: 2454 case -EIO:
2419 if (ehc->tries[dev->devno] == 1) { 2455 if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) {
2420 /* This is the last chance, better to slow 2456 /* This is the last chance, better to slow
2421 * down than lose it. 2457 * down than lose it.
2422 */ 2458 */
@@ -2607,6 +2643,10 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2607 ehc->i.flags &= ~ATA_EHI_SETMODE; 2643 ehc->i.flags &= ~ATA_EHI_SETMODE;
2608 } 2644 }
2609 2645
2646 if (ehc->i.action & ATA_EHI_LPM)
2647 ata_link_for_each_dev(dev, link)
2648 ata_dev_enable_pm(dev, ap->pm_policy);
2649
2610 /* this link is okay now */ 2650 /* this link is okay now */
2611 ehc->i.flags = 0; 2651 ehc->i.flags = 0;
2612 continue; 2652 continue;
@@ -2672,8 +2712,15 @@ void ata_eh_finish(struct ata_port *ap)
2672 /* FIXME: Once EH migration is complete, 2712 /* FIXME: Once EH migration is complete,
2673 * generate sense data in this function, 2713 * generate sense data in this function,
2674 * considering both err_mask and tf. 2714 * considering both err_mask and tf.
2715 *
2716 * There's no point in retrying invalid
2717 * (detected by libata) and non-IO device
2718 * errors (rejected by device). Finish them
2719 * immediately.
2675 */ 2720 */
2676 if (qc->err_mask & AC_ERR_INVALID) 2721 if ((qc->err_mask & AC_ERR_INVALID) ||
2722 (!(qc->flags & ATA_QCFLAG_IO) &&
2723 qc->err_mask == AC_ERR_DEV))
2677 ata_eh_qc_complete(qc); 2724 ata_eh_qc_complete(qc);
2678 else 2725 else
2679 ata_eh_qc_retry(qc); 2726 ata_eh_qc_retry(qc);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index f5d5420a1ba2..245057df69d6 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -110,6 +110,74 @@ static struct scsi_transport_template ata_scsi_transport_template = {
110}; 110};
111 111
112 112
113static const struct {
114 enum link_pm value;
115 const char *name;
116} link_pm_policy[] = {
117 { NOT_AVAILABLE, "max_performance" },
118 { MIN_POWER, "min_power" },
119 { MAX_PERFORMANCE, "max_performance" },
120 { MEDIUM_POWER, "medium_power" },
121};
122
123static const char *ata_scsi_lpm_get(enum link_pm policy)
124{
125 int i;
126
127 for (i = 0; i < ARRAY_SIZE(link_pm_policy); i++)
128 if (link_pm_policy[i].value == policy)
129 return link_pm_policy[i].name;
130
131 return NULL;
132}
133
134static ssize_t ata_scsi_lpm_put(struct class_device *class_dev,
135 const char *buf, size_t count)
136{
137 struct Scsi_Host *shost = class_to_shost(class_dev);
138 struct ata_port *ap = ata_shost_to_port(shost);
139 enum link_pm policy = 0;
140 int i;
141
142 /*
143 * we are skipping array location 0 on purpose - this
144 * is because a value of NOT_AVAILABLE is displayed
145 * to the user as max_performance, but when the user
146 * writes "max_performance", they actually want the
147 * value to match MAX_PERFORMANCE.
148 */
149 for (i = 1; i < ARRAY_SIZE(link_pm_policy); i++) {
150 const int len = strlen(link_pm_policy[i].name);
151 if (strncmp(link_pm_policy[i].name, buf, len) == 0 &&
152 buf[len] == '\n') {
153 policy = link_pm_policy[i].value;
154 break;
155 }
156 }
157 if (!policy)
158 return -EINVAL;
159
160 ata_lpm_schedule(ap, policy);
161 return count;
162}
163
164static ssize_t
165ata_scsi_lpm_show(struct class_device *class_dev, char *buf)
166{
167 struct Scsi_Host *shost = class_to_shost(class_dev);
168 struct ata_port *ap = ata_shost_to_port(shost);
169 const char *policy =
170 ata_scsi_lpm_get(ap->pm_policy);
171
172 if (!policy)
173 return -EINVAL;
174
175 return snprintf(buf, 23, "%s\n", policy);
176}
177CLASS_DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR,
178 ata_scsi_lpm_show, ata_scsi_lpm_put);
179EXPORT_SYMBOL_GPL(class_device_attr_link_power_management_policy);
180
113static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, 181static void ata_scsi_invalid_field(struct scsi_cmnd *cmd,
114 void (*done)(struct scsi_cmnd *)) 182 void (*done)(struct scsi_cmnd *))
115{ 183{
@@ -1040,6 +1108,9 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
1040 else 1108 else
1041 tf->command = ATA_CMD_FLUSH; 1109 tf->command = ATA_CMD_FLUSH;
1042 1110
1111 /* flush is critical for IO integrity, consider it an IO command */
1112 qc->flags |= ATA_QCFLAG_IO;
1113
1043 return 0; 1114 return 0;
1044} 1115}
1045 1116
@@ -1361,33 +1432,10 @@ nothing_to_do:
1361static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) 1432static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1362{ 1433{
1363 struct ata_port *ap = qc->ap; 1434 struct ata_port *ap = qc->ap;
1364 struct ata_eh_info *ehi = &qc->dev->link->eh_info;
1365 struct scsi_cmnd *cmd = qc->scsicmd; 1435 struct scsi_cmnd *cmd = qc->scsicmd;
1366 u8 *cdb = cmd->cmnd; 1436 u8 *cdb = cmd->cmnd;
1367 int need_sense = (qc->err_mask != 0); 1437 int need_sense = (qc->err_mask != 0);
1368 1438
1369 /* We snoop the SET_FEATURES - Write Cache ON/OFF command, and
1370 * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE
1371 * cache
1372 */
1373 if (ap->ops->error_handler && !need_sense) {
1374 switch (qc->tf.command) {
1375 case ATA_CMD_SET_FEATURES:
1376 if ((qc->tf.feature == SETFEATURES_WC_ON) ||
1377 (qc->tf.feature == SETFEATURES_WC_OFF)) {
1378 ehi->action |= ATA_EH_REVALIDATE;
1379 ata_port_schedule_eh(ap);
1380 }
1381 break;
1382
1383 case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */
1384 case ATA_CMD_SET_MULTI: /* multi_count changed */
1385 ehi->action |= ATA_EH_REVALIDATE;
1386 ata_port_schedule_eh(ap);
1387 break;
1388 }
1389 }
1390
1391 /* For ATA pass thru (SAT) commands, generate a sense block if 1439 /* For ATA pass thru (SAT) commands, generate a sense block if
1392 * user mandated it or if there's an error. Note that if we 1440 * user mandated it or if there's an error. Note that if we
1393 * generate because the user forced us to, a check condition 1441 * generate because the user forced us to, a check condition
@@ -2719,8 +2767,8 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
2719 */ 2767 */
2720 qc->nbytes = scsi_bufflen(scmd); 2768 qc->nbytes = scsi_bufflen(scmd);
2721 2769
2722 /* request result TF */ 2770 /* request result TF and be quiet about device error */
2723 qc->flags |= ATA_QCFLAG_RESULT_TF; 2771 qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET;
2724 2772
2725 return 0; 2773 return 0;
2726 2774
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 90df58a3edc9..0e6cf3a484dc 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -101,6 +101,8 @@ extern int sata_link_init_spd(struct ata_link *link);
101extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); 101extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg);
102extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); 102extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
103extern struct ata_port *ata_port_alloc(struct ata_host *host); 103extern struct ata_port *ata_port_alloc(struct ata_host *host);
104extern void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy);
105extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm);
104 106
105/* libata-acpi.c */ 107/* libata-acpi.c */
106#ifdef CONFIG_ATA_ACPI 108#ifdef CONFIG_ATA_ACPI
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c
index 0f6f7bcc3def..e4542ab9c7f8 100644
--- a/drivers/ata/pata_acpi.c
+++ b/drivers/ata/pata_acpi.c
@@ -181,7 +181,7 @@ static void pacpi_set_piomode(struct ata_port *ap, struct ata_device *adev)
181 int unit = adev->devno; 181 int unit = adev->devno;
182 struct pata_acpi *acpi = ap->private_data; 182 struct pata_acpi *acpi = ap->private_data;
183 183
184 if(!(acpi->gtm.flags & 0x10)) 184 if (!(acpi->gtm.flags & 0x10))
185 unit = 0; 185 unit = 0;
186 186
187 /* Now stuff the nS values into the structure */ 187 /* Now stuff the nS values into the structure */
@@ -202,7 +202,7 @@ static void pacpi_set_dmamode(struct ata_port *ap, struct ata_device *adev)
202 int unit = adev->devno; 202 int unit = adev->devno;
203 struct pata_acpi *acpi = ap->private_data; 203 struct pata_acpi *acpi = ap->private_data;
204 204
205 if(!(acpi->gtm.flags & 0x10)) 205 if (!(acpi->gtm.flags & 0x10))
206 unit = 0; 206 unit = 0;
207 207
208 /* Now stuff the nS values into the structure */ 208 /* Now stuff the nS values into the structure */
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index be30923566c5..842fe08a3c13 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -332,12 +332,13 @@ static void ata_dummy_noret(struct ata_port *port)
332{ 332{
333} 333}
334 334
335static void pata_icside_postreset(struct ata_port *ap, unsigned int *classes) 335static void pata_icside_postreset(struct ata_link *link, unsigned int *classes)
336{ 336{
337 struct ata_port *ap = link->ap;
337 struct pata_icside_state *state = ap->host->private_data; 338 struct pata_icside_state *state = ap->host->private_data;
338 339
339 if (classes[0] != ATA_DEV_NONE || classes[1] != ATA_DEV_NONE) 340 if (classes[0] != ATA_DEV_NONE || classes[1] != ATA_DEV_NONE)
340 return ata_std_postreset(ap, classes); 341 return ata_std_postreset(link, classes);
341 342
342 state->port[ap->port_no].disabled = 1; 343 state->port[ap->port_no].disabled = 1;
343 344
@@ -395,29 +396,30 @@ static struct ata_port_operations pata_icside_port_ops = {
395 396
396static void __devinit 397static void __devinit
397pata_icside_setup_ioaddr(struct ata_port *ap, void __iomem *base, 398pata_icside_setup_ioaddr(struct ata_port *ap, void __iomem *base,
398 const struct portinfo *info) 399 struct pata_icside_info *info,
400 const struct portinfo *port)
399{ 401{
400 struct ata_ioports *ioaddr = &ap->ioaddr; 402 struct ata_ioports *ioaddr = &ap->ioaddr;
401 void __iomem *cmd = base + info->dataoffset; 403 void __iomem *cmd = base + port->dataoffset;
402 404
403 ioaddr->cmd_addr = cmd; 405 ioaddr->cmd_addr = cmd;
404 ioaddr->data_addr = cmd + (ATA_REG_DATA << info->stepping); 406 ioaddr->data_addr = cmd + (ATA_REG_DATA << port->stepping);
405 ioaddr->error_addr = cmd + (ATA_REG_ERR << info->stepping); 407 ioaddr->error_addr = cmd + (ATA_REG_ERR << port->stepping);
406 ioaddr->feature_addr = cmd + (ATA_REG_FEATURE << info->stepping); 408 ioaddr->feature_addr = cmd + (ATA_REG_FEATURE << port->stepping);
407 ioaddr->nsect_addr = cmd + (ATA_REG_NSECT << info->stepping); 409 ioaddr->nsect_addr = cmd + (ATA_REG_NSECT << port->stepping);
408 ioaddr->lbal_addr = cmd + (ATA_REG_LBAL << info->stepping); 410 ioaddr->lbal_addr = cmd + (ATA_REG_LBAL << port->stepping);
409 ioaddr->lbam_addr = cmd + (ATA_REG_LBAM << info->stepping); 411 ioaddr->lbam_addr = cmd + (ATA_REG_LBAM << port->stepping);
410 ioaddr->lbah_addr = cmd + (ATA_REG_LBAH << info->stepping); 412 ioaddr->lbah_addr = cmd + (ATA_REG_LBAH << port->stepping);
411 ioaddr->device_addr = cmd + (ATA_REG_DEVICE << info->stepping); 413 ioaddr->device_addr = cmd + (ATA_REG_DEVICE << port->stepping);
412 ioaddr->status_addr = cmd + (ATA_REG_STATUS << info->stepping); 414 ioaddr->status_addr = cmd + (ATA_REG_STATUS << port->stepping);
413 ioaddr->command_addr = cmd + (ATA_REG_CMD << info->stepping); 415 ioaddr->command_addr = cmd + (ATA_REG_CMD << port->stepping);
414 416
415 ioaddr->ctl_addr = base + info->ctrloffset; 417 ioaddr->ctl_addr = base + port->ctrloffset;
416 ioaddr->altstatus_addr = ioaddr->ctl_addr; 418 ioaddr->altstatus_addr = ioaddr->ctl_addr;
417 419
418 ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", 420 ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx",
419 info->raw_base + info->dataoffset, 421 info->raw_base + port->dataoffset,
420 info->raw_base + info->ctrloffset); 422 info->raw_base + port->ctrloffset);
421 423
422 if (info->raw_ioc_base) 424 if (info->raw_ioc_base)
423 ata_port_desc(ap, "iocbase 0x%lx", info->raw_ioc_base); 425 ata_port_desc(ap, "iocbase 0x%lx", info->raw_ioc_base);
@@ -441,7 +443,7 @@ static int __devinit pata_icside_register_v5(struct pata_icside_info *info)
441 info->nr_ports = 1; 443 info->nr_ports = 1;
442 info->port[0] = &pata_icside_portinfo_v5; 444 info->port[0] = &pata_icside_portinfo_v5;
443 445
444 info->raw_base = ecard_resource_start(ec, ECARD_RES_MEMC); 446 info->raw_base = ecard_resource_start(info->ec, ECARD_RES_MEMC);
445 447
446 return 0; 448 return 0;
447} 449}
@@ -522,7 +524,7 @@ static int __devinit pata_icside_add_ports(struct pata_icside_info *info)
522 ap->flags |= ATA_FLAG_SLAVE_POSS; 524 ap->flags |= ATA_FLAG_SLAVE_POSS;
523 ap->ops = &pata_icside_port_ops; 525 ap->ops = &pata_icside_port_ops;
524 526
525 pata_icside_setup_ioaddr(ap, info->base, info->port[i]); 527 pata_icside_setup_ioaddr(ap, info->base, info, info->port[i]);
526 } 528 }
527 529
528 return ata_host_activate(host, ec->irq, ata_interrupt, 0, 530 return ata_host_activate(host, ec->irq, ata_interrupt, 0,
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c
index b9a17eb100d0..d0e2e50823b1 100644
--- a/drivers/ata/pata_ns87415.c
+++ b/drivers/ata/pata_ns87415.c
@@ -215,6 +215,8 @@ static int ns87415_check_atapi_dma(struct ata_queued_cmd *qc)
215 215
216#include <asm/superio.h> 216#include <asm/superio.h>
217 217
218#define SUPERIO_IDE_MAX_RETRIES 25
219
218/** 220/**
219 * ns87560_read_buggy - workaround buggy Super I/O chip 221 * ns87560_read_buggy - workaround buggy Super I/O chip
220 * @port: Port to read 222 * @port: Port to read
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c
index 6b07b5b48532..f9b485a487ae 100644
--- a/drivers/ata/pata_optidma.c
+++ b/drivers/ata/pata_optidma.c
@@ -449,7 +449,7 @@ static int optiplus_with_udma(struct pci_dev *pdev)
449 449
450 /* Find function 1 */ 450 /* Find function 1 */
451 dev1 = pci_get_device(0x1045, 0xC701, NULL); 451 dev1 = pci_get_device(0x1045, 0xC701, NULL);
452 if(dev1 == NULL) 452 if (dev1 == NULL)
453 return 0; 453 return 0;
454 454
455 /* Rev must be >= 0x10 */ 455 /* Rev must be >= 0x10 */
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 5db2013230b3..fd36099428a4 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -74,8 +74,7 @@ static int pcmcia_set_mode(struct ata_link *link, struct ata_device **r_failed_d
74 return ata_do_set_mode(link, r_failed_dev); 74 return ata_do_set_mode(link, r_failed_dev);
75 75
76 if (memcmp(master->id + ATA_ID_FW_REV, slave->id + ATA_ID_FW_REV, 76 if (memcmp(master->id + ATA_ID_FW_REV, slave->id + ATA_ID_FW_REV,
77 ATA_ID_FW_REV_LEN + ATA_ID_PROD_LEN) == 0) 77 ATA_ID_FW_REV_LEN + ATA_ID_PROD_LEN) == 0) {
78 {
79 /* Suspicious match, but could be two cards from 78 /* Suspicious match, but could be two cards from
80 the same vendor - check serial */ 79 the same vendor - check serial */
81 if (memcmp(master->id + ATA_ID_SERNO, slave->id + ATA_ID_SERNO, 80 if (memcmp(master->id + ATA_ID_SERNO, slave->id + ATA_ID_SERNO,
@@ -248,7 +247,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
248 goto next_entry; 247 goto next_entry;
249 io_base = pdev->io.BasePort1; 248 io_base = pdev->io.BasePort1;
250 ctl_base = pdev->io.BasePort1 + 0x0e; 249 ctl_base = pdev->io.BasePort1 + 0x0e;
251 } else goto next_entry; 250 } else
251 goto next_entry;
252 /* If we've got this far, we're done */ 252 /* If we've got this far, we're done */
253 break; 253 break;
254 } 254 }
@@ -285,8 +285,8 @@ next_entry:
285 printk(KERN_WARNING DRV_NAME ": second channel not yet supported.\n"); 285 printk(KERN_WARNING DRV_NAME ": second channel not yet supported.\n");
286 286
287 /* 287 /*
288 * Having done the PCMCIA plumbing the ATA side is relatively 288 * Having done the PCMCIA plumbing the ATA side is relatively
289 * sane. 289 * sane.
290 */ 290 */
291 ret = -ENOMEM; 291 ret = -ENOMEM;
292 host = ata_host_alloc(&pdev->dev, 1); 292 host = ata_host_alloc(&pdev->dev, 1);
@@ -363,7 +363,7 @@ static struct pcmcia_device_id pcmcia_devices[] = {
363 PCMCIA_DEVICE_MANF_CARD(0x0098, 0x0000), /* Toshiba */ 363 PCMCIA_DEVICE_MANF_CARD(0x0098, 0x0000), /* Toshiba */
364 PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x002d), 364 PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x002d),
365 PCMCIA_DEVICE_MANF_CARD(0x00ce, 0x0000), /* Samsung */ 365 PCMCIA_DEVICE_MANF_CARD(0x00ce, 0x0000), /* Samsung */
366 PCMCIA_DEVICE_MANF_CARD(0x0319, 0x0000), /* Hitachi */ 366 PCMCIA_DEVICE_MANF_CARD(0x0319, 0x0000), /* Hitachi */
367 PCMCIA_DEVICE_MANF_CARD(0x2080, 0x0001), 367 PCMCIA_DEVICE_MANF_CARD(0x2080, 0x0001),
368 PCMCIA_DEVICE_MANF_CARD(0x4e01, 0x0100), /* Viking CFA */ 368 PCMCIA_DEVICE_MANF_CARD(0x4e01, 0x0100), /* Viking CFA */
369 PCMCIA_DEVICE_MANF_CARD(0x4e01, 0x0200), /* Lexar, Viking CFA */ 369 PCMCIA_DEVICE_MANF_CARD(0x4e01, 0x0200), /* Lexar, Viking CFA */
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index 3d3f1558cdee..2622577521a1 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -348,7 +348,7 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long
348 ata_id_c_string(pair->id, model_num, ATA_ID_PROD, 348 ata_id_c_string(pair->id, model_num, ATA_ID_PROD,
349 ATA_ID_PROD_LEN + 1); 349 ATA_ID_PROD_LEN + 1);
350 /* If the master is a maxtor in UDMA6 then the slave should not use UDMA 6 */ 350 /* If the master is a maxtor in UDMA6 then the slave should not use UDMA 6 */
351 if(strstr(model_num, "Maxtor") == 0 && pair->dma_mode == XFER_UDMA_6) 351 if (strstr(model_num, "Maxtor") == 0 && pair->dma_mode == XFER_UDMA_6)
352 mask &= ~ (1 << (6 + ATA_SHIFT_UDMA)); 352 mask &= ~ (1 << (6 + ATA_SHIFT_UDMA));
353 353
354 return ata_pci_default_filter(adev, mask); 354 return ata_pci_default_filter(adev, mask);
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index 65d951618c60..bc7c2d5d8d5e 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -351,9 +351,9 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id
351 struct pci_dev *bridge = dev->bus->self; 351 struct pci_dev *bridge = dev->bus->self;
352 /* Don't grab anything behind a Promise I2O RAID */ 352 /* Don't grab anything behind a Promise I2O RAID */
353 if (bridge && bridge->vendor == PCI_VENDOR_ID_INTEL) { 353 if (bridge && bridge->vendor == PCI_VENDOR_ID_INTEL) {
354 if( bridge->device == PCI_DEVICE_ID_INTEL_I960) 354 if (bridge->device == PCI_DEVICE_ID_INTEL_I960)
355 return -ENODEV; 355 return -ENODEV;
356 if( bridge->device == PCI_DEVICE_ID_INTEL_I960RM) 356 if (bridge->device == PCI_DEVICE_ID_INTEL_I960RM)
357 return -ENODEV; 357 return -ENODEV;
358 } 358 }
359 } 359 }
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 55576138faea..ea2ef9fc15be 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -570,17 +570,8 @@ static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask,
570 udelay(20); 570 udelay(20);
571 out_be32(ioaddr->ctl_addr, ap->ctl); 571 out_be32(ioaddr->ctl_addr, ap->ctl);
572 572
573 /* spec mandates ">= 2ms" before checking status. 573 /* wait a while before checking status */
574 * We wait 150ms, because that was the magic delay used for 574 ata_wait_after_reset(ap, deadline);
575 * ATAPI devices in Hale Landis's ATADRVR, for the period of time
576 * between when the ATA command register is written, and then
577 * status is checked. Because waiting for "a while" before
578 * checking status is fine, post SRST, we perform this magic
579 * delay here as well.
580 *
581 * Old drivers/ide uses the 2mS rule and then waits for ready
582 */
583 msleep(150);
584 575
585 /* Before we perform post reset processing we want to see if 576 /* Before we perform post reset processing we want to see if
586 * the bus shows 0xFF because the odd clown forgets the D7 577 * the bus shows 0xFF because the odd clown forgets the D7
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index ea7a9a652e61..a4175fbdd170 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -176,7 +176,7 @@ static int via_cable_detect(struct ata_port *ap) {
176 if ((config->flags & VIA_UDMA) < VIA_UDMA_66) 176 if ((config->flags & VIA_UDMA) < VIA_UDMA_66)
177 return ATA_CBL_PATA40; 177 return ATA_CBL_PATA40;
178 /* UDMA 66 chips have only drive side logic */ 178 /* UDMA 66 chips have only drive side logic */
179 else if((config->flags & VIA_UDMA) < VIA_UDMA_100) 179 else if ((config->flags & VIA_UDMA) < VIA_UDMA_100)
180 return ATA_CBL_PATA_UNK; 180 return ATA_CBL_PATA_UNK;
181 /* UDMA 100 or later */ 181 /* UDMA 100 or later */
182 pci_read_config_dword(pdev, 0x50, &ata66); 182 pci_read_config_dword(pdev, 0x50, &ata66);
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c
index 549cbbe9fd07..311cdb3a5566 100644
--- a/drivers/ata/pata_winbond.c
+++ b/drivers/ata/pata_winbond.c
@@ -279,7 +279,7 @@ static __init int winbond_init(void)
279 279
280 if (request_region(port, 2, "pata_winbond")) { 280 if (request_region(port, 2, "pata_winbond")) {
281 ret = winbond_init_one(port); 281 ret = winbond_init_one(port);
282 if(ret <= 0) 282 if (ret <= 0)
283 release_region(port, 2); 283 release_region(port, 2);
284 else ct+= ret; 284 else ct+= ret;
285 } 285 }
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 199f7e150eb3..bd4c2a3c88d7 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -47,10 +47,10 @@
47#define DRV_VERSION "1.0" 47#define DRV_VERSION "1.0"
48 48
49/* macro to calculate base address for ATA regs */ 49/* macro to calculate base address for ATA regs */
50#define ADMA_ATA_REGS(base,port_no) ((base) + ((port_no) * 0x40)) 50#define ADMA_ATA_REGS(base, port_no) ((base) + ((port_no) * 0x40))
51 51
52/* macro to calculate base address for ADMA regs */ 52/* macro to calculate base address for ADMA regs */
53#define ADMA_REGS(base,port_no) ((base) + 0x80 + ((port_no) * 0x20)) 53#define ADMA_REGS(base, port_no) ((base) + 0x80 + ((port_no) * 0x20))
54 54
55/* macro to obtain addresses from ata_port */ 55/* macro to obtain addresses from ata_port */
56#define ADMA_PORT_REGS(ap) \ 56#define ADMA_PORT_REGS(ap) \
@@ -128,7 +128,7 @@ struct adma_port_priv {
128 adma_state_t state; 128 adma_state_t state;
129}; 129};
130 130
131static int adma_ata_init_one (struct pci_dev *pdev, 131static int adma_ata_init_one(struct pci_dev *pdev,
132 const struct pci_device_id *ent); 132 const struct pci_device_id *ent);
133static int adma_port_start(struct ata_port *ap); 133static int adma_port_start(struct ata_port *ap);
134static void adma_host_stop(struct ata_host *host); 134static void adma_host_stop(struct ata_host *host);
@@ -340,8 +340,8 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
340 buf[i++] = 0; /* pPKLW */ 340 buf[i++] = 0; /* pPKLW */
341 buf[i++] = 0; /* reserved */ 341 buf[i++] = 0; /* reserved */
342 342
343 *(__le32 *)(buf + i) 343 *(__le32 *)(buf + i) =
344 = (pFLAGS & pEND) ? 0 : cpu_to_le32(pp->pkt_dma + i + 4); 344 (pFLAGS & pEND) ? 0 : cpu_to_le32(pp->pkt_dma + i + 4);
345 i += 4; 345 i += 4;
346 346
347 VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4, 347 VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4,
@@ -617,7 +617,7 @@ static int adma_port_start(struct ata_port *ap)
617 return -ENOMEM; 617 return -ENOMEM;
618 /* paranoia? */ 618 /* paranoia? */
619 if ((pp->pkt_dma & 7) != 0) { 619 if ((pp->pkt_dma & 7) != 0) {
620 printk("bad alignment for pp->pkt_dma: %08x\n", 620 printk(KERN_ERR "bad alignment for pp->pkt_dma: %08x\n",
621 (u32)pp->pkt_dma); 621 (u32)pp->pkt_dma);
622 return -ENOMEM; 622 return -ENOMEM;
623 } 623 }
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index b4c37b9e413c..d015b4adcfe0 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -34,7 +34,8 @@ enum {
34 34
35 SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 35 SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
36 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 36 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
37 ATA_FLAG_NCQ | ATA_FLAG_SKIP_D2H_BSY), 37 ATA_FLAG_NCQ),
38 SATA_FSL_HOST_LFLAGS = ATA_LFLAG_SKIP_D2H_BSY,
38 39
39 SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, 40 SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH,
40 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ 41 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */
@@ -264,10 +265,11 @@ struct sata_fsl_host_priv {
264 void __iomem *hcr_base; 265 void __iomem *hcr_base;
265 void __iomem *ssr_base; 266 void __iomem *ssr_base;
266 void __iomem *csr_base; 267 void __iomem *csr_base;
268 int irq;
267}; 269};
268 270
269static inline unsigned int sata_fsl_tag(unsigned int tag, 271static inline unsigned int sata_fsl_tag(unsigned int tag,
270 void __iomem * hcr_base) 272 void __iomem *hcr_base)
271{ 273{
272 /* We let libATA core do actual (queue) tag allocation */ 274 /* We let libATA core do actual (queue) tag allocation */
273 275
@@ -306,7 +308,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
306 pp->cmdslot[tag].prde_fis_len = 308 pp->cmdslot[tag].prde_fis_len =
307 cpu_to_le32((num_prde << 16) | (fis_len << 2)); 309 cpu_to_le32((num_prde << 16) | (fis_len << 2));
308 pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03); 310 pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03);
309 pp->cmdslot[tag].desc_info = cpu_to_le32((desc_info | (tag & 0x1F))); 311 pp->cmdslot[tag].desc_info = cpu_to_le32(desc_info | (tag & 0x1F));
310 312
311 VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n", 313 VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n",
312 pp->cmdslot[tag].cda, 314 pp->cmdslot[tag].cda,
@@ -316,7 +318,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
316} 318}
317 319
318static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, 320static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
319 u32 * ttl, dma_addr_t cmd_desc_paddr) 321 u32 *ttl, dma_addr_t cmd_desc_paddr)
320{ 322{
321 struct scatterlist *sg; 323 struct scatterlist *sg;
322 unsigned int num_prde = 0; 324 unsigned int num_prde = 0;
@@ -353,7 +355,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
353 "s/g len unaligned : 0x%x\n", sg_len); 355 "s/g len unaligned : 0x%x\n", sg_len);
354 356
355 if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) && 357 if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) &&
356 !ata_sg_is_last(sg, qc)) { 358 (qc->n_iter + 1 != qc->n_elem)) {
357 VPRINTK("setting indirect prde\n"); 359 VPRINTK("setting indirect prde\n");
358 prd_ptr_to_indirect_ext = prd; 360 prd_ptr_to_indirect_ext = prd;
359 prd->dba = cpu_to_le32(indirect_ext_segment_paddr); 361 prd->dba = cpu_to_le32(indirect_ext_segment_paddr);
@@ -404,7 +406,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
404 cd = (struct command_desc *)pp->cmdentry + tag; 406 cd = (struct command_desc *)pp->cmdentry + tag;
405 cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; 407 cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE;
406 408
407 ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) & cd->cfis); 409 ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) &cd->cfis);
408 410
409 VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", 411 VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n",
410 cd->cfis[0], cd->cfis[1], cd->cfis[2]); 412 cd->cfis[0], cd->cfis[1], cd->cfis[2]);
@@ -470,16 +472,10 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
470 472
471 switch (sc_reg_in) { 473 switch (sc_reg_in) {
472 case SCR_STATUS: 474 case SCR_STATUS:
473 sc_reg = 0;
474 break;
475 case SCR_ERROR: 475 case SCR_ERROR:
476 sc_reg = 1;
477 break;
478 case SCR_CONTROL: 476 case SCR_CONTROL:
479 sc_reg = 2;
480 break;
481 case SCR_ACTIVE: 477 case SCR_ACTIVE:
482 sc_reg = 3; 478 sc_reg = sc_reg_in;
483 break; 479 break;
484 default: 480 default:
485 return -EINVAL; 481 return -EINVAL;
@@ -487,7 +483,7 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
487 483
488 VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg); 484 VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg);
489 485
490 iowrite32(val, (void __iomem *)ssr_base + (sc_reg * 4)); 486 iowrite32(val, ssr_base + (sc_reg * 4));
491 return 0; 487 return 0;
492} 488}
493 489
@@ -500,16 +496,10 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in,
500 496
501 switch (sc_reg_in) { 497 switch (sc_reg_in) {
502 case SCR_STATUS: 498 case SCR_STATUS:
503 sc_reg = 0;
504 break;
505 case SCR_ERROR: 499 case SCR_ERROR:
506 sc_reg = 1;
507 break;
508 case SCR_CONTROL: 500 case SCR_CONTROL:
509 sc_reg = 2;
510 break;
511 case SCR_ACTIVE: 501 case SCR_ACTIVE:
512 sc_reg = 3; 502 sc_reg = sc_reg_in;
513 break; 503 break;
514 default: 504 default:
515 return -EINVAL; 505 return -EINVAL;
@@ -517,7 +507,7 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in,
517 507
518 VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg); 508 VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg);
519 509
520 *val = ioread32((void __iomem *)ssr_base + (sc_reg * 4)); 510 *val = ioread32(ssr_base + (sc_reg * 4));
521 return 0; 511 return 0;
522} 512}
523 513
@@ -571,7 +561,6 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd
571 struct ata_port *ap) 561 struct ata_port *ap)
572{ 562{
573 struct sata_fsl_port_priv *pp = ap->private_data; 563 struct sata_fsl_port_priv *pp = ap->private_data;
574 u8 fis[6 * 4];
575 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 564 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
576 void __iomem *hcr_base = host_priv->hcr_base; 565 void __iomem *hcr_base = host_priv->hcr_base;
577 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base); 566 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base);
@@ -579,8 +568,7 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd
579 568
580 cd = pp->cmdentry + tag; 569 cd = pp->cmdentry + tag;
581 570
582 memcpy(fis, &cd->sfis, 6 * 4); /* should we use memcpy_from_io() */ 571 ata_tf_from_fis(cd->sfis, &pp->tf);
583 ata_tf_from_fis(fis, &pp->tf);
584} 572}
585 573
586static u8 sata_fsl_check_status(struct ata_port *ap) 574static u8 sata_fsl_check_status(struct ata_port *ap)
@@ -664,6 +652,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
664 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); 652 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
665 VPRINTK("CHBA = 0x%x\n", ioread32(hcr_base + CHBA)); 653 VPRINTK("CHBA = 0x%x\n", ioread32(hcr_base + CHBA));
666 654
655#ifdef CONFIG_MPC8315_DS
667 /* 656 /*
668 * Workaround for 8315DS board 3gbps link-up issue, 657 * Workaround for 8315DS board 3gbps link-up issue,
669 * currently limit SATA port to GEN1 speed 658 * currently limit SATA port to GEN1 speed
@@ -676,6 +665,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
676 sata_fsl_scr_read(ap, SCR_CONTROL, &temp); 665 sata_fsl_scr_read(ap, SCR_CONTROL, &temp);
677 dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n", 666 dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n",
678 temp); 667 temp);
668#endif
679 669
680 return 0; 670 return 0;
681} 671}
@@ -728,9 +718,10 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap)
728 return ata_dev_classify(&tf); 718 return ata_dev_classify(&tf);
729} 719}
730 720
731static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class, 721static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
732 unsigned long deadline) 722 unsigned long deadline)
733{ 723{
724 struct ata_port *ap = link->ap;
734 struct sata_fsl_port_priv *pp = ap->private_data; 725 struct sata_fsl_port_priv *pp = ap->private_data;
735 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 726 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
736 void __iomem *hcr_base = host_priv->hcr_base; 727 void __iomem *hcr_base = host_priv->hcr_base;
@@ -739,10 +730,6 @@ static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class,
739 u8 *cfis; 730 u8 *cfis;
740 u32 Serror; 731 u32 Serror;
741 int i = 0; 732 int i = 0;
742 struct ata_queued_cmd qc;
743 u8 *buf;
744 dma_addr_t dma_address;
745 struct scatterlist *sg;
746 unsigned long start_jiffies; 733 unsigned long start_jiffies;
747 734
748 DPRINTK("in xx_softreset\n"); 735 DPRINTK("in xx_softreset\n");
@@ -811,7 +798,7 @@ try_offline_again:
811 */ 798 */
812 799
813 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500); 800 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500);
814 if ((!(temp & 0x10)) || ata_port_offline(ap)) { 801 if ((!(temp & 0x10)) || ata_link_offline(link)) {
815 ata_port_printk(ap, KERN_WARNING, 802 ata_port_printk(ap, KERN_WARNING,
816 "No Device OR PHYRDY change,Hstatus = 0x%x\n", 803 "No Device OR PHYRDY change,Hstatus = 0x%x\n",
817 ioread32(hcr_base + HSTATUS)); 804 ioread32(hcr_base + HSTATUS));
@@ -842,13 +829,10 @@ try_offline_again:
842 * reached here, we can send a command to the target device 829 * reached here, we can send a command to the target device
843 */ 830 */
844 831
845 if (ap->sactive)
846 goto skip_srst_do_ncq_error_handling;
847
848 DPRINTK("Sending SRST/device reset\n"); 832 DPRINTK("Sending SRST/device reset\n");
849 833
850 ata_tf_init(ap->device, &tf); 834 ata_tf_init(link->device, &tf);
851 cfis = (u8 *) & pp->cmdentry->cfis; 835 cfis = (u8 *) &pp->cmdentry->cfis;
852 836
853 /* device reset/SRST is a control register update FIS, uses tag0 */ 837 /* device reset/SRST is a control register update FIS, uses tag0 */
854 sata_fsl_setup_cmd_hdr_entry(pp, 0, 838 sata_fsl_setup_cmd_hdr_entry(pp, 0,
@@ -912,76 +896,13 @@ try_offline_again:
912 * command bit of the CCreg 896 * command bit of the CCreg
913 */ 897 */
914 iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ 898 iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */
915 goto check_device_signature;
916
917skip_srst_do_ncq_error_handling:
918
919 VPRINTK("Sending read log ext(10h) command\n");
920
921 memset(&qc, 0, sizeof(struct ata_queued_cmd));
922 ata_tf_init(ap->device, &tf);
923
924 tf.command = ATA_CMD_READ_LOG_EXT;
925 tf.lbal = ATA_LOG_SATA_NCQ;
926 tf.nsect = 1;
927 tf.hob_nsect = 0;
928 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE;
929 tf.protocol = ATA_PROT_PIO;
930
931 qc.tag = ATA_TAG_INTERNAL;
932 qc.scsicmd = NULL;
933 qc.ap = ap;
934 qc.dev = ap->device;
935
936 qc.tf = tf;
937 qc.flags |= ATA_QCFLAG_RESULT_TF;
938 qc.dma_dir = DMA_FROM_DEVICE;
939
940 buf = ap->sector_buf;
941 ata_sg_init_one(&qc, buf, 1 * ATA_SECT_SIZE);
942
943 /*
944 * Need to DMA-map the memory buffer associated with the command
945 */
946
947 sg = qc.__sg;
948 dma_address = dma_map_single(ap->dev, qc.buf_virt,
949 sg->length, DMA_FROM_DEVICE);
950
951 sg_dma_address(sg) = dma_address;
952 sg_dma_len(sg) = sg->length;
953
954 VPRINTK("EH, addr = 0x%x, len = 0x%x\n", dma_address, sg->length);
955
956 sata_fsl_qc_prep(&qc);
957 sata_fsl_qc_issue(&qc);
958
959 temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000);
960 if (temp & 0x1) {
961 VPRINTK("READ_LOG_EXT_10H issue failed\n");
962
963 VPRINTK("READ_LOG@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n",
964 ioread32(CQ + hcr_base),
965 ioread32(CA + hcr_base), ioread32(CC + hcr_base));
966
967 sata_fsl_scr_read(ap, SCR_ERROR, &Serror);
968
969 VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
970 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
971 VPRINTK("Serror = 0x%x\n", Serror);
972 goto err;
973 }
974
975 iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */
976
977 check_device_signature:
978 899
979 DPRINTK("SATA FSL : Now checking device signature\n"); 900 DPRINTK("SATA FSL : Now checking device signature\n");
980 901
981 *class = ATA_DEV_NONE; 902 *class = ATA_DEV_NONE;
982 903
983 /* Verify if SStatus indicates device presence */ 904 /* Verify if SStatus indicates device presence */
984 if (ata_port_online(ap)) { 905 if (ata_link_online(link)) {
985 /* 906 /*
986 * if we are here, device presence has been detected, 907 * if we are here, device presence has been detected,
987 * 1st D2H FIS would have been received, but sfis in 908 * 1st D2H FIS would have been received, but sfis in
@@ -1002,25 +923,13 @@ err:
1002 return -EIO; 923 return -EIO;
1003} 924}
1004 925
1005static int sata_fsl_hardreset(struct ata_port *ap, unsigned int *class,
1006 unsigned long deadline)
1007{
1008 int retval;
1009
1010 retval = sata_std_hardreset(ap, class, deadline);
1011
1012 DPRINTK("SATA FSL : in xx_hardreset, retval = 0x%d\n", retval);
1013
1014 return retval;
1015}
1016
1017static void sata_fsl_error_handler(struct ata_port *ap) 926static void sata_fsl_error_handler(struct ata_port *ap)
1018{ 927{
1019 928
1020 DPRINTK("in xx_error_handler\n"); 929 DPRINTK("in xx_error_handler\n");
1021 930
1022 /* perform recovery */ 931 /* perform recovery */
1023 ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_fsl_hardreset, 932 ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_std_hardreset,
1024 ata_std_postreset); 933 ata_std_postreset);
1025} 934}
1026 935
@@ -1042,7 +951,8 @@ static void sata_fsl_irq_clear(struct ata_port *ap)
1042 951
1043static void sata_fsl_error_intr(struct ata_port *ap) 952static void sata_fsl_error_intr(struct ata_port *ap)
1044{ 953{
1045 struct ata_eh_info *ehi = &ap->eh_info; 954 struct ata_link *link = &ap->link;
955 struct ata_eh_info *ehi = &link->eh_info;
1046 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 956 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
1047 void __iomem *hcr_base = host_priv->hcr_base; 957 void __iomem *hcr_base = host_priv->hcr_base;
1048 u32 hstatus, dereg, cereg = 0, SError = 0; 958 u32 hstatus, dereg, cereg = 0, SError = 0;
@@ -1111,7 +1021,7 @@ static void sata_fsl_error_intr(struct ata_port *ap)
1111 } 1021 }
1112 1022
1113 /* record error info */ 1023 /* record error info */
1114 qc = ata_qc_from_tag(ap, ap->active_tag); 1024 qc = ata_qc_from_tag(ap, link->active_tag);
1115 1025
1116 if (qc) { 1026 if (qc) {
1117 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap); 1027 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap);
@@ -1139,6 +1049,7 @@ static void sata_fsl_qc_complete(struct ata_queued_cmd *qc)
1139 1049
1140static void sata_fsl_host_intr(struct ata_port *ap) 1050static void sata_fsl_host_intr(struct ata_port *ap)
1141{ 1051{
1052 struct ata_link *link = &ap->link;
1142 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 1053 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
1143 void __iomem *hcr_base = host_priv->hcr_base; 1054 void __iomem *hcr_base = host_priv->hcr_base;
1144 u32 hstatus, qc_active = 0; 1055 u32 hstatus, qc_active = 0;
@@ -1161,7 +1072,7 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1161 return; 1072 return;
1162 } 1073 }
1163 1074
1164 if (ap->sactive) { /* only true for NCQ commands */ 1075 if (link->sactive) { /* only true for NCQ commands */
1165 int i; 1076 int i;
1166 /* Read command completed register */ 1077 /* Read command completed register */
1167 qc_active = ioread32(hcr_base + CC); 1078 qc_active = ioread32(hcr_base + CC);
@@ -1190,10 +1101,10 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1190 1101
1191 } else if (ap->qc_active) { 1102 } else if (ap->qc_active) {
1192 iowrite32(1, hcr_base + CC); 1103 iowrite32(1, hcr_base + CC);
1193 qc = ata_qc_from_tag(ap, ap->active_tag); 1104 qc = ata_qc_from_tag(ap, link->active_tag);
1194 1105
1195 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", 1106 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n",
1196 ap->active_tag, ioread32(hcr_base + CC)); 1107 link->active_tag, ioread32(hcr_base + CC));
1197 1108
1198 if (qc) { 1109 if (qc) {
1199 sata_fsl_qc_complete(qc); 1110 sata_fsl_qc_complete(qc);
@@ -1312,15 +1223,9 @@ static struct scsi_host_template sata_fsl_sht = {
1312 .slave_configure = ata_scsi_slave_config, 1223 .slave_configure = ata_scsi_slave_config,
1313 .slave_destroy = ata_scsi_slave_destroy, 1224 .slave_destroy = ata_scsi_slave_destroy,
1314 .bios_param = ata_std_bios_param, 1225 .bios_param = ata_std_bios_param,
1315#ifdef CONFIG_PM
1316 .suspend = ata_scsi_device_suspend,
1317 .resume = ata_scsi_device_resume,
1318#endif
1319}; 1226};
1320 1227
1321static const struct ata_port_operations sata_fsl_ops = { 1228static const struct ata_port_operations sata_fsl_ops = {
1322 .port_disable = ata_port_disable,
1323
1324 .check_status = sata_fsl_check_status, 1229 .check_status = sata_fsl_check_status,
1325 .check_altstatus = sata_fsl_check_status, 1230 .check_altstatus = sata_fsl_check_status,
1326 .dev_select = ata_noop_dev_select, 1231 .dev_select = ata_noop_dev_select,
@@ -1330,8 +1235,6 @@ static const struct ata_port_operations sata_fsl_ops = {
1330 .qc_prep = sata_fsl_qc_prep, 1235 .qc_prep = sata_fsl_qc_prep,
1331 .qc_issue = sata_fsl_qc_issue, 1236 .qc_issue = sata_fsl_qc_issue,
1332 .irq_clear = sata_fsl_irq_clear, 1237 .irq_clear = sata_fsl_irq_clear,
1333 .irq_on = ata_dummy_irq_on,
1334 .irq_ack = ata_dummy_irq_ack,
1335 1238
1336 .scr_read = sata_fsl_scr_read, 1239 .scr_read = sata_fsl_scr_read,
1337 .scr_write = sata_fsl_scr_write, 1240 .scr_write = sata_fsl_scr_write,
@@ -1348,6 +1251,7 @@ static const struct ata_port_operations sata_fsl_ops = {
1348static const struct ata_port_info sata_fsl_port_info[] = { 1251static const struct ata_port_info sata_fsl_port_info[] = {
1349 { 1252 {
1350 .flags = SATA_FSL_HOST_FLAGS, 1253 .flags = SATA_FSL_HOST_FLAGS,
1254 .link_flags = SATA_FSL_HOST_LFLAGS,
1351 .pio_mask = 0x1f, /* pio 0-4 */ 1255 .pio_mask = 0x1f, /* pio 0-4 */
1352 .udma_mask = 0x7f, /* udma 0-6 */ 1256 .udma_mask = 0x7f, /* udma 0-6 */
1353 .port_ops = &sata_fsl_ops, 1257 .port_ops = &sata_fsl_ops,
@@ -1398,6 +1302,7 @@ static int sata_fsl_probe(struct of_device *ofdev,
1398 dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n"); 1302 dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n");
1399 goto error_exit_with_cleanup; 1303 goto error_exit_with_cleanup;
1400 } 1304 }
1305 host_priv->irq = irq;
1401 1306
1402 /* allocate host structure */ 1307 /* allocate host structure */
1403 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS); 1308 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS);
@@ -1444,7 +1349,7 @@ static int sata_fsl_remove(struct of_device *ofdev)
1444 1349
1445 dev_set_drvdata(&ofdev->dev, NULL); 1350 dev_set_drvdata(&ofdev->dev, NULL);
1446 1351
1447 irq_dispose_mapping(host->irq); 1352 irq_dispose_mapping(host_priv->irq);
1448 iounmap(host_priv->hcr_base); 1353 iounmap(host_priv->hcr_base);
1449 kfree(host_priv); 1354 kfree(host_priv);
1450 1355
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index 08595f34b3e8..323c087e8cc1 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -143,7 +143,7 @@ static const int scr_map[] = {
143 [SCR_CONTROL] = 2, 143 [SCR_CONTROL] = 2,
144}; 144};
145 145
146static void __iomem * inic_port_base(struct ata_port *ap) 146static void __iomem *inic_port_base(struct ata_port *ap)
147{ 147{
148 return ap->host->iomap[MMIO_BAR] + ap->port_no * PORT_SIZE; 148 return ap->host->iomap[MMIO_BAR] + ap->port_no * PORT_SIZE;
149} 149}
@@ -448,7 +448,7 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class,
448 struct ata_taskfile tf; 448 struct ata_taskfile tf;
449 449
450 /* wait a while before checking status */ 450 /* wait a while before checking status */
451 msleep(150); 451 ata_wait_after_reset(ap, deadline);
452 452
453 rc = ata_wait_ready(ap, deadline); 453 rc = ata_wait_ready(ap, deadline);
454 /* link occupied, -ENODEV too is an error */ 454 /* link occupied, -ENODEV too is an error */
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index b39648f0914b..a43f64d2775b 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1156,7 +1156,7 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
1156 last_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); 1156 last_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
1157} 1157}
1158 1158
1159static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last) 1159static void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last)
1160{ 1160{
1161 u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS | 1161 u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS |
1162 (last ? CRQB_CMD_LAST : 0); 1162 (last ? CRQB_CMD_LAST : 0);
@@ -2429,7 +2429,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2429 struct mv_host_priv *hpriv = host->private_data; 2429 struct mv_host_priv *hpriv = host->private_data;
2430 u32 hp_flags = hpriv->hp_flags; 2430 u32 hp_flags = hpriv->hp_flags;
2431 2431
2432 switch(board_idx) { 2432 switch (board_idx) {
2433 case chip_5080: 2433 case chip_5080:
2434 hpriv->ops = &mv5xxx_ops; 2434 hpriv->ops = &mv5xxx_ops;
2435 hp_flags |= MV_HP_GEN_I; 2435 hp_flags |= MV_HP_GEN_I;
@@ -2510,7 +2510,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2510 break; 2510 break;
2511 2511
2512 default: 2512 default:
2513 printk(KERN_ERR DRV_NAME ": BUG: invalid board index %u\n", board_idx); 2513 dev_printk(KERN_ERR, &pdev->dev,
2514 "BUG: invalid board index %u\n", board_idx);
2514 return 1; 2515 return 1;
2515 } 2516 }
2516 2517
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 2e0279fdd7aa..35b2df297527 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -291,7 +291,7 @@ struct nv_swncq_port_priv {
291}; 291};
292 292
293 293
294#define NV_ADMA_CHECK_INTR(GCTL, PORT) ((GCTL) & ( 1 << (19 + (12 * (PORT))))) 294#define NV_ADMA_CHECK_INTR(GCTL, PORT) ((GCTL) & (1 << (19 + (12 * (PORT)))))
295 295
296static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 296static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
297#ifdef CONFIG_PM 297#ifdef CONFIG_PM
@@ -365,9 +365,9 @@ static const struct pci_device_id nv_pci_tbl[] = {
365 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2), SWNCQ }, 365 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2), SWNCQ },
366 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA), SWNCQ }, 366 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA), SWNCQ },
367 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2), SWNCQ }, 367 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2), SWNCQ },
368 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), SWNCQ }, 368 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC },
369 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), SWNCQ }, 369 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC },
370 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), SWNCQ }, 370 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC },
371 371
372 { } /* terminate list */ 372 { } /* terminate list */
373}; 373};
@@ -884,8 +884,9 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err)
884 /* Notifier bits set without a command may indicate the drive 884 /* Notifier bits set without a command may indicate the drive
885 is misbehaving. Raise host state machine violation on this 885 is misbehaving. Raise host state machine violation on this
886 condition. */ 886 condition. */
887 ata_port_printk(ap, KERN_ERR, "notifier for tag %d with no command?\n", 887 ata_port_printk(ap, KERN_ERR,
888 cpb_num); 888 "notifier for tag %d with no cmd?\n",
889 cpb_num);
889 ehi->err_mask |= AC_ERR_HSM; 890 ehi->err_mask |= AC_ERR_HSM;
890 ehi->action |= ATA_EH_SOFTRESET; 891 ehi->action |= ATA_EH_SOFTRESET;
891 ata_port_freeze(ap); 892 ata_port_freeze(ap);
@@ -1012,7 +1013,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
1012 u32 check_commands; 1013 u32 check_commands;
1013 int pos, error = 0; 1014 int pos, error = 0;
1014 1015
1015 if(ata_tag_valid(ap->link.active_tag)) 1016 if (ata_tag_valid(ap->link.active_tag))
1016 check_commands = 1 << ap->link.active_tag; 1017 check_commands = 1 << ap->link.active_tag;
1017 else 1018 else
1018 check_commands = ap->link.sactive; 1019 check_commands = ap->link.sactive;
@@ -1021,14 +1022,14 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
1021 while ((pos = ffs(check_commands)) && !error) { 1022 while ((pos = ffs(check_commands)) && !error) {
1022 pos--; 1023 pos--;
1023 error = nv_adma_check_cpb(ap, pos, 1024 error = nv_adma_check_cpb(ap, pos,
1024 notifier_error & (1 << pos) ); 1025 notifier_error & (1 << pos));
1025 check_commands &= ~(1 << pos ); 1026 check_commands &= ~(1 << pos);
1026 } 1027 }
1027 } 1028 }
1028 } 1029 }
1029 } 1030 }
1030 1031
1031 if(notifier_clears[0] || notifier_clears[1]) { 1032 if (notifier_clears[0] || notifier_clears[1]) {
1032 /* Note: Both notifier clear registers must be written 1033 /* Note: Both notifier clear registers must be written
1033 if either is set, even if one is zero, according to NVIDIA. */ 1034 if either is set, even if one is zero, according to NVIDIA. */
1034 struct nv_adma_port_priv *pp = host->ports[0]->private_data; 1035 struct nv_adma_port_priv *pp = host->ports[0]->private_data;
@@ -1061,7 +1062,7 @@ static void nv_adma_freeze(struct ata_port *ap)
1061 tmp = readw(mmio + NV_ADMA_CTL); 1062 tmp = readw(mmio + NV_ADMA_CTL);
1062 writew(tmp & ~(NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN), 1063 writew(tmp & ~(NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN),
1063 mmio + NV_ADMA_CTL); 1064 mmio + NV_ADMA_CTL);
1064 readw(mmio + NV_ADMA_CTL ); /* flush posted write */ 1065 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1065} 1066}
1066 1067
1067static void nv_adma_thaw(struct ata_port *ap) 1068static void nv_adma_thaw(struct ata_port *ap)
@@ -1079,7 +1080,7 @@ static void nv_adma_thaw(struct ata_port *ap)
1079 tmp = readw(mmio + NV_ADMA_CTL); 1080 tmp = readw(mmio + NV_ADMA_CTL);
1080 writew(tmp | (NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN), 1081 writew(tmp | (NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN),
1081 mmio + NV_ADMA_CTL); 1082 mmio + NV_ADMA_CTL);
1082 readw(mmio + NV_ADMA_CTL ); /* flush posted write */ 1083 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1083} 1084}
1084 1085
1085static void nv_adma_irq_clear(struct ata_port *ap) 1086static void nv_adma_irq_clear(struct ata_port *ap)
@@ -1119,7 +1120,7 @@ static void nv_adma_post_internal_cmd(struct ata_queued_cmd *qc)
1119{ 1120{
1120 struct nv_adma_port_priv *pp = qc->ap->private_data; 1121 struct nv_adma_port_priv *pp = qc->ap->private_data;
1121 1122
1122 if(pp->flags & NV_ADMA_PORT_REGISTER_MODE) 1123 if (pp->flags & NV_ADMA_PORT_REGISTER_MODE)
1123 ata_bmdma_post_internal_cmd(qc); 1124 ata_bmdma_post_internal_cmd(qc);
1124} 1125}
1125 1126
@@ -1165,7 +1166,7 @@ static int nv_adma_port_start(struct ata_port *ap)
1165 pp->cpb_dma = mem_dma; 1166 pp->cpb_dma = mem_dma;
1166 1167
1167 writel(mem_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW); 1168 writel(mem_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW);
1168 writel((mem_dma >> 16 ) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH); 1169 writel((mem_dma >> 16) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH);
1169 1170
1170 mem += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ; 1171 mem += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ;
1171 mem_dma += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ; 1172 mem_dma += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ;
@@ -1189,15 +1190,15 @@ static int nv_adma_port_start(struct ata_port *ap)
1189 1190
1190 /* clear GO for register mode, enable interrupt */ 1191 /* clear GO for register mode, enable interrupt */
1191 tmp = readw(mmio + NV_ADMA_CTL); 1192 tmp = readw(mmio + NV_ADMA_CTL);
1192 writew( (tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN | 1193 writew((tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN |
1193 NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL); 1194 NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL);
1194 1195
1195 tmp = readw(mmio + NV_ADMA_CTL); 1196 tmp = readw(mmio + NV_ADMA_CTL);
1196 writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); 1197 writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL);
1197 readw( mmio + NV_ADMA_CTL ); /* flush posted write */ 1198 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1198 udelay(1); 1199 udelay(1);
1199 writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); 1200 writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL);
1200 readw( mmio + NV_ADMA_CTL ); /* flush posted write */ 1201 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1201 1202
1202 return 0; 1203 return 0;
1203} 1204}
@@ -1237,7 +1238,7 @@ static int nv_adma_port_resume(struct ata_port *ap)
1237 1238
1238 /* set CPB block location */ 1239 /* set CPB block location */
1239 writel(pp->cpb_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW); 1240 writel(pp->cpb_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW);
1240 writel((pp->cpb_dma >> 16 ) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH); 1241 writel((pp->cpb_dma >> 16) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH);
1241 1242
1242 /* clear any outstanding interrupt conditions */ 1243 /* clear any outstanding interrupt conditions */
1243 writew(0xffff, mmio + NV_ADMA_STAT); 1244 writew(0xffff, mmio + NV_ADMA_STAT);
@@ -1250,15 +1251,15 @@ static int nv_adma_port_resume(struct ata_port *ap)
1250 1251
1251 /* clear GO for register mode, enable interrupt */ 1252 /* clear GO for register mode, enable interrupt */
1252 tmp = readw(mmio + NV_ADMA_CTL); 1253 tmp = readw(mmio + NV_ADMA_CTL);
1253 writew( (tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN | 1254 writew((tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN |
1254 NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL); 1255 NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL);
1255 1256
1256 tmp = readw(mmio + NV_ADMA_CTL); 1257 tmp = readw(mmio + NV_ADMA_CTL);
1257 writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); 1258 writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL);
1258 readw( mmio + NV_ADMA_CTL ); /* flush posted write */ 1259 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1259 udelay(1); 1260 udelay(1);
1260 writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); 1261 writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL);
1261 readw( mmio + NV_ADMA_CTL ); /* flush posted write */ 1262 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1262 1263
1263 return 0; 1264 return 0;
1264} 1265}
@@ -1342,7 +1343,8 @@ static void nv_adma_fill_sg(struct ata_queued_cmd *qc, struct nv_adma_cpb *cpb)
1342 idx = 0; 1343 idx = 0;
1343 1344
1344 ata_for_each_sg(sg, qc) { 1345 ata_for_each_sg(sg, qc) {
1345 aprd = (idx < 5) ? &cpb->aprd[idx] : &pp->aprd[NV_ADMA_SGTBL_LEN * qc->tag + (idx-5)]; 1346 aprd = (idx < 5) ? &cpb->aprd[idx] :
1347 &pp->aprd[NV_ADMA_SGTBL_LEN * qc->tag + (idx-5)];
1346 nv_adma_fill_aprd(qc, sg, idx, aprd); 1348 nv_adma_fill_aprd(qc, sg, idx, aprd);
1347 idx++; 1349 idx++;
1348 } 1350 }
@@ -1359,12 +1361,12 @@ static int nv_adma_use_reg_mode(struct ata_queued_cmd *qc)
1359 /* ADMA engine can only be used for non-ATAPI DMA commands, 1361 /* ADMA engine can only be used for non-ATAPI DMA commands,
1360 or interrupt-driven no-data commands, where a result taskfile 1362 or interrupt-driven no-data commands, where a result taskfile
1361 is not required. */ 1363 is not required. */
1362 if((pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) || 1364 if ((pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) ||
1363 (qc->tf.flags & ATA_TFLAG_POLLING) || 1365 (qc->tf.flags & ATA_TFLAG_POLLING) ||
1364 (qc->flags & ATA_QCFLAG_RESULT_TF)) 1366 (qc->flags & ATA_QCFLAG_RESULT_TF))
1365 return 1; 1367 return 1;
1366 1368
1367 if((qc->flags & ATA_QCFLAG_DMAMAP) || 1369 if ((qc->flags & ATA_QCFLAG_DMAMAP) ||
1368 (qc->tf.protocol == ATA_PROT_NODATA)) 1370 (qc->tf.protocol == ATA_PROT_NODATA))
1369 return 0; 1371 return 0;
1370 1372
@@ -1401,14 +1403,14 @@ static void nv_adma_qc_prep(struct ata_queued_cmd *qc)
1401 1403
1402 nv_adma_tf_to_cpb(&qc->tf, cpb->tf); 1404 nv_adma_tf_to_cpb(&qc->tf, cpb->tf);
1403 1405
1404 if(qc->flags & ATA_QCFLAG_DMAMAP) { 1406 if (qc->flags & ATA_QCFLAG_DMAMAP) {
1405 nv_adma_fill_sg(qc, cpb); 1407 nv_adma_fill_sg(qc, cpb);
1406 ctl_flags |= NV_CPB_CTL_APRD_VALID; 1408 ctl_flags |= NV_CPB_CTL_APRD_VALID;
1407 } else 1409 } else
1408 memset(&cpb->aprd[0], 0, sizeof(struct nv_adma_prd) * 5); 1410 memset(&cpb->aprd[0], 0, sizeof(struct nv_adma_prd) * 5);
1409 1411
1410 /* Be paranoid and don't let the device see NV_CPB_CTL_CPB_VALID until we are 1412 /* Be paranoid and don't let the device see NV_CPB_CTL_CPB_VALID
1411 finished filling in all of the contents */ 1413 until we are finished filling in all of the contents */
1412 wmb(); 1414 wmb();
1413 cpb->ctl_flags = ctl_flags; 1415 cpb->ctl_flags = ctl_flags;
1414 wmb(); 1416 wmb();
@@ -1435,16 +1437,16 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)
1435 and (number of cpbs to append -1) in top 8 bits */ 1437 and (number of cpbs to append -1) in top 8 bits */
1436 wmb(); 1438 wmb();
1437 1439
1438 if(curr_ncq != pp->last_issue_ncq) { 1440 if (curr_ncq != pp->last_issue_ncq) {
1439 /* Seems to need some delay before switching between NCQ and non-NCQ 1441 /* Seems to need some delay before switching between NCQ and
1440 commands, else we get command timeouts and such. */ 1442 non-NCQ commands, else we get command timeouts and such. */
1441 udelay(20); 1443 udelay(20);
1442 pp->last_issue_ncq = curr_ncq; 1444 pp->last_issue_ncq = curr_ncq;
1443 } 1445 }
1444 1446
1445 writew(qc->tag, mmio + NV_ADMA_APPEND); 1447 writew(qc->tag, mmio + NV_ADMA_APPEND);
1446 1448
1447 DPRINTK("Issued tag %u\n",qc->tag); 1449 DPRINTK("Issued tag %u\n", qc->tag);
1448 1450
1449 return 0; 1451 return 0;
1450} 1452}
@@ -1641,12 +1643,12 @@ static void nv_error_handler(struct ata_port *ap)
1641static void nv_adma_error_handler(struct ata_port *ap) 1643static void nv_adma_error_handler(struct ata_port *ap)
1642{ 1644{
1643 struct nv_adma_port_priv *pp = ap->private_data; 1645 struct nv_adma_port_priv *pp = ap->private_data;
1644 if(!(pp->flags & NV_ADMA_PORT_REGISTER_MODE)) { 1646 if (!(pp->flags & NV_ADMA_PORT_REGISTER_MODE)) {
1645 void __iomem *mmio = pp->ctl_block; 1647 void __iomem *mmio = pp->ctl_block;
1646 int i; 1648 int i;
1647 u16 tmp; 1649 u16 tmp;
1648 1650
1649 if(ata_tag_valid(ap->link.active_tag) || ap->link.sactive) { 1651 if (ata_tag_valid(ap->link.active_tag) || ap->link.sactive) {
1650 u32 notifier = readl(mmio + NV_ADMA_NOTIFIER); 1652 u32 notifier = readl(mmio + NV_ADMA_NOTIFIER);
1651 u32 notifier_error = readl(mmio + NV_ADMA_NOTIFIER_ERROR); 1653 u32 notifier_error = readl(mmio + NV_ADMA_NOTIFIER_ERROR);
1652 u32 gen_ctl = readl(pp->gen_block + NV_ADMA_GEN_CTL); 1654 u32 gen_ctl = readl(pp->gen_block + NV_ADMA_GEN_CTL);
@@ -1654,16 +1656,17 @@ static void nv_adma_error_handler(struct ata_port *ap)
1654 u8 cpb_count = readb(mmio + NV_ADMA_CPB_COUNT); 1656 u8 cpb_count = readb(mmio + NV_ADMA_CPB_COUNT);
1655 u8 next_cpb_idx = readb(mmio + NV_ADMA_NEXT_CPB_IDX); 1657 u8 next_cpb_idx = readb(mmio + NV_ADMA_NEXT_CPB_IDX);
1656 1658
1657 ata_port_printk(ap, KERN_ERR, "EH in ADMA mode, notifier 0x%X " 1659 ata_port_printk(ap, KERN_ERR,
1660 "EH in ADMA mode, notifier 0x%X "
1658 "notifier_error 0x%X gen_ctl 0x%X status 0x%X " 1661 "notifier_error 0x%X gen_ctl 0x%X status 0x%X "
1659 "next cpb count 0x%X next cpb idx 0x%x\n", 1662 "next cpb count 0x%X next cpb idx 0x%x\n",
1660 notifier, notifier_error, gen_ctl, status, 1663 notifier, notifier_error, gen_ctl, status,
1661 cpb_count, next_cpb_idx); 1664 cpb_count, next_cpb_idx);
1662 1665
1663 for( i=0;i<NV_ADMA_MAX_CPBS;i++) { 1666 for (i = 0; i < NV_ADMA_MAX_CPBS; i++) {
1664 struct nv_adma_cpb *cpb = &pp->cpb[i]; 1667 struct nv_adma_cpb *cpb = &pp->cpb[i];
1665 if( (ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) || 1668 if ((ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) ||
1666 ap->link.sactive & (1 << i) ) 1669 ap->link.sactive & (1 << i))
1667 ata_port_printk(ap, KERN_ERR, 1670 ata_port_printk(ap, KERN_ERR,
1668 "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n", 1671 "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n",
1669 i, cpb->ctl_flags, cpb->resp_flags); 1672 i, cpb->ctl_flags, cpb->resp_flags);
@@ -1673,8 +1676,9 @@ static void nv_adma_error_handler(struct ata_port *ap)
1673 /* Push us back into port register mode for error handling. */ 1676 /* Push us back into port register mode for error handling. */
1674 nv_adma_register_mode(ap); 1677 nv_adma_register_mode(ap);
1675 1678
1676 /* Mark all of the CPBs as invalid to prevent them from being executed */ 1679 /* Mark all of the CPBs as invalid to prevent them from
1677 for( i=0;i<NV_ADMA_MAX_CPBS;i++) 1680 being executed */
1681 for (i = 0; i < NV_ADMA_MAX_CPBS; i++)
1678 pp->cpb[i].ctl_flags &= ~NV_CPB_CTL_CPB_VALID; 1682 pp->cpb[i].ctl_flags &= ~NV_CPB_CTL_CPB_VALID;
1679 1683
1680 /* clear CPB fetch count */ 1684 /* clear CPB fetch count */
@@ -1683,10 +1687,10 @@ static void nv_adma_error_handler(struct ata_port *ap)
1683 /* Reset channel */ 1687 /* Reset channel */
1684 tmp = readw(mmio + NV_ADMA_CTL); 1688 tmp = readw(mmio + NV_ADMA_CTL);
1685 writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); 1689 writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL);
1686 readw( mmio + NV_ADMA_CTL ); /* flush posted write */ 1690 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1687 udelay(1); 1691 udelay(1);
1688 writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); 1692 writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL);
1689 readw( mmio + NV_ADMA_CTL ); /* flush posted write */ 1693 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1690 } 1694 }
1691 1695
1692 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, 1696 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset,
@@ -2350,9 +2354,9 @@ static irqreturn_t nv_swncq_interrupt(int irq, void *dev_instance)
2350 return IRQ_RETVAL(handled); 2354 return IRQ_RETVAL(handled);
2351} 2355}
2352 2356
2353static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 2357static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2354{ 2358{
2355 static int printed_version = 0; 2359 static int printed_version;
2356 const struct ata_port_info *ppi[] = { NULL, NULL }; 2360 const struct ata_port_info *ppi[] = { NULL, NULL };
2357 struct ata_host *host; 2361 struct ata_host *host;
2358 struct nv_host_priv *hpriv; 2362 struct nv_host_priv *hpriv;
@@ -2364,7 +2368,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
2364 // Make sure this is a SATA controller by counting the number of bars 2368 // Make sure this is a SATA controller by counting the number of bars
2365 // (NVIDIA SATA controllers will always have six bars). Otherwise, 2369 // (NVIDIA SATA controllers will always have six bars). Otherwise,
2366 // it's an IDE controller and we ignore it. 2370 // it's an IDE controller and we ignore it.
2367 for (bar=0; bar<6; bar++) 2371 for (bar = 0; bar < 6; bar++)
2368 if (pci_resource_start(pdev, bar) == 0) 2372 if (pci_resource_start(pdev, bar) == 0)
2369 return -ENODEV; 2373 return -ENODEV;
2370 2374
@@ -2381,6 +2385,14 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
2381 type = ADMA; 2385 type = ADMA;
2382 } 2386 }
2383 2387
2388 if (type == SWNCQ) {
2389 if (swncq_enabled)
2390 dev_printk(KERN_NOTICE, &pdev->dev,
2391 "Using SWNCQ mode\n");
2392 else
2393 type = GENERIC;
2394 }
2395
2384 ppi[0] = &nv_port_info[type]; 2396 ppi[0] = &nv_port_info[type];
2385 rc = ata_pci_prepare_sff_host(pdev, ppi, &host); 2397 rc = ata_pci_prepare_sff_host(pdev, ppi, &host);
2386 if (rc) 2398 if (rc)
@@ -2422,10 +2434,8 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
2422 rc = nv_adma_host_init(host); 2434 rc = nv_adma_host_init(host);
2423 if (rc) 2435 if (rc)
2424 return rc; 2436 return rc;
2425 } else if (type == SWNCQ && swncq_enabled) { 2437 } else if (type == SWNCQ)
2426 dev_printk(KERN_NOTICE, &pdev->dev, "Using SWNCQ mode\n");
2427 nv_swncq_host_init(host); 2438 nv_swncq_host_init(host);
2428 }
2429 2439
2430 pci_set_master(pdev); 2440 pci_set_master(pdev);
2431 return ata_host_activate(host, pdev->irq, ppi[0]->irq_handler, 2441 return ata_host_activate(host, pdev->irq, ppi[0]->irq_handler,
@@ -2440,37 +2450,37 @@ static int nv_pci_device_resume(struct pci_dev *pdev)
2440 int rc; 2450 int rc;
2441 2451
2442 rc = ata_pci_device_do_resume(pdev); 2452 rc = ata_pci_device_do_resume(pdev);
2443 if(rc) 2453 if (rc)
2444 return rc; 2454 return rc;
2445 2455
2446 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { 2456 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
2447 if(hpriv->type >= CK804) { 2457 if (hpriv->type >= CK804) {
2448 u8 regval; 2458 u8 regval;
2449 2459
2450 pci_read_config_byte(pdev, NV_MCP_SATA_CFG_20, &regval); 2460 pci_read_config_byte(pdev, NV_MCP_SATA_CFG_20, &regval);
2451 regval |= NV_MCP_SATA_CFG_20_SATA_SPACE_EN; 2461 regval |= NV_MCP_SATA_CFG_20_SATA_SPACE_EN;
2452 pci_write_config_byte(pdev, NV_MCP_SATA_CFG_20, regval); 2462 pci_write_config_byte(pdev, NV_MCP_SATA_CFG_20, regval);
2453 } 2463 }
2454 if(hpriv->type == ADMA) { 2464 if (hpriv->type == ADMA) {
2455 u32 tmp32; 2465 u32 tmp32;
2456 struct nv_adma_port_priv *pp; 2466 struct nv_adma_port_priv *pp;
2457 /* enable/disable ADMA on the ports appropriately */ 2467 /* enable/disable ADMA on the ports appropriately */
2458 pci_read_config_dword(pdev, NV_MCP_SATA_CFG_20, &tmp32); 2468 pci_read_config_dword(pdev, NV_MCP_SATA_CFG_20, &tmp32);
2459 2469
2460 pp = host->ports[0]->private_data; 2470 pp = host->ports[0]->private_data;
2461 if(pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) 2471 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE)
2462 tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT0_EN | 2472 tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT0_EN |
2463 NV_MCP_SATA_CFG_20_PORT0_PWB_EN); 2473 NV_MCP_SATA_CFG_20_PORT0_PWB_EN);
2464 else 2474 else
2465 tmp32 |= (NV_MCP_SATA_CFG_20_PORT0_EN | 2475 tmp32 |= (NV_MCP_SATA_CFG_20_PORT0_EN |
2466 NV_MCP_SATA_CFG_20_PORT0_PWB_EN); 2476 NV_MCP_SATA_CFG_20_PORT0_PWB_EN);
2467 pp = host->ports[1]->private_data; 2477 pp = host->ports[1]->private_data;
2468 if(pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) 2478 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE)
2469 tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT1_EN | 2479 tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT1_EN |
2470 NV_MCP_SATA_CFG_20_PORT1_PWB_EN); 2480 NV_MCP_SATA_CFG_20_PORT1_PWB_EN);
2471 else 2481 else
2472 tmp32 |= (NV_MCP_SATA_CFG_20_PORT1_EN | 2482 tmp32 |= (NV_MCP_SATA_CFG_20_PORT1_EN |
2473 NV_MCP_SATA_CFG_20_PORT1_PWB_EN); 2483 NV_MCP_SATA_CFG_20_PORT1_PWB_EN);
2474 2484
2475 pci_write_config_dword(pdev, NV_MCP_SATA_CFG_20, tmp32); 2485 pci_write_config_dword(pdev, NV_MCP_SATA_CFG_20, tmp32);
2476 } 2486 }
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 903213153b5d..7914def54fa3 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -2,6 +2,7 @@
2 * sata_promise.c - Promise SATA 2 * sata_promise.c - Promise SATA
3 * 3 *
4 * Maintained by: Jeff Garzik <jgarzik@pobox.com> 4 * Maintained by: Jeff Garzik <jgarzik@pobox.com>
5 * Mikael Pettersson <mikpe@it.uu.se>
5 * Please ALWAYS copy linux-ide@vger.kernel.org 6 * Please ALWAYS copy linux-ide@vger.kernel.org
6 * on emails. 7 * on emails.
7 * 8 *
@@ -45,11 +46,12 @@
45#include "sata_promise.h" 46#include "sata_promise.h"
46 47
47#define DRV_NAME "sata_promise" 48#define DRV_NAME "sata_promise"
48#define DRV_VERSION "2.10" 49#define DRV_VERSION "2.11"
49 50
50enum { 51enum {
51 PDC_MAX_PORTS = 4, 52 PDC_MAX_PORTS = 4,
52 PDC_MMIO_BAR = 3, 53 PDC_MMIO_BAR = 3,
54 PDC_MAX_PRD = LIBATA_MAX_PRD - 1, /* -1 for ASIC PRD bug workaround */
53 55
54 /* register offsets */ 56 /* register offsets */
55 PDC_FEATURE = 0x04, /* Feature/Error reg (per port) */ 57 PDC_FEATURE = 0x04, /* Feature/Error reg (per port) */
@@ -83,10 +85,12 @@ enum {
83 PDC_PCI_SYS_ERR = (1 << 22), /* PCI system error */ 85 PDC_PCI_SYS_ERR = (1 << 22), /* PCI system error */
84 PDC1_PCI_PARITY_ERR = (1 << 23), /* PCI parity error (from SATA150 driver) */ 86 PDC1_PCI_PARITY_ERR = (1 << 23), /* PCI parity error (from SATA150 driver) */
85 PDC1_ERR_MASK = PDC1_PCI_PARITY_ERR, 87 PDC1_ERR_MASK = PDC1_PCI_PARITY_ERR,
86 PDC2_ERR_MASK = PDC2_HTO_ERR | PDC2_ATA_HBA_ERR | PDC2_ATA_DMA_CNT_ERR, 88 PDC2_ERR_MASK = PDC2_HTO_ERR | PDC2_ATA_HBA_ERR |
87 PDC_ERR_MASK = (PDC_PH_ERR | PDC_SH_ERR | PDC_DH_ERR | PDC_OVERRUN_ERR 89 PDC2_ATA_DMA_CNT_ERR,
88 | PDC_UNDERRUN_ERR | PDC_DRIVE_ERR | PDC_PCI_SYS_ERR 90 PDC_ERR_MASK = PDC_PH_ERR | PDC_SH_ERR | PDC_DH_ERR |
89 | PDC1_ERR_MASK | PDC2_ERR_MASK), 91 PDC_OVERRUN_ERR | PDC_UNDERRUN_ERR |
92 PDC_DRIVE_ERR | PDC_PCI_SYS_ERR |
93 PDC1_ERR_MASK | PDC2_ERR_MASK,
90 94
91 board_2037x = 0, /* FastTrak S150 TX2plus */ 95 board_2037x = 0, /* FastTrak S150 TX2plus */
92 board_2037x_pata = 1, /* FastTrak S150 TX2plus PATA port */ 96 board_2037x_pata = 1, /* FastTrak S150 TX2plus PATA port */
@@ -155,7 +159,7 @@ static struct scsi_host_template pdc_ata_sht = {
155 .queuecommand = ata_scsi_queuecmd, 159 .queuecommand = ata_scsi_queuecmd,
156 .can_queue = ATA_DEF_QUEUE, 160 .can_queue = ATA_DEF_QUEUE,
157 .this_id = ATA_SHT_THIS_ID, 161 .this_id = ATA_SHT_THIS_ID,
158 .sg_tablesize = LIBATA_MAX_PRD, 162 .sg_tablesize = PDC_MAX_PRD,
159 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 163 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
160 .emulated = ATA_SHT_EMULATED, 164 .emulated = ATA_SHT_EMULATED,
161 .use_clustering = ATA_SHT_USE_CLUSTERING, 165 .use_clustering = ATA_SHT_USE_CLUSTERING,
@@ -238,7 +242,7 @@ static const struct ata_port_operations pdc_pata_ops = {
238}; 242};
239 243
240static const struct ata_port_info pdc_port_info[] = { 244static const struct ata_port_info pdc_port_info[] = {
241 /* board_2037x */ 245 [board_2037x] =
242 { 246 {
243 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | 247 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA |
244 PDC_FLAG_SATA_PATA, 248 PDC_FLAG_SATA_PATA,
@@ -248,7 +252,7 @@ static const struct ata_port_info pdc_port_info[] = {
248 .port_ops = &pdc_old_sata_ops, 252 .port_ops = &pdc_old_sata_ops,
249 }, 253 },
250 254
251 /* board_2037x_pata */ 255 [board_2037x_pata] =
252 { 256 {
253 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS, 257 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS,
254 .pio_mask = 0x1f, /* pio0-4 */ 258 .pio_mask = 0x1f, /* pio0-4 */
@@ -257,7 +261,7 @@ static const struct ata_port_info pdc_port_info[] = {
257 .port_ops = &pdc_pata_ops, 261 .port_ops = &pdc_pata_ops,
258 }, 262 },
259 263
260 /* board_20319 */ 264 [board_20319] =
261 { 265 {
262 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | 266 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA |
263 PDC_FLAG_4_PORTS, 267 PDC_FLAG_4_PORTS,
@@ -267,7 +271,7 @@ static const struct ata_port_info pdc_port_info[] = {
267 .port_ops = &pdc_old_sata_ops, 271 .port_ops = &pdc_old_sata_ops,
268 }, 272 },
269 273
270 /* board_20619 */ 274 [board_20619] =
271 { 275 {
272 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS | 276 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS |
273 PDC_FLAG_4_PORTS, 277 PDC_FLAG_4_PORTS,
@@ -277,7 +281,7 @@ static const struct ata_port_info pdc_port_info[] = {
277 .port_ops = &pdc_pata_ops, 281 .port_ops = &pdc_pata_ops,
278 }, 282 },
279 283
280 /* board_2057x */ 284 [board_2057x] =
281 { 285 {
282 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | 286 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA |
283 PDC_FLAG_GEN_II | PDC_FLAG_SATA_PATA, 287 PDC_FLAG_GEN_II | PDC_FLAG_SATA_PATA,
@@ -287,7 +291,7 @@ static const struct ata_port_info pdc_port_info[] = {
287 .port_ops = &pdc_sata_ops, 291 .port_ops = &pdc_sata_ops,
288 }, 292 },
289 293
290 /* board_2057x_pata */ 294 [board_2057x_pata] =
291 { 295 {
292 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS | 296 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS |
293 PDC_FLAG_GEN_II, 297 PDC_FLAG_GEN_II,
@@ -297,7 +301,7 @@ static const struct ata_port_info pdc_port_info[] = {
297 .port_ops = &pdc_pata_ops, 301 .port_ops = &pdc_pata_ops,
298 }, 302 },
299 303
300 /* board_40518 */ 304 [board_40518] =
301 { 305 {
302 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | 306 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA |
303 PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS, 307 PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS,
@@ -521,6 +525,84 @@ static void pdc_atapi_pkt(struct ata_queued_cmd *qc)
521 memcpy(buf+31, cdb, cdb_len); 525 memcpy(buf+31, cdb, cdb_len);
522} 526}
523 527
528/**
529 * pdc_fill_sg - Fill PCI IDE PRD table
530 * @qc: Metadata associated with taskfile to be transferred
531 *
532 * Fill PCI IDE PRD (scatter-gather) table with segments
533 * associated with the current disk command.
534 * Make sure hardware does not choke on it.
535 *
536 * LOCKING:
537 * spin_lock_irqsave(host lock)
538 *
539 */
540static void pdc_fill_sg(struct ata_queued_cmd *qc)
541{
542 struct ata_port *ap = qc->ap;
543 struct scatterlist *sg;
544 unsigned int idx;
545 const u32 SG_COUNT_ASIC_BUG = 41*4;
546
547 if (!(qc->flags & ATA_QCFLAG_DMAMAP))
548 return;
549
550 WARN_ON(qc->__sg == NULL);
551 WARN_ON(qc->n_elem == 0 && qc->pad_len == 0);
552
553 idx = 0;
554 ata_for_each_sg(sg, qc) {
555 u32 addr, offset;
556 u32 sg_len, len;
557
558 /* determine if physical DMA addr spans 64K boundary.
559 * Note h/w doesn't support 64-bit, so we unconditionally
560 * truncate dma_addr_t to u32.
561 */
562 addr = (u32) sg_dma_address(sg);
563 sg_len = sg_dma_len(sg);
564
565 while (sg_len) {
566 offset = addr & 0xffff;
567 len = sg_len;
568 if ((offset + sg_len) > 0x10000)
569 len = 0x10000 - offset;
570
571 ap->prd[idx].addr = cpu_to_le32(addr);
572 ap->prd[idx].flags_len = cpu_to_le32(len & 0xffff);
573 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
574
575 idx++;
576 sg_len -= len;
577 addr += len;
578 }
579 }
580
581 if (idx) {
582 u32 len = le32_to_cpu(ap->prd[idx - 1].flags_len);
583
584 if (len > SG_COUNT_ASIC_BUG) {
585 u32 addr;
586
587 VPRINTK("Splitting last PRD.\n");
588
589 addr = le32_to_cpu(ap->prd[idx - 1].addr);
590 ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
591 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG);
592
593 addr = addr + len - SG_COUNT_ASIC_BUG;
594 len = SG_COUNT_ASIC_BUG;
595 ap->prd[idx].addr = cpu_to_le32(addr);
596 ap->prd[idx].flags_len = cpu_to_le32(len);
597 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
598
599 idx++;
600 }
601
602 ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
603 }
604}
605
524static void pdc_qc_prep(struct ata_queued_cmd *qc) 606static void pdc_qc_prep(struct ata_queued_cmd *qc)
525{ 607{
526 struct pdc_port_priv *pp = qc->ap->private_data; 608 struct pdc_port_priv *pp = qc->ap->private_data;
@@ -530,7 +612,7 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc)
530 612
531 switch (qc->tf.protocol) { 613 switch (qc->tf.protocol) {
532 case ATA_PROT_DMA: 614 case ATA_PROT_DMA:
533 ata_qc_prep(qc); 615 pdc_fill_sg(qc);
534 /* fall through */ 616 /* fall through */
535 617
536 case ATA_PROT_NODATA: 618 case ATA_PROT_NODATA:
@@ -546,11 +628,11 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc)
546 break; 628 break;
547 629
548 case ATA_PROT_ATAPI: 630 case ATA_PROT_ATAPI:
549 ata_qc_prep(qc); 631 pdc_fill_sg(qc);
550 break; 632 break;
551 633
552 case ATA_PROT_ATAPI_DMA: 634 case ATA_PROT_ATAPI_DMA:
553 ata_qc_prep(qc); 635 pdc_fill_sg(qc);
554 /*FALLTHROUGH*/ 636 /*FALLTHROUGH*/
555 case ATA_PROT_ATAPI_NODATA: 637 case ATA_PROT_ATAPI_NODATA:
556 pdc_atapi_pkt(qc); 638 pdc_atapi_pkt(qc);
@@ -695,19 +777,20 @@ static void pdc_irq_clear(struct ata_port *ap)
695 readl(mmio + PDC_INT_SEQMASK); 777 readl(mmio + PDC_INT_SEQMASK);
696} 778}
697 779
698static inline int pdc_is_sataii_tx4(unsigned long flags) 780static int pdc_is_sataii_tx4(unsigned long flags)
699{ 781{
700 const unsigned long mask = PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS; 782 const unsigned long mask = PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS;
701 return (flags & mask) == mask; 783 return (flags & mask) == mask;
702} 784}
703 785
704static inline unsigned int pdc_port_no_to_ata_no(unsigned int port_no, int is_sataii_tx4) 786static unsigned int pdc_port_no_to_ata_no(unsigned int port_no,
787 int is_sataii_tx4)
705{ 788{
706 static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2}; 789 static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2};
707 return is_sataii_tx4 ? sataii_tx4_port_remap[port_no] : port_no; 790 return is_sataii_tx4 ? sataii_tx4_port_remap[port_no] : port_no;
708} 791}
709 792
710static irqreturn_t pdc_interrupt (int irq, void *dev_instance) 793static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
711{ 794{
712 struct ata_host *host = dev_instance; 795 struct ata_host *host = dev_instance;
713 struct ata_port *ap; 796 struct ata_port *ap;
@@ -839,15 +922,16 @@ static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
839 922
840static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) 923static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
841{ 924{
842 WARN_ON (tf->protocol == ATA_PROT_DMA || 925 WARN_ON(tf->protocol == ATA_PROT_DMA ||
843 tf->protocol == ATA_PROT_ATAPI_DMA); 926 tf->protocol == ATA_PROT_ATAPI_DMA);
844 ata_tf_load(ap, tf); 927 ata_tf_load(ap, tf);
845} 928}
846 929
847static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) 930static void pdc_exec_command_mmio(struct ata_port *ap,
931 const struct ata_taskfile *tf)
848{ 932{
849 WARN_ON (tf->protocol == ATA_PROT_DMA || 933 WARN_ON(tf->protocol == ATA_PROT_DMA ||
850 tf->protocol == ATA_PROT_ATAPI_DMA); 934 tf->protocol == ATA_PROT_ATAPI_DMA);
851 ata_exec_command(ap, tf); 935 ata_exec_command(ap, tf);
852} 936}
853 937
@@ -870,8 +954,11 @@ static int pdc_check_atapi_dma(struct ata_queued_cmd *qc)
870 } 954 }
871 /* -45150 (FFFF4FA2) to -1 (FFFFFFFF) shall use PIO mode */ 955 /* -45150 (FFFF4FA2) to -1 (FFFFFFFF) shall use PIO mode */
872 if (scsicmd[0] == WRITE_10) { 956 if (scsicmd[0] == WRITE_10) {
873 unsigned int lba; 957 unsigned int lba =
874 lba = (scsicmd[2] << 24) | (scsicmd[3] << 16) | (scsicmd[4] << 8) | scsicmd[5]; 958 (scsicmd[2] << 24) |
959 (scsicmd[3] << 16) |
960 (scsicmd[4] << 8) |
961 scsicmd[5];
875 if (lba >= 0xFFFF4FA2) 962 if (lba >= 0xFFFF4FA2)
876 pio = 1; 963 pio = 1;
877 } 964 }
@@ -956,7 +1043,8 @@ static void pdc_host_init(struct ata_host *host)
956 writel(tmp, mmio + PDC_SLEW_CTL); 1043 writel(tmp, mmio + PDC_SLEW_CTL);
957} 1044}
958 1045
959static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 1046static int pdc_ata_init_one(struct pci_dev *pdev,
1047 const struct pci_device_id *ent)
960{ 1048{
961 static int printed_version; 1049 static int printed_version;
962 const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; 1050 const struct ata_port_info *pi = &pdc_port_info[ent->driver_data];
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index c4c4cd29eebb..6d43ba79e154 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -113,7 +113,7 @@ struct qs_port_priv {
113 113
114static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 114static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
115static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 115static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
116static int qs_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 116static int qs_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
117static int qs_port_start(struct ata_port *ap); 117static int qs_port_start(struct ata_port *ap);
118static void qs_host_stop(struct ata_host *host); 118static void qs_host_stop(struct ata_host *host);
119static void qs_phy_reset(struct ata_port *ap); 119static void qs_phy_reset(struct ata_port *ap);
@@ -135,7 +135,6 @@ static struct scsi_host_template qs_ata_sht = {
135 .sg_tablesize = QS_MAX_PRD, 135 .sg_tablesize = QS_MAX_PRD,
136 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 136 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
137 .emulated = ATA_SHT_EMULATED, 137 .emulated = ATA_SHT_EMULATED,
138 //FIXME .use_clustering = ATA_SHT_USE_CLUSTERING,
139 .use_clustering = ENABLE_CLUSTERING, 138 .use_clustering = ENABLE_CLUSTERING,
140 .proc_name = DRV_NAME, 139 .proc_name = DRV_NAME,
141 .dma_boundary = QS_DMA_BOUNDARY, 140 .dma_boundary = QS_DMA_BOUNDARY,
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index ea3a0ab7e027..4e6e381279cc 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -111,7 +111,7 @@ enum {
111 SIL_QUIRK_UDMA5MAX = (1 << 1), 111 SIL_QUIRK_UDMA5MAX = (1 << 1),
112}; 112};
113 113
114static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 114static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
115#ifdef CONFIG_PM 115#ifdef CONFIG_PM
116static int sil_pci_device_resume(struct pci_dev *pdev); 116static int sil_pci_device_resume(struct pci_dev *pdev);
117#endif 117#endif
@@ -138,7 +138,7 @@ static const struct pci_device_id sil_pci_tbl[] = {
138 138
139/* TODO firmware versions should be added - eric */ 139/* TODO firmware versions should be added - eric */
140static const struct sil_drivelist { 140static const struct sil_drivelist {
141 const char * product; 141 const char *product;
142 unsigned int quirk; 142 unsigned int quirk;
143} sil_blacklist [] = { 143} sil_blacklist [] = {
144 { "ST320012AS", SIL_QUIRK_MOD15WRITE }, 144 { "ST320012AS", SIL_QUIRK_MOD15WRITE },
@@ -279,7 +279,7 @@ MODULE_LICENSE("GPL");
279MODULE_DEVICE_TABLE(pci, sil_pci_tbl); 279MODULE_DEVICE_TABLE(pci, sil_pci_tbl);
280MODULE_VERSION(DRV_VERSION); 280MODULE_VERSION(DRV_VERSION);
281 281
282static int slow_down = 0; 282static int slow_down;
283module_param(slow_down, int, 0444); 283module_param(slow_down, int, 0444);
284MODULE_PARM_DESC(slow_down, "Sledgehammer used to work around random problems, by limiting commands to 15 sectors (0=off, 1=on)"); 284MODULE_PARM_DESC(slow_down, "Sledgehammer used to work around random problems, by limiting commands to 15 sectors (0=off, 1=on)");
285 285
@@ -332,7 +332,8 @@ static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed)
332 return 0; 332 return 0;
333} 333}
334 334
335static inline void __iomem *sil_scr_addr(struct ata_port *ap, unsigned int sc_reg) 335static inline void __iomem *sil_scr_addr(struct ata_port *ap,
336 unsigned int sc_reg)
336{ 337{
337 void __iomem *offset = ap->ioaddr.scr_addr; 338 void __iomem *offset = ap->ioaddr.scr_addr;
338 339
@@ -643,7 +644,7 @@ static void sil_init_controller(struct ata_host *host)
643 } 644 }
644} 645}
645 646
646static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 647static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
647{ 648{
648 static int printed_version; 649 static int printed_version;
649 int board_id = ent->driver_data; 650 int board_id = ent->driver_data;
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 26ebffc10f3e..187dcb02c681 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -265,11 +265,11 @@ static struct sil24_cerr_info {
265 unsigned int err_mask, action; 265 unsigned int err_mask, action;
266 const char *desc; 266 const char *desc;
267} sil24_cerr_db[] = { 267} sil24_cerr_db[] = {
268 [0] = { AC_ERR_DEV, ATA_EH_REVALIDATE, 268 [0] = { AC_ERR_DEV, 0,
269 "device error" }, 269 "device error" },
270 [PORT_CERR_DEV] = { AC_ERR_DEV, ATA_EH_REVALIDATE, 270 [PORT_CERR_DEV] = { AC_ERR_DEV, 0,
271 "device error via D2H FIS" }, 271 "device error via D2H FIS" },
272 [PORT_CERR_SDB] = { AC_ERR_DEV, ATA_EH_REVALIDATE, 272 [PORT_CERR_SDB] = { AC_ERR_DEV, 0,
273 "device error via SDB FIS" }, 273 "device error via SDB FIS" },
274 [PORT_CERR_DATA] = { AC_ERR_ATA_BUS, ATA_EH_SOFTRESET, 274 [PORT_CERR_DATA] = { AC_ERR_ATA_BUS, ATA_EH_SOFTRESET,
275 "error in data FIS" }, 275 "error in data FIS" },
@@ -674,7 +674,7 @@ static int sil24_do_softreset(struct ata_link *link, unsigned int *class,
674 674
675 /* put the port into known state */ 675 /* put the port into known state */
676 if (sil24_init_port(ap)) { 676 if (sil24_init_port(ap)) {
677 reason ="port not ready"; 677 reason = "port not ready";
678 goto err; 678 goto err;
679 } 679 }
680 680
@@ -756,7 +756,8 @@ static int sil24_hardreset(struct ata_link *link, unsigned int *class,
756 756
757 writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT); 757 writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT);
758 tmp = ata_wait_register(port + PORT_CTRL_STAT, 758 tmp = ata_wait_register(port + PORT_CTRL_STAT,
759 PORT_CS_DEV_RST, PORT_CS_DEV_RST, 10, tout_msec); 759 PORT_CS_DEV_RST, PORT_CS_DEV_RST, 10,
760 tout_msec);
760 761
761 /* SStatus oscillates between zero and valid status after 762 /* SStatus oscillates between zero and valid status after
762 * DEV_RST, debounce it. 763 * DEV_RST, debounce it.
@@ -1270,7 +1271,7 @@ static void sil24_init_controller(struct ata_host *host)
1270 PORT_CS_PORT_RST, 10, 100); 1271 PORT_CS_PORT_RST, 10, 100);
1271 if (tmp & PORT_CS_PORT_RST) 1272 if (tmp & PORT_CS_PORT_RST)
1272 dev_printk(KERN_ERR, host->dev, 1273 dev_printk(KERN_ERR, host->dev,
1273 "failed to clear port RST\n"); 1274 "failed to clear port RST\n");
1274 } 1275 }
1275 1276
1276 /* configure port */ 1277 /* configure port */
@@ -1283,7 +1284,7 @@ static void sil24_init_controller(struct ata_host *host)
1283 1284
1284static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 1285static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1285{ 1286{
1286 static int printed_version = 0; 1287 static int printed_version;
1287 struct ata_port_info pi = sil24_port_info[ent->driver_data]; 1288 struct ata_port_info pi = sil24_port_info[ent->driver_data];
1288 const struct ata_port_info *ppi[] = { &pi, NULL }; 1289 const struct ata_port_info *ppi[] = { &pi, NULL };
1289 void __iomem * const *iomap; 1290 void __iomem * const *iomap;
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index f147dc7bf464..a01260a56432 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -63,17 +63,17 @@ enum {
63 GENCTL_IOMAPPED_SCR = (1 << 26), /* if set, SCRs are in IO space */ 63 GENCTL_IOMAPPED_SCR = (1 << 26), /* if set, SCRs are in IO space */
64}; 64};
65 65
66static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 66static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
67static int sis_scr_read (struct ata_port *ap, unsigned int sc_reg, u32 *val); 67static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
68static int sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 68static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
69 69
70static const struct pci_device_id sis_pci_tbl[] = { 70static const struct pci_device_id sis_pci_tbl[] = {
71 { PCI_VDEVICE(SI, 0x0180), sis_180 }, /* SiS 964/180 */ 71 { PCI_VDEVICE(SI, 0x0180), sis_180 }, /* SiS 964/180 */
72 { PCI_VDEVICE(SI, 0x0181), sis_180 }, /* SiS 964/180 */ 72 { PCI_VDEVICE(SI, 0x0181), sis_180 }, /* SiS 964/180 */
73 { PCI_VDEVICE(SI, 0x0182), sis_180 }, /* SiS 965/965L */ 73 { PCI_VDEVICE(SI, 0x0182), sis_180 }, /* SiS 965/965L */
74 { PCI_VDEVICE(SI, 0x0183), sis_180 }, /* SiS 965/965L */ 74 { PCI_VDEVICE(SI, 0x0183), sis_180 }, /* SiS 965/965L */
75 { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/680 */ 75 { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/680 */
76 { PCI_VDEVICE(SI, 0x1183), sis_180 }, /* SiS 966/966L/968/680 */ 76 { PCI_VDEVICE(SI, 0x1183), sis_180 }, /* SiS 966/966L/968/680 */
77 77
78 { } /* terminate list */ 78 { } /* terminate list */
79}; 79};
@@ -149,24 +149,24 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg)
149 149
150 if (ap->port_no) { 150 if (ap->port_no) {
151 switch (pdev->device) { 151 switch (pdev->device) {
152 case 0x0180: 152 case 0x0180:
153 case 0x0181: 153 case 0x0181:
154 pci_read_config_byte(pdev, SIS_PMR, &pmr); 154 pci_read_config_byte(pdev, SIS_PMR, &pmr);
155 if ((pmr & SIS_PMR_COMBINED) == 0) 155 if ((pmr & SIS_PMR_COMBINED) == 0)
156 addr += SIS180_SATA1_OFS; 156 addr += SIS180_SATA1_OFS;
157 break; 157 break;
158 158
159 case 0x0182: 159 case 0x0182:
160 case 0x0183: 160 case 0x0183:
161 case 0x1182: 161 case 0x1182:
162 addr += SIS182_SATA1_OFS; 162 addr += SIS182_SATA1_OFS;
163 break; 163 break;
164 } 164 }
165 } 165 }
166 return addr; 166 return addr;
167} 167}
168 168
169static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg, u32 *val) 169static u32 sis_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
170{ 170{
171 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 171 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
172 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); 172 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
@@ -190,7 +190,7 @@ static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg, u32 *val)
190 return 0; 190 return 0;
191} 191}
192 192
193static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val) 193static void sis_scr_cfg_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
194{ 194{
195 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 195 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
196 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); 196 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
@@ -253,7 +253,7 @@ static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
253 return 0; 253 return 0;
254} 254}
255 255
256static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 256static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
257{ 257{
258 static int printed_version; 258 static int printed_version;
259 struct ata_port_info pi = sis_port_info; 259 struct ata_port_info pi = sis_port_info;
@@ -309,29 +309,33 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
309 } else { 309 } else {
310 dev_printk(KERN_INFO, &pdev->dev, 310 dev_printk(KERN_INFO, &pdev->dev,
311 "Detected SiS 180/181 chipset in combined mode\n"); 311 "Detected SiS 180/181 chipset in combined mode\n");
312 port2_start=0; 312 port2_start = 0;
313 pi.flags |= ATA_FLAG_SLAVE_POSS; 313 pi.flags |= ATA_FLAG_SLAVE_POSS;
314 } 314 }
315 break; 315 break;
316 316
317 case 0x0182: 317 case 0x0182:
318 case 0x0183: 318 case 0x0183:
319 pci_read_config_dword ( pdev, 0x6C, &val); 319 pci_read_config_dword(pdev, 0x6C, &val);
320 if (val & (1L << 31)) { 320 if (val & (1L << 31)) {
321 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 182/965 chipset\n"); 321 dev_printk(KERN_INFO, &pdev->dev,
322 "Detected SiS 182/965 chipset\n");
322 pi.flags |= ATA_FLAG_SLAVE_POSS; 323 pi.flags |= ATA_FLAG_SLAVE_POSS;
323 } else { 324 } else {
324 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 182/965L chipset\n"); 325 dev_printk(KERN_INFO, &pdev->dev,
326 "Detected SiS 182/965L chipset\n");
325 } 327 }
326 break; 328 break;
327 329
328 case 0x1182: 330 case 0x1182:
329 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/966/680 SATA controller\n"); 331 dev_printk(KERN_INFO, &pdev->dev,
332 "Detected SiS 1182/966/680 SATA controller\n");
330 pi.flags |= ATA_FLAG_SLAVE_POSS; 333 pi.flags |= ATA_FLAG_SLAVE_POSS;
331 break; 334 break;
332 335
333 case 0x1183: 336 case 0x1183:
334 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1183/966/966L/968/680 controller in PATA mode\n"); 337 dev_printk(KERN_INFO, &pdev->dev,
338 "Detected SiS 1183/966/966L/968/680 controller in PATA mode\n");
335 ppi[0] = &sis_info133_for_sata; 339 ppi[0] = &sis_info133_for_sata;
336 ppi[1] = &sis_info133_for_sata; 340 ppi[1] = &sis_info133_for_sata;
337 break; 341 break;
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 12d613c48c19..69f651e0bc98 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -182,7 +182,7 @@ static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
182 tf->hob_lbal = lbal >> 8; 182 tf->hob_lbal = lbal >> 8;
183 tf->hob_lbam = lbam >> 8; 183 tf->hob_lbam = lbam >> 8;
184 tf->hob_lbah = lbah >> 8; 184 tf->hob_lbah = lbah >> 8;
185 } 185 }
186} 186}
187 187
188/** 188/**
@@ -193,7 +193,7 @@ static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
193 * spin_lock_irqsave(host lock) 193 * spin_lock_irqsave(host lock)
194 */ 194 */
195 195
196static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc) 196static void k2_bmdma_setup_mmio(struct ata_queued_cmd *qc)
197{ 197{
198 struct ata_port *ap = qc->ap; 198 struct ata_port *ap = qc->ap;
199 unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); 199 unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
@@ -224,7 +224,7 @@ static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc)
224 * spin_lock_irqsave(host lock) 224 * spin_lock_irqsave(host lock)
225 */ 225 */
226 226
227static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc) 227static void k2_bmdma_start_mmio(struct ata_queued_cmd *qc)
228{ 228{
229 struct ata_port *ap = qc->ap; 229 struct ata_port *ap = qc->ap;
230 void __iomem *mmio = ap->ioaddr.bmdma_addr; 230 void __iomem *mmio = ap->ioaddr.bmdma_addr;
@@ -255,7 +255,7 @@ static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc)
255 255
256static u8 k2_stat_check_status(struct ata_port *ap) 256static u8 k2_stat_check_status(struct ata_port *ap)
257{ 257{
258 return readl(ap->ioaddr.status_addr); 258 return readl(ap->ioaddr.status_addr);
259} 259}
260 260
261#ifdef CONFIG_PPC_OF 261#ifdef CONFIG_PPC_OF
@@ -395,7 +395,7 @@ static void k2_sata_setup_port(struct ata_ioports *port, void __iomem *base)
395} 395}
396 396
397 397
398static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 398static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
399{ 399{
400 static int printed_version; 400 static int printed_version;
401 const struct ata_port_info *ppi[] = 401 const struct ata_port_info *ppi[] =
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index b6026bceccd1..4d857185f33b 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -212,9 +212,9 @@ struct pdc_host_priv {
212}; 212};
213 213
214 214
215static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 215static int pdc_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
216static void pdc_eng_timeout(struct ata_port *ap); 216static void pdc_eng_timeout(struct ata_port *ap);
217static void pdc_20621_phy_reset (struct ata_port *ap); 217static void pdc_20621_phy_reset(struct ata_port *ap);
218static int pdc_port_start(struct ata_port *ap); 218static int pdc_port_start(struct ata_port *ap);
219static void pdc20621_qc_prep(struct ata_queued_cmd *qc); 219static void pdc20621_qc_prep(struct ata_queued_cmd *qc);
220static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 220static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
@@ -320,16 +320,16 @@ static int pdc_port_start(struct ata_port *ap)
320 return 0; 320 return 0;
321} 321}
322 322
323static void pdc_20621_phy_reset (struct ata_port *ap) 323static void pdc_20621_phy_reset(struct ata_port *ap)
324{ 324{
325 VPRINTK("ENTER\n"); 325 VPRINTK("ENTER\n");
326 ap->cbl = ATA_CBL_SATA; 326 ap->cbl = ATA_CBL_SATA;
327 ata_port_probe(ap); 327 ata_port_probe(ap);
328 ata_bus_reset(ap); 328 ata_bus_reset(ap);
329} 329}
330 330
331static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf, 331static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf,
332 unsigned int portno, 332 unsigned int portno,
333 unsigned int total_len) 333 unsigned int total_len)
334{ 334{
335 u32 addr; 335 u32 addr;
@@ -351,7 +351,7 @@ static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf,
351} 351}
352 352
353static inline void pdc20621_host_sg(struct ata_taskfile *tf, u8 *buf, 353static inline void pdc20621_host_sg(struct ata_taskfile *tf, u8 *buf,
354 unsigned int portno, 354 unsigned int portno,
355 unsigned int total_len) 355 unsigned int total_len)
356{ 356{
357 u32 addr; 357 u32 addr;
@@ -711,8 +711,8 @@ static unsigned int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc)
711 return ata_qc_issue_prot(qc); 711 return ata_qc_issue_prot(qc);
712} 712}
713 713
714static inline unsigned int pdc20621_host_intr( struct ata_port *ap, 714static inline unsigned int pdc20621_host_intr(struct ata_port *ap,
715 struct ata_queued_cmd *qc, 715 struct ata_queued_cmd *qc,
716 unsigned int doing_hdma, 716 unsigned int doing_hdma,
717 void __iomem *mmio) 717 void __iomem *mmio)
718{ 718{
@@ -803,7 +803,7 @@ static void pdc20621_irq_clear(struct ata_port *ap)
803 readl(mmio + PDC_20621_SEQMASK); 803 readl(mmio + PDC_20621_SEQMASK);
804} 804}
805 805
806static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance) 806static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance)
807{ 807{
808 struct ata_host *host = dev_instance; 808 struct ata_host *host = dev_instance;
809 struct ata_port *ap; 809 struct ata_port *ap;
@@ -836,9 +836,9 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance)
836 return IRQ_NONE; 836 return IRQ_NONE;
837 } 837 }
838 838
839 spin_lock(&host->lock); 839 spin_lock(&host->lock);
840 840
841 for (i = 1; i < 9; i++) { 841 for (i = 1; i < 9; i++) {
842 port_no = i - 1; 842 port_no = i - 1;
843 if (port_no > 3) 843 if (port_no > 3)
844 port_no -= 4; 844 port_no -= 4;
@@ -859,7 +859,7 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance)
859 } 859 }
860 } 860 }
861 861
862 spin_unlock(&host->lock); 862 spin_unlock(&host->lock);
863 863
864 VPRINTK("mask == 0x%x\n", mask); 864 VPRINTK("mask == 0x%x\n", mask);
865 865
@@ -906,16 +906,16 @@ static void pdc_eng_timeout(struct ata_port *ap)
906 906
907static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) 907static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
908{ 908{
909 WARN_ON (tf->protocol == ATA_PROT_DMA || 909 WARN_ON(tf->protocol == ATA_PROT_DMA ||
910 tf->protocol == ATA_PROT_NODATA); 910 tf->protocol == ATA_PROT_NODATA);
911 ata_tf_load(ap, tf); 911 ata_tf_load(ap, tf);
912} 912}
913 913
914 914
915static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) 915static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
916{ 916{
917 WARN_ON (tf->protocol == ATA_PROT_DMA || 917 WARN_ON(tf->protocol == ATA_PROT_DMA ||
918 tf->protocol == ATA_PROT_NODATA); 918 tf->protocol == ATA_PROT_NODATA);
919 ata_exec_command(ap, tf); 919 ata_exec_command(ap, tf);
920} 920}
921 921
@@ -953,7 +953,7 @@ static void pdc20621_get_from_dimm(struct ata_host *host, void *psource,
953 mmio += PDC_CHIP0_OFS; 953 mmio += PDC_CHIP0_OFS;
954 954
955 page_mask = 0x00; 955 page_mask = 0x00;
956 window_size = 0x2000 * 4; /* 32K byte uchar size */ 956 window_size = 0x2000 * 4; /* 32K byte uchar size */
957 idx = (u16) (offset / window_size); 957 idx = (u16) (offset / window_size);
958 958
959 writel(0x01, mmio + PDC_GENERAL_CTLR); 959 writel(0x01, mmio + PDC_GENERAL_CTLR);
@@ -979,7 +979,7 @@ static void pdc20621_get_from_dimm(struct ata_host *host, void *psource,
979 window_size / 4); 979 window_size / 4);
980 psource += window_size; 980 psource += window_size;
981 size -= window_size; 981 size -= window_size;
982 idx ++; 982 idx++;
983 } 983 }
984 984
985 if (size) { 985 if (size) {
@@ -1008,7 +1008,7 @@ static void pdc20621_put_to_dimm(struct ata_host *host, void *psource,
1008 mmio += PDC_CHIP0_OFS; 1008 mmio += PDC_CHIP0_OFS;
1009 1009
1010 page_mask = 0x00; 1010 page_mask = 0x00;
1011 window_size = 0x2000 * 4; /* 32K byte uchar size */ 1011 window_size = 0x2000 * 4; /* 32K byte uchar size */
1012 idx = (u16) (offset / window_size); 1012 idx = (u16) (offset / window_size);
1013 1013
1014 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); 1014 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
@@ -1031,7 +1031,7 @@ static void pdc20621_put_to_dimm(struct ata_host *host, void *psource,
1031 readl(mmio + PDC_GENERAL_CTLR); 1031 readl(mmio + PDC_GENERAL_CTLR);
1032 psource += window_size; 1032 psource += window_size;
1033 size -= window_size; 1033 size -= window_size;
1034 idx ++; 1034 idx++;
1035 } 1035 }
1036 1036
1037 if (size) { 1037 if (size) {
@@ -1050,7 +1050,7 @@ static unsigned int pdc20621_i2c_read(struct ata_host *host, u32 device,
1050 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; 1050 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
1051 u32 i2creg = 0; 1051 u32 i2creg = 0;
1052 u32 status; 1052 u32 status;
1053 u32 count =0; 1053 u32 count = 0;
1054 1054
1055 /* hard-code chip #0 */ 1055 /* hard-code chip #0 */
1056 mmio += PDC_CHIP0_OFS; 1056 mmio += PDC_CHIP0_OFS;
@@ -1082,21 +1082,21 @@ static unsigned int pdc20621_i2c_read(struct ata_host *host, u32 device,
1082 1082
1083static int pdc20621_detect_dimm(struct ata_host *host) 1083static int pdc20621_detect_dimm(struct ata_host *host)
1084{ 1084{
1085 u32 data=0 ; 1085 u32 data = 0;
1086 if (pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, 1086 if (pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
1087 PDC_DIMM_SPD_SYSTEM_FREQ, &data)) { 1087 PDC_DIMM_SPD_SYSTEM_FREQ, &data)) {
1088 if (data == 100) 1088 if (data == 100)
1089 return 100; 1089 return 100;
1090 } else 1090 } else
1091 return 0; 1091 return 0;
1092 1092
1093 if (pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, 9, &data)) { 1093 if (pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, 9, &data)) {
1094 if(data <= 0x75) 1094 if (data <= 0x75)
1095 return 133; 1095 return 133;
1096 } else 1096 } else
1097 return 0; 1097 return 0;
1098 1098
1099 return 0; 1099 return 0;
1100} 1100}
1101 1101
1102 1102
@@ -1104,8 +1104,8 @@ static int pdc20621_prog_dimm0(struct ata_host *host)
1104{ 1104{
1105 u32 spd0[50]; 1105 u32 spd0[50];
1106 u32 data = 0; 1106 u32 data = 0;
1107 int size, i; 1107 int size, i;
1108 u8 bdimmsize; 1108 u8 bdimmsize;
1109 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; 1109 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
1110 static const struct { 1110 static const struct {
1111 unsigned int reg; 1111 unsigned int reg;
@@ -1128,40 +1128,40 @@ static int pdc20621_prog_dimm0(struct ata_host *host)
1128 /* hard-code chip #0 */ 1128 /* hard-code chip #0 */
1129 mmio += PDC_CHIP0_OFS; 1129 mmio += PDC_CHIP0_OFS;
1130 1130
1131 for(i=0; i<ARRAY_SIZE(pdc_i2c_read_data); i++) 1131 for (i = 0; i < ARRAY_SIZE(pdc_i2c_read_data); i++)
1132 pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, 1132 pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
1133 pdc_i2c_read_data[i].reg, 1133 pdc_i2c_read_data[i].reg,
1134 &spd0[pdc_i2c_read_data[i].ofs]); 1134 &spd0[pdc_i2c_read_data[i].ofs]);
1135 1135
1136 data |= (spd0[4] - 8) | ((spd0[21] != 0) << 3) | ((spd0[3]-11) << 4); 1136 data |= (spd0[4] - 8) | ((spd0[21] != 0) << 3) | ((spd0[3]-11) << 4);
1137 data |= ((spd0[17] / 4) << 6) | ((spd0[5] / 2) << 7) | 1137 data |= ((spd0[17] / 4) << 6) | ((spd0[5] / 2) << 7) |
1138 ((((spd0[27] + 9) / 10) - 1) << 8) ; 1138 ((((spd0[27] + 9) / 10) - 1) << 8) ;
1139 data |= (((((spd0[29] > spd0[28]) 1139 data |= (((((spd0[29] > spd0[28])
1140 ? spd0[29] : spd0[28]) + 9) / 10) - 1) << 10; 1140 ? spd0[29] : spd0[28]) + 9) / 10) - 1) << 10;
1141 data |= ((spd0[30] - spd0[29] + 9) / 10 - 2) << 12; 1141 data |= ((spd0[30] - spd0[29] + 9) / 10 - 2) << 12;
1142 1142
1143 if (spd0[18] & 0x08) 1143 if (spd0[18] & 0x08)
1144 data |= ((0x03) << 14); 1144 data |= ((0x03) << 14);
1145 else if (spd0[18] & 0x04) 1145 else if (spd0[18] & 0x04)
1146 data |= ((0x02) << 14); 1146 data |= ((0x02) << 14);
1147 else if (spd0[18] & 0x01) 1147 else if (spd0[18] & 0x01)
1148 data |= ((0x01) << 14); 1148 data |= ((0x01) << 14);
1149 else 1149 else
1150 data |= (0 << 14); 1150 data |= (0 << 14);
1151 1151
1152 /* 1152 /*
1153 Calculate the size of bDIMMSize (power of 2) and 1153 Calculate the size of bDIMMSize (power of 2) and
1154 merge the DIMM size by program start/end address. 1154 merge the DIMM size by program start/end address.
1155 */ 1155 */
1156 1156
1157 bdimmsize = spd0[4] + (spd0[5] / 2) + spd0[3] + (spd0[17] / 2) + 3; 1157 bdimmsize = spd0[4] + (spd0[5] / 2) + spd0[3] + (spd0[17] / 2) + 3;
1158 size = (1 << bdimmsize) >> 20; /* size = xxx(MB) */ 1158 size = (1 << bdimmsize) >> 20; /* size = xxx(MB) */
1159 data |= (((size / 16) - 1) << 16); 1159 data |= (((size / 16) - 1) << 16);
1160 data |= (0 << 23); 1160 data |= (0 << 23);
1161 data |= 8; 1161 data |= 8;
1162 writel(data, mmio + PDC_DIMM0_CONTROL); 1162 writel(data, mmio + PDC_DIMM0_CONTROL);
1163 readl(mmio + PDC_DIMM0_CONTROL); 1163 readl(mmio + PDC_DIMM0_CONTROL);
1164 return size; 1164 return size;
1165} 1165}
1166 1166
1167 1167
@@ -1172,9 +1172,9 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_host *host)
1172 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; 1172 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
1173 1173
1174 /* hard-code chip #0 */ 1174 /* hard-code chip #0 */
1175 mmio += PDC_CHIP0_OFS; 1175 mmio += PDC_CHIP0_OFS;
1176 1176
1177 /* 1177 /*
1178 Set To Default : DIMM Module Global Control Register (0x022259F1) 1178 Set To Default : DIMM Module Global Control Register (0x022259F1)
1179 DIMM Arbitration Disable (bit 20) 1179 DIMM Arbitration Disable (bit 20)
1180 DIMM Data/Control Output Driving Selection (bit12 - bit15) 1180 DIMM Data/Control Output Driving Selection (bit12 - bit15)
@@ -1193,40 +1193,40 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_host *host)
1193 writel(data, mmio + PDC_SDRAM_CONTROL); 1193 writel(data, mmio + PDC_SDRAM_CONTROL);
1194 readl(mmio + PDC_SDRAM_CONTROL); 1194 readl(mmio + PDC_SDRAM_CONTROL);
1195 printk(KERN_ERR "Local DIMM ECC Enabled\n"); 1195 printk(KERN_ERR "Local DIMM ECC Enabled\n");
1196 } 1196 }
1197 1197
1198 /* DIMM Initialization Select/Enable (bit 18/19) */ 1198 /* DIMM Initialization Select/Enable (bit 18/19) */
1199 data &= (~(1<<18)); 1199 data &= (~(1<<18));
1200 data |= (1<<19); 1200 data |= (1<<19);
1201 writel(data, mmio + PDC_SDRAM_CONTROL); 1201 writel(data, mmio + PDC_SDRAM_CONTROL);
1202 1202
1203 error = 1; 1203 error = 1;
1204 for (i = 1; i <= 10; i++) { /* polling ~5 secs */ 1204 for (i = 1; i <= 10; i++) { /* polling ~5 secs */
1205 data = readl(mmio + PDC_SDRAM_CONTROL); 1205 data = readl(mmio + PDC_SDRAM_CONTROL);
1206 if (!(data & (1<<19))) { 1206 if (!(data & (1<<19))) {
1207 error = 0; 1207 error = 0;
1208 break; 1208 break;
1209 } 1209 }
1210 msleep(i*100); 1210 msleep(i*100);
1211 } 1211 }
1212 return error; 1212 return error;
1213} 1213}
1214 1214
1215 1215
1216static unsigned int pdc20621_dimm_init(struct ata_host *host) 1216static unsigned int pdc20621_dimm_init(struct ata_host *host)
1217{ 1217{
1218 int speed, size, length; 1218 int speed, size, length;
1219 u32 addr,spd0,pci_status; 1219 u32 addr, spd0, pci_status;
1220 u32 tmp=0; 1220 u32 tmp = 0;
1221 u32 time_period=0; 1221 u32 time_period = 0;
1222 u32 tcount=0; 1222 u32 tcount = 0;
1223 u32 ticks=0; 1223 u32 ticks = 0;
1224 u32 clock=0; 1224 u32 clock = 0;
1225 u32 fparam=0; 1225 u32 fparam = 0;
1226 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; 1226 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
1227 1227
1228 /* hard-code chip #0 */ 1228 /* hard-code chip #0 */
1229 mmio += PDC_CHIP0_OFS; 1229 mmio += PDC_CHIP0_OFS;
1230 1230
1231 /* Initialize PLL based upon PCI Bus Frequency */ 1231 /* Initialize PLL based upon PCI Bus Frequency */
1232 1232
@@ -1254,7 +1254,7 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
1254 If SX4 is on PCI-X bus, after 3 seconds, the timer counter 1254 If SX4 is on PCI-X bus, after 3 seconds, the timer counter
1255 register should be >= (0xffffffff - 3x10^8). 1255 register should be >= (0xffffffff - 3x10^8).
1256 */ 1256 */
1257 if(tcount >= PCI_X_TCOUNT) { 1257 if (tcount >= PCI_X_TCOUNT) {
1258 ticks = (time_period - tcount); 1258 ticks = (time_period - tcount);
1259 VPRINTK("Num counters 0x%x (%d)\n", ticks, ticks); 1259 VPRINTK("Num counters 0x%x (%d)\n", ticks, ticks);
1260 1260
@@ -1285,41 +1285,43 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
1285 if (!(speed = pdc20621_detect_dimm(host))) { 1285 if (!(speed = pdc20621_detect_dimm(host))) {
1286 printk(KERN_ERR "Detect Local DIMM Fail\n"); 1286 printk(KERN_ERR "Detect Local DIMM Fail\n");
1287 return 1; /* DIMM error */ 1287 return 1; /* DIMM error */
1288 } 1288 }
1289 VPRINTK("Local DIMM Speed = %d\n", speed); 1289 VPRINTK("Local DIMM Speed = %d\n", speed);
1290 1290
1291 /* Programming DIMM0 Module Control Register (index_CID0:80h) */ 1291 /* Programming DIMM0 Module Control Register (index_CID0:80h) */
1292 size = pdc20621_prog_dimm0(host); 1292 size = pdc20621_prog_dimm0(host);
1293 VPRINTK("Local DIMM Size = %dMB\n",size); 1293 VPRINTK("Local DIMM Size = %dMB\n", size);
1294 1294
1295 /* Programming DIMM Module Global Control Register (index_CID0:88h) */ 1295 /* Programming DIMM Module Global Control Register (index_CID0:88h) */
1296 if (pdc20621_prog_dimm_global(host)) { 1296 if (pdc20621_prog_dimm_global(host)) {
1297 printk(KERN_ERR "Programming DIMM Module Global Control Register Fail\n"); 1297 printk(KERN_ERR "Programming DIMM Module Global Control Register Fail\n");
1298 return 1; 1298 return 1;
1299 } 1299 }
1300 1300
1301#ifdef ATA_VERBOSE_DEBUG 1301#ifdef ATA_VERBOSE_DEBUG
1302 { 1302 {
1303 u8 test_parttern1[40] = {0x55,0xAA,'P','r','o','m','i','s','e',' ', 1303 u8 test_parttern1[40] =
1304 'N','o','t',' ','Y','e','t',' ','D','e','f','i','n','e','d',' ', 1304 {0x55,0xAA,'P','r','o','m','i','s','e',' ',
1305 '1','.','1','0', 1305 'N','o','t',' ','Y','e','t',' ',
1306 '9','8','0','3','1','6','1','2',0,0}; 1306 'D','e','f','i','n','e','d',' ',
1307 '1','.','1','0',
1308 '9','8','0','3','1','6','1','2',0,0};
1307 u8 test_parttern2[40] = {0}; 1309 u8 test_parttern2[40] = {0};
1308 1310
1309 pdc20621_put_to_dimm(host, (void *) test_parttern2, 0x10040, 40); 1311 pdc20621_put_to_dimm(host, test_parttern2, 0x10040, 40);
1310 pdc20621_put_to_dimm(host, (void *) test_parttern2, 0x40, 40); 1312 pdc20621_put_to_dimm(host, test_parttern2, 0x40, 40);
1311 1313
1312 pdc20621_put_to_dimm(host, (void *) test_parttern1, 0x10040, 40); 1314 pdc20621_put_to_dimm(host, test_parttern1, 0x10040, 40);
1313 pdc20621_get_from_dimm(host, (void *) test_parttern2, 0x40, 40); 1315 pdc20621_get_from_dimm(host, test_parttern2, 0x40, 40);
1314 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 1316 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
1315 test_parttern2[1], &(test_parttern2[2])); 1317 test_parttern2[1], &(test_parttern2[2]));
1316 pdc20621_get_from_dimm(host, (void *) test_parttern2, 0x10040, 1318 pdc20621_get_from_dimm(host, test_parttern2, 0x10040,
1317 40); 1319 40);
1318 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 1320 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
1319 test_parttern2[1], &(test_parttern2[2])); 1321 test_parttern2[1], &(test_parttern2[2]));
1320 1322
1321 pdc20621_put_to_dimm(host, (void *) test_parttern1, 0x40, 40); 1323 pdc20621_put_to_dimm(host, test_parttern1, 0x40, 40);
1322 pdc20621_get_from_dimm(host, (void *) test_parttern2, 0x40, 40); 1324 pdc20621_get_from_dimm(host, test_parttern2, 0x40, 40);
1323 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 1325 printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
1324 test_parttern2[1], &(test_parttern2[2])); 1326 test_parttern2[1], &(test_parttern2[2]));
1325 } 1327 }
@@ -1375,7 +1377,8 @@ static void pdc_20621_init(struct ata_host *host)
1375 readl(mmio + PDC_HDMA_CTLSTAT); /* flush */ 1377 readl(mmio + PDC_HDMA_CTLSTAT); /* flush */
1376} 1378}
1377 1379
1378static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 1380static int pdc_sata_init_one(struct pci_dev *pdev,
1381 const struct pci_device_id *ent)
1379{ 1382{
1380 static int printed_version; 1383 static int printed_version;
1381 const struct ata_port_info *ppi[] = 1384 const struct ata_port_info *ppi[] =
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index d394da085ae4..e710e71b7b92 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -56,9 +56,9 @@ struct uli_priv {
56 unsigned int scr_cfg_addr[uli_max_ports]; 56 unsigned int scr_cfg_addr[uli_max_ports];
57}; 57};
58 58
59static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 59static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
60static int uli_scr_read (struct ata_port *ap, unsigned int sc_reg, u32 *val); 60static int uli_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
61static int uli_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 61static int uli_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
62 62
63static const struct pci_device_id uli_pci_tbl[] = { 63static const struct pci_device_id uli_pci_tbl[] = {
64 { PCI_VDEVICE(AL, 0x5289), uli_5289 }, 64 { PCI_VDEVICE(AL, 0x5289), uli_5289 },
@@ -143,7 +143,7 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg)
143 return hpriv->scr_cfg_addr[ap->port_no] + (4 * sc_reg); 143 return hpriv->scr_cfg_addr[ap->port_no] + (4 * sc_reg);
144} 144}
145 145
146static u32 uli_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) 146static u32 uli_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg)
147{ 147{
148 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 148 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
149 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); 149 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
@@ -153,7 +153,7 @@ static u32 uli_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
153 return val; 153 return val;
154} 154}
155 155
156static void uli_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val) 156static void uli_scr_cfg_write(struct ata_port *ap, unsigned int scr, u32 val)
157{ 157{
158 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 158 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
159 unsigned int cfg_addr = get_scr_cfg_addr(ap, scr); 159 unsigned int cfg_addr = get_scr_cfg_addr(ap, scr);
@@ -161,7 +161,7 @@ static void uli_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val)
161 pci_write_config_dword(pdev, cfg_addr, val); 161 pci_write_config_dword(pdev, cfg_addr, val);
162} 162}
163 163
164static int uli_scr_read (struct ata_port *ap, unsigned int sc_reg, u32 *val) 164static int uli_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
165{ 165{
166 if (sc_reg > SCR_CONTROL) 166 if (sc_reg > SCR_CONTROL)
167 return -EINVAL; 167 return -EINVAL;
@@ -170,16 +170,16 @@ static int uli_scr_read (struct ata_port *ap, unsigned int sc_reg, u32 *val)
170 return 0; 170 return 0;
171} 171}
172 172
173static int uli_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) 173static int uli_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
174{ 174{
175 if (sc_reg > SCR_CONTROL) //SCR_CONTROL=2, SCR_ERROR=1, SCR_STATUS=0 175 if (sc_reg > SCR_CONTROL) //SCR_CONTROL=2, SCR_ERROR=1, SCR_STATUS=0
176 return -EINVAL; 176 return -EINVAL;
177 177
178 uli_scr_cfg_write(ap, sc_reg, val); 178 uli_scr_cfg_write(ap, sc_reg, val);
179 return 0; 179 return 0;
180} 180}
181 181
182static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 182static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
183{ 183{
184 static int printed_version; 184 static int printed_version;
185 const struct ata_port_info *ppi[] = { &uli_port_info, NULL }; 185 const struct ata_port_info *ppi[] = { &uli_port_info, NULL };
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index cc6ee0890f56..3ef072ff319d 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Maintained by: Jeff Garzik <jgarzik@pobox.com> 4 * Maintained by: Jeff Garzik <jgarzik@pobox.com>
5 * Please ALWAYS copy linux-ide@vger.kernel.org 5 * Please ALWAYS copy linux-ide@vger.kernel.org
6 on emails. 6 * on emails.
7 * 7 *
8 * Copyright 2003-2004 Red Hat, Inc. All rights reserved. 8 * Copyright 2003-2004 Red Hat, Inc. All rights reserved.
9 * Copyright 2003-2004 Jeff Garzik 9 * Copyright 2003-2004 Jeff Garzik
@@ -69,7 +69,7 @@ enum {
69 SATA_EXT_PHY = (1 << 6), /* 0==use PATA, 1==ext phy */ 69 SATA_EXT_PHY = (1 << 6), /* 0==use PATA, 1==ext phy */
70}; 70};
71 71
72static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 72static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
73static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 73static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
74static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 74static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
75static void svia_noop_freeze(struct ata_port *ap); 75static void svia_noop_freeze(struct ata_port *ap);
@@ -372,12 +372,12 @@ static const unsigned int vt6421_bar_sizes[] = {
372 16, 16, 16, 16, 32, 128 372 16, 16, 16, 16, 32, 128
373}; 373};
374 374
375static void __iomem * svia_scr_addr(void __iomem *addr, unsigned int port) 375static void __iomem *svia_scr_addr(void __iomem *addr, unsigned int port)
376{ 376{
377 return addr + (port * 128); 377 return addr + (port * 128);
378} 378}
379 379
380static void __iomem * vt6421_scr_addr(void __iomem *addr, unsigned int port) 380static void __iomem *vt6421_scr_addr(void __iomem *addr, unsigned int port)
381{ 381{
382 return addr + (port * 64); 382 return addr + (port * 64);
383} 383}
@@ -472,7 +472,7 @@ static void svia_configure(struct pci_dev *pdev)
472 if ((tmp8 & ALL_PORTS) != ALL_PORTS) { 472 if ((tmp8 & ALL_PORTS) != ALL_PORTS) {
473 dev_printk(KERN_DEBUG, &pdev->dev, 473 dev_printk(KERN_DEBUG, &pdev->dev,
474 "enabling SATA channels (0x%x)\n", 474 "enabling SATA channels (0x%x)\n",
475 (int) tmp8); 475 (int) tmp8);
476 tmp8 |= ALL_PORTS; 476 tmp8 |= ALL_PORTS;
477 pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8); 477 pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8);
478 } 478 }
@@ -482,7 +482,7 @@ static void svia_configure(struct pci_dev *pdev)
482 if ((tmp8 & ALL_PORTS) != ALL_PORTS) { 482 if ((tmp8 & ALL_PORTS) != ALL_PORTS) {
483 dev_printk(KERN_DEBUG, &pdev->dev, 483 dev_printk(KERN_DEBUG, &pdev->dev,
484 "enabling SATA channel interrupts (0x%x)\n", 484 "enabling SATA channel interrupts (0x%x)\n",
485 (int) tmp8); 485 (int) tmp8);
486 tmp8 |= ALL_PORTS; 486 tmp8 |= ALL_PORTS;
487 pci_write_config_byte(pdev, SATA_INT_GATE, tmp8); 487 pci_write_config_byte(pdev, SATA_INT_GATE, tmp8);
488 } 488 }
@@ -492,13 +492,13 @@ static void svia_configure(struct pci_dev *pdev)
492 if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) { 492 if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) {
493 dev_printk(KERN_DEBUG, &pdev->dev, 493 dev_printk(KERN_DEBUG, &pdev->dev,
494 "enabling SATA channel native mode (0x%x)\n", 494 "enabling SATA channel native mode (0x%x)\n",
495 (int) tmp8); 495 (int) tmp8);
496 tmp8 |= NATIVE_MODE_ALL; 496 tmp8 |= NATIVE_MODE_ALL;
497 pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8); 497 pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
498 } 498 }
499} 499}
500 500
501static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 501static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
502{ 502{
503 static int printed_version; 503 static int printed_version;
504 unsigned int i; 504 unsigned int i;
@@ -525,8 +525,8 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
525 dev_printk(KERN_ERR, &pdev->dev, 525 dev_printk(KERN_ERR, &pdev->dev,
526 "invalid PCI BAR %u (sz 0x%llx, val 0x%llx)\n", 526 "invalid PCI BAR %u (sz 0x%llx, val 0x%llx)\n",
527 i, 527 i,
528 (unsigned long long)pci_resource_start(pdev, i), 528 (unsigned long long)pci_resource_start(pdev, i),
529 (unsigned long long)pci_resource_len(pdev, i)); 529 (unsigned long long)pci_resource_len(pdev, i));
530 return -ENODEV; 530 return -ENODEV;
531 } 531 }
532 532
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
index 0d9be1684873..95ae3ed24a9d 100644
--- a/drivers/ata/sata_vsc.c
+++ b/drivers/ata/sata_vsc.c
@@ -162,7 +162,8 @@ static void vsc_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
162 /* 162 /*
163 * The only thing the ctl register is used for is SRST. 163 * The only thing the ctl register is used for is SRST.
164 * That is not enabled or disabled via tf_load. 164 * That is not enabled or disabled via tf_load.
165 * However, if ATA_NIEN is changed, then we need to change the interrupt register. 165 * However, if ATA_NIEN is changed, then we need to change
166 * the interrupt register.
166 */ 167 */
167 if ((tf->ctl & ATA_NIEN) != (ap->last_ctl & ATA_NIEN)) { 168 if ((tf->ctl & ATA_NIEN) != (ap->last_ctl & ATA_NIEN)) {
168 ap->last_ctl = tf->ctl; 169 ap->last_ctl = tf->ctl;
@@ -219,7 +220,7 @@ static void vsc_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
219 tf->hob_lbal = lbal >> 8; 220 tf->hob_lbal = lbal >> 8;
220 tf->hob_lbam = lbam >> 8; 221 tf->hob_lbam = lbam >> 8;
221 tf->hob_lbah = lbah >> 8; 222 tf->hob_lbah = lbah >> 8;
222 } 223 }
223} 224}
224 225
225static inline void vsc_error_intr(u8 port_status, struct ata_port *ap) 226static inline void vsc_error_intr(u8 port_status, struct ata_port *ap)
@@ -256,9 +257,10 @@ static void vsc_port_intr(u8 port_status, struct ata_port *ap)
256/* 257/*
257 * vsc_sata_interrupt 258 * vsc_sata_interrupt
258 * 259 *
259 * Read the interrupt register and process for the devices that have them pending. 260 * Read the interrupt register and process for the devices that have
261 * them pending.
260 */ 262 */
261static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance) 263static irqreturn_t vsc_sata_interrupt(int irq, void *dev_instance)
262{ 264{
263 struct ata_host *host = dev_instance; 265 struct ata_host *host = dev_instance;
264 unsigned int i; 266 unsigned int i;
@@ -287,7 +289,7 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance)
287 handled++; 289 handled++;
288 } else 290 } else
289 dev_printk(KERN_ERR, host->dev, 291 dev_printk(KERN_ERR, host->dev,
290 ": interrupt from disabled port %d\n", i); 292 "interrupt from disabled port %d\n", i);
291 } 293 }
292 } 294 }
293 295
@@ -363,7 +365,8 @@ static void __devinit vsc_sata_setup_port(struct ata_ioports *port,
363} 365}
364 366
365 367
366static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 368static int __devinit vsc_sata_init_one(struct pci_dev *pdev,
369 const struct pci_device_id *ent)
367{ 370{
368 static const struct ata_port_info pi = { 371 static const struct ata_port_info pi = {
369 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 372 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
diff --git a/drivers/base/core.c b/drivers/base/core.c
index c1343414d285..3f4d6aa13990 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1228,18 +1228,18 @@ int device_rename(struct device *dev, char *new_name)
1228 sysfs_remove_link(&dev->parent->kobj, old_class_name); 1228 sysfs_remove_link(&dev->parent->kobj, old_class_name);
1229 } 1229 }
1230 } 1230 }
1231#endif 1231#else
1232
1233 if (dev->class) { 1232 if (dev->class) {
1234 sysfs_remove_link(&dev->class->subsys.kobj, old_device_name); 1233 sysfs_remove_link(&dev->class->subsys.kobj, old_device_name);
1235 error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, 1234 error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj,
1236 dev->bus_id); 1235 dev->bus_id);
1237 if (error) { 1236 if (error) {
1238 /* Uh... how to unravel this if restoring can fail? */
1239 dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n", 1237 dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n",
1240 __FUNCTION__, error); 1238 __FUNCTION__, error);
1241 } 1239 }
1242 } 1240 }
1241#endif
1242
1243out: 1243out:
1244 put_device(dev); 1244 put_device(dev);
1245 1245
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 5a6fe17fc638..7d704968765f 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1,20 +1,20 @@
1/* 1/*
2 * Disk Array driver for HP SA 5xxx and 6xxx Controllers 2 * Disk Array driver for HP Smart Array controllers.
3 * Copyright 2000, 2006 Hewlett-Packard Development Company, L.P. 3 * (C) Copyright 2000, 2007 Hewlett-Packard Development Company, L.P.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; version 2 of the License.
8 * (at your option) any later version.
9 * 8 *
10 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * NON INFRINGEMENT. See the GNU General Public License for more details. 12 * General Public License for more details.
14 * 13 *
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 * 02111-1307, USA.
18 * 18 *
19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com 19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
20 * 20 *
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index 4aca7ddfdddf..63ee6c076cb3 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -1,20 +1,20 @@
1/* 1/*
2 * Disk Array driver for Compaq SA53xx Controllers, SCSI Tape module 2 * Disk Array driver for HP Smart Array controllers, SCSI Tape module.
3 * Copyright 2001 Compaq Computer Corporation 3 * (C) Copyright 2001, 2007 Hewlett-Packard Development Company, L.P.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; version 2 of the License.
8 * (at your option) any later version.
9 * 8 *
10 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * NON INFRINGEMENT. See the GNU General Public License for more details. 12 * General Public License for more details.
14 * 13 *
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Foundation, Inc., 59 Temple Place, Suite 300, Boston, MA
17 * 02111-1307, USA.
18 * 18 *
19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com 19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
20 * 20 *
diff --git a/drivers/block/cciss_scsi.h b/drivers/block/cciss_scsi.h
index 5e7e06c07d6c..d9c2c586502f 100644
--- a/drivers/block/cciss_scsi.h
+++ b/drivers/block/cciss_scsi.h
@@ -1,20 +1,20 @@
1/* 1/*
2 * Disk Array driver for Compaq SA53xx Controllers, SCSI Tape module 2 * Disk Array driver for HP Smart Array controllers, SCSI Tape module.
3 * Copyright 2001 Compaq Computer Corporation 3 * (C) Copyright 2001, 2007 Hewlett-Packard Development Company, L.P.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; version 2 of the License.
8 * (at your option) any later version.
9 * 8 *
10 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * NON INFRINGEMENT. See the GNU General Public License for more details. 12 * General Public License for more details.
14 * 13 *
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Foundation, Inc., 59 Temple Place, Suite 300, Boston, MA
17 * 02111-1307, USA.
18 * 18 *
19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com 19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
20 * 20 *
diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c
index 1b58b010797f..241167878edf 100644
--- a/drivers/block/cryptoloop.c
+++ b/drivers/block/cryptoloop.c
@@ -150,13 +150,8 @@ cryptoloop_transfer(struct loop_device *lo, int cmd,
150 u32 iv[4] = { 0, }; 150 u32 iv[4] = { 0, };
151 iv[0] = cpu_to_le32(IV & 0xffffffff); 151 iv[0] = cpu_to_le32(IV & 0xffffffff);
152 152
153 sg_set_page(&sg_in, in_page); 153 sg_set_page(&sg_in, in_page, sz, in_offs);
154 sg_in.offset = in_offs; 154 sg_set_page(&sg_out, out_page, sz, out_offs);
155 sg_in.length = sz;
156
157 sg_set_page(&sg_out, out_page);
158 sg_out.offset = out_offs;
159 sg_out.length = sz;
160 155
161 desc.info = iv; 156 desc.info = iv;
162 err = encdecfunc(&desc, &sg_out, &sg_in, sz); 157 err = encdecfunc(&desc, &sg_out, &sg_in, sz);
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 7276f7d207c2..fac4c6cd04f7 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -15,6 +15,7 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/scatterlist.h>
18 19
19#include <asm/vio.h> 20#include <asm/vio.h>
20#include <asm/ldc.h> 21#include <asm/ldc.h>
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 14143f2c484d..08e909dc7944 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1428,9 +1428,9 @@ static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1428 scmd->state = UB_CMDST_INIT; 1428 scmd->state = UB_CMDST_INIT;
1429 scmd->nsg = 1; 1429 scmd->nsg = 1;
1430 sg = &scmd->sgv[0]; 1430 sg = &scmd->sgv[0];
1431 sg_set_page(sg, virt_to_page(sc->top_sense)); 1431 sg_init_table(sg, UB_MAX_REQ_SG);
1432 sg->offset = (unsigned long)sc->top_sense & (PAGE_SIZE-1); 1432 sg_set_page(sg, virt_to_page(sc->top_sense), UB_SENSE_SIZE,
1433 sg->length = UB_SENSE_SIZE; 1433 (unsigned long)sc->top_sense & (PAGE_SIZE-1));
1434 scmd->len = UB_SENSE_SIZE; 1434 scmd->len = UB_SENSE_SIZE;
1435 scmd->lun = cmd->lun; 1435 scmd->lun = cmd->lun;
1436 scmd->done = ub_top_sense_done; 1436 scmd->done = ub_top_sense_done;
@@ -1864,9 +1864,8 @@ static int ub_sync_read_cap(struct ub_dev *sc, struct ub_lun *lun,
1864 cmd->state = UB_CMDST_INIT; 1864 cmd->state = UB_CMDST_INIT;
1865 cmd->nsg = 1; 1865 cmd->nsg = 1;
1866 sg = &cmd->sgv[0]; 1866 sg = &cmd->sgv[0];
1867 sg_set_page(sg, virt_to_page(p)); 1867 sg_init_table(sg, UB_MAX_REQ_SG);
1868 sg->offset = (unsigned long)p & (PAGE_SIZE-1); 1868 sg_set_page(sg, virt_to_page(p), 8, (unsigned long)p & (PAGE_SIZE-1));
1869 sg->length = 8;
1870 cmd->len = 8; 1869 cmd->len = 8;
1871 cmd->lun = lun; 1870 cmd->lun = lun;
1872 cmd->done = ub_probe_done; 1871 cmd->done = ub_probe_done;
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index a901eee64ba5..3cf7129d83e6 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -4,7 +4,9 @@
4#include <linux/hdreg.h> 4#include <linux/hdreg.h>
5#include <linux/virtio.h> 5#include <linux/virtio.h>
6#include <linux/virtio_blk.h> 6#include <linux/virtio_blk.h>
7#include <linux/virtio_blk.h> 7#include <linux/scatterlist.h>
8
9#define VIRTIO_MAX_SG (3+MAX_PHYS_SEGMENTS)
8 10
9static unsigned char virtblk_index = 'a'; 11static unsigned char virtblk_index = 'a';
10struct virtio_blk 12struct virtio_blk
@@ -23,7 +25,7 @@ struct virtio_blk
23 mempool_t *pool; 25 mempool_t *pool;
24 26
25 /* Scatterlist: can be too big for stack. */ 27 /* Scatterlist: can be too big for stack. */
26 struct scatterlist sg[3+MAX_PHYS_SEGMENTS]; 28 struct scatterlist sg[VIRTIO_MAX_SG];
27}; 29};
28 30
29struct virtblk_req 31struct virtblk_req
@@ -94,8 +96,8 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
94 if (blk_barrier_rq(vbr->req)) 96 if (blk_barrier_rq(vbr->req))
95 vbr->out_hdr.type |= VIRTIO_BLK_T_BARRIER; 97 vbr->out_hdr.type |= VIRTIO_BLK_T_BARRIER;
96 98
97 /* We have to zero this, otherwise blk_rq_map_sg gets upset. */ 99 /* This init could be done at vblk creation time */
98 memset(vblk->sg, 0, sizeof(vblk->sg)); 100 sg_init_table(vblk->sg, VIRTIO_MAX_SG);
99 sg_set_buf(&vblk->sg[0], &vbr->out_hdr, sizeof(vbr->out_hdr)); 101 sg_set_buf(&vblk->sg[0], &vbr->out_hdr, sizeof(vbr->out_hdr));
100 num = blk_rq_map_sg(q, vbr->req, vblk->sg+1); 102 num = blk_rq_map_sg(q, vbr->req, vblk->sg+1);
101 sg_set_buf(&vblk->sg[num+1], &vbr->in_hdr, sizeof(vbr->in_hdr)); 103 sg_set_buf(&vblk->sg[num+1], &vbr->in_hdr, sizeof(vbr->in_hdr));
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 880b5dce3a62..d8bb44b98a6a 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -41,9 +41,9 @@
41#include <linux/completion.h> 41#include <linux/completion.h>
42#include <linux/proc_fs.h> 42#include <linux/proc_fs.h>
43#include <linux/seq_file.h> 43#include <linux/seq_file.h>
44#include <linux/scatterlist.h>
44 45
45#include <asm/vio.h> 46#include <asm/vio.h>
46#include <asm/scatterlist.h>
47#include <asm/iseries/hv_types.h> 47#include <asm/iseries/hv_types.h>
48#include <asm/iseries/hv_lp_event.h> 48#include <asm/iseries/hv_lp_event.h>
49#include <asm/iseries/vio.h> 49#include <asm/iseries/vio.h>
@@ -258,6 +258,7 @@ static int send_request(struct request *req)
258 cmd = viomajorsubtype_cdio | viocdwrite; 258 cmd = viomajorsubtype_cdio | viocdwrite;
259 } 259 }
260 260
261 sg_init_table(&sg, 1);
261 if (blk_rq_map_sg(req->q, req, &sg) == 0) { 262 if (blk_rq_map_sg(req->q, req, &sg) == 0) {
262 printk(VIOCD_KERN_WARNING 263 printk(VIOCD_KERN_WARNING
263 "error setting up scatter/gather list\n"); 264 "error setting up scatter/gather list\n");
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
index f22c253bc09f..ccb1fa89de29 100644
--- a/drivers/char/agp/Kconfig
+++ b/drivers/char/agp/Kconfig
@@ -56,9 +56,9 @@ config AGP_AMD
56 X on AMD Irongate, 761, and 762 chipsets. 56 X on AMD Irongate, 761, and 762 chipsets.
57 57
58config AGP_AMD64 58config AGP_AMD64
59 tristate "AMD Opteron/Athlon64 on-CPU GART support" if !IOMMU 59 tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU
60 depends on AGP && X86 60 depends on AGP && X86
61 default y if IOMMU 61 default y if GART_IOMMU
62 help 62 help
63 This option gives you AGP support for the GLX component of 63 This option gives you AGP support for the GLX component of
64 X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs. 64 X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index d95662e96326..d8200ac8f8cb 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -787,7 +787,7 @@ static void __exit agp_amd64_cleanup(void)
787 787
788/* On AMD64 the PCI driver needs to initialize this driver early 788/* On AMD64 the PCI driver needs to initialize this driver early
789 for the IOMMU, so it has to be called via a backdoor. */ 789 for the IOMMU, so it has to be called via a backdoor. */
790#ifndef CONFIG_IOMMU 790#ifndef CONFIG_GART_IOMMU
791module_init(agp_amd64_init); 791module_init(agp_amd64_init);
792module_exit(agp_amd64_cleanup); 792module_exit(agp_amd64_cleanup);
793#endif 793#endif
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 0e937f64a789..20070b7c573d 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -41,7 +41,7 @@
41 */ 41 */
42static inline int uncached_access(struct file *file, unsigned long addr) 42static inline int uncached_access(struct file *file, unsigned long addr)
43{ 43{
44#if defined(__i386__) 44#if defined(__i386__) && !defined(__arch_um__)
45 /* 45 /*
46 * On the PPro and successors, the MTRRs are used to set 46 * On the PPro and successors, the MTRRs are used to set
47 * memory types for physical addresses outside main memory, 47 * memory types for physical addresses outside main memory,
@@ -57,7 +57,7 @@ static inline int uncached_access(struct file *file, unsigned long addr)
57 test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) || 57 test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) ||
58 test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) ) 58 test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) )
59 && addr >= __pa(high_memory); 59 && addr >= __pa(high_memory);
60#elif defined(__x86_64__) 60#elif defined(__x86_64__) && !defined(__arch_um__)
61 /* 61 /*
62 * This is broken because it can generate memory type aliases, 62 * This is broken because it can generate memory type aliases,
63 * which can cause cache corruptions 63 * which can cause cache corruptions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 0e328d387af4..6883fcb79ad3 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -218,7 +218,7 @@ static void cn_rx_skb(struct sk_buff *__skb)
218 skb->len < nlh->nlmsg_len || 218 skb->len < nlh->nlmsg_len ||
219 nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) { 219 nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) {
220 kfree_skb(skb); 220 kfree_skb(skb);
221 goto out; 221 return;
222 } 222 }
223 223
224 len = NLMSG_ALIGN(nlh->nlmsg_len); 224 len = NLMSG_ALIGN(nlh->nlmsg_len);
@@ -229,9 +229,6 @@ static void cn_rx_skb(struct sk_buff *__skb)
229 if (err < 0) 229 if (err < 0)
230 kfree_skb(skb); 230 kfree_skb(skb);
231 } 231 }
232
233out:
234 kfree_skb(__skb);
235} 232}
236 233
237/* 234/*
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index fdf4106b817b..d2fabe7863a9 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -19,7 +19,6 @@
19#include "cpuidle.h" 19#include "cpuidle.h"
20 20
21DEFINE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 21DEFINE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
22EXPORT_PER_CPU_SYMBOL_GPL(cpuidle_devices);
23 22
24DEFINE_MUTEX(cpuidle_lock); 23DEFINE_MUTEX(cpuidle_lock);
25LIST_HEAD(cpuidle_detected_devices); 24LIST_HEAD(cpuidle_detected_devices);
diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c
index bb699cb2dc5a..70b59642a708 100644
--- a/drivers/cpuidle/governor.c
+++ b/drivers/cpuidle/governor.c
@@ -94,8 +94,6 @@ int cpuidle_register_governor(struct cpuidle_governor *gov)
94 return ret; 94 return ret;
95} 95}
96 96
97EXPORT_SYMBOL_GPL(cpuidle_register_governor);
98
99/** 97/**
100 * cpuidle_replace_governor - find a replacement governor 98 * cpuidle_replace_governor - find a replacement governor
101 * @exclude_rating: the rating that will be skipped while looking for 99 * @exclude_rating: the rating that will be skipped while looking for
@@ -138,4 +136,3 @@ void cpuidle_unregister_governor(struct cpuidle_governor *gov)
138 mutex_unlock(&cpuidle_lock); 136 mutex_unlock(&cpuidle_lock);
139} 137}
140 138
141EXPORT_SYMBOL_GPL(cpuidle_unregister_governor);
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c
index 4e8de162fc12..c666b4e0933e 100644
--- a/drivers/crypto/padlock-sha.c
+++ b/drivers/crypto/padlock-sha.c
@@ -55,7 +55,7 @@ static void padlock_sha_bypass(struct crypto_tfm *tfm)
55 if (ctx(tfm)->data && ctx(tfm)->used) { 55 if (ctx(tfm)->data && ctx(tfm)->used) {
56 struct scatterlist sg; 56 struct scatterlist sg;
57 57
58 sg_set_buf(&sg, ctx(tfm)->data, ctx(tfm)->used); 58 sg_init_one(&sg, ctx(tfm)->data, ctx(tfm)->used);
59 crypto_hash_update(&ctx(tfm)->fallback, &sg, sg.length); 59 crypto_hash_update(&ctx(tfm)->fallback, &sg, sg.length);
60 } 60 }
61 61
@@ -79,7 +79,7 @@ static void padlock_sha_update(struct crypto_tfm *tfm,
79 79
80 if (unlikely(ctx(tfm)->bypass)) { 80 if (unlikely(ctx(tfm)->bypass)) {
81 struct scatterlist sg; 81 struct scatterlist sg;
82 sg_set_buf(&sg, (uint8_t *)data, length); 82 sg_init_one(&sg, (uint8_t *)data, length);
83 crypto_hash_update(&ctx(tfm)->fallback, &sg, length); 83 crypto_hash_update(&ctx(tfm)->fallback, &sg, length);
84 return; 84 return;
85 } 85 }
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 9c91b0fd134f..6a7d25fc2470 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -43,7 +43,6 @@ comment "DMA Clients"
43config NET_DMA 43config NET_DMA
44 bool "Network: TCP receive copy offload" 44 bool "Network: TCP receive copy offload"
45 depends on DMA_ENGINE && NET 45 depends on DMA_ENGINE && NET
46 default y
47 help 46 help
48 This enables the use of DMA engines in the network stack to 47 This enables the use of DMA engines in the network stack to
49 offload receive copy-to-user operations, freeing CPU cycles. 48 offload receive copy-to-user operations, freeing CPU cycles.
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 67588326ae56..c9b9081831da 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -984,8 +984,10 @@ static void bus_reset_tasklet(unsigned long data)
984 */ 984 */
985 985
986 if (ohci->next_config_rom != NULL) { 986 if (ohci->next_config_rom != NULL) {
987 free_rom = ohci->config_rom; 987 if (ohci->next_config_rom != ohci->config_rom) {
988 free_rom_bus = ohci->config_rom_bus; 988 free_rom = ohci->config_rom;
989 free_rom_bus = ohci->config_rom_bus;
990 }
989 ohci->config_rom = ohci->next_config_rom; 991 ohci->config_rom = ohci->next_config_rom;
990 ohci->config_rom_bus = ohci->next_config_rom_bus; 992 ohci->config_rom_bus = ohci->next_config_rom_bus;
991 ohci->next_config_rom = NULL; 993 ohci->next_config_rom = NULL;
@@ -1161,19 +1163,30 @@ static int ohci_enable(struct fw_card *card, u32 *config_rom, size_t length)
1161 * the right values in the bus reset tasklet. 1163 * the right values in the bus reset tasklet.
1162 */ 1164 */
1163 1165
1164 ohci->next_config_rom = 1166 if (config_rom) {
1165 dma_alloc_coherent(ohci->card.device, CONFIG_ROM_SIZE, 1167 ohci->next_config_rom =
1166 &ohci->next_config_rom_bus, GFP_KERNEL); 1168 dma_alloc_coherent(ohci->card.device, CONFIG_ROM_SIZE,
1167 if (ohci->next_config_rom == NULL) 1169 &ohci->next_config_rom_bus,
1168 return -ENOMEM; 1170 GFP_KERNEL);
1171 if (ohci->next_config_rom == NULL)
1172 return -ENOMEM;
1169 1173
1170 memset(ohci->next_config_rom, 0, CONFIG_ROM_SIZE); 1174 memset(ohci->next_config_rom, 0, CONFIG_ROM_SIZE);
1171 fw_memcpy_to_be32(ohci->next_config_rom, config_rom, length * 4); 1175 fw_memcpy_to_be32(ohci->next_config_rom, config_rom, length * 4);
1176 } else {
1177 /*
1178 * In the suspend case, config_rom is NULL, which
1179 * means that we just reuse the old config rom.
1180 */
1181 ohci->next_config_rom = ohci->config_rom;
1182 ohci->next_config_rom_bus = ohci->config_rom_bus;
1183 }
1172 1184
1173 ohci->next_header = config_rom[0]; 1185 ohci->next_header = be32_to_cpu(ohci->next_config_rom[0]);
1174 ohci->next_config_rom[0] = 0; 1186 ohci->next_config_rom[0] = 0;
1175 reg_write(ohci, OHCI1394_ConfigROMhdr, 0); 1187 reg_write(ohci, OHCI1394_ConfigROMhdr, 0);
1176 reg_write(ohci, OHCI1394_BusOptions, config_rom[2]); 1188 reg_write(ohci, OHCI1394_BusOptions,
1189 be32_to_cpu(ohci->next_config_rom[2]));
1177 reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); 1190 reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus);
1178 1191
1179 reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000); 1192 reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000);
@@ -1984,7 +1997,7 @@ static int pci_resume(struct pci_dev *pdev)
1984 return err; 1997 return err;
1985 } 1998 }
1986 1999
1987 return ohci_enable(&ohci->card, ohci->config_rom, CONFIG_ROM_SIZE); 2000 return ohci_enable(&ohci->card, NULL, 0);
1988} 2001}
1989#endif 2002#endif
1990 2003
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index dd332f28e08c..0b27da7d7497 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -297,7 +297,7 @@ static struct hid_usage *hidinput_find_key(struct hid_device *hid,
297static int hidinput_getkeycode(struct input_dev *dev, int scancode, 297static int hidinput_getkeycode(struct input_dev *dev, int scancode,
298 int *keycode) 298 int *keycode)
299{ 299{
300 struct hid_device *hid = dev->private; 300 struct hid_device *hid = input_get_drvdata(dev);
301 struct hid_usage *usage; 301 struct hid_usage *usage;
302 302
303 usage = hidinput_find_key(hid, scancode, 0); 303 usage = hidinput_find_key(hid, scancode, 0);
@@ -311,7 +311,7 @@ static int hidinput_getkeycode(struct input_dev *dev, int scancode,
311static int hidinput_setkeycode(struct input_dev *dev, int scancode, 311static int hidinput_setkeycode(struct input_dev *dev, int scancode,
312 int keycode) 312 int keycode)
313{ 313{
314 struct hid_device *hid = dev->private; 314 struct hid_device *hid = input_get_drvdata(dev);
315 struct hid_usage *usage; 315 struct hid_usage *usage;
316 int old_keycode; 316 int old_keycode;
317 317
@@ -1152,7 +1152,7 @@ int hidinput_connect(struct hid_device *hid)
1152 kfree(hidinput); 1152 kfree(hidinput);
1153 input_free_device(input_dev); 1153 input_free_device(input_dev);
1154 err_hid("Out of memory during hid input probe"); 1154 err_hid("Out of memory during hid input probe");
1155 return -1; 1155 goto out_unwind;
1156 } 1156 }
1157 1157
1158 input_set_drvdata(input_dev, hid); 1158 input_set_drvdata(input_dev, hid);
@@ -1186,15 +1186,25 @@ int hidinput_connect(struct hid_device *hid)
1186 * UGCI) cram a lot of unrelated inputs into the 1186 * UGCI) cram a lot of unrelated inputs into the
1187 * same interface. */ 1187 * same interface. */
1188 hidinput->report = report; 1188 hidinput->report = report;
1189 input_register_device(hidinput->input); 1189 if (input_register_device(hidinput->input))
1190 goto out_cleanup;
1190 hidinput = NULL; 1191 hidinput = NULL;
1191 } 1192 }
1192 } 1193 }
1193 1194
1194 if (hidinput) 1195 if (hidinput && input_register_device(hidinput->input))
1195 input_register_device(hidinput->input); 1196 goto out_cleanup;
1196 1197
1197 return 0; 1198 return 0;
1199
1200out_cleanup:
1201 input_free_device(hidinput->input);
1202 kfree(hidinput);
1203out_unwind:
1204 /* unwind the ones we already registered */
1205 hidinput_disconnect(hid);
1206
1207 return -1;
1198} 1208}
1199EXPORT_SYMBOL_GPL(hidinput_connect); 1209EXPORT_SYMBOL_GPL(hidinput_connect);
1200 1210
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 41a59a80e7ed..a2552856476b 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -129,6 +129,11 @@
129#define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053 129#define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053
130#define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058 130#define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058
131 131
132#define USB_VENDOR_ID_GOTOP 0x08f2
133#define USB_DEVICE_ID_SUPER_Q2 0x007f
134#define USB_DEVICE_ID_GOGOPEN 0x00ce
135#define USB_DEVICE_ID_PENPOWER 0x00f4
136
132#define USB_VENDOR_ID_GRIFFIN 0x077d 137#define USB_VENDOR_ID_GRIFFIN 0x077d
133#define USB_DEVICE_ID_POWERMATE 0x0410 138#define USB_DEVICE_ID_POWERMATE 0x0410
134#define USB_DEVICE_ID_SOUNDKNOB 0x04AA 139#define USB_DEVICE_ID_SOUNDKNOB 0x04AA
@@ -415,6 +420,9 @@ static const struct hid_blacklist {
415 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT, HID_QUIRK_IGNORE }, 420 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT, HID_QUIRK_IGNORE },
416 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE }, 421 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE },
417 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL, HID_QUIRK_IGNORE }, 422 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL, HID_QUIRK_IGNORE },
423 { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2, HID_QUIRK_IGNORE },
424 { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN, HID_QUIRK_IGNORE },
425 { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER, HID_QUIRK_IGNORE },
418 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, 426 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE },
419 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, 427 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE },
420 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90, HID_QUIRK_IGNORE }, 428 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90, HID_QUIRK_IGNORE },
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 9837adcb17e9..5fc4019956ba 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -743,7 +743,7 @@ inval:
743static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 743static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
744{ 744{
745 struct inode *inode = file->f_path.dentry->d_inode; 745 struct inode *inode = file->f_path.dentry->d_inode;
746 return hiddev_ioctl(inode, file, cmd, compat_ptr(arg)); 746 return hiddev_ioctl(inode, file, cmd, (unsigned long)compat_ptr(arg));
747} 747}
748#endif 748#endif
749 749
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 410a0d13e35e..93f71fcfc04d 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -316,13 +316,13 @@ static int icside_dma_end(ide_drive_t *drive)
316 316
317 drive->waiting_for_dma = 0; 317 drive->waiting_for_dma = 0;
318 318
319 disable_dma(state->dev->dma); 319 disable_dma(ECARD_DEV(state->dev)->dma);
320 320
321 /* Teardown mappings after DMA has completed. */ 321 /* Teardown mappings after DMA has completed. */
322 dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, 322 dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents,
323 hwif->sg_dma_direction); 323 hwif->sg_dma_direction);
324 324
325 return get_dma_residue(state->dev->dma) != 0; 325 return get_dma_residue(ECARD_DEV(state->dev)->dma) != 0;
326} 326}
327 327
328static void icside_dma_start(ide_drive_t *drive) 328static void icside_dma_start(ide_drive_t *drive)
@@ -331,8 +331,8 @@ static void icside_dma_start(ide_drive_t *drive)
331 struct icside_state *state = hwif->hwif_data; 331 struct icside_state *state = hwif->hwif_data;
332 332
333 /* We can not enable DMA on both channels simultaneously. */ 333 /* We can not enable DMA on both channels simultaneously. */
334 BUG_ON(dma_channel_active(state->dev->dma)); 334 BUG_ON(dma_channel_active(ECARD_DEV(state->dev)->dma));
335 enable_dma(state->dev->dma); 335 enable_dma(ECARD_DEV(state->dev)->dma);
336} 336}
337 337
338static int icside_dma_setup(ide_drive_t *drive) 338static int icside_dma_setup(ide_drive_t *drive)
@@ -350,7 +350,7 @@ static int icside_dma_setup(ide_drive_t *drive)
350 /* 350 /*
351 * We can not enable DMA on both channels. 351 * We can not enable DMA on both channels.
352 */ 352 */
353 BUG_ON(dma_channel_active(state->dev->dma)); 353 BUG_ON(dma_channel_active(ECARD_DEV(state->dev)->dma));
354 354
355 icside_build_sglist(drive, rq); 355 icside_build_sglist(drive, rq);
356 356
@@ -367,14 +367,14 @@ static int icside_dma_setup(ide_drive_t *drive)
367 /* 367 /*
368 * Select the correct timing for this drive. 368 * Select the correct timing for this drive.
369 */ 369 */
370 set_dma_speed(state->dev->dma, drive->drive_data); 370 set_dma_speed(ECARD_DEV(state->dev)->dma, drive->drive_data);
371 371
372 /* 372 /*
373 * Tell the DMA engine about the SG table and 373 * Tell the DMA engine about the SG table and
374 * data direction. 374 * data direction.
375 */ 375 */
376 set_dma_sg(state->dev->dma, hwif->sg_table, hwif->sg_nents); 376 set_dma_sg(ECARD_DEV(state->dev)->dma, hwif->sg_table, hwif->sg_nents);
377 set_dma_mode(state->dev->dma, dma_mode); 377 set_dma_mode(ECARD_DEV(state->dev)->dma, dma_mode);
378 378
379 drive->waiting_for_dma = 1; 379 drive->waiting_for_dma = 1;
380 380
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 95168833d069..dcda0f109df5 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -582,9 +582,12 @@ EXPORT_SYMBOL_GPL(ide_in_drive_list);
582/* 582/*
583 * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid. 583 * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid.
584 * We list them here and depend on the device side cable detection for them. 584 * We list them here and depend on the device side cable detection for them.
585 *
586 * Some optical devices with the buggy firmwares have the same problem.
585 */ 587 */
586static const struct drive_list_entry ivb_list[] = { 588static const struct drive_list_entry ivb_list[] = {
587 { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, 589 { "QUANTUM FIREBALLlct10 05" , "A03.0900" },
590 { "TSSTcorp CDDVDW SH-S202J" , "SB00" },
588 { NULL , NULL } 591 { NULL , NULL }
589}; 592};
590 593
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index 3ef4fc10fe2c..1cd4e9cb0521 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cy82c693.c Version 0.41 Aug 27, 2007 2 * linux/drivers/ide/pci/cy82c693.c Version 0.42 Oct 23, 2007
3 * 3 *
4 * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer 4 * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer
5 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator 5 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator
@@ -436,10 +436,10 @@ static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif)
436 hwif->ide_dma_on = &cy82c693_ide_dma_on; 436 hwif->ide_dma_on = &cy82c693_ide_dma_on;
437} 437}
438 438
439static __devinitdata ide_hwif_t *primary;
440
441static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) 439static void __devinit init_iops_cy82c693(ide_hwif_t *hwif)
442{ 440{
441 static ide_hwif_t *primary;
442
443 if (PCI_FUNC(hwif->pci_dev->devfn) == 1) 443 if (PCI_FUNC(hwif->pci_dev->devfn) == 1)
444 primary = hwif; 444 primary = hwif;
445 else { 445 else {
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
index f44d70852c3c..06885697ed7b 100644
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -49,7 +49,7 @@ static int __init ide_generic_all_on(char *unused)
49 printk(KERN_INFO "IDE generic will claim all unknown PCI IDE storage controllers.\n"); 49 printk(KERN_INFO "IDE generic will claim all unknown PCI IDE storage controllers.\n");
50 return 1; 50 return 1;
51} 51}
52__setup("all-generic-ide", ide_generic_all_on); 52const __setup("all-generic-ide", ide_generic_all_on);
53#endif 53#endif
54module_param_named(all_generic_ide, ide_generic_all, bool, 0444); 54module_param_named(all_generic_ide, ide_generic_all, bool, 0444);
55MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); 55MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers.");
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 612b795241bf..5682895d36d9 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/hpt366.c Version 1.20 Oct 1, 2007 2 * linux/drivers/ide/pci/hpt366.c Version 1.21 Oct 23, 2007
3 * 3 *
4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
5 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 5 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
@@ -433,7 +433,7 @@ static u32 *hpt37x_settings[NUM_ATA_CLOCKS] = {
433 sixty_six_base_hpt37x 433 sixty_six_base_hpt37x
434}; 434};
435 435
436static struct hpt_info hpt36x __devinitdata = { 436static const struct hpt_info hpt36x __devinitdata = {
437 .chip_name = "HPT36x", 437 .chip_name = "HPT36x",
438 .chip_type = HPT36x, 438 .chip_type = HPT36x,
439 .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2, 439 .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2,
@@ -441,7 +441,7 @@ static struct hpt_info hpt36x __devinitdata = {
441 .settings = hpt36x_settings 441 .settings = hpt36x_settings
442}; 442};
443 443
444static struct hpt_info hpt370 __devinitdata = { 444static const struct hpt_info hpt370 __devinitdata = {
445 .chip_name = "HPT370", 445 .chip_name = "HPT370",
446 .chip_type = HPT370, 446 .chip_type = HPT370,
447 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, 447 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4,
@@ -449,7 +449,7 @@ static struct hpt_info hpt370 __devinitdata = {
449 .settings = hpt37x_settings 449 .settings = hpt37x_settings
450}; 450};
451 451
452static struct hpt_info hpt370a __devinitdata = { 452static const struct hpt_info hpt370a __devinitdata = {
453 .chip_name = "HPT370A", 453 .chip_name = "HPT370A",
454 .chip_type = HPT370A, 454 .chip_type = HPT370A,
455 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, 455 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4,
@@ -457,7 +457,7 @@ static struct hpt_info hpt370a __devinitdata = {
457 .settings = hpt37x_settings 457 .settings = hpt37x_settings
458}; 458};
459 459
460static struct hpt_info hpt374 __devinitdata = { 460static const struct hpt_info hpt374 __devinitdata = {
461 .chip_name = "HPT374", 461 .chip_name = "HPT374",
462 .chip_type = HPT374, 462 .chip_type = HPT374,
463 .udma_mask = ATA_UDMA5, 463 .udma_mask = ATA_UDMA5,
@@ -465,7 +465,7 @@ static struct hpt_info hpt374 __devinitdata = {
465 .settings = hpt37x_settings 465 .settings = hpt37x_settings
466}; 466};
467 467
468static struct hpt_info hpt372 __devinitdata = { 468static const struct hpt_info hpt372 __devinitdata = {
469 .chip_name = "HPT372", 469 .chip_name = "HPT372",
470 .chip_type = HPT372, 470 .chip_type = HPT372,
471 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 471 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -473,7 +473,7 @@ static struct hpt_info hpt372 __devinitdata = {
473 .settings = hpt37x_settings 473 .settings = hpt37x_settings
474}; 474};
475 475
476static struct hpt_info hpt372a __devinitdata = { 476static const struct hpt_info hpt372a __devinitdata = {
477 .chip_name = "HPT372A", 477 .chip_name = "HPT372A",
478 .chip_type = HPT372A, 478 .chip_type = HPT372A,
479 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 479 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -481,7 +481,7 @@ static struct hpt_info hpt372a __devinitdata = {
481 .settings = hpt37x_settings 481 .settings = hpt37x_settings
482}; 482};
483 483
484static struct hpt_info hpt302 __devinitdata = { 484static const struct hpt_info hpt302 __devinitdata = {
485 .chip_name = "HPT302", 485 .chip_name = "HPT302",
486 .chip_type = HPT302, 486 .chip_type = HPT302,
487 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 487 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -489,7 +489,7 @@ static struct hpt_info hpt302 __devinitdata = {
489 .settings = hpt37x_settings 489 .settings = hpt37x_settings
490}; 490};
491 491
492static struct hpt_info hpt371 __devinitdata = { 492static const struct hpt_info hpt371 __devinitdata = {
493 .chip_name = "HPT371", 493 .chip_name = "HPT371",
494 .chip_type = HPT371, 494 .chip_type = HPT371,
495 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 495 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -497,7 +497,7 @@ static struct hpt_info hpt371 __devinitdata = {
497 .settings = hpt37x_settings 497 .settings = hpt37x_settings
498}; 498};
499 499
500static struct hpt_info hpt372n __devinitdata = { 500static const struct hpt_info hpt372n __devinitdata = {
501 .chip_name = "HPT372N", 501 .chip_name = "HPT372N",
502 .chip_type = HPT372N, 502 .chip_type = HPT372N,
503 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 503 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -505,7 +505,7 @@ static struct hpt_info hpt372n __devinitdata = {
505 .settings = hpt37x_settings 505 .settings = hpt37x_settings
506}; 506};
507 507
508static struct hpt_info hpt302n __devinitdata = { 508static const struct hpt_info hpt302n __devinitdata = {
509 .chip_name = "HPT302N", 509 .chip_name = "HPT302N",
510 .chip_type = HPT302N, 510 .chip_type = HPT302N,
511 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 511 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -513,7 +513,7 @@ static struct hpt_info hpt302n __devinitdata = {
513 .settings = hpt37x_settings 513 .settings = hpt37x_settings
514}; 514};
515 515
516static struct hpt_info hpt371n __devinitdata = { 516static const struct hpt_info hpt371n __devinitdata = {
517 .chip_name = "HPT371N", 517 .chip_name = "HPT371N",
518 .chip_type = HPT371N, 518 .chip_type = HPT371N,
519 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 519 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -1508,7 +1508,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
1508 */ 1508 */
1509static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id) 1509static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1510{ 1510{
1511 struct hpt_info *info = NULL; 1511 const struct hpt_info *info = NULL;
1512 struct pci_dev *dev2 = NULL; 1512 struct pci_dev *dev2 = NULL;
1513 struct ide_port_info d; 1513 struct ide_port_info d;
1514 u8 idx = id->driver_data; 1514 u8 idx = id->driver_data;
@@ -1522,7 +1522,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
1522 if (rev < 3) 1522 if (rev < 3)
1523 info = &hpt36x; 1523 info = &hpt36x;
1524 else { 1524 else {
1525 static struct hpt_info *hpt37x_info[] = 1525 static const struct hpt_info *hpt37x_info[] =
1526 { &hpt370, &hpt370a, &hpt372, &hpt372n }; 1526 { &hpt370, &hpt370a, &hpt372, &hpt372n };
1527 1527
1528 info = hpt37x_info[min_t(u8, rev, 6) - 3]; 1528 info = hpt37x_info[min_t(u8, rev, 6) - 3];
@@ -1552,7 +1552,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
1552 d.name = info->chip_name; 1552 d.name = info->chip_name;
1553 d.udma_mask = info->udma_mask; 1553 d.udma_mask = info->udma_mask;
1554 1554
1555 pci_set_drvdata(dev, info); 1555 pci_set_drvdata(dev, (void *)info);
1556 1556
1557 if (info == &hpt36x || info == &hpt374) 1557 if (info == &hpt36x || info == &hpt374)
1558 dev2 = pci_get_slot(dev->bus, dev->devfn + 1); 1558 dev2 = pci_get_slot(dev->bus, dev->devfn + 1);
@@ -1560,7 +1560,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
1560 if (dev2) { 1560 if (dev2) {
1561 int ret; 1561 int ret;
1562 1562
1563 pci_set_drvdata(dev2, info); 1563 pci_set_drvdata(dev2, (void *)info);
1564 1564
1565 if (info == &hpt374) 1565 if (info == &hpt374)
1566 hpt374_init(dev, dev2); 1566 hpt374_init(dev, dev2);
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index d2c8b5524f28..0a7b3202066d 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -324,17 +324,18 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)
324 324
325 pci_disable_device(dev); 325 pci_disable_device(dev);
326 pci_set_power_state(dev, pci_choose_state(dev, state)); 326 pci_set_power_state(dev, pci_choose_state(dev, state));
327 dev->current_state = state.event;
328 return 0; 327 return 0;
329} 328}
330 329
331static int sc1200_resume (struct pci_dev *dev) 330static int sc1200_resume (struct pci_dev *dev)
332{ 331{
333 ide_hwif_t *hwif = NULL; 332 ide_hwif_t *hwif = NULL;
333 int i;
334
335 i = pci_enable_device(dev);
336 if (i)
337 return i;
334 338
335 pci_set_power_state(dev, PCI_D0); // bring chip back from sleep state
336 dev->current_state = PM_EVENT_ON;
337 pci_enable_device(dev);
338 // 339 //
339 // loop over all interfaces that are part of this pci device: 340 // loop over all interfaces that are part of this pci device:
340 // 341 //
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c
index 3051e312fdc8..f5f4983dfbf3 100644
--- a/drivers/ieee1394/dma.c
+++ b/drivers/ieee1394/dma.c
@@ -111,8 +111,8 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes,
111 unsigned long va = 111 unsigned long va =
112 (unsigned long)dma->kvirt + (i << PAGE_SHIFT); 112 (unsigned long)dma->kvirt + (i << PAGE_SHIFT);
113 113
114 sg_set_page(&dma->sglist[i], vmalloc_to_page((void *)va)); 114 sg_set_page(&dma->sglist[i], vmalloc_to_page((void *)va),
115 dma->sglist[i].length = PAGE_SIZE; 115 PAGE_SIZE, 0);
116 } 116 }
117 117
118 /* map sglist to the IOMMU */ 118 /* map sglist to the IOMMU */
diff --git a/drivers/ieee1394/ieee1394_transactions.c b/drivers/ieee1394/ieee1394_transactions.c
index c39c70a8aa9f..677989320951 100644
--- a/drivers/ieee1394/ieee1394_transactions.c
+++ b/drivers/ieee1394/ieee1394_transactions.c
@@ -235,7 +235,6 @@ int hpsb_packet_success(struct hpsb_packet *packet)
235 packet->node_id); 235 packet->node_id);
236 return -EAGAIN; 236 return -EAGAIN;
237 } 237 }
238 BUG();
239 238
240 case ACK_BUSY_X: 239 case ACK_BUSY_X:
241 case ACK_BUSY_A: 240 case ACK_BUSY_A:
@@ -282,7 +281,6 @@ int hpsb_packet_success(struct hpsb_packet *packet)
282 packet->ack_code, packet->node_id, packet->tcode); 281 packet->ack_code, packet->node_id, packet->tcode);
283 return -EAGAIN; 282 return -EAGAIN;
284 } 283 }
285 BUG();
286} 284}
287 285
288struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, 286struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c
index d7f64525469b..e8d5f6b64998 100644
--- a/drivers/infiniband/core/fmr_pool.c
+++ b/drivers/infiniband/core/fmr_pool.c
@@ -291,10 +291,10 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
291 atomic_set(&pool->flush_ser, 0); 291 atomic_set(&pool->flush_ser, 0);
292 init_waitqueue_head(&pool->force_wait); 292 init_waitqueue_head(&pool->force_wait);
293 293
294 pool->thread = kthread_create(ib_fmr_cleanup_thread, 294 pool->thread = kthread_run(ib_fmr_cleanup_thread,
295 pool, 295 pool,
296 "ib_fmr(%s)", 296 "ib_fmr(%s)",
297 device->name); 297 device->name);
298 if (IS_ERR(pool->thread)) { 298 if (IS_ERR(pool->thread)) {
299 printk(KERN_WARNING PFX "couldn't start cleanup thread\n"); 299 printk(KERN_WARNING PFX "couldn't start cleanup thread\n");
300 ret = PTR_ERR(pool->thread); 300 ret = PTR_ERR(pool->thread);
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 14159ff29408..4e3128ff73c1 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -171,9 +171,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
171 if (vma_list && 171 if (vma_list &&
172 !is_vm_hugetlb_page(vma_list[i + off])) 172 !is_vm_hugetlb_page(vma_list[i + off]))
173 umem->hugetlb = 0; 173 umem->hugetlb = 0;
174 sg_set_page(&chunk->page_list[i], page_list[i + off]); 174 sg_set_page(&chunk->page_list[i], page_list[i + off], PAGE_SIZE, 0);
175 chunk->page_list[i].offset = 0;
176 chunk->page_list[i].length = PAGE_SIZE;
177 } 175 }
178 176
179 chunk->nmap = ib_dma_map_sg(context->device, 177 chunk->nmap = ib_dma_map_sg(context->device,
diff --git a/drivers/infiniband/hw/ipath/ipath_eeprom.c b/drivers/infiniband/hw/ipath/ipath_eeprom.c
index bcfa3ccb555f..e7c25dbbcdc9 100644
--- a/drivers/infiniband/hw/ipath/ipath_eeprom.c
+++ b/drivers/infiniband/hw/ipath/ipath_eeprom.c
@@ -538,7 +538,15 @@ static u8 flash_csum(struct ipath_flash *ifp, int adjust)
538 u8 *ip = (u8 *) ifp; 538 u8 *ip = (u8 *) ifp;
539 u8 csum = 0, len; 539 u8 csum = 0, len;
540 540
541 for (len = 0; len < ifp->if_length; len++) 541 /*
542 * Limit length checksummed to max length of actual data.
543 * Checksum of erased eeprom will still be bad, but we avoid
544 * reading past the end of the buffer we were passed.
545 */
546 len = ifp->if_length;
547 if (len > sizeof(struct ipath_flash))
548 len = sizeof(struct ipath_flash);
549 while (len--)
542 csum += *ip++; 550 csum += *ip++;
543 csum -= ifp->if_csum; 551 csum -= ifp->if_csum;
544 csum = ~csum; 552 csum = ~csum;
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c
index 6a5dd5cd773d..c61f9da2964a 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -453,7 +453,7 @@ skip_ibchange:
453} 453}
454 454
455static void handle_supp_msgs(struct ipath_devdata *dd, 455static void handle_supp_msgs(struct ipath_devdata *dd,
456 unsigned supp_msgs, char msg[512]) 456 unsigned supp_msgs, char *msg, int msgsz)
457{ 457{
458 /* 458 /*
459 * Print the message unless it's ibc status change only, which 459 * Print the message unless it's ibc status change only, which
@@ -461,9 +461,9 @@ static void handle_supp_msgs(struct ipath_devdata *dd,
461 */ 461 */
462 if (dd->ipath_lasterror & ~INFINIPATH_E_IBSTATUSCHANGED) { 462 if (dd->ipath_lasterror & ~INFINIPATH_E_IBSTATUSCHANGED) {
463 int iserr; 463 int iserr;
464 iserr = ipath_decode_err(msg, sizeof msg, 464 iserr = ipath_decode_err(msg, msgsz,
465 dd->ipath_lasterror & 465 dd->ipath_lasterror &
466 ~INFINIPATH_E_IBSTATUSCHANGED); 466 ~INFINIPATH_E_IBSTATUSCHANGED);
467 if (dd->ipath_lasterror & 467 if (dd->ipath_lasterror &
468 ~(INFINIPATH_E_RRCVEGRFULL | 468 ~(INFINIPATH_E_RRCVEGRFULL |
469 INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS)) 469 INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS))
@@ -492,8 +492,8 @@ static void handle_supp_msgs(struct ipath_devdata *dd,
492} 492}
493 493
494static unsigned handle_frequent_errors(struct ipath_devdata *dd, 494static unsigned handle_frequent_errors(struct ipath_devdata *dd,
495 ipath_err_t errs, char msg[512], 495 ipath_err_t errs, char *msg,
496 int *noprint) 496 int msgsz, int *noprint)
497{ 497{
498 unsigned long nc; 498 unsigned long nc;
499 static unsigned long nextmsg_time; 499 static unsigned long nextmsg_time;
@@ -512,7 +512,7 @@ static unsigned handle_frequent_errors(struct ipath_devdata *dd,
512 nextmsg_time = nc + HZ * 3; 512 nextmsg_time = nc + HZ * 3;
513 } 513 }
514 else if (supp_msgs) { 514 else if (supp_msgs) {
515 handle_supp_msgs(dd, supp_msgs, msg); 515 handle_supp_msgs(dd, supp_msgs, msg, msgsz);
516 supp_msgs = 0; 516 supp_msgs = 0;
517 nmsgs = 0; 517 nmsgs = 0;
518 } 518 }
@@ -525,14 +525,14 @@ static unsigned handle_frequent_errors(struct ipath_devdata *dd,
525 525
526static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs) 526static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
527{ 527{
528 char msg[512]; 528 char msg[128];
529 u64 ignore_this_time = 0; 529 u64 ignore_this_time = 0;
530 int i, iserr = 0; 530 int i, iserr = 0;
531 int chkerrpkts = 0, noprint = 0; 531 int chkerrpkts = 0, noprint = 0;
532 unsigned supp_msgs; 532 unsigned supp_msgs;
533 int log_idx; 533 int log_idx;
534 534
535 supp_msgs = handle_frequent_errors(dd, errs, msg, &noprint); 535 supp_msgs = handle_frequent_errors(dd, errs, msg, sizeof msg, &noprint);
536 536
537 /* don't report errors that are masked */ 537 /* don't report errors that are masked */
538 errs &= ~dd->ipath_maskederrs; 538 errs &= ~dd->ipath_maskederrs;
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c
index 4b6b7ee8e5c1..54c61a972de2 100644
--- a/drivers/infiniband/hw/ipath/ipath_ruc.c
+++ b/drivers/infiniband/hw/ipath/ipath_ruc.c
@@ -630,11 +630,8 @@ bail:;
630void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe, 630void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe,
631 enum ib_wc_status status) 631 enum ib_wc_status status)
632{ 632{
633 u32 last = qp->s_last; 633 unsigned long flags;
634 634 u32 last;
635 if (++last == qp->s_size)
636 last = 0;
637 qp->s_last = last;
638 635
639 /* See ch. 11.2.4.1 and 10.7.3.1 */ 636 /* See ch. 11.2.4.1 and 10.7.3.1 */
640 if (!(qp->s_flags & IPATH_S_SIGNAL_REQ_WR) || 637 if (!(qp->s_flags & IPATH_S_SIGNAL_REQ_WR) ||
@@ -658,4 +655,11 @@ void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe,
658 wc.port_num = 0; 655 wc.port_num = 0;
659 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 0); 656 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 0);
660 } 657 }
658
659 spin_lock_irqsave(&qp->s_lock, flags);
660 last = qp->s_last;
661 if (++last >= qp->s_size)
662 last = 0;
663 qp->s_last = last;
664 spin_unlock_irqrestore(&qp->s_lock, flags);
661} 665}
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 6b3322486b5e..8cba9c532e64 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1282,7 +1282,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1282 int size; 1282 int size;
1283 int i; 1283 int i;
1284 1284
1285 spin_lock_irqsave(&qp->rq.lock, flags); 1285 spin_lock_irqsave(&qp->sq.lock, flags);
1286 1286
1287 ind = qp->sq.head; 1287 ind = qp->sq.head;
1288 1288
@@ -1448,7 +1448,7 @@ out:
1448 (qp->sq.wqe_cnt - 1)); 1448 (qp->sq.wqe_cnt - 1));
1449 } 1449 }
1450 1450
1451 spin_unlock_irqrestore(&qp->rq.lock, flags); 1451 spin_unlock_irqrestore(&qp->sq.lock, flags);
1452 1452
1453 return err; 1453 return err;
1454} 1454}
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
index 007b38157fc4..1f4d27d7c16d 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -113,9 +113,7 @@ static int mthca_alloc_icm_pages(struct scatterlist *mem, int order, gfp_t gfp_m
113 if (!page) 113 if (!page)
114 return -ENOMEM; 114 return -ENOMEM;
115 115
116 sg_set_page(mem, page); 116 sg_set_page(mem, page, PAGE_SIZE << order, 0);
117 mem->length = PAGE_SIZE << order;
118 mem->offset = 0;
119 return 0; 117 return 0;
120} 118}
121 119
@@ -481,9 +479,8 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
481 if (ret < 0) 479 if (ret < 0)
482 goto out; 480 goto out;
483 481
484 sg_set_page(&db_tab->page[i].mem, pages[0]); 482 sg_set_page(&db_tab->page[i].mem, pages[0], MTHCA_ICM_PAGE_SIZE,
485 db_tab->page[i].mem.length = MTHCA_ICM_PAGE_SIZE; 483 uaddr & ~PAGE_MASK);
486 db_tab->page[i].mem.offset = uaddr & ~PAGE_MASK;
487 484
488 ret = pci_map_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE); 485 ret = pci_map_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE);
489 if (ret < 0) { 486 if (ret < 0) {
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 87610772a979..059cf92b60a5 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -60,7 +60,7 @@ static struct ib_qp_attr ipoib_cm_err_attr = {
60 .qp_state = IB_QPS_ERR 60 .qp_state = IB_QPS_ERR
61}; 61};
62 62
63#define IPOIB_CM_RX_DRAIN_WRID 0x7fffffff 63#define IPOIB_CM_RX_DRAIN_WRID 0xffffffff
64 64
65static struct ib_send_wr ipoib_cm_rx_drain_wr = { 65static struct ib_send_wr ipoib_cm_rx_drain_wr = {
66 .wr_id = IPOIB_CM_RX_DRAIN_WRID, 66 .wr_id = IPOIB_CM_RX_DRAIN_WRID,
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 6dd375825a14..6e9d75bd2b15 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -120,6 +120,7 @@ static const struct xpad_device {
120 { 0x0738, 0x4536, "Mad Catz MicroCON", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 120 { 0x0738, 0x4536, "Mad Catz MicroCON", MAP_DPAD_TO_AXES, XTYPE_XBOX },
121 { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, 121 { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
122 { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 122 { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
123 { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
123 { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, 124 { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
124 { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 125 { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
125 { 0x0c12, 0x8810, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 126 { 0x0c12, 0x8810, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
@@ -129,6 +130,7 @@ static const struct xpad_device {
129 { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 130 { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
130 { 0x0e6f, 0x0005, "Eclipse wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 131 { 0x0e6f, 0x0005, "Eclipse wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
131 { 0x0e6f, 0x0006, "Edge wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 132 { 0x0e6f, 0x0006, "Edge wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
133 { 0x0e6f, 0x0006, "Pelican 'TSZ' Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
132 { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 134 { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", MAP_DPAD_TO_AXES, XTYPE_XBOX },
133 { 0x0f30, 0x0202, "Joytech Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 135 { 0x0f30, 0x0202, "Joytech Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
134 { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 136 { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
index 4941a9e61e90..43aaa5cebd12 100644
--- a/drivers/input/misc/pcspkr.c
+++ b/drivers/input/misc/pcspkr.c
@@ -24,7 +24,7 @@ MODULE_DESCRIPTION("PC Speaker beeper driver");
24MODULE_LICENSE("GPL"); 24MODULE_LICENSE("GPL");
25MODULE_ALIAS("platform:pcspkr"); 25MODULE_ALIAS("platform:pcspkr");
26 26
27#ifdef CONFIG_X86 27#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
28/* Use the global PIT lock ! */ 28/* Use the global PIT lock ! */
29#include <asm/i8253.h> 29#include <asm/i8253.h>
30#else 30#else
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index f132702d137d..b4423a471f02 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -129,12 +129,12 @@ MODULE_DEVICE_TABLE (usb, atp_table);
129 */ 129 */
130#define ATP_THRESHOLD 5 130#define ATP_THRESHOLD 5
131 131
132/* MacBook Pro (Geyser 3 & 4) initialization constants */ 132/* Geyser initialization constants */
133#define ATP_GEYSER3_MODE_READ_REQUEST_ID 1 133#define ATP_GEYSER_MODE_READ_REQUEST_ID 1
134#define ATP_GEYSER3_MODE_WRITE_REQUEST_ID 9 134#define ATP_GEYSER_MODE_WRITE_REQUEST_ID 9
135#define ATP_GEYSER3_MODE_REQUEST_VALUE 0x300 135#define ATP_GEYSER_MODE_REQUEST_VALUE 0x300
136#define ATP_GEYSER3_MODE_REQUEST_INDEX 0 136#define ATP_GEYSER_MODE_REQUEST_INDEX 0
137#define ATP_GEYSER3_MODE_VENDOR_VALUE 0x04 137#define ATP_GEYSER_MODE_VENDOR_VALUE 0x04
138 138
139/* Structure to hold all of our device specific stuff */ 139/* Structure to hold all of our device specific stuff */
140struct atp { 140struct atp {
@@ -142,9 +142,11 @@ struct atp {
142 struct usb_device * udev; /* usb device */ 142 struct usb_device * udev; /* usb device */
143 struct urb * urb; /* usb request block */ 143 struct urb * urb; /* usb request block */
144 signed char * data; /* transferred data */ 144 signed char * data; /* transferred data */
145 int open; /* non-zero if opened */ 145 struct input_dev * input; /* input dev */
146 struct input_dev *input; /* input dev */ 146 unsigned char open; /* non-zero if opened */
147 int valid; /* are the sensors valid ? */ 147 unsigned char valid; /* are the sensors valid ? */
148 unsigned char size_detect_done;
149 unsigned char overflowwarn; /* overflow warning printed? */
148 int x_old; /* last reported x/y, */ 150 int x_old; /* last reported x/y, */
149 int y_old; /* used for smoothing */ 151 int y_old; /* used for smoothing */
150 /* current value of the sensors */ 152 /* current value of the sensors */
@@ -153,7 +155,6 @@ struct atp {
153 signed char xy_old[ATP_XSENSORS + ATP_YSENSORS]; 155 signed char xy_old[ATP_XSENSORS + ATP_YSENSORS];
154 /* accumulated sensors */ 156 /* accumulated sensors */
155 int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; 157 int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
156 int overflowwarn; /* overflow warning printed? */
157 int datalen; /* size of an USB urb transfer */ 158 int datalen; /* size of an USB urb transfer */
158 int idlecount; /* number of empty packets */ 159 int idlecount; /* number of empty packets */
159 struct work_struct work; 160 struct work_struct work;
@@ -170,7 +171,7 @@ struct atp {
170 171
171#define dprintk(format, a...) \ 172#define dprintk(format, a...) \
172 do { \ 173 do { \
173 if (debug) printk(format, ##a); \ 174 if (debug) printk(KERN_DEBUG format, ##a); \
174 } while (0) 175 } while (0)
175 176
176MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold, Michael Hanselmann"); 177MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold, Michael Hanselmann");
@@ -188,6 +189,15 @@ static int debug = 1;
188module_param(debug, int, 0644); 189module_param(debug, int, 0644);
189MODULE_PARM_DESC(debug, "Activate debugging output"); 190MODULE_PARM_DESC(debug, "Activate debugging output");
190 191
192static inline int atp_is_fountain(struct atp *dev)
193{
194 u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct);
195
196 return productId == FOUNTAIN_ANSI_PRODUCT_ID ||
197 productId == FOUNTAIN_ISO_PRODUCT_ID ||
198 productId == FOUNTAIN_TP_ONLY_PRODUCT_ID;
199}
200
191/* Checks if the device a Geyser 2 (ANSI, ISO, JIS) */ 201/* Checks if the device a Geyser 2 (ANSI, ISO, JIS) */
192static inline int atp_is_geyser_2(struct atp *dev) 202static inline int atp_is_geyser_2(struct atp *dev)
193{ 203{
@@ -211,52 +221,63 @@ static inline int atp_is_geyser_3(struct atp *dev)
211} 221}
212 222
213/* 223/*
214 * By default Geyser 3 device sends standard USB HID mouse 224 * By default newer Geyser devices send standard USB HID mouse
215 * packets (Report ID 2). This code changes device mode, so it 225 * packets (Report ID 2). This code changes device mode, so it
216 * sends raw sensor reports (Report ID 5). 226 * sends raw sensor reports (Report ID 5).
217 */ 227 */
218static int atp_geyser3_init(struct usb_device *udev) 228static int atp_geyser_init(struct usb_device *udev)
219{ 229{
220 char data[8]; 230 char data[8];
221 int size; 231 int size;
222 232
223 size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 233 size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
224 ATP_GEYSER3_MODE_READ_REQUEST_ID, 234 ATP_GEYSER_MODE_READ_REQUEST_ID,
225 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 235 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
226 ATP_GEYSER3_MODE_REQUEST_VALUE, 236 ATP_GEYSER_MODE_REQUEST_VALUE,
227 ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); 237 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000);
228 238
229 if (size != 8) { 239 if (size != 8) {
230 err("Could not do mode read request from device" 240 err("Could not do mode read request from device"
231 " (Geyser 3 mode)"); 241 " (Geyser Raw mode)");
232 return -EIO; 242 return -EIO;
233 } 243 }
234 244
235 /* Apply the mode switch */ 245 /* Apply the mode switch */
236 data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE; 246 data[0] = ATP_GEYSER_MODE_VENDOR_VALUE;
237 247
238 size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 248 size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
239 ATP_GEYSER3_MODE_WRITE_REQUEST_ID, 249 ATP_GEYSER_MODE_WRITE_REQUEST_ID,
240 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 250 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
241 ATP_GEYSER3_MODE_REQUEST_VALUE, 251 ATP_GEYSER_MODE_REQUEST_VALUE,
242 ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); 252 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000);
243 253
244 if (size != 8) { 254 if (size != 8) {
245 err("Could not do mode write request to device" 255 err("Could not do mode write request to device"
246 " (Geyser 3 mode)"); 256 " (Geyser Raw mode)");
247 return -EIO; 257 return -EIO;
248 } 258 }
249 return 0; 259 return 0;
250} 260}
251 261
252/* Reinitialise the device if it's a geyser 3 */ 262/*
263 * Reinitialise the device. This usually stops stream of empty packets
264 * coming from it.
265 */
253static void atp_reinit(struct work_struct *work) 266static void atp_reinit(struct work_struct *work)
254{ 267{
255 struct atp *dev = container_of(work, struct atp, work); 268 struct atp *dev = container_of(work, struct atp, work);
256 struct usb_device *udev = dev->udev; 269 struct usb_device *udev = dev->udev;
270 int retval;
257 271
258 dev->idlecount = 0; 272 dev->idlecount = 0;
259 atp_geyser3_init(udev); 273
274 atp_geyser_init(udev);
275
276 retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
277 if (retval) {
278 err("%s - usb_submit_urb failed with result %d",
279 __FUNCTION__, retval);
280 }
260} 281}
261 282
262static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, 283static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
@@ -337,7 +358,7 @@ static void atp_complete(struct urb* urb)
337 break; 358 break;
338 case -EOVERFLOW: 359 case -EOVERFLOW:
339 if(!dev->overflowwarn) { 360 if(!dev->overflowwarn) {
340 printk("appletouch: OVERFLOW with data " 361 printk(KERN_WARNING "appletouch: OVERFLOW with data "
341 "length %d, actual length is %d\n", 362 "length %d, actual length is %d\n",
342 dev->datalen, dev->urb->actual_length); 363 dev->datalen, dev->urb->actual_length);
343 dev->overflowwarn = 1; 364 dev->overflowwarn = 1;
@@ -426,15 +447,17 @@ static void atp_complete(struct urb* urb)
426 dev->x_old = dev->y_old = -1; 447 dev->x_old = dev->y_old = -1;
427 memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old)); 448 memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
428 449
429 if (atp_is_geyser_3(dev)) /* No 17" Macbooks (yet) */ 450 if (dev->size_detect_done ||
451 atp_is_geyser_3(dev)) /* No 17" Macbooks (yet) */
430 goto exit; 452 goto exit;
431 453
432 /* 17" Powerbooks have extra X sensors */ 454 /* 17" Powerbooks have extra X sensors */
433 for (i = (atp_is_geyser_2(dev)?15:16); i < ATP_XSENSORS; i++) { 455 for (i = (atp_is_geyser_2(dev) ? 15 : 16); i < ATP_XSENSORS; i++) {
434 if (!dev->xy_cur[i]) continue; 456 if (!dev->xy_cur[i])
457 continue;
435 458
436 printk("appletouch: 17\" model detected.\n"); 459 printk(KERN_INFO "appletouch: 17\" model detected.\n");
437 if(atp_is_geyser_2(dev)) 460 if (atp_is_geyser_2(dev))
438 input_set_abs_params(dev->input, ABS_X, 0, 461 input_set_abs_params(dev->input, ABS_X, 0,
439 (20 - 1) * 462 (20 - 1) *
440 ATP_XFACT - 1, 463 ATP_XFACT - 1,
@@ -444,10 +467,10 @@ static void atp_complete(struct urb* urb)
444 (ATP_XSENSORS - 1) * 467 (ATP_XSENSORS - 1) *
445 ATP_XFACT - 1, 468 ATP_XFACT - 1,
446 ATP_FUZZ, 0); 469 ATP_FUZZ, 0);
447
448 break; 470 break;
449 } 471 }
450 472
473 dev->size_detect_done = 1;
451 goto exit; 474 goto exit;
452 } 475 }
453 476
@@ -479,7 +502,7 @@ static void atp_complete(struct urb* urb)
479 dev->y_old = y; 502 dev->y_old = y;
480 503
481 if (debug > 1) 504 if (debug > 1)
482 printk("appletouch: X: %3d Y: %3d " 505 printk(KERN_DEBUG "appletouch: X: %3d Y: %3d "
483 "Xz: %3d Yz: %3d\n", 506 "Xz: %3d Yz: %3d\n",
484 x, y, x_z, y_z); 507 x, y, x_z, y_z);
485 508
@@ -507,19 +530,25 @@ static void atp_complete(struct urb* urb)
507 input_report_key(dev->input, BTN_LEFT, key); 530 input_report_key(dev->input, BTN_LEFT, key);
508 input_sync(dev->input); 531 input_sync(dev->input);
509 532
510 /* Many Geysers will continue to send packets continually after 533 /*
511 the first touch unless reinitialised. Do so if it's been 534 * Many Geysers will continue to send packets continually after
512 idle for a while in order to avoid waking the kernel up 535 * the first touch unless reinitialised. Do so if it's been
513 several hundred times a second */ 536 * idle for a while in order to avoid waking the kernel up
514 537 * several hundred times a second. Re-initialization does not
515 if (!x && !y && !key) { 538 * work on Fountain touchpads.
516 dev->idlecount++; 539 */
517 if (dev->idlecount == 10) { 540 if (!atp_is_fountain(dev)) {
518 dev->valid = 0; 541 if (!x && !y && !key) {
519 schedule_work(&dev->work); 542 dev->idlecount++;
520 } 543 if (dev->idlecount == 10) {
521 } else 544 dev->valid = 0;
522 dev->idlecount = 0; 545 schedule_work(&dev->work);
546 /* Don't resubmit urb here, wait for reinit */
547 return;
548 }
549 } else
550 dev->idlecount = 0;
551 }
523 552
524exit: 553exit:
525 retval = usb_submit_urb(dev->urb, GFP_ATOMIC); 554 retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
@@ -593,12 +622,12 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
593 else 622 else
594 dev->datalen = 81; 623 dev->datalen = 81;
595 624
596 if (atp_is_geyser_3(dev)) { 625 if (!atp_is_fountain(dev)) {
597 /* switch to raw sensor mode */ 626 /* switch to raw sensor mode */
598 if (atp_geyser3_init(udev)) 627 if (atp_geyser_init(udev))
599 goto err_free_devs; 628 goto err_free_devs;
600 629
601 printk("appletouch Geyser 3 inited.\n"); 630 printk(KERN_INFO "appletouch: Geyser mode initialized.\n");
602 } 631 }
603 632
604 dev->urb = usb_alloc_urb(0, GFP_KERNEL); 633 dev->urb = usb_alloc_urb(0, GFP_KERNEL);
diff --git a/drivers/input/mouse/inport.c b/drivers/input/mouse/inport.c
index 655a39217432..26ec09529b51 100644
--- a/drivers/input/mouse/inport.c
+++ b/drivers/input/mouse/inport.c
@@ -144,7 +144,7 @@ static int __init inport_init(void)
144 b = inb(INPORT_SIGNATURE_PORT); 144 b = inb(INPORT_SIGNATURE_PORT);
145 c = inb(INPORT_SIGNATURE_PORT); 145 c = inb(INPORT_SIGNATURE_PORT);
146 if (a == b || a != c) { 146 if (a == b || a != c) {
147 printk(KERN_ERR "inport.c: Didn't find InPort mouse at %#x\n", INPORT_BASE); 147 printk(KERN_INFO "inport.c: Didn't find InPort mouse at %#x\n", INPORT_BASE);
148 err = -ENODEV; 148 err = -ENODEV;
149 goto err_release_region; 149 goto err_release_region;
150 } 150 }
diff --git a/drivers/input/mouse/logibm.c b/drivers/input/mouse/logibm.c
index b23a4f3ea5cd..37e7c75b43bd 100644
--- a/drivers/input/mouse/logibm.c
+++ b/drivers/input/mouse/logibm.c
@@ -134,7 +134,7 @@ static int __init logibm_init(void)
134 udelay(100); 134 udelay(100);
135 135
136 if (inb(LOGIBM_SIGNATURE_PORT) != LOGIBM_SIGNATURE_BYTE) { 136 if (inb(LOGIBM_SIGNATURE_PORT) != LOGIBM_SIGNATURE_BYTE) {
137 printk(KERN_ERR "logibm.c: Didn't find Logitech busmouse at %#x\n", LOGIBM_BASE); 137 printk(KERN_INFO "logibm.c: Didn't find Logitech busmouse at %#x\n", LOGIBM_BASE);
138 err = -ENODEV; 138 err = -ENODEV;
139 goto err_release_region; 139 goto err_release_region;
140 } 140 }
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c
index 6af199805ffc..02b3ad8c0826 100644
--- a/drivers/input/serio/hp_sdc.c
+++ b/drivers/input/serio/hp_sdc.c
@@ -944,11 +944,7 @@ static int __init hp_sdc_init_hppa(struct parisc_device *d)
944 944
945#endif /* __hppa__ */ 945#endif /* __hppa__ */
946 946
947#if !defined(__mc68000__) /* Link error on m68k! */
948static void __exit hp_sdc_exit(void)
949#else
950static void hp_sdc_exit(void) 947static void hp_sdc_exit(void)
951#endif
952{ 948{
953 write_lock_irq(&hp_sdc.lock); 949 write_lock_irq(&hp_sdc.lock);
954 950
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index 476012b6dfac..48c1775ef5b3 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -1843,6 +1843,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
1843 int msglen; 1843 int msglen;
1844 u16 errcode; 1844 u16 errcode;
1845 u16 datahandle; 1845 u16 datahandle;
1846 u32 data;
1846 1847
1847 if (!card) { 1848 if (!card) {
1848 printk(KERN_ERR "capidrv: if_sendbuf called with invalid driverId %d!\n", 1849 printk(KERN_ERR "capidrv: if_sendbuf called with invalid driverId %d!\n",
@@ -1860,9 +1861,26 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
1860 return 0; 1861 return 0;
1861 } 1862 }
1862 datahandle = nccip->datahandle; 1863 datahandle = nccip->datahandle;
1864
1865 /*
1866 * Here we copy pointer skb->data into the 32-bit 'Data' field.
1867 * The 'Data' field is not used in practice in linux kernel
1868 * (neither in 32 or 64 bit), but should have some value,
1869 * since a CAPI message trace will display it.
1870 *
1871 * The correct value in the 32 bit case is the address of the
1872 * data, in 64 bit it makes no sense, we use 0 there.
1873 */
1874
1875#ifdef CONFIG_64BIT
1876 data = 0;
1877#else
1878 data = (unsigned long) skb->data;
1879#endif
1880
1863 capi_fill_DATA_B3_REQ(&sendcmsg, global.ap.applid, card->msgid++, 1881 capi_fill_DATA_B3_REQ(&sendcmsg, global.ap.applid, card->msgid++,
1864 nccip->ncci, /* adr */ 1882 nccip->ncci, /* adr */
1865 (u32) skb->data, /* Data */ 1883 data, /* Data */
1866 skb->len, /* DataLength */ 1884 skb->len, /* DataLength */
1867 datahandle, /* DataHandle */ 1885 datahandle, /* DataHandle */
1868 0 /* Flags */ 1886 0 /* Flags */
@@ -2123,7 +2141,10 @@ static int capidrv_delcontr(u16 contr)
2123 printk(KERN_ERR "capidrv: delcontr: no contr %u\n", contr); 2141 printk(KERN_ERR "capidrv: delcontr: no contr %u\n", contr);
2124 return -1; 2142 return -1;
2125 } 2143 }
2126 #warning FIXME: maybe a race condition the card should be removed here from global list /kkeil 2144
2145 /* FIXME: maybe a race condition the card should be removed
2146 * here from global list /kkeil
2147 */
2127 spin_unlock_irqrestore(&global_lock, flags); 2148 spin_unlock_irqrestore(&global_lock, flags);
2128 2149
2129 del_timer(&card->listentimer); 2150 del_timer(&card->listentimer);
diff --git a/drivers/isdn/sc/shmem.c b/drivers/isdn/sc/shmem.c
index 034d41a61ae1..e0331e0094f1 100644
--- a/drivers/isdn/sc/shmem.c
+++ b/drivers/isdn/sc/shmem.c
@@ -28,15 +28,15 @@ void memcpy_toshmem(int card, void *dest, const void *src, size_t n)
28{ 28{
29 unsigned long flags; 29 unsigned long flags;
30 unsigned char ch; 30 unsigned char ch;
31 unsigned long dest_rem = ((unsigned long) dest) % 0x4000;
31 32
32 if(!IS_VALID_CARD(card)) { 33 if (!IS_VALID_CARD(card)) {
33 pr_debug("Invalid param: %d is not a valid card id\n", card); 34 pr_debug("Invalid param: %d is not a valid card id\n", card);
34 return; 35 return;
35 } 36 }
36 37
37 if(n > SRAM_PAGESIZE) { 38 if (n > SRAM_PAGESIZE)
38 return; 39 return;
39 }
40 40
41 /* 41 /*
42 * determine the page to load from the address 42 * determine the page to load from the address
@@ -50,8 +50,7 @@ void memcpy_toshmem(int card, void *dest, const void *src, size_t n)
50 50
51 outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, 51 outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80,
52 sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); 52 sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]);
53 memcpy_toio(sc_adapter[card]->rambase + 53 memcpy_toio(sc_adapter[card]->rambase + dest_rem, src, n);
54 ((unsigned long) dest % 0x4000), src, n);
55 spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); 54 spin_unlock_irqrestore(&sc_adapter[card]->lock, flags);
56 pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename, 55 pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename,
57 ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); 56 ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80);
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 35d19ae58de7..cb4c67025d52 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -128,9 +128,12 @@ static void unmap_switcher(void)
128 __free_pages(switcher_page[i], 0); 128 __free_pages(switcher_page[i], 0);
129} 129}
130 130
131/*L:305 131/*H:032
132 * Dealing With Guest Memory. 132 * Dealing With Guest Memory.
133 * 133 *
134 * Before we go too much further into the Host, we need to grok the routines
135 * we use to deal with Guest memory.
136 *
134 * When the Guest gives us (what it thinks is) a physical address, we can use 137 * When the Guest gives us (what it thinks is) a physical address, we can use
135 * the normal copy_from_user() & copy_to_user() on the corresponding place in 138 * the normal copy_from_user() & copy_to_user() on the corresponding place in
136 * the memory region allocated by the Launcher. 139 * the memory region allocated by the Launcher.
diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index 9d5184c7c14a..b478affe8f91 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -90,6 +90,7 @@ static void do_hcall(struct lguest *lg, struct hcall_args *args)
90 lg->pending_notify = args->arg1; 90 lg->pending_notify = args->arg1;
91 break; 91 break;
92 default: 92 default:
93 /* It should be an architecture-specific hypercall. */
93 if (lguest_arch_do_hcall(lg, args)) 94 if (lguest_arch_do_hcall(lg, args))
94 kill_guest(lg, "Bad hypercall %li\n", args->arg0); 95 kill_guest(lg, "Bad hypercall %li\n", args->arg0);
95 } 96 }
@@ -157,7 +158,6 @@ static void do_async_hcalls(struct lguest *lg)
157 * Guest makes a hypercall, we end up here to set things up: */ 158 * Guest makes a hypercall, we end up here to set things up: */
158static void initialize(struct lguest *lg) 159static void initialize(struct lguest *lg)
159{ 160{
160
161 /* You can't do anything until you're initialized. The Guest knows the 161 /* You can't do anything until you're initialized. The Guest knows the
162 * rules, so we're unforgiving here. */ 162 * rules, so we're unforgiving here. */
163 if (lg->hcall->arg0 != LHCALL_LGUEST_INIT) { 163 if (lg->hcall->arg0 != LHCALL_LGUEST_INIT) {
@@ -174,7 +174,8 @@ static void initialize(struct lguest *lg)
174 || get_user(lg->noirq_end, &lg->lguest_data->noirq_end)) 174 || get_user(lg->noirq_end, &lg->lguest_data->noirq_end))
175 kill_guest(lg, "bad guest page %p", lg->lguest_data); 175 kill_guest(lg, "bad guest page %p", lg->lguest_data);
176 176
177 /* We write the current time into the Guest's data page once now. */ 177 /* We write the current time into the Guest's data page once so it can
178 * set its clock. */
178 write_timestamp(lg); 179 write_timestamp(lg);
179 180
180 /* page_tables.c will also do some setup. */ 181 /* page_tables.c will also do some setup. */
@@ -182,8 +183,8 @@ static void initialize(struct lguest *lg)
182 183
183 /* This is the one case where the above accesses might have been the 184 /* This is the one case where the above accesses might have been the
184 * first write to a Guest page. This may have caused a copy-on-write 185 * first write to a Guest page. This may have caused a copy-on-write
185 * fault, but the Guest might be referring to the old (read-only) 186 * fault, but the old page might be (read-only) in the Guest
186 * page. */ 187 * pagetable. */
187 guest_pagetable_clear_all(lg); 188 guest_pagetable_clear_all(lg);
188} 189}
189 190
@@ -220,7 +221,7 @@ void do_hypercalls(struct lguest *lg)
220 * Normally it doesn't matter: the Guest will run again and 221 * Normally it doesn't matter: the Guest will run again and
221 * update the trap number before we come back here. 222 * update the trap number before we come back here.
222 * 223 *
223 * However, if we are signalled or the Guest sends DMA to the 224 * However, if we are signalled or the Guest sends I/O to the
224 * Launcher, the run_guest() loop will exit without running the 225 * Launcher, the run_guest() loop will exit without running the
225 * Guest. When it comes back it would try to re-run the 226 * Guest. When it comes back it would try to re-run the
226 * hypercall. */ 227 * hypercall. */
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c
index 82966982cb38..2b66f79c208b 100644
--- a/drivers/lguest/interrupts_and_traps.c
+++ b/drivers/lguest/interrupts_and_traps.c
@@ -92,8 +92,8 @@ static void set_guest_interrupt(struct lguest *lg, u32 lo, u32 hi, int has_err)
92 92
93 /* Remember that we never let the Guest actually disable interrupts, so 93 /* Remember that we never let the Guest actually disable interrupts, so
94 * the "Interrupt Flag" bit is always set. We copy that bit from the 94 * the "Interrupt Flag" bit is always set. We copy that bit from the
95 * Guest's "irq_enabled" field into the eflags word: the Guest copies 95 * Guest's "irq_enabled" field into the eflags word: we saw the Guest
96 * it back in "lguest_iret". */ 96 * copy it back in "lguest_iret". */
97 eflags = lg->regs->eflags; 97 eflags = lg->regs->eflags;
98 if (get_user(irq_enable, &lg->lguest_data->irq_enabled) == 0 98 if (get_user(irq_enable, &lg->lguest_data->irq_enabled) == 0
99 && !(irq_enable & X86_EFLAGS_IF)) 99 && !(irq_enable & X86_EFLAGS_IF))
@@ -124,7 +124,7 @@ static void set_guest_interrupt(struct lguest *lg, u32 lo, u32 hi, int has_err)
124 kill_guest(lg, "Disabling interrupts"); 124 kill_guest(lg, "Disabling interrupts");
125} 125}
126 126
127/*H:200 127/*H:205
128 * Virtual Interrupts. 128 * Virtual Interrupts.
129 * 129 *
130 * maybe_do_interrupt() gets called before every entry to the Guest, to see if 130 * maybe_do_interrupt() gets called before every entry to the Guest, to see if
@@ -256,19 +256,21 @@ int deliver_trap(struct lguest *lg, unsigned int num)
256 * bogus one in): if we fail here, the Guest will be killed. */ 256 * bogus one in): if we fail here, the Guest will be killed. */
257 if (!idt_present(lg->arch.idt[num].a, lg->arch.idt[num].b)) 257 if (!idt_present(lg->arch.idt[num].a, lg->arch.idt[num].b))
258 return 0; 258 return 0;
259 set_guest_interrupt(lg, lg->arch.idt[num].a, lg->arch.idt[num].b, has_err(num)); 259 set_guest_interrupt(lg, lg->arch.idt[num].a, lg->arch.idt[num].b,
260 has_err(num));
260 return 1; 261 return 1;
261} 262}
262 263
263/*H:250 Here's the hard part: returning to the Host every time a trap happens 264/*H:250 Here's the hard part: returning to the Host every time a trap happens
264 * and then calling deliver_trap() and re-entering the Guest is slow. 265 * and then calling deliver_trap() and re-entering the Guest is slow.
265 * Particularly because Guest userspace system calls are traps (trap 128). 266 * Particularly because Guest userspace system calls are traps (usually trap
267 * 128).
266 * 268 *
267 * So we'd like to set up the IDT to tell the CPU to deliver traps directly 269 * So we'd like to set up the IDT to tell the CPU to deliver traps directly
268 * into the Guest. This is possible, but the complexities cause the size of 270 * into the Guest. This is possible, but the complexities cause the size of
269 * this file to double! However, 150 lines of code is worth writing for taking 271 * this file to double! However, 150 lines of code is worth writing for taking
270 * system calls down from 1750ns to 270ns. Plus, if lguest didn't do it, all 272 * system calls down from 1750ns to 270ns. Plus, if lguest didn't do it, all
271 * the other hypervisors would tease it. 273 * the other hypervisors would beat it up at lunchtime.
272 * 274 *
273 * This routine indicates if a particular trap number could be delivered 275 * This routine indicates if a particular trap number could be delivered
274 * directly. */ 276 * directly. */
@@ -331,7 +333,7 @@ void pin_stack_pages(struct lguest *lg)
331 * change stacks on each context switch. */ 333 * change stacks on each context switch. */
332void guest_set_stack(struct lguest *lg, u32 seg, u32 esp, unsigned int pages) 334void guest_set_stack(struct lguest *lg, u32 seg, u32 esp, unsigned int pages)
333{ 335{
334 /* You are not allowd have a stack segment with privilege level 0: bad 336 /* You are not allowed have a stack segment with privilege level 0: bad
335 * Guest! */ 337 * Guest! */
336 if ((seg & 0x3) != GUEST_PL) 338 if ((seg & 0x3) != GUEST_PL)
337 kill_guest(lg, "bad stack segment %i", seg); 339 kill_guest(lg, "bad stack segment %i", seg);
@@ -350,7 +352,7 @@ void guest_set_stack(struct lguest *lg, u32 seg, u32 esp, unsigned int pages)
350 * part of the Host: page table handling. */ 352 * part of the Host: page table handling. */
351 353
352/*H:235 This is the routine which actually checks the Guest's IDT entry and 354/*H:235 This is the routine which actually checks the Guest's IDT entry and
353 * transfers it into our entry in "struct lguest": */ 355 * transfers it into the entry in "struct lguest": */
354static void set_trap(struct lguest *lg, struct desc_struct *trap, 356static void set_trap(struct lguest *lg, struct desc_struct *trap,
355 unsigned int num, u32 lo, u32 hi) 357 unsigned int num, u32 lo, u32 hi)
356{ 358{
@@ -456,6 +458,18 @@ void copy_traps(const struct lguest *lg, struct desc_struct *idt,
456 } 458 }
457} 459}
458 460
461/*H:200
462 * The Guest Clock.
463 *
464 * There are two sources of virtual interrupts. We saw one in lguest_user.c:
465 * the Launcher sending interrupts for virtual devices. The other is the Guest
466 * timer interrupt.
467 *
468 * The Guest uses the LHCALL_SET_CLOCKEVENT hypercall to tell us how long to
469 * the next timer interrupt (in nanoseconds). We use the high-resolution timer
470 * infrastructure to set a callback at that time.
471 *
472 * 0 means "turn off the clock". */
459void guest_set_clockevent(struct lguest *lg, unsigned long delta) 473void guest_set_clockevent(struct lguest *lg, unsigned long delta)
460{ 474{
461 ktime_t expires; 475 ktime_t expires;
@@ -466,20 +480,27 @@ void guest_set_clockevent(struct lguest *lg, unsigned long delta)
466 return; 480 return;
467 } 481 }
468 482
483 /* We use wallclock time here, so the Guest might not be running for
484 * all the time between now and the timer interrupt it asked for. This
485 * is almost always the right thing to do. */
469 expires = ktime_add_ns(ktime_get_real(), delta); 486 expires = ktime_add_ns(ktime_get_real(), delta);
470 hrtimer_start(&lg->hrt, expires, HRTIMER_MODE_ABS); 487 hrtimer_start(&lg->hrt, expires, HRTIMER_MODE_ABS);
471} 488}
472 489
490/* This is the function called when the Guest's timer expires. */
473static enum hrtimer_restart clockdev_fn(struct hrtimer *timer) 491static enum hrtimer_restart clockdev_fn(struct hrtimer *timer)
474{ 492{
475 struct lguest *lg = container_of(timer, struct lguest, hrt); 493 struct lguest *lg = container_of(timer, struct lguest, hrt);
476 494
495 /* Remember the first interrupt is the timer interrupt. */
477 set_bit(0, lg->irqs_pending); 496 set_bit(0, lg->irqs_pending);
497 /* If the Guest is actually stopped, we need to wake it up. */
478 if (lg->halted) 498 if (lg->halted)
479 wake_up_process(lg->tsk); 499 wake_up_process(lg->tsk);
480 return HRTIMER_NORESTART; 500 return HRTIMER_NORESTART;
481} 501}
482 502
503/* This sets up the timer for this Guest. */
483void init_clockdev(struct lguest *lg) 504void init_clockdev(struct lguest *lg)
484{ 505{
485 hrtimer_init(&lg->hrt, CLOCK_REALTIME, HRTIMER_MODE_ABS); 506 hrtimer_init(&lg->hrt, CLOCK_REALTIME, HRTIMER_MODE_ABS);
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index d9144beca82c..86924891b5eb 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -74,9 +74,6 @@ struct lguest
74 u32 pgdidx; 74 u32 pgdidx;
75 struct pgdir pgdirs[4]; 75 struct pgdir pgdirs[4];
76 76
77 /* Cached wakeup: we hold a reference to this task. */
78 struct task_struct *wake;
79
80 unsigned long noirq_start, noirq_end; 77 unsigned long noirq_start, noirq_end;
81 unsigned long pending_notify; /* pfn from LHCALL_NOTIFY */ 78 unsigned long pending_notify; /* pfn from LHCALL_NOTIFY */
82 79
@@ -103,7 +100,7 @@ int lguest_address_ok(const struct lguest *lg,
103void __lgread(struct lguest *, void *, unsigned long, unsigned); 100void __lgread(struct lguest *, void *, unsigned long, unsigned);
104void __lgwrite(struct lguest *, unsigned long, const void *, unsigned); 101void __lgwrite(struct lguest *, unsigned long, const void *, unsigned);
105 102
106/*L:306 Using memory-copy operations like that is usually inconvient, so we 103/*H:035 Using memory-copy operations like that is usually inconvient, so we
107 * have the following helper macros which read and write a specific type (often 104 * have the following helper macros which read and write a specific type (often
108 * an unsigned long). 105 * an unsigned long).
109 * 106 *
@@ -191,7 +188,7 @@ void write_timestamp(struct lguest *lg);
191 * Let's step aside for the moment, to study one important routine that's used 188 * Let's step aside for the moment, to study one important routine that's used
192 * widely in the Host code. 189 * widely in the Host code.
193 * 190 *
194 * There are many cases where the Guest does something invalid, like pass crap 191 * There are many cases where the Guest can do something invalid, like pass crap
195 * to a hypercall. Since only the Guest kernel can make hypercalls, it's quite 192 * to a hypercall. Since only the Guest kernel can make hypercalls, it's quite
196 * acceptable to simply terminate the Guest and give the Launcher a nicely 193 * acceptable to simply terminate the Guest and give the Launcher a nicely
197 * formatted reason. It's also simpler for the Guest itself, which doesn't 194 * formatted reason. It's also simpler for the Guest itself, which doesn't
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index 71c64837b437..8904f72f97c6 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -53,7 +53,8 @@ struct lguest_device {
53 * Device configurations 53 * Device configurations
54 * 54 *
55 * The configuration information for a device consists of a series of fields. 55 * The configuration information for a device consists of a series of fields.
56 * The device will look for these fields during setup. 56 * We don't really care what they are: the Launcher set them up, and the driver
57 * will look at them during setup.
57 * 58 *
58 * For us these fields come immediately after that device's descriptor in the 59 * For us these fields come immediately after that device's descriptor in the
59 * lguest_devices page. 60 * lguest_devices page.
@@ -122,8 +123,8 @@ static void lg_set_status(struct virtio_device *vdev, u8 status)
122 * The other piece of infrastructure virtio needs is a "virtqueue": a way of 123 * The other piece of infrastructure virtio needs is a "virtqueue": a way of
123 * the Guest device registering buffers for the other side to read from or 124 * the Guest device registering buffers for the other side to read from or
124 * write into (ie. send and receive buffers). Each device can have multiple 125 * write into (ie. send and receive buffers). Each device can have multiple
125 * virtqueues: for example the console has one queue for sending and one for 126 * virtqueues: for example the console driver uses one queue for sending and
126 * receiving. 127 * another for receiving.
127 * 128 *
128 * Fortunately for us, a very fast shared-memory-plus-descriptors virtqueue 129 * Fortunately for us, a very fast shared-memory-plus-descriptors virtqueue
129 * already exists in virtio_ring.c. We just need to connect it up. 130 * already exists in virtio_ring.c. We just need to connect it up.
@@ -158,7 +159,7 @@ static void lg_notify(struct virtqueue *vq)
158 * 159 *
159 * This is kind of an ugly duckling. It'd be nicer to have a standard 160 * This is kind of an ugly duckling. It'd be nicer to have a standard
160 * representation of a virtqueue in the configuration space, but it seems that 161 * representation of a virtqueue in the configuration space, but it seems that
161 * everyone wants to do it differently. The KVM guys want the Guest to 162 * everyone wants to do it differently. The KVM coders want the Guest to
162 * allocate its own pages and tell the Host where they are, but for lguest it's 163 * allocate its own pages and tell the Host where they are, but for lguest it's
163 * simpler for the Host to simply tell us where the pages are. 164 * simpler for the Host to simply tell us where the pages are.
164 * 165 *
@@ -284,6 +285,8 @@ static void add_lguest_device(struct lguest_device_desc *d)
284{ 285{
285 struct lguest_device *ldev; 286 struct lguest_device *ldev;
286 287
288 /* Start with zeroed memory; Linux's device layer seems to count on
289 * it. */
287 ldev = kzalloc(sizeof(*ldev), GFP_KERNEL); 290 ldev = kzalloc(sizeof(*ldev), GFP_KERNEL);
288 if (!ldev) { 291 if (!ldev) {
289 printk(KERN_EMERG "Cannot allocate lguest dev %u\n", 292 printk(KERN_EMERG "Cannot allocate lguest dev %u\n",
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index ee405b38383d..9d716fa42cad 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -8,20 +8,22 @@
8#include <linux/fs.h> 8#include <linux/fs.h>
9#include "lg.h" 9#include "lg.h"
10 10
11/*L:315 To force the Guest to stop running and return to the Launcher, the 11/*L:055 When something happens, the Waker process needs a way to stop the
12 * Waker sets writes LHREQ_BREAK and the value "1" to /dev/lguest. The 12 * kernel running the Guest and return to the Launcher. So the Waker writes
13 * Launcher then writes LHREQ_BREAK and "0" to release the Waker. */ 13 * LHREQ_BREAK and the value "1" to /dev/lguest to do this. Once the Launcher
14 * has done whatever needs attention, it writes LHREQ_BREAK and "0" to release
15 * the Waker. */
14static int break_guest_out(struct lguest *lg, const unsigned long __user *input) 16static int break_guest_out(struct lguest *lg, const unsigned long __user *input)
15{ 17{
16 unsigned long on; 18 unsigned long on;
17 19
18 /* Fetch whether they're turning break on or off.. */ 20 /* Fetch whether they're turning break on or off. */
19 if (get_user(on, input) != 0) 21 if (get_user(on, input) != 0)
20 return -EFAULT; 22 return -EFAULT;
21 23
22 if (on) { 24 if (on) {
23 lg->break_out = 1; 25 lg->break_out = 1;
24 /* Pop it out (may be running on different CPU) */ 26 /* Pop it out of the Guest (may be running on different CPU) */
25 wake_up_process(lg->tsk); 27 wake_up_process(lg->tsk);
26 /* Wait for them to reset it */ 28 /* Wait for them to reset it */
27 return wait_event_interruptible(lg->break_wq, !lg->break_out); 29 return wait_event_interruptible(lg->break_wq, !lg->break_out);
@@ -58,7 +60,7 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
58 if (!lg) 60 if (!lg)
59 return -EINVAL; 61 return -EINVAL;
60 62
61 /* If you're not the task which owns the guest, go away. */ 63 /* If you're not the task which owns the Guest, go away. */
62 if (current != lg->tsk) 64 if (current != lg->tsk)
63 return -EPERM; 65 return -EPERM;
64 66
@@ -92,8 +94,8 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
92 * base: The start of the Guest-physical memory inside the Launcher memory. 94 * base: The start of the Guest-physical memory inside the Launcher memory.
93 * 95 *
94 * pfnlimit: The highest (Guest-physical) page number the Guest should be 96 * pfnlimit: The highest (Guest-physical) page number the Guest should be
95 * allowed to access. The Launcher has to live in Guest memory, so it sets 97 * allowed to access. The Guest memory lives inside the Launcher, so it sets
96 * this to ensure the Guest can't reach it. 98 * this to ensure the Guest can only reach its own memory.
97 * 99 *
98 * pgdir: The (Guest-physical) address of the top of the initial Guest 100 * pgdir: The (Guest-physical) address of the top of the initial Guest
99 * pagetables (which are set up by the Launcher). 101 * pagetables (which are set up by the Launcher).
@@ -189,7 +191,7 @@ unlock:
189} 191}
190 192
191/*L:010 The first operation the Launcher does must be a write. All writes 193/*L:010 The first operation the Launcher does must be a write. All writes
192 * start with a 32 bit number: for the first write this must be 194 * start with an unsigned long number: for the first write this must be
193 * LHREQ_INITIALIZE to set up the Guest. After that the Launcher can use 195 * LHREQ_INITIALIZE to set up the Guest. After that the Launcher can use
194 * writes of other values to send interrupts. */ 196 * writes of other values to send interrupts. */
195static ssize_t write(struct file *file, const char __user *in, 197static ssize_t write(struct file *file, const char __user *in,
@@ -275,8 +277,7 @@ static int close(struct inode *inode, struct file *file)
275 * The Launcher is the Host userspace program which sets up, runs and services 277 * The Launcher is the Host userspace program which sets up, runs and services
276 * the Guest. In fact, many comments in the Drivers which refer to "the Host" 278 * the Guest. In fact, many comments in the Drivers which refer to "the Host"
277 * doing things are inaccurate: the Launcher does all the device handling for 279 * doing things are inaccurate: the Launcher does all the device handling for
278 * the Guest. The Guest can't tell what's done by the the Launcher and what by 280 * the Guest, but the Guest can't know that.
279 * the Host.
280 * 281 *
281 * Just to confuse you: to the Host kernel, the Launcher *is* the Guest and we 282 * Just to confuse you: to the Host kernel, the Launcher *is* the Guest and we
282 * shall see more of that later. 283 * shall see more of that later.
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index 2a45f0691c9b..fffabb327157 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -26,7 +26,8 @@
26 * 26 *
27 * We use two-level page tables for the Guest. If you're not entirely 27 * We use two-level page tables for the Guest. If you're not entirely
28 * comfortable with virtual addresses, physical addresses and page tables then 28 * comfortable with virtual addresses, physical addresses and page tables then
29 * I recommend you review lguest.c's "Page Table Handling" (with diagrams!). 29 * I recommend you review arch/x86/lguest/boot.c's "Page Table Handling" (with
30 * diagrams!).
30 * 31 *
31 * The Guest keeps page tables, but we maintain the actual ones here: these are 32 * The Guest keeps page tables, but we maintain the actual ones here: these are
32 * called "shadow" page tables. Which is a very Guest-centric name: these are 33 * called "shadow" page tables. Which is a very Guest-centric name: these are
@@ -36,11 +37,11 @@
36 * 37 *
37 * Anyway, this is the most complicated part of the Host code. There are seven 38 * Anyway, this is the most complicated part of the Host code. There are seven
38 * parts to this: 39 * parts to this:
39 * (i) Setting up a page table entry for the Guest when it faults, 40 * (i) Looking up a page table entry when the Guest faults,
40 * (ii) Setting up the page table entry for the Guest stack, 41 * (ii) Making sure the Guest stack is mapped,
41 * (iii) Setting up a page table entry when the Guest tells us it has changed, 42 * (iii) Setting up a page table entry when the Guest tells us one has changed,
42 * (iv) Switching page tables, 43 * (iv) Switching page tables,
43 * (v) Flushing (thowing away) page tables, 44 * (v) Flushing (throwing away) page tables,
44 * (vi) Mapping the Switcher when the Guest is about to run, 45 * (vi) Mapping the Switcher when the Guest is about to run,
45 * (vii) Setting up the page tables initially. 46 * (vii) Setting up the page tables initially.
46 :*/ 47 :*/
@@ -57,16 +58,15 @@
57static DEFINE_PER_CPU(pte_t *, switcher_pte_pages); 58static DEFINE_PER_CPU(pte_t *, switcher_pte_pages);
58#define switcher_pte_page(cpu) per_cpu(switcher_pte_pages, cpu) 59#define switcher_pte_page(cpu) per_cpu(switcher_pte_pages, cpu)
59 60
60/*H:320 With our shadow and Guest types established, we need to deal with 61/*H:320 The page table code is curly enough to need helper functions to keep it
61 * them: the page table code is curly enough to need helper functions to keep 62 * clear and clean.
62 * it clear and clean.
63 * 63 *
64 * There are two functions which return pointers to the shadow (aka "real") 64 * There are two functions which return pointers to the shadow (aka "real")
65 * page tables. 65 * page tables.
66 * 66 *
67 * spgd_addr() takes the virtual address and returns a pointer to the top-level 67 * spgd_addr() takes the virtual address and returns a pointer to the top-level
68 * page directory entry for that address. Since we keep track of several page 68 * page directory entry (PGD) for that address. Since we keep track of several
69 * tables, the "i" argument tells us which one we're interested in (it's 69 * page tables, the "i" argument tells us which one we're interested in (it's
70 * usually the current one). */ 70 * usually the current one). */
71static pgd_t *spgd_addr(struct lguest *lg, u32 i, unsigned long vaddr) 71static pgd_t *spgd_addr(struct lguest *lg, u32 i, unsigned long vaddr)
72{ 72{
@@ -81,9 +81,9 @@ static pgd_t *spgd_addr(struct lguest *lg, u32 i, unsigned long vaddr)
81 return &lg->pgdirs[i].pgdir[index]; 81 return &lg->pgdirs[i].pgdir[index];
82} 82}
83 83
84/* This routine then takes the PGD entry given above, which contains the 84/* This routine then takes the page directory entry returned above, which
85 * address of the PTE page. It then returns a pointer to the PTE entry for the 85 * contains the address of the page table entry (PTE) page. It then returns a
86 * given address. */ 86 * pointer to the PTE entry for the given address. */
87static pte_t *spte_addr(struct lguest *lg, pgd_t spgd, unsigned long vaddr) 87static pte_t *spte_addr(struct lguest *lg, pgd_t spgd, unsigned long vaddr)
88{ 88{
89 pte_t *page = __va(pgd_pfn(spgd) << PAGE_SHIFT); 89 pte_t *page = __va(pgd_pfn(spgd) << PAGE_SHIFT);
@@ -191,7 +191,7 @@ static void check_gpgd(struct lguest *lg, pgd_t gpgd)
191} 191}
192 192
193/*H:330 193/*H:330
194 * (i) Setting up a page table entry for the Guest when it faults 194 * (i) Looking up a page table entry when the Guest faults.
195 * 195 *
196 * We saw this call in run_guest(): when we see a page fault in the Guest, we 196 * We saw this call in run_guest(): when we see a page fault in the Guest, we
197 * come here. That's because we only set up the shadow page tables lazily as 197 * come here. That's because we only set up the shadow page tables lazily as
@@ -199,7 +199,7 @@ static void check_gpgd(struct lguest *lg, pgd_t gpgd)
199 * and return to the Guest without it knowing. 199 * and return to the Guest without it knowing.
200 * 200 *
201 * If we fixed up the fault (ie. we mapped the address), this routine returns 201 * If we fixed up the fault (ie. we mapped the address), this routine returns
202 * true. */ 202 * true. Otherwise, it was a real fault and we need to tell the Guest. */
203int demand_page(struct lguest *lg, unsigned long vaddr, int errcode) 203int demand_page(struct lguest *lg, unsigned long vaddr, int errcode)
204{ 204{
205 pgd_t gpgd; 205 pgd_t gpgd;
@@ -246,16 +246,16 @@ int demand_page(struct lguest *lg, unsigned long vaddr, int errcode)
246 if ((errcode & 2) && !(pte_flags(gpte) & _PAGE_RW)) 246 if ((errcode & 2) && !(pte_flags(gpte) & _PAGE_RW))
247 return 0; 247 return 0;
248 248
249 /* User access to a kernel page? (bit 3 == user access) */ 249 /* User access to a kernel-only page? (bit 3 == user access) */
250 if ((errcode & 4) && !(pte_flags(gpte) & _PAGE_USER)) 250 if ((errcode & 4) && !(pte_flags(gpte) & _PAGE_USER))
251 return 0; 251 return 0;
252 252
253 /* Check that the Guest PTE flags are OK, and the page number is below 253 /* Check that the Guest PTE flags are OK, and the page number is below
254 * the pfn_limit (ie. not mapping the Launcher binary). */ 254 * the pfn_limit (ie. not mapping the Launcher binary). */
255 check_gpte(lg, gpte); 255 check_gpte(lg, gpte);
256
256 /* Add the _PAGE_ACCESSED and (for a write) _PAGE_DIRTY flag */ 257 /* Add the _PAGE_ACCESSED and (for a write) _PAGE_DIRTY flag */
257 gpte = pte_mkyoung(gpte); 258 gpte = pte_mkyoung(gpte);
258
259 if (errcode & 2) 259 if (errcode & 2)
260 gpte = pte_mkdirty(gpte); 260 gpte = pte_mkdirty(gpte);
261 261
@@ -272,23 +272,28 @@ int demand_page(struct lguest *lg, unsigned long vaddr, int errcode)
272 else 272 else
273 /* If this is a read, don't set the "writable" bit in the page 273 /* If this is a read, don't set the "writable" bit in the page
274 * table entry, even if the Guest says it's writable. That way 274 * table entry, even if the Guest says it's writable. That way
275 * we come back here when a write does actually ocur, so we can 275 * we will come back here when a write does actually occur, so
276 * update the Guest's _PAGE_DIRTY flag. */ 276 * we can update the Guest's _PAGE_DIRTY flag. */
277 *spte = gpte_to_spte(lg, pte_wrprotect(gpte), 0); 277 *spte = gpte_to_spte(lg, pte_wrprotect(gpte), 0);
278 278
279 /* Finally, we write the Guest PTE entry back: we've set the 279 /* Finally, we write the Guest PTE entry back: we've set the
280 * _PAGE_ACCESSED and maybe the _PAGE_DIRTY flags. */ 280 * _PAGE_ACCESSED and maybe the _PAGE_DIRTY flags. */
281 lgwrite(lg, gpte_ptr, pte_t, gpte); 281 lgwrite(lg, gpte_ptr, pte_t, gpte);
282 282
283 /* We succeeded in mapping the page! */ 283 /* The fault is fixed, the page table is populated, the mapping
284 * manipulated, the result returned and the code complete. A small
285 * delay and a trace of alliteration are the only indications the Guest
286 * has that a page fault occurred at all. */
284 return 1; 287 return 1;
285} 288}
286 289
287/*H:360 (ii) Setting up the page table entry for the Guest stack. 290/*H:360
291 * (ii) Making sure the Guest stack is mapped.
288 * 292 *
289 * Remember pin_stack_pages() which makes sure the stack is mapped? It could 293 * Remember that direct traps into the Guest need a mapped Guest kernel stack.
290 * simply call demand_page(), but as we've seen that logic is quite long, and 294 * pin_stack_pages() calls us here: we could simply call demand_page(), but as
291 * usually the stack pages are already mapped anyway, so it's not required. 295 * we've seen that logic is quite long, and usually the stack pages are already
296 * mapped, so it's overkill.
292 * 297 *
293 * This is a quick version which answers the question: is this virtual address 298 * This is a quick version which answers the question: is this virtual address
294 * mapped by the shadow page tables, and is it writable? */ 299 * mapped by the shadow page tables, and is it writable? */
@@ -297,7 +302,7 @@ static int page_writable(struct lguest *lg, unsigned long vaddr)
297 pgd_t *spgd; 302 pgd_t *spgd;
298 unsigned long flags; 303 unsigned long flags;
299 304
300 /* Look at the top level entry: is it present? */ 305 /* Look at the current top level entry: is it present? */
301 spgd = spgd_addr(lg, lg->pgdidx, vaddr); 306 spgd = spgd_addr(lg, lg->pgdidx, vaddr);
302 if (!(pgd_flags(*spgd) & _PAGE_PRESENT)) 307 if (!(pgd_flags(*spgd) & _PAGE_PRESENT))
303 return 0; 308 return 0;
@@ -333,15 +338,14 @@ static void release_pgd(struct lguest *lg, pgd_t *spgd)
333 release_pte(ptepage[i]); 338 release_pte(ptepage[i]);
334 /* Now we can free the page of PTEs */ 339 /* Now we can free the page of PTEs */
335 free_page((long)ptepage); 340 free_page((long)ptepage);
336 /* And zero out the PGD entry we we never release it twice. */ 341 /* And zero out the PGD entry so we never release it twice. */
337 *spgd = __pgd(0); 342 *spgd = __pgd(0);
338 } 343 }
339} 344}
340 345
341/*H:440 (v) Flushing (thowing away) page tables, 346/*H:445 We saw flush_user_mappings() twice: once from the flush_user_mappings()
342 * 347 * hypercall and once in new_pgdir() when we re-used a top-level pgdir page.
343 * We saw flush_user_mappings() called when we re-used a top-level pgdir page. 348 * It simply releases every PTE page from 0 up to the Guest's kernel address. */
344 * It simply releases every PTE page from 0 up to the kernel address. */
345static void flush_user_mappings(struct lguest *lg, int idx) 349static void flush_user_mappings(struct lguest *lg, int idx)
346{ 350{
347 unsigned int i; 351 unsigned int i;
@@ -350,8 +354,10 @@ static void flush_user_mappings(struct lguest *lg, int idx)
350 release_pgd(lg, lg->pgdirs[idx].pgdir + i); 354 release_pgd(lg, lg->pgdirs[idx].pgdir + i);
351} 355}
352 356
353/* The Guest also has a hypercall to do this manually: it's used when a large 357/*H:440 (v) Flushing (throwing away) page tables,
354 * number of mappings have been changed. */ 358 *
359 * The Guest has a hypercall to throw away the page tables: it's used when a
360 * large number of mappings have been changed. */
355void guest_pagetable_flush_user(struct lguest *lg) 361void guest_pagetable_flush_user(struct lguest *lg)
356{ 362{
357 /* Drop the userspace part of the current page table. */ 363 /* Drop the userspace part of the current page table. */
@@ -423,8 +429,9 @@ static unsigned int new_pgdir(struct lguest *lg,
423 429
424/*H:430 (iv) Switching page tables 430/*H:430 (iv) Switching page tables
425 * 431 *
426 * This is what happens when the Guest changes page tables (ie. changes the 432 * Now we've seen all the page table setting and manipulation, let's see what
427 * top-level pgdir). This happens on almost every context switch. */ 433 * what happens when the Guest changes page tables (ie. changes the top-level
434 * pgdir). This occurs on almost every context switch. */
428void guest_new_pagetable(struct lguest *lg, unsigned long pgtable) 435void guest_new_pagetable(struct lguest *lg, unsigned long pgtable)
429{ 436{
430 int newpgdir, repin = 0; 437 int newpgdir, repin = 0;
@@ -443,7 +450,8 @@ void guest_new_pagetable(struct lguest *lg, unsigned long pgtable)
443} 450}
444 451
445/*H:470 Finally, a routine which throws away everything: all PGD entries in all 452/*H:470 Finally, a routine which throws away everything: all PGD entries in all
446 * the shadow page tables. This is used when we destroy the Guest. */ 453 * the shadow page tables, including the Guest's kernel mappings. This is used
454 * when we destroy the Guest. */
447static void release_all_pagetables(struct lguest *lg) 455static void release_all_pagetables(struct lguest *lg)
448{ 456{
449 unsigned int i, j; 457 unsigned int i, j;
@@ -458,13 +466,22 @@ static void release_all_pagetables(struct lguest *lg)
458 466
459/* We also throw away everything when a Guest tells us it's changed a kernel 467/* We also throw away everything when a Guest tells us it's changed a kernel
460 * mapping. Since kernel mappings are in every page table, it's easiest to 468 * mapping. Since kernel mappings are in every page table, it's easiest to
461 * throw them all away. This is amazingly slow, but thankfully rare. */ 469 * throw them all away. This traps the Guest in amber for a while as
470 * everything faults back in, but it's rare. */
462void guest_pagetable_clear_all(struct lguest *lg) 471void guest_pagetable_clear_all(struct lguest *lg)
463{ 472{
464 release_all_pagetables(lg); 473 release_all_pagetables(lg);
465 /* We need the Guest kernel stack mapped again. */ 474 /* We need the Guest kernel stack mapped again. */
466 pin_stack_pages(lg); 475 pin_stack_pages(lg);
467} 476}
477/*:*/
478/*M:009 Since we throw away all mappings when a kernel mapping changes, our
479 * performance sucks for guests using highmem. In fact, a guest with
480 * PAGE_OFFSET 0xc0000000 (the default) and more than about 700MB of RAM is
481 * usually slower than a Guest with less memory.
482 *
483 * This, of course, cannot be fixed. It would take some kind of... well, I
484 * don't know, but the term "puissant code-fu" comes to mind. :*/
468 485
469/*H:420 This is the routine which actually sets the page table entry for then 486/*H:420 This is the routine which actually sets the page table entry for then
470 * "idx"'th shadow page table. 487 * "idx"'th shadow page table.
@@ -483,7 +500,7 @@ void guest_pagetable_clear_all(struct lguest *lg)
483static void do_set_pte(struct lguest *lg, int idx, 500static void do_set_pte(struct lguest *lg, int idx,
484 unsigned long vaddr, pte_t gpte) 501 unsigned long vaddr, pte_t gpte)
485{ 502{
486 /* Look up the matching shadow page directot entry. */ 503 /* Look up the matching shadow page directory entry. */
487 pgd_t *spgd = spgd_addr(lg, idx, vaddr); 504 pgd_t *spgd = spgd_addr(lg, idx, vaddr);
488 505
489 /* If the top level isn't present, there's no entry to update. */ 506 /* If the top level isn't present, there's no entry to update. */
@@ -500,7 +517,8 @@ static void do_set_pte(struct lguest *lg, int idx,
500 *spte = gpte_to_spte(lg, gpte, 517 *spte = gpte_to_spte(lg, gpte,
501 pte_flags(gpte) & _PAGE_DIRTY); 518 pte_flags(gpte) & _PAGE_DIRTY);
502 } else 519 } else
503 /* Otherwise we can demand_page() it in later. */ 520 /* Otherwise kill it and we can demand_page() it in
521 * later. */
504 *spte = __pte(0); 522 *spte = __pte(0);
505 } 523 }
506} 524}
@@ -535,7 +553,7 @@ void guest_set_pte(struct lguest *lg,
535} 553}
536 554
537/*H:400 555/*H:400
538 * (iii) Setting up a page table entry when the Guest tells us it has changed. 556 * (iii) Setting up a page table entry when the Guest tells us one has changed.
539 * 557 *
540 * Just like we did in interrupts_and_traps.c, it makes sense for us to deal 558 * Just like we did in interrupts_and_traps.c, it makes sense for us to deal
541 * with the other side of page tables while we're here: what happens when the 559 * with the other side of page tables while we're here: what happens when the
@@ -612,9 +630,10 @@ void free_guest_pagetable(struct lguest *lg)
612 630
613/*H:480 (vi) Mapping the Switcher when the Guest is about to run. 631/*H:480 (vi) Mapping the Switcher when the Guest is about to run.
614 * 632 *
615 * The Switcher and the two pages for this CPU need to be available to the 633 * The Switcher and the two pages for this CPU need to be visible in the
616 * Guest (and not the pages for other CPUs). We have the appropriate PTE pages 634 * Guest (and not the pages for other CPUs). We have the appropriate PTE pages
617 * for each CPU already set up, we just need to hook them in. */ 635 * for each CPU already set up, we just need to hook them in now we know which
636 * Guest is about to run on this CPU. */
618void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages) 637void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages)
619{ 638{
620 pte_t *switcher_pte_page = __get_cpu_var(switcher_pte_pages); 639 pte_t *switcher_pte_page = __get_cpu_var(switcher_pte_pages);
@@ -677,6 +696,18 @@ static __init void populate_switcher_pte_page(unsigned int cpu,
677 __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED)); 696 __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED));
678} 697}
679 698
699/* We've made it through the page table code. Perhaps our tired brains are
700 * still processing the details, or perhaps we're simply glad it's over.
701 *
702 * If nothing else, note that all this complexity in juggling shadow page
703 * tables in sync with the Guest's page tables is for one reason: for most
704 * Guests this page table dance determines how bad performance will be. This
705 * is why Xen uses exotic direct Guest pagetable manipulation, and why both
706 * Intel and AMD have implemented shadow page table support directly into
707 * hardware.
708 *
709 * There is just one file remaining in the Host. */
710
680/*H:510 At boot or module load time, init_pagetables() allocates and populates 711/*H:510 At boot or module load time, init_pagetables() allocates and populates
681 * the Switcher PTE page for each CPU. */ 712 * the Switcher PTE page for each CPU. */
682__init int init_pagetables(struct page **switcher_page, unsigned int pages) 713__init int init_pagetables(struct page **switcher_page, unsigned int pages)
diff --git a/drivers/lguest/segments.c b/drivers/lguest/segments.c
index c2434ec99f7b..9e189cbec7dd 100644
--- a/drivers/lguest/segments.c
+++ b/drivers/lguest/segments.c
@@ -12,8 +12,6 @@
12#include "lg.h" 12#include "lg.h"
13 13
14/*H:600 14/*H:600
15 * We've almost completed the Host; there's just one file to go!
16 *
17 * Segments & The Global Descriptor Table 15 * Segments & The Global Descriptor Table
18 * 16 *
19 * (That title sounds like a bad Nerdcore group. Not to suggest that there are 17 * (That title sounds like a bad Nerdcore group. Not to suggest that there are
@@ -55,7 +53,7 @@ static int ignored_gdt(unsigned int num)
55 || num == GDT_ENTRY_DOUBLEFAULT_TSS); 53 || num == GDT_ENTRY_DOUBLEFAULT_TSS);
56} 54}
57 55
58/*H:610 Once the GDT has been changed, we fix the new entries up a little. We 56/*H:630 Once the Guest gave us new GDT entries, we fix them up a little. We
59 * don't care if they're invalid: the worst that can happen is a General 57 * don't care if they're invalid: the worst that can happen is a General
60 * Protection Fault in the Switcher when it restores a Guest segment register 58 * Protection Fault in the Switcher when it restores a Guest segment register
61 * which tries to use that entry. Then we kill the Guest for causing such a 59 * which tries to use that entry. Then we kill the Guest for causing such a
@@ -84,25 +82,33 @@ static void fixup_gdt_table(struct lguest *lg, unsigned start, unsigned end)
84 } 82 }
85} 83}
86 84
87/* This routine is called at boot or modprobe time for each CPU to set up the 85/*H:610 Like the IDT, we never simply use the GDT the Guest gives us. We keep
88 * "constant" GDT entries for Guests running on that CPU. */ 86 * a GDT for each CPU, and copy across the Guest's entries each time we want to
87 * run the Guest on that CPU.
88 *
89 * This routine is called at boot or modprobe time for each CPU to set up the
90 * constant GDT entries: the ones which are the same no matter what Guest we're
91 * running. */
89void setup_default_gdt_entries(struct lguest_ro_state *state) 92void setup_default_gdt_entries(struct lguest_ro_state *state)
90{ 93{
91 struct desc_struct *gdt = state->guest_gdt; 94 struct desc_struct *gdt = state->guest_gdt;
92 unsigned long tss = (unsigned long)&state->guest_tss; 95 unsigned long tss = (unsigned long)&state->guest_tss;
93 96
94 /* The hypervisor segments are full 0-4G segments, privilege level 0 */ 97 /* The Switcher segments are full 0-4G segments, privilege level 0 */
95 gdt[GDT_ENTRY_LGUEST_CS] = FULL_EXEC_SEGMENT; 98 gdt[GDT_ENTRY_LGUEST_CS] = FULL_EXEC_SEGMENT;
96 gdt[GDT_ENTRY_LGUEST_DS] = FULL_SEGMENT; 99 gdt[GDT_ENTRY_LGUEST_DS] = FULL_SEGMENT;
97 100
98 /* The TSS segment refers to the TSS entry for this CPU, so we cannot 101 /* The TSS segment refers to the TSS entry for this particular CPU.
99 * copy it from the Guest. Forgive the magic flags */ 102 * Forgive the magic flags: the 0x8900 means the entry is Present, it's
103 * privilege level 0 Available 386 TSS system segment, and the 0x67
104 * means Saturn is eclipsed by Mercury in the twelfth house. */
100 gdt[GDT_ENTRY_TSS].a = 0x00000067 | (tss << 16); 105 gdt[GDT_ENTRY_TSS].a = 0x00000067 | (tss << 16);
101 gdt[GDT_ENTRY_TSS].b = 0x00008900 | (tss & 0xFF000000) 106 gdt[GDT_ENTRY_TSS].b = 0x00008900 | (tss & 0xFF000000)
102 | ((tss >> 16) & 0x000000FF); 107 | ((tss >> 16) & 0x000000FF);
103} 108}
104 109
105/* This routine is called before the Guest is run for the first time. */ 110/* This routine sets up the initial Guest GDT for booting. All entries start
111 * as 0 (unusable). */
106void setup_guest_gdt(struct lguest *lg) 112void setup_guest_gdt(struct lguest *lg)
107{ 113{
108 /* Start with full 0-4G segments... */ 114 /* Start with full 0-4G segments... */
@@ -114,13 +120,8 @@ void setup_guest_gdt(struct lguest *lg)
114 lg->arch.gdt[GDT_ENTRY_KERNEL_DS].b |= (GUEST_PL << 13); 120 lg->arch.gdt[GDT_ENTRY_KERNEL_DS].b |= (GUEST_PL << 13);
115} 121}
116 122
117/* Like the IDT, we never simply use the GDT the Guest gives us. We set up the 123/*H:650 An optimization of copy_gdt(), for just the three "thead-local storage"
118 * GDTs for each CPU, then we copy across the entries each time we want to run 124 * entries. */
119 * a different Guest on that CPU. */
120
121/* A partial GDT load, for the three "thead-local storage" entries. Otherwise
122 * it's just like load_guest_gdt(). So much, in fact, it would probably be
123 * neater to have a single hypercall to cover both. */
124void copy_gdt_tls(const struct lguest *lg, struct desc_struct *gdt) 125void copy_gdt_tls(const struct lguest *lg, struct desc_struct *gdt)
125{ 126{
126 unsigned int i; 127 unsigned int i;
@@ -129,7 +130,9 @@ void copy_gdt_tls(const struct lguest *lg, struct desc_struct *gdt)
129 gdt[i] = lg->arch.gdt[i]; 130 gdt[i] = lg->arch.gdt[i];
130} 131}
131 132
132/* This is the full version */ 133/*H:640 When the Guest is run on a different CPU, or the GDT entries have
134 * changed, copy_gdt() is called to copy the Guest's GDT entries across to this
135 * CPU's GDT. */
133void copy_gdt(const struct lguest *lg, struct desc_struct *gdt) 136void copy_gdt(const struct lguest *lg, struct desc_struct *gdt)
134{ 137{
135 unsigned int i; 138 unsigned int i;
@@ -141,7 +144,8 @@ void copy_gdt(const struct lguest *lg, struct desc_struct *gdt)
141 gdt[i] = lg->arch.gdt[i]; 144 gdt[i] = lg->arch.gdt[i];
142} 145}
143 146
144/* This is where the Guest asks us to load a new GDT (LHCALL_LOAD_GDT). */ 147/*H:620 This is where the Guest asks us to load a new GDT (LHCALL_LOAD_GDT).
148 * We copy it from the Guest and tweak the entries. */
145void load_guest_gdt(struct lguest *lg, unsigned long table, u32 num) 149void load_guest_gdt(struct lguest *lg, unsigned long table, u32 num)
146{ 150{
147 /* We assume the Guest has the same number of GDT entries as the 151 /* We assume the Guest has the same number of GDT entries as the
@@ -157,16 +161,22 @@ void load_guest_gdt(struct lguest *lg, unsigned long table, u32 num)
157 lg->changed |= CHANGED_GDT; 161 lg->changed |= CHANGED_GDT;
158} 162}
159 163
164/* This is the fast-track version for just changing the three TLS entries.
165 * Remember that this happens on every context switch, so it's worth
166 * optimizing. But wouldn't it be neater to have a single hypercall to cover
167 * both cases? */
160void guest_load_tls(struct lguest *lg, unsigned long gtls) 168void guest_load_tls(struct lguest *lg, unsigned long gtls)
161{ 169{
162 struct desc_struct *tls = &lg->arch.gdt[GDT_ENTRY_TLS_MIN]; 170 struct desc_struct *tls = &lg->arch.gdt[GDT_ENTRY_TLS_MIN];
163 171
164 __lgread(lg, tls, gtls, sizeof(*tls)*GDT_ENTRY_TLS_ENTRIES); 172 __lgread(lg, tls, gtls, sizeof(*tls)*GDT_ENTRY_TLS_ENTRIES);
165 fixup_gdt_table(lg, GDT_ENTRY_TLS_MIN, GDT_ENTRY_TLS_MAX+1); 173 fixup_gdt_table(lg, GDT_ENTRY_TLS_MIN, GDT_ENTRY_TLS_MAX+1);
174 /* Note that just the TLS entries have changed. */
166 lg->changed |= CHANGED_GDT_TLS; 175 lg->changed |= CHANGED_GDT_TLS;
167} 176}
177/*:*/
168 178
169/* 179/*H:660
170 * With this, we have finished the Host. 180 * With this, we have finished the Host.
171 * 181 *
172 * Five of the seven parts of our task are complete. You have made it through 182 * Five of the seven parts of our task are complete. You have made it through
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index 9eed12d5a395..482aec2a9631 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -63,7 +63,7 @@ static struct lguest_pages *lguest_pages(unsigned int cpu)
63static DEFINE_PER_CPU(struct lguest *, last_guest); 63static DEFINE_PER_CPU(struct lguest *, last_guest);
64 64
65/*S:010 65/*S:010
66 * We are getting close to the Switcher. 66 * We approach the Switcher.
67 * 67 *
68 * Remember that each CPU has two pages which are visible to the Guest when it 68 * Remember that each CPU has two pages which are visible to the Guest when it
69 * runs on that CPU. This has to contain the state for that Guest: we copy the 69 * runs on that CPU. This has to contain the state for that Guest: we copy the
@@ -134,7 +134,7 @@ static void run_guest_once(struct lguest *lg, struct lguest_pages *pages)
134 * 134 *
135 * The lcall also pushes the old code segment (KERNEL_CS) onto the 135 * The lcall also pushes the old code segment (KERNEL_CS) onto the
136 * stack, then the address of this call. This stack layout happens to 136 * stack, then the address of this call. This stack layout happens to
137 * exactly match the stack of an interrupt... */ 137 * exactly match the stack layout created by an interrupt... */
138 asm volatile("pushf; lcall *lguest_entry" 138 asm volatile("pushf; lcall *lguest_entry"
139 /* This is how we tell GCC that %eax ("a") and %ebx ("b") 139 /* This is how we tell GCC that %eax ("a") and %ebx ("b")
140 * are changed by this routine. The "=" means output. */ 140 * are changed by this routine. The "=" means output. */
@@ -151,40 +151,46 @@ static void run_guest_once(struct lguest *lg, struct lguest_pages *pages)
151} 151}
152/*:*/ 152/*:*/
153 153
154/*M:002 There are hooks in the scheduler which we can register to tell when we
155 * get kicked off the CPU (preempt_notifier_register()). This would allow us
156 * to lazily disable SYSENTER which would regain some performance, and should
157 * also simplify copy_in_guest_info(). Note that we'd still need to restore
158 * things when we exit to Launcher userspace, but that's fairly easy.
159 *
160 * The hooks were designed for KVM, but we can also put them to good use. :*/
161
154/*H:040 This is the i386-specific code to setup and run the Guest. Interrupts 162/*H:040 This is the i386-specific code to setup and run the Guest. Interrupts
155 * are disabled: we own the CPU. */ 163 * are disabled: we own the CPU. */
156void lguest_arch_run_guest(struct lguest *lg) 164void lguest_arch_run_guest(struct lguest *lg)
157{ 165{
158 /* Remember the awfully-named TS bit? If the Guest has asked 166 /* Remember the awfully-named TS bit? If the Guest has asked to set it
159 * to set it we set it now, so we can trap and pass that trap 167 * we set it now, so we can trap and pass that trap to the Guest if it
160 * to the Guest if it uses the FPU. */ 168 * uses the FPU. */
161 if (lg->ts) 169 if (lg->ts)
162 lguest_set_ts(); 170 lguest_set_ts();
163 171
164 /* SYSENTER is an optimized way of doing system calls. We 172 /* SYSENTER is an optimized way of doing system calls. We can't allow
165 * can't allow it because it always jumps to privilege level 0. 173 * it because it always jumps to privilege level 0. A normal Guest
166 * A normal Guest won't try it because we don't advertise it in 174 * won't try it because we don't advertise it in CPUID, but a malicious
167 * CPUID, but a malicious Guest (or malicious Guest userspace 175 * Guest (or malicious Guest userspace program) could, so we tell the
168 * program) could, so we tell the CPU to disable it before 176 * CPU to disable it before running the Guest. */
169 * running the Guest. */
170 if (boot_cpu_has(X86_FEATURE_SEP)) 177 if (boot_cpu_has(X86_FEATURE_SEP))
171 wrmsr(MSR_IA32_SYSENTER_CS, 0, 0); 178 wrmsr(MSR_IA32_SYSENTER_CS, 0, 0);
172 179
173 /* Now we actually run the Guest. It will pop back out when 180 /* Now we actually run the Guest. It will return when something
174 * something interesting happens, and we can examine its 181 * interesting happens, and we can examine its registers to see what it
175 * registers to see what it was doing. */ 182 * was doing. */
176 run_guest_once(lg, lguest_pages(raw_smp_processor_id())); 183 run_guest_once(lg, lguest_pages(raw_smp_processor_id()));
177 184
178 /* The "regs" pointer contains two extra entries which are not 185 /* Note that the "regs" pointer contains two extra entries which are
179 * really registers: a trap number which says what interrupt or 186 * not really registers: a trap number which says what interrupt or
180 * trap made the switcher code come back, and an error code 187 * trap made the switcher code come back, and an error code which some
181 * which some traps set. */ 188 * traps set. */
182 189
183 /* If the Guest page faulted, then the cr2 register will tell 190 /* If the Guest page faulted, then the cr2 register will tell us the
184 * us the bad virtual address. We have to grab this now, 191 * bad virtual address. We have to grab this now, because once we
185 * because once we re-enable interrupts an interrupt could 192 * re-enable interrupts an interrupt could fault and thus overwrite
186 * fault and thus overwrite cr2, or we could even move off to a 193 * cr2, or we could even move off to a different CPU. */
187 * different CPU. */
188 if (lg->regs->trapnum == 14) 194 if (lg->regs->trapnum == 14)
189 lg->arch.last_pagefault = read_cr2(); 195 lg->arch.last_pagefault = read_cr2();
190 /* Similarly, if we took a trap because the Guest used the FPU, 196 /* Similarly, if we took a trap because the Guest used the FPU,
@@ -197,14 +203,15 @@ void lguest_arch_run_guest(struct lguest *lg)
197 wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); 203 wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
198} 204}
199 205
200/*H:130 Our Guest is usually so well behaved; it never tries to do things it 206/*H:130 Now we've examined the hypercall code; our Guest can make requests.
201 * isn't allowed to. Unfortunately, Linux's paravirtual infrastructure isn't 207 * Our Guest is usually so well behaved; it never tries to do things it isn't
202 * quite complete, because it doesn't contain replacements for the Intel I/O 208 * allowed to, and uses hypercalls instead. Unfortunately, Linux's paravirtual
203 * instructions. As a result, the Guest sometimes fumbles across one during 209 * infrastructure isn't quite complete, because it doesn't contain replacements
204 * the boot process as it probes for various things which are usually attached 210 * for the Intel I/O instructions. As a result, the Guest sometimes fumbles
205 * to a PC. 211 * across one during the boot process as it probes for various things which are
212 * usually attached to a PC.
206 * 213 *
207 * When the Guest uses one of these instructions, we get trap #13 (General 214 * When the Guest uses one of these instructions, we get a trap (General
208 * Protection Fault) and come here. We see if it's one of those troublesome 215 * Protection Fault) and come here. We see if it's one of those troublesome
209 * instructions and skip over it. We return true if we did. */ 216 * instructions and skip over it. We return true if we did. */
210static int emulate_insn(struct lguest *lg) 217static int emulate_insn(struct lguest *lg)
@@ -275,43 +282,43 @@ static int emulate_insn(struct lguest *lg)
275void lguest_arch_handle_trap(struct lguest *lg) 282void lguest_arch_handle_trap(struct lguest *lg)
276{ 283{
277 switch (lg->regs->trapnum) { 284 switch (lg->regs->trapnum) {
278 case 13: /* We've intercepted a GPF. */ 285 case 13: /* We've intercepted a General Protection Fault. */
279 /* Check if this was one of those annoying IN or OUT 286 /* Check if this was one of those annoying IN or OUT
280 * instructions which we need to emulate. If so, we 287 * instructions which we need to emulate. If so, we just go
281 * just go back into the Guest after we've done it. */ 288 * back into the Guest after we've done it. */
282 if (lg->regs->errcode == 0) { 289 if (lg->regs->errcode == 0) {
283 if (emulate_insn(lg)) 290 if (emulate_insn(lg))
284 return; 291 return;
285 } 292 }
286 break; 293 break;
287 case 14: /* We've intercepted a page fault. */ 294 case 14: /* We've intercepted a Page Fault. */
288 /* The Guest accessed a virtual address that wasn't 295 /* The Guest accessed a virtual address that wasn't mapped.
289 * mapped. This happens a lot: we don't actually set 296 * This happens a lot: we don't actually set up most of the
290 * up most of the page tables for the Guest at all when 297 * page tables for the Guest at all when we start: as it runs
291 * we start: as it runs it asks for more and more, and 298 * it asks for more and more, and we set them up as
292 * we set them up as required. In this case, we don't 299 * required. In this case, we don't even tell the Guest that
293 * even tell the Guest that the fault happened. 300 * the fault happened.
294 * 301 *
295 * The errcode tells whether this was a read or a 302 * The errcode tells whether this was a read or a write, and
296 * write, and whether kernel or userspace code. */ 303 * whether kernel or userspace code. */
297 if (demand_page(lg, lg->arch.last_pagefault, lg->regs->errcode)) 304 if (demand_page(lg, lg->arch.last_pagefault, lg->regs->errcode))
298 return; 305 return;
299 306
300 /* OK, it's really not there (or not OK): the Guest 307 /* OK, it's really not there (or not OK): the Guest needs to
301 * needs to know. We write out the cr2 value so it 308 * know. We write out the cr2 value so it knows where the
302 * knows where the fault occurred. 309 * fault occurred.
303 * 310 *
304 * Note that if the Guest were really messed up, this 311 * Note that if the Guest were really messed up, this could
305 * could happen before it's done the INITIALIZE 312 * happen before it's done the LHCALL_LGUEST_INIT hypercall, so
306 * hypercall, so lg->lguest_data will be NULL */ 313 * lg->lguest_data could be NULL */
307 if (lg->lguest_data && 314 if (lg->lguest_data &&
308 put_user(lg->arch.last_pagefault, &lg->lguest_data->cr2)) 315 put_user(lg->arch.last_pagefault, &lg->lguest_data->cr2))
309 kill_guest(lg, "Writing cr2"); 316 kill_guest(lg, "Writing cr2");
310 break; 317 break;
311 case 7: /* We've intercepted a Device Not Available fault. */ 318 case 7: /* We've intercepted a Device Not Available fault. */
312 /* If the Guest doesn't want to know, we already 319 /* If the Guest doesn't want to know, we already restored the
313 * restored the Floating Point Unit, so we just 320 * Floating Point Unit, so we just continue without telling
314 * continue without telling it. */ 321 * it. */
315 if (!lg->ts) 322 if (!lg->ts)
316 return; 323 return;
317 break; 324 break;
@@ -536,9 +543,6 @@ int lguest_arch_init_hypercalls(struct lguest *lg)
536 543
537 return 0; 544 return 0;
538} 545}
539/* Now we've examined the hypercall code; our Guest can make requests. There
540 * is one other way we can do things for the Guest, as we see in
541 * emulate_insn(). :*/
542 546
543/*L:030 lguest_arch_setup_regs() 547/*L:030 lguest_arch_setup_regs()
544 * 548 *
@@ -562,7 +566,7 @@ void lguest_arch_setup_regs(struct lguest *lg, unsigned long start)
562 * is supposed to always be "1". Bit 9 (0x200) controls whether 566 * is supposed to always be "1". Bit 9 (0x200) controls whether
563 * interrupts are enabled. We always leave interrupts enabled while 567 * interrupts are enabled. We always leave interrupts enabled while
564 * running the Guest. */ 568 * running the Guest. */
565 regs->eflags = 0x202; 569 regs->eflags = X86_EFLAGS_IF | 0x2;
566 570
567 /* The "Extended Instruction Pointer" register says where the Guest is 571 /* The "Extended Instruction Pointer" register says where the Guest is
568 * running. */ 572 * running. */
@@ -570,8 +574,8 @@ void lguest_arch_setup_regs(struct lguest *lg, unsigned long start)
570 574
571 /* %esi points to our boot information, at physical address 0, so don't 575 /* %esi points to our boot information, at physical address 0, so don't
572 * touch it. */ 576 * touch it. */
577
573 /* There are a couple of GDT entries the Guest expects when first 578 /* There are a couple of GDT entries the Guest expects when first
574 * booting. */ 579 * booting. */
575
576 setup_guest_gdt(lg); 580 setup_guest_gdt(lg);
577} 581}
diff --git a/drivers/lguest/x86/switcher_32.S b/drivers/lguest/x86/switcher_32.S
index 1010b90b11fc..0af8baaa0d4a 100644
--- a/drivers/lguest/x86/switcher_32.S
+++ b/drivers/lguest/x86/switcher_32.S
@@ -6,6 +6,37 @@
6 * are feeling invigorated and refreshed then the next, more challenging stage 6 * are feeling invigorated and refreshed then the next, more challenging stage
7 * can be found in "make Guest". :*/ 7 * can be found in "make Guest". :*/
8 8
9/*M:012 Lguest is meant to be simple: my rule of thumb is that 1% more LOC must
10 * gain at least 1% more performance. Since neither LOC nor performance can be
11 * measured beforehand, it generally means implementing a feature then deciding
12 * if it's worth it. And once it's implemented, who can say no?
13 *
14 * This is why I haven't implemented this idea myself. I want to, but I
15 * haven't. You could, though.
16 *
17 * The main place where lguest performance sucks is Guest page faulting. When
18 * a Guest userspace process hits an unmapped page we switch back to the Host,
19 * walk the page tables, find it's not mapped, switch back to the Guest page
20 * fault handler, which calls a hypercall to set the page table entry, then
21 * finally returns to userspace. That's two round-trips.
22 *
23 * If we had a small walker in the Switcher, we could quickly check the Guest
24 * page table and if the page isn't mapped, immediately reflect the fault back
25 * into the Guest. This means the Switcher would have to know the top of the
26 * Guest page table and the page fault handler address.
27 *
28 * For simplicity, the Guest should only handle the case where the privilege
29 * level of the fault is 3 and probably only not present or write faults. It
30 * should also detect recursive faults, and hand the original fault to the
31 * Host (which is actually really easy).
32 *
33 * Two questions remain. Would the performance gain outweigh the complexity?
34 * And who would write the verse documenting it? :*/
35
36/*M:011 Lguest64 handles NMI. This gave me NMI envy (until I looked at their
37 * code). It's worth doing though, since it would let us use oprofile in the
38 * Host when a Guest is running. :*/
39
9/*S:100 40/*S:100
10 * Welcome to the Switcher itself! 41 * Welcome to the Switcher itself!
11 * 42 *
@@ -88,7 +119,7 @@ ENTRY(switch_to_guest)
88 119
89 // All saved and there's now five steps before us: 120 // All saved and there's now five steps before us:
90 // Stack, GDT, IDT, TSS 121 // Stack, GDT, IDT, TSS
91 // And last of all the page tables are flipped. 122 // Then last of all the page tables are flipped.
92 123
93 // Yet beware that our stack pointer must be 124 // Yet beware that our stack pointer must be
94 // Always valid lest an NMI hits 125 // Always valid lest an NMI hits
@@ -103,25 +134,25 @@ ENTRY(switch_to_guest)
103 lgdt LGUEST_PAGES_guest_gdt_desc(%eax) 134 lgdt LGUEST_PAGES_guest_gdt_desc(%eax)
104 135
105 // The Guest's IDT we did partially 136 // The Guest's IDT we did partially
106 // Move to the "struct lguest_pages" as well. 137 // Copy to "struct lguest_pages" as well.
107 lidt LGUEST_PAGES_guest_idt_desc(%eax) 138 lidt LGUEST_PAGES_guest_idt_desc(%eax)
108 139
109 // The TSS entry which controls traps 140 // The TSS entry which controls traps
110 // Must be loaded up with "ltr" now: 141 // Must be loaded up with "ltr" now:
142 // The GDT entry that TSS uses
143 // Changes type when we load it: damn Intel!
111 // For after we switch over our page tables 144 // For after we switch over our page tables
112 // It (as the rest) will be writable no more. 145 // That entry will be read-only: we'd crash.
113 // (The GDT entry TSS needs
114 // Changes type when we load it: damn Intel!)
115 movl $(GDT_ENTRY_TSS*8), %edx 146 movl $(GDT_ENTRY_TSS*8), %edx
116 ltr %dx 147 ltr %dx
117 148
118 // Look back now, before we take this last step! 149 // Look back now, before we take this last step!
119 // The Host's TSS entry was also marked used; 150 // The Host's TSS entry was also marked used;
120 // Let's clear it again, ere we return. 151 // Let's clear it again for our return.
121 // The GDT descriptor of the Host 152 // The GDT descriptor of the Host
122 // Points to the table after two "size" bytes 153 // Points to the table after two "size" bytes
123 movl (LGUEST_PAGES_host_gdt_desc+2)(%eax), %edx 154 movl (LGUEST_PAGES_host_gdt_desc+2)(%eax), %edx
124 // Clear the type field of "used" (byte 5, bit 2) 155 // Clear "used" from type field (byte 5, bit 2)
125 andb $0xFD, (GDT_ENTRY_TSS*8 + 5)(%edx) 156 andb $0xFD, (GDT_ENTRY_TSS*8 + 5)(%edx)
126 157
127 // Once our page table's switched, the Guest is live! 158 // Once our page table's switched, the Guest is live!
@@ -131,7 +162,7 @@ ENTRY(switch_to_guest)
131 162
132 // The page table change did one tricky thing: 163 // The page table change did one tricky thing:
133 // The Guest's register page has been mapped 164 // The Guest's register page has been mapped
134 // Writable onto our %esp (stack) -- 165 // Writable under our %esp (stack) --
135 // We can simply pop off all Guest regs. 166 // We can simply pop off all Guest regs.
136 popl %eax 167 popl %eax
137 popl %ebx 168 popl %ebx
@@ -152,16 +183,15 @@ ENTRY(switch_to_guest)
152 addl $8, %esp 183 addl $8, %esp
153 184
154 // The last five stack slots hold return address 185 // The last five stack slots hold return address
155 // And everything needed to change privilege 186 // And everything needed to switch privilege
156 // Into the Guest privilege level of 1, 187 // From Switcher's level 0 to Guest's 1,
157 // And the stack where the Guest had last left it. 188 // And the stack where the Guest had last left it.
158 // Interrupts are turned back on: we are Guest. 189 // Interrupts are turned back on: we are Guest.
159 iret 190 iret
160 191
161// There are two paths where we switch to the Host 192// We treat two paths to switch back to the Host
193// Yet both must save Guest state and restore Host
162// So we put the routine in a macro. 194// So we put the routine in a macro.
163// We are on our way home, back to the Host
164// Interrupted out of the Guest, we come here.
165#define SWITCH_TO_HOST \ 195#define SWITCH_TO_HOST \
166 /* We save the Guest state: all registers first \ 196 /* We save the Guest state: all registers first \
167 * Laid out just as "struct lguest_regs" defines */ \ 197 * Laid out just as "struct lguest_regs" defines */ \
@@ -194,7 +224,7 @@ ENTRY(switch_to_guest)
194 movl %esp, %eax; \ 224 movl %esp, %eax; \
195 andl $(~(1 << PAGE_SHIFT - 1)), %eax; \ 225 andl $(~(1 << PAGE_SHIFT - 1)), %eax; \
196 /* Save our trap number: the switch will obscure it \ 226 /* Save our trap number: the switch will obscure it \
197 * (The Guest regs are not mapped here in the Host) \ 227 * (In the Host the Guest regs are not mapped here) \
198 * %ebx holds it safe for deliver_to_host */ \ 228 * %ebx holds it safe for deliver_to_host */ \
199 movl LGUEST_PAGES_regs_trapnum(%eax), %ebx; \ 229 movl LGUEST_PAGES_regs_trapnum(%eax), %ebx; \
200 /* The Host GDT, IDT and stack! \ 230 /* The Host GDT, IDT and stack! \
@@ -210,9 +240,9 @@ ENTRY(switch_to_guest)
210 /* Switch to Host's GDT, IDT. */ \ 240 /* Switch to Host's GDT, IDT. */ \
211 lgdt LGUEST_PAGES_host_gdt_desc(%eax); \ 241 lgdt LGUEST_PAGES_host_gdt_desc(%eax); \
212 lidt LGUEST_PAGES_host_idt_desc(%eax); \ 242 lidt LGUEST_PAGES_host_idt_desc(%eax); \
213 /* Restore the Host's stack where it's saved regs lie */ \ 243 /* Restore the Host's stack where its saved regs lie */ \
214 movl LGUEST_PAGES_host_sp(%eax), %esp; \ 244 movl LGUEST_PAGES_host_sp(%eax), %esp; \
215 /* Last the TSS: our Host is complete */ \ 245 /* Last the TSS: our Host is returned */ \
216 movl $(GDT_ENTRY_TSS*8), %edx; \ 246 movl $(GDT_ENTRY_TSS*8), %edx; \
217 ltr %dx; \ 247 ltr %dx; \
218 /* Restore now the regs saved right at the first. */ \ 248 /* Restore now the regs saved right at the first. */ \
@@ -222,14 +252,15 @@ ENTRY(switch_to_guest)
222 popl %ds; \ 252 popl %ds; \
223 popl %es 253 popl %es
224 254
225// Here's where we come when the Guest has just trapped: 255// The first path is trod when the Guest has trapped:
226// (Which trap we'll see has been pushed on the stack). 256// (Which trap it was has been pushed on the stack).
227// We need only switch back, and the Host will decode 257// We need only switch back, and the Host will decode
228// Why we came home, and what needs to be done. 258// Why we came home, and what needs to be done.
229return_to_host: 259return_to_host:
230 SWITCH_TO_HOST 260 SWITCH_TO_HOST
231 iret 261 iret
232 262
263// We are lead to the second path like so:
233// An interrupt, with some cause external 264// An interrupt, with some cause external
234// Has ajerked us rudely from the Guest's code 265// Has ajerked us rudely from the Guest's code
235// Again we must return home to the Host 266// Again we must return home to the Host
@@ -238,7 +269,7 @@ deliver_to_host:
238 // But now we must go home via that place 269 // But now we must go home via that place
239 // Where that interrupt was supposed to go 270 // Where that interrupt was supposed to go
240 // Had we not been ensconced, running the Guest. 271 // Had we not been ensconced, running the Guest.
241 // Here we see the cleverness of our stack: 272 // Here we see the trickness of run_guest_once():
242 // The Host stack is formed like an interrupt 273 // The Host stack is formed like an interrupt
243 // With EIP, CS and EFLAGS layered. 274 // With EIP, CS and EFLAGS layered.
244 // Interrupt handlers end with "iret" 275 // Interrupt handlers end with "iret"
@@ -263,7 +294,7 @@ deliver_to_host:
263 xorw %ax, %ax 294 xorw %ax, %ax
264 orl %eax, %edx 295 orl %eax, %edx
265 // Now the address of the handler's in %edx 296 // Now the address of the handler's in %edx
266 // We call it now: its "iret" takes us home. 297 // We call it now: its "iret" drops us home.
267 jmp *%edx 298 jmp *%edx
268 299
269// Every interrupt can come to us here 300// Every interrupt can come to us here
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index ac54f697c508..28c6ae095c56 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -168,7 +168,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
168 return -ENOMEM; 168 return -ENOMEM;
169 } 169 }
170 170
171 sg_set_buf(&sg, cc->key, cc->key_size); 171 sg_init_one(&sg, cc->key, cc->key_size);
172 desc.tfm = hash_tfm; 172 desc.tfm = hash_tfm;
173 desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; 173 desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
174 err = crypto_hash_digest(&desc, &sg, cc->key_size, salt); 174 err = crypto_hash_digest(&desc, &sg, cc->key_size, salt);
@@ -351,14 +351,10 @@ static int crypt_convert(struct crypt_config *cc,
351 struct scatterlist sg_in, sg_out; 351 struct scatterlist sg_in, sg_out;
352 352
353 sg_init_table(&sg_in, 1); 353 sg_init_table(&sg_in, 1);
354 sg_set_page(&sg_in, bv_in->bv_page); 354 sg_set_page(&sg_in, bv_in->bv_page, 1 << SECTOR_SHIFT, bv_in->bv_offset + ctx->offset_in);
355 sg_in.offset = bv_in->bv_offset + ctx->offset_in;
356 sg_in.length = 1 << SECTOR_SHIFT;
357 355
358 sg_init_table(&sg_out, 1); 356 sg_init_table(&sg_out, 1);
359 sg_set_page(&sg_out, bv_out->bv_page); 357 sg_set_page(&sg_out, bv_out->bv_page, 1 << SECTOR_SHIFT, bv_out->bv_offset + ctx->offset_out);
360 sg_out.offset = bv_out->bv_offset + ctx->offset_out;
361 sg_out.length = 1 << SECTOR_SHIFT;
362 358
363 ctx->offset_in += sg_in.length; 359 ctx->offset_in += sg_in.length;
364 if (ctx->offset_in >= bv_in->bv_len) { 360 if (ctx->offset_in >= bv_in->bv_len) {
diff --git a/drivers/md/raid6algos.c b/drivers/md/raid6algos.c
index 926576156578..77a6e4bf503d 100644
--- a/drivers/md/raid6algos.c
+++ b/drivers/md/raid6algos.c
@@ -52,7 +52,7 @@ const struct raid6_calls * const raid6_algos[] = {
52 &raid6_intx16, 52 &raid6_intx16,
53 &raid6_intx32, 53 &raid6_intx32,
54#endif 54#endif
55#if defined(__i386__) 55#if defined(__i386__) && !defined(__arch_um__)
56 &raid6_mmxx1, 56 &raid6_mmxx1,
57 &raid6_mmxx2, 57 &raid6_mmxx2,
58 &raid6_sse1x1, 58 &raid6_sse1x1,
@@ -60,7 +60,7 @@ const struct raid6_calls * const raid6_algos[] = {
60 &raid6_sse2x1, 60 &raid6_sse2x1,
61 &raid6_sse2x2, 61 &raid6_sse2x2,
62#endif 62#endif
63#if defined(__x86_64__) 63#if defined(__x86_64__) && !defined(__arch_um__)
64 &raid6_sse2x1, 64 &raid6_sse2x1,
65 &raid6_sse2x2, 65 &raid6_sse2x2,
66 &raid6_sse2x4, 66 &raid6_sse2x4,
diff --git a/drivers/md/raid6mmx.c b/drivers/md/raid6mmx.c
index 6181a5a3365a..d4e4a1bd70ad 100644
--- a/drivers/md/raid6mmx.c
+++ b/drivers/md/raid6mmx.c
@@ -16,7 +16,7 @@
16 * MMX implementation of RAID-6 syndrome functions 16 * MMX implementation of RAID-6 syndrome functions
17 */ 17 */
18 18
19#if defined(__i386__) 19#if defined(__i386__) && !defined(__arch_um__)
20 20
21#include "raid6.h" 21#include "raid6.h"
22#include "raid6x86.h" 22#include "raid6x86.h"
diff --git a/drivers/md/raid6sse1.c b/drivers/md/raid6sse1.c
index f0a1ba8f40ba..0666237276ff 100644
--- a/drivers/md/raid6sse1.c
+++ b/drivers/md/raid6sse1.c
@@ -21,7 +21,7 @@
21 * worthwhile as a separate implementation. 21 * worthwhile as a separate implementation.
22 */ 22 */
23 23
24#if defined(__i386__) 24#if defined(__i386__) && !defined(__arch_um__)
25 25
26#include "raid6.h" 26#include "raid6.h"
27#include "raid6x86.h" 27#include "raid6x86.h"
diff --git a/drivers/md/raid6sse2.c b/drivers/md/raid6sse2.c
index 0f019762a7c3..b034ad868039 100644
--- a/drivers/md/raid6sse2.c
+++ b/drivers/md/raid6sse2.c
@@ -17,7 +17,7 @@
17 * 17 *
18 */ 18 */
19 19
20#if defined(__i386__) || defined(__x86_64__) 20#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)
21 21
22#include "raid6.h" 22#include "raid6.h"
23#include "raid6x86.h" 23#include "raid6x86.h"
@@ -161,7 +161,7 @@ const struct raid6_calls raid6_sse2x2 = {
161 161
162#endif 162#endif
163 163
164#ifdef __x86_64__ 164#if defined(__x86_64__) && !defined(__arch_um__)
165 165
166/* 166/*
167 * Unrolled-by-4 SSE2 implementation 167 * Unrolled-by-4 SSE2 implementation
diff --git a/drivers/md/raid6x86.h b/drivers/md/raid6x86.h
index 9111950414ff..99fea7a70ca7 100644
--- a/drivers/md/raid6x86.h
+++ b/drivers/md/raid6x86.h
@@ -19,7 +19,7 @@
19#ifndef LINUX_RAID_RAID6X86_H 19#ifndef LINUX_RAID_RAID6X86_H
20#define LINUX_RAID_RAID6X86_H 20#define LINUX_RAID_RAID6X86_H
21 21
22#if defined(__i386__) || defined(__x86_64__) 22#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)
23 23
24#ifdef __KERNEL__ /* Real code */ 24#ifdef __KERNEL__ /* Real code */
25 25
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index 2b1f8b4be00a..cb034ead95ab 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -118,8 +118,7 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
118 if (NULL == pg) 118 if (NULL == pg)
119 goto err; 119 goto err;
120 BUG_ON(PageHighMem(pg)); 120 BUG_ON(PageHighMem(pg));
121 sg_set_page(&sglist[i], pg); 121 sg_set_page(&sglist[i], pg, PAGE_SIZE, 0);
122 sglist[i].length = PAGE_SIZE;
123 } 122 }
124 return sglist; 123 return sglist;
125 124
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index 285fca676a69..623eea2652ca 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -741,7 +741,7 @@ int __devinit init_ivtv_i2c(struct ivtv *itv)
741 return i2c_bit_add_bus(&itv->i2c_adap); 741 return i2c_bit_add_bus(&itv->i2c_adap);
742} 742}
743 743
744void __devexit exit_ivtv_i2c(struct ivtv *itv) 744void exit_ivtv_i2c(struct ivtv *itv)
745{ 745{
746 IVTV_DEBUG_I2C("i2c exit\n"); 746 IVTV_DEBUG_I2C("i2c exit\n");
747 747
diff --git a/drivers/media/video/ivtv/ivtv-i2c.h b/drivers/media/video/ivtv/ivtv-i2c.h
index 677c3292855e..de6a07442298 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.h
+++ b/drivers/media/video/ivtv/ivtv-i2c.h
@@ -36,6 +36,6 @@ void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg);
36 36
37/* init + register i2c algo-bit adapter */ 37/* init + register i2c algo-bit adapter */
38int __devinit init_ivtv_i2c(struct ivtv *itv); 38int __devinit init_ivtv_i2c(struct ivtv *itv);
39void __devexit exit_ivtv_i2c(struct ivtv *itv); 39void exit_ivtv_i2c(struct ivtv *itv);
40 40
41#endif 41#endif
diff --git a/drivers/media/video/ivtv/ivtv-udma.c b/drivers/media/video/ivtv/ivtv-udma.c
index 912b424e5204..460db03b0ba0 100644
--- a/drivers/media/video/ivtv/ivtv-udma.c
+++ b/drivers/media/video/ivtv/ivtv-udma.c
@@ -49,8 +49,6 @@ int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info
49 unsigned int len = (i == dma_page->page_count - 1) ? 49 unsigned int len = (i == dma_page->page_count - 1) ?
50 dma_page->tail : PAGE_SIZE - offset; 50 dma_page->tail : PAGE_SIZE - offset;
51 51
52 dma->SGlist[map_offset].length = len;
53 dma->SGlist[map_offset].offset = offset;
54 if (PageHighMem(dma->map[map_offset])) { 52 if (PageHighMem(dma->map[map_offset])) {
55 void *src; 53 void *src;
56 54
@@ -63,10 +61,10 @@ int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info
63 memcpy(page_address(dma->bouncemap[map_offset]) + offset, src, len); 61 memcpy(page_address(dma->bouncemap[map_offset]) + offset, src, len);
64 kunmap_atomic(src, KM_BOUNCE_READ); 62 kunmap_atomic(src, KM_BOUNCE_READ);
65 local_irq_restore(flags); 63 local_irq_restore(flags);
66 sg_set_page(&dma->SGlist[map_offset], dma->bouncemap[map_offset]); 64 sg_set_page(&dma->SGlist[map_offset], dma->bouncemap[map_offset], len, offset);
67 } 65 }
68 else { 66 else {
69 sg_set_page(&dma->SGlist[map_offset], dma->map[map_offset]); 67 sg_set_page(&dma->SGlist[map_offset], dma->map[map_offset], len, offset);
70 } 68 }
71 offset = 0; 69 offset = 0;
72 map_offset++; 70 map_offset++;
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
index 9ab94a749d81..44ee408e145f 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -67,8 +67,7 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages)
67 if (NULL == pg) 67 if (NULL == pg)
68 goto err; 68 goto err;
69 BUG_ON(PageHighMem(pg)); 69 BUG_ON(PageHighMem(pg));
70 sg_set_page(&sglist[i], pg); 70 sg_set_page(&sglist[i], pg, PAGE_SIZE, 0);
71 sglist[i].length = PAGE_SIZE;
72 } 71 }
73 return sglist; 72 return sglist;
74 73
@@ -95,16 +94,13 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset)
95 if (PageHighMem(pages[0])) 94 if (PageHighMem(pages[0]))
96 /* DMA to highmem pages might not work */ 95 /* DMA to highmem pages might not work */
97 goto highmem; 96 goto highmem;
98 sg_set_page(&sglist[0], pages[0]); 97 sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset);
99 sglist[0].offset = offset;
100 sglist[0].length = PAGE_SIZE - offset;
101 for (i = 1; i < nr_pages; i++) { 98 for (i = 1; i < nr_pages; i++) {
102 if (NULL == pages[i]) 99 if (NULL == pages[i])
103 goto nopage; 100 goto nopage;
104 if (PageHighMem(pages[i])) 101 if (PageHighMem(pages[i]))
105 goto highmem; 102 goto highmem;
106 sg_set_page(&sglist[i], pages[i]); 103 sg_set_page(&sglist[i], pages[i], PAGE_SIZE, 0);
107 sglist[i].length = PAGE_SIZE;
108 } 104 }
109 return sglist; 105 return sglist;
110 106
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index d602ba6d5417..682406168de9 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -284,6 +284,7 @@ static inline struct i2o_block_request *i2o_block_request_alloc(void)
284 return ERR_PTR(-ENOMEM); 284 return ERR_PTR(-ENOMEM);
285 285
286 INIT_LIST_HEAD(&ireq->queue); 286 INIT_LIST_HEAD(&ireq->queue);
287 sg_init_table(ireq->sg_table, I2O_MAX_PHYS_SEGMENTS);
287 288
288 return ireq; 289 return ireq;
289}; 290};
diff --git a/drivers/misc/fujitsu-laptop.c b/drivers/misc/fujitsu-laptop.c
index d366a6cc1fd9..c8d62c268b11 100644
--- a/drivers/misc/fujitsu-laptop.c
+++ b/drivers/misc/fujitsu-laptop.c
@@ -122,9 +122,6 @@ static int get_lcd_level(void)
122 else 122 else
123 fujitsu->brightness_changed = 0; 123 fujitsu->brightness_changed = 0;
124 124
125 if (status < 0)
126 return status;
127
128 return fujitsu->brightness_level; 125 return fujitsu->brightness_level;
129} 126}
130 127
@@ -198,7 +195,7 @@ static struct platform_driver fujitsupf_driver = {
198 195
199/* ACPI device */ 196/* ACPI device */
200 197
201int acpi_fujitsu_add(struct acpi_device *device) 198static int acpi_fujitsu_add(struct acpi_device *device)
202{ 199{
203 int result = 0; 200 int result = 0;
204 int state = 0; 201 int state = 0;
@@ -229,7 +226,7 @@ int acpi_fujitsu_add(struct acpi_device *device)
229 return result; 226 return result;
230} 227}
231 228
232int acpi_fujitsu_remove(struct acpi_device *device, int type) 229static int acpi_fujitsu_remove(struct acpi_device *device, int type)
233{ 230{
234 ACPI_FUNCTION_TRACE("acpi_fujitsu_remove"); 231 ACPI_FUNCTION_TRACE("acpi_fujitsu_remove");
235 232
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index bf4bc6adcfef..7471d49909b2 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -267,15 +267,26 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
267 267
268int mmc_send_csd(struct mmc_card *card, u32 *csd) 268int mmc_send_csd(struct mmc_card *card, u32 *csd)
269{ 269{
270 int ret, i;
271
270 if (!mmc_host_is_spi(card->host)) 272 if (!mmc_host_is_spi(card->host))
271 return mmc_send_cxd_native(card->host, card->rca << 16, 273 return mmc_send_cxd_native(card->host, card->rca << 16,
272 csd, MMC_SEND_CSD); 274 csd, MMC_SEND_CSD);
273 275
274 return mmc_send_cxd_data(card, card->host, MMC_SEND_CSD, csd, 16); 276 ret = mmc_send_cxd_data(card, card->host, MMC_SEND_CSD, csd, 16);
277 if (ret)
278 return ret;
279
280 for (i = 0;i < 4;i++)
281 csd[i] = be32_to_cpu(csd[i]);
282
283 return 0;
275} 284}
276 285
277int mmc_send_cid(struct mmc_host *host, u32 *cid) 286int mmc_send_cid(struct mmc_host *host, u32 *cid)
278{ 287{
288 int ret, i;
289
279 if (!mmc_host_is_spi(host)) { 290 if (!mmc_host_is_spi(host)) {
280 if (!host->card) 291 if (!host->card)
281 return -EINVAL; 292 return -EINVAL;
@@ -283,7 +294,14 @@ int mmc_send_cid(struct mmc_host *host, u32 *cid)
283 cid, MMC_SEND_CID); 294 cid, MMC_SEND_CID);
284 } 295 }
285 296
286 return mmc_send_cxd_data(NULL, host, MMC_SEND_CID, cid, 16); 297 ret = mmc_send_cxd_data(NULL, host, MMC_SEND_CID, cid, 16);
298 if (ret)
299 return ret;
300
301 for (i = 0;i < 4;i++)
302 cid[i] = be32_to_cpu(cid[i]);
303
304 return 0;
287} 305}
288 306
289int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd) 307int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd)
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
index ee4029a24efd..a6dafe62b992 100644
--- a/drivers/mmc/core/sd_ops.c
+++ b/drivers/mmc/core/sd_ops.c
@@ -294,8 +294,8 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
294 if (data.error) 294 if (data.error)
295 return data.error; 295 return data.error;
296 296
297 scr[0] = ntohl(scr[0]); 297 scr[0] = be32_to_cpu(scr[0]);
298 scr[1] = ntohl(scr[1]); 298 scr[1] = be32_to_cpu(scr[1]);
299 299
300 return 0; 300 return 0;
301} 301}
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index bcbb6d247bf7..c3926eb3bf43 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -40,13 +40,13 @@
40#include <linux/mm.h> 40#include <linux/mm.h>
41#include <linux/interrupt.h> 41#include <linux/interrupt.h>
42#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
43#include <linux/scatterlist.h>
43 44
44#include <linux/mmc/host.h> 45#include <linux/mmc/host.h>
45#include <asm/io.h> 46#include <asm/io.h>
46#include <asm/mach-au1x00/au1000.h> 47#include <asm/mach-au1x00/au1000.h>
47#include <asm/mach-au1x00/au1xxx_dbdma.h> 48#include <asm/mach-au1x00/au1xxx_dbdma.h>
48#include <asm/mach-au1x00/au1100_mmc.h> 49#include <asm/mach-au1x00/au1100_mmc.h>
49#include <asm/scatterlist.h>
50 50
51#include <au1xxx.h> 51#include <au1xxx.h>
52#include "au1xmmc.h" 52#include "au1xmmc.h"
@@ -212,12 +212,12 @@ static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
212 } 212 }
213 213
214 if (data) { 214 if (data) {
215 if (flags & MMC_DATA_READ) { 215 if (data->flags & MMC_DATA_READ) {
216 if (data->blocks > 1) 216 if (data->blocks > 1)
217 mmccmd |= SD_CMD_CT_4; 217 mmccmd |= SD_CMD_CT_4;
218 else 218 else
219 mmccmd |= SD_CMD_CT_2; 219 mmccmd |= SD_CMD_CT_2;
220 } else if (flags & MMC_DATA_WRITE) { 220 } else if (data->flags & MMC_DATA_WRITE) {
221 if (data->blocks > 1) 221 if (data->blocks > 1)
222 mmccmd |= SD_CMD_CT_3; 222 mmccmd |= SD_CMD_CT_3;
223 else 223 else
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c
index fc72e1fadb6a..f2070a19cfa7 100644
--- a/drivers/mmc/host/imxmmc.c
+++ b/drivers/mmc/host/imxmmc.c
@@ -262,7 +262,7 @@ static void imxmci_setup_data(struct imxmci_host *host, struct mmc_data *data)
262 } 262 }
263 263
264 /* Convert back to virtual address */ 264 /* Convert back to virtual address */
265 host->data_ptr = (u16*)sg_virt(sg); 265 host->data_ptr = (u16*)sg_virt(data->sg);
266 host->data_cnt = 0; 266 host->data_cnt = 0;
267 267
268 clear_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events); 268 clear_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events);
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 12c2d807c145..a6469218f194 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1165,6 +1165,23 @@ mmc_spi_detect_irq(int irq, void *mmc)
1165 return IRQ_HANDLED; 1165 return IRQ_HANDLED;
1166} 1166}
1167 1167
1168struct count_children {
1169 unsigned n;
1170 struct bus_type *bus;
1171};
1172
1173static int maybe_count_child(struct device *dev, void *c)
1174{
1175 struct count_children *ccp = c;
1176
1177 if (dev->bus == ccp->bus) {
1178 if (ccp->n)
1179 return -EBUSY;
1180 ccp->n++;
1181 }
1182 return 0;
1183}
1184
1168static int mmc_spi_probe(struct spi_device *spi) 1185static int mmc_spi_probe(struct spi_device *spi)
1169{ 1186{
1170 void *ones; 1187 void *ones;
@@ -1188,33 +1205,30 @@ static int mmc_spi_probe(struct spi_device *spi)
1188 return status; 1205 return status;
1189 } 1206 }
1190 1207
1191 /* We can use the bus safely iff nobody else will interfere with 1208 /* We can use the bus safely iff nobody else will interfere with us.
1192 * us. That is, either we have the experimental exclusive access 1209 * Most commands consist of one SPI message to issue a command, then
1193 * primitives ... or else there's nobody to share it with. 1210 * several more to collect its response, then possibly more for data
1211 * transfer. Clocking access to other devices during that period will
1212 * corrupt the command execution.
1213 *
1214 * Until we have software primitives which guarantee non-interference,
1215 * we'll aim for a hardware-level guarantee.
1216 *
1217 * REVISIT we can't guarantee another device won't be added later...
1194 */ 1218 */
1195 if (spi->master->num_chipselect > 1) { 1219 if (spi->master->num_chipselect > 1) {
1196 struct device *parent = spi->dev.parent; 1220 struct count_children cc;
1197 1221
1198 /* If there are multiple devices on this bus, we 1222 cc.n = 0;
1199 * can't proceed. 1223 cc.bus = spi->dev.bus;
1200 */ 1224 status = device_for_each_child(spi->dev.parent, &cc,
1201 spin_lock(&parent->klist_children.k_lock); 1225 maybe_count_child);
1202 if (parent->klist_children.k_list.next
1203 != parent->klist_children.k_list.prev)
1204 status = -EMLINK;
1205 else
1206 status = 0;
1207 spin_unlock(&parent->klist_children.k_lock);
1208 if (status < 0) { 1226 if (status < 0) {
1209 dev_err(&spi->dev, "can't share SPI bus\n"); 1227 dev_err(&spi->dev, "can't share SPI bus\n");
1210 return status; 1228 return status;
1211 } 1229 }
1212 1230
1213 /* REVISIT we can't guarantee another device won't 1231 dev_warn(&spi->dev, "ASSUMING SPI bus stays unshared!\n");
1214 * be added later. It's uncommon though ... for now,
1215 * work as if this is safe.
1216 */
1217 dev_warn(&spi->dev, "ASSUMING unshared SPI bus!\n");
1218 } 1232 }
1219 1233
1220 /* We need a supply of ones to transmit. This is the only time 1234 /* We need a supply of ones to transmit. This is the only time
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index d0eb0a2abf4d..95244a7e7353 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -20,11 +20,11 @@
20#include <linux/mmc/host.h> 20#include <linux/mmc/host.h>
21#include <linux/amba/bus.h> 21#include <linux/amba/bus.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/scatterlist.h>
23 24
24#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
25#include <asm/div64.h> 26#include <asm/div64.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <asm/scatterlist.h>
28#include <asm/sizes.h> 28#include <asm/sizes.h>
29#include <asm/mach/mmc.h> 29#include <asm/mach/mmc.h>
30 30
@@ -167,7 +167,7 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
167 * partially written to a page is properly coherent. 167 * partially written to a page is properly coherent.
168 */ 168 */
169 if (host->sg_len && data->flags & MMC_DATA_READ) 169 if (host->sg_len && data->flags & MMC_DATA_READ)
170 flush_dcache_page(host->sg_ptr->page); 170 flush_dcache_page(sg_page(host->sg_ptr));
171 } 171 }
172 if (status & MCI_DATAEND) { 172 if (status & MCI_DATAEND) {
173 mmci_stop_data(host); 173 mmci_stop_data(host);
@@ -319,7 +319,7 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id)
319 * page, ensure that the data cache is coherent. 319 * page, ensure that the data cache is coherent.
320 */ 320 */
321 if (status & MCI_RXACTIVE) 321 if (status & MCI_RXACTIVE)
322 flush_dcache_page(host->sg_ptr->page); 322 flush_dcache_page(sg_page(host->sg_ptr));
323 323
324 if (!mmci_next_sg(host)) 324 if (!mmci_next_sg(host))
325 break; 325 break;
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 0601e01aa2c2..1654a3330340 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -29,7 +29,6 @@
29 29
30#include <asm/dma.h> 30#include <asm/dma.h>
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/scatterlist.h>
33#include <asm/sizes.h> 32#include <asm/sizes.h>
34 33
35#include <asm/arch/pxa-regs.h> 34#include <asm/arch/pxa-regs.h>
@@ -40,6 +39,7 @@
40#define DRIVER_NAME "pxa2xx-mci" 39#define DRIVER_NAME "pxa2xx-mci"
41 40
42#define NR_SG 1 41#define NR_SG 1
42#define CLKRT_OFF (~0)
43 43
44struct pxamci_host { 44struct pxamci_host {
45 struct mmc_host *mmc; 45 struct mmc_host *mmc;
@@ -372,6 +372,9 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
372 unsigned long rate = host->clkrate; 372 unsigned long rate = host->clkrate;
373 unsigned int clk = rate / ios->clock; 373 unsigned int clk = rate / ios->clock;
374 374
375 if (host->clkrt == CLKRT_OFF)
376 clk_enable(host->clk);
377
375 /* 378 /*
376 * clk might result in a lower divisor than we 379 * clk might result in a lower divisor than we
377 * desire. check for that condition and adjust 380 * desire. check for that condition and adjust
@@ -380,14 +383,16 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
380 if (rate / clk > ios->clock) 383 if (rate / clk > ios->clock)
381 clk <<= 1; 384 clk <<= 1;
382 host->clkrt = fls(clk) - 1; 385 host->clkrt = fls(clk) - 1;
383 clk_enable(host->clk);
384 386
385 /* 387 /*
386 * we write clkrt on the next command 388 * we write clkrt on the next command
387 */ 389 */
388 } else { 390 } else {
389 pxamci_stop_clock(host); 391 pxamci_stop_clock(host);
390 clk_disable(host->clk); 392 if (host->clkrt != CLKRT_OFF) {
393 host->clkrt = CLKRT_OFF;
394 clk_disable(host->clk);
395 }
391 } 396 }
392 397
393 if (host->power_mode != ios->power_mode) { 398 if (host->power_mode != ios->power_mode) {
@@ -499,6 +504,7 @@ static int pxamci_probe(struct platform_device *pdev)
499 host->mmc = mmc; 504 host->mmc = mmc;
500 host->dma = -1; 505 host->dma = -1;
501 host->pdata = pdev->dev.platform_data; 506 host->pdata = pdev->dev.platform_data;
507 host->clkrt = CLKRT_OFF;
502 508
503 host->clk = clk_get(&pdev->dev, "MMCCLK"); 509 host->clk = clk_get(&pdev->dev, "MMCCLK");
504 if (IS_ERR(host->clk)) { 510 if (IS_ERR(host->clk)) {
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index d7c5b94d8c58..6b80bf77a4ef 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -17,8 +17,6 @@
17 17
18#include <linux/mmc/host.h> 18#include <linux/mmc/host.h>
19 19
20#include <asm/scatterlist.h>
21
22#include "sdhci.h" 20#include "sdhci.h"
23 21
24#define DRIVER_NAME "sdhci" 22#define DRIVER_NAME "sdhci"
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index fa4c8c53cc7a..4d5f37421874 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -33,10 +33,10 @@
33#include <linux/pnp.h> 33#include <linux/pnp.h>
34#include <linux/highmem.h> 34#include <linux/highmem.h>
35#include <linux/mmc/host.h> 35#include <linux/mmc/host.h>
36#include <linux/scatterlist.h>
36 37
37#include <asm/io.h> 38#include <asm/io.h>
38#include <asm/dma.h> 39#include <asm/dma.h>
39#include <asm/scatterlist.h>
40 40
41#include "wbsd.h" 41#include "wbsd.h"
42 42
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 86b8641b4664..5f800a6dd978 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -166,13 +166,14 @@ config NET_SB1000
166 If you don't have this card, of course say N. 166 If you don't have this card, of course say N.
167 167
168config IP1000 168config IP1000
169 tristate "IP1000 Gigabit Ethernet support" 169 tristate "IP1000 Gigabit Ethernet support"
170 depends on PCI && EXPERIMENTAL 170 depends on PCI && EXPERIMENTAL
171 ---help--- 171 select MII
172 This driver supports IP1000 gigabit Ethernet cards. 172 ---help---
173 This driver supports IP1000 gigabit Ethernet cards.
173 174
174 To compile this driver as a module, choose M here: the module 175 To compile this driver as a module, choose M here: the module
175 will be called ipg. This is recommended. 176 will be called ipg. This is recommended.
176 177
177source "drivers/net/arcnet/Kconfig" 178source "drivers/net/arcnet/Kconfig"
178 179
@@ -1880,6 +1881,28 @@ config FEC2
1880 Say Y here if you want to use the second built-in 10/100 Fast 1881 Say Y here if you want to use the second built-in 10/100 Fast
1881 ethernet controller on some Motorola ColdFire processors. 1882 ethernet controller on some Motorola ColdFire processors.
1882 1883
1884config FEC_MPC52xx
1885 tristate "MPC52xx FEC driver"
1886 depends on PPC_MERGE && PPC_MPC52xx && PPC_BESTCOMM_FEC
1887 select CRC32
1888 select PHYLIB
1889 ---help---
1890 This option enables support for the MPC5200's on-chip
1891 Fast Ethernet Controller
1892 If compiled as module, it will be called 'fec_mpc52xx.ko'.
1893
1894config FEC_MPC52xx_MDIO
1895 bool "MPC52xx FEC MDIO bus driver"
1896 depends on FEC_MPC52xx
1897 default y
1898 ---help---
1899 The MPC5200's FEC can connect to the Ethernet either with
1900 an external MII PHY chip or 10 Mbps 7-wire interface
1901 (Motorola? industry standard).
1902 If your board uses an external PHY connected to FEC, enable this.
1903 If not sure, enable.
1904 If compiled as module, it will be called 'fec_mpc52xx_phy.ko'.
1905
1883config NE_H8300 1906config NE_H8300
1884 tristate "NE2000 compatible support for H8/300" 1907 tristate "NE2000 compatible support for H8/300"
1885 depends on H8300 1908 depends on H8300
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 593262065c9b..0e5fde4a1b2c 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -96,6 +96,10 @@ obj-$(CONFIG_SHAPER) += shaper.o
96obj-$(CONFIG_HP100) += hp100.o 96obj-$(CONFIG_HP100) += hp100.o
97obj-$(CONFIG_SMC9194) += smc9194.o 97obj-$(CONFIG_SMC9194) += smc9194.o
98obj-$(CONFIG_FEC) += fec.o 98obj-$(CONFIG_FEC) += fec.o
99obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx.o
100ifeq ($(CONFIG_FEC_MPC52xx_MDIO),y)
101 obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx_phy.o
102endif
99obj-$(CONFIG_68360_ENET) += 68360enet.o 103obj-$(CONFIG_68360_ENET) += 68360enet.o
100obj-$(CONFIG_WD80x3) += wd.o 8390.o 104obj-$(CONFIG_WD80x3) += wd.o 8390.o
101obj-$(CONFIG_EL2) += 3c503.o 8390.o 105obj-$(CONFIG_EL2) += 3c503.o 8390.o
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 53fe7ded5d50..084acfd6fc5f 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -371,7 +371,6 @@ static void bf537_adjust_link(struct net_device *dev)
371 if (phydev->speed != lp->old_speed) { 371 if (phydev->speed != lp->old_speed) {
372#if defined(CONFIG_BFIN_MAC_RMII) 372#if defined(CONFIG_BFIN_MAC_RMII)
373 u32 opmode = bfin_read_EMAC_OPMODE(); 373 u32 opmode = bfin_read_EMAC_OPMODE();
374 bf537mac_disable();
375 switch (phydev->speed) { 374 switch (phydev->speed) {
376 case 10: 375 case 10:
377 opmode |= RMII_10; 376 opmode |= RMII_10;
@@ -386,7 +385,6 @@ static void bf537_adjust_link(struct net_device *dev)
386 break; 385 break;
387 } 386 }
388 bfin_write_EMAC_OPMODE(opmode); 387 bfin_write_EMAC_OPMODE(opmode);
389 bf537mac_enable();
390#endif 388#endif
391 389
392 new_state = 1; 390 new_state = 1;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 6909becb10f6..6937ef0e7275 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -188,6 +188,7 @@ struct bond_parm_tbl arp_validate_tbl[] = {
188/*-------------------------- Forward declarations ---------------------------*/ 188/*-------------------------- Forward declarations ---------------------------*/
189 189
190static void bond_send_gratuitous_arp(struct bonding *bond); 190static void bond_send_gratuitous_arp(struct bonding *bond);
191static void bond_deinit(struct net_device *bond_dev);
191 192
192/*---------------------------- General routines -----------------------------*/ 193/*---------------------------- General routines -----------------------------*/
193 194
@@ -3681,7 +3682,7 @@ static int bond_open(struct net_device *bond_dev)
3681 } 3682 }
3682 3683
3683 if (bond->params.mode == BOND_MODE_8023AD) { 3684 if (bond->params.mode == BOND_MODE_8023AD) {
3684 INIT_DELAYED_WORK(&bond->ad_work, bond_alb_monitor); 3685 INIT_DELAYED_WORK(&bond->ad_work, bond_3ad_state_machine_handler);
3685 queue_delayed_work(bond->wq, &bond->ad_work, 0); 3686 queue_delayed_work(bond->wq, &bond->ad_work, 0);
3686 /* register to receive LACPDUs */ 3687 /* register to receive LACPDUs */
3687 bond_register_lacpdu(bond); 3688 bond_register_lacpdu(bond);
@@ -4449,7 +4450,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
4449/* De-initialize device specific data. 4450/* De-initialize device specific data.
4450 * Caller must hold rtnl_lock. 4451 * Caller must hold rtnl_lock.
4451 */ 4452 */
4452void bond_deinit(struct net_device *bond_dev) 4453static void bond_deinit(struct net_device *bond_dev)
4453{ 4454{
4454 struct bonding *bond = bond_dev->priv; 4455 struct bonding *bond = bond_dev->priv;
4455 4456
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index d1ed14bf1ccb..61c1b4536d34 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -302,7 +302,6 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_de
302int bond_create(char *name, struct bond_params *params, struct bonding **newbond); 302int bond_create(char *name, struct bond_params *params, struct bonding **newbond);
303void bond_destroy(struct bonding *bond); 303void bond_destroy(struct bonding *bond);
304int bond_release_and_destroy(struct net_device *bond_dev, struct net_device *slave_dev); 304int bond_release_and_destroy(struct net_device *bond_dev, struct net_device *slave_dev);
305void bond_deinit(struct net_device *bond_dev);
306int bond_create_sysfs(void); 305int bond_create_sysfs(void);
307void bond_destroy_sysfs(void); 306void bond_destroy_sysfs(void);
308void bond_destroy_sysfs_entry(struct bonding *bond); 307void bond_destroy_sysfs_entry(struct bonding *bond);
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 57541d2d9e1e..6fd95a2c8cec 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -34,6 +34,7 @@
34#include <linux/skbuff.h> 34#include <linux/skbuff.h>
35#include <linux/mii.h> 35#include <linux/mii.h>
36#include <linux/phy.h> 36#include <linux/phy.h>
37#include <linux/phy_fixed.h>
37#include <linux/platform_device.h> 38#include <linux/platform_device.h>
38#include <linux/dma-mapping.h> 39#include <linux/dma-mapping.h>
39#include <asm/gpio.h> 40#include <asm/gpio.h>
@@ -53,12 +54,6 @@ MODULE_PARM_DESC(debug_level, "Number of NETIF_MSG bits to enable");
53MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus"); 54MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus");
54 55
55#define CPMAC_VERSION "0.5.0" 56#define CPMAC_VERSION "0.5.0"
56/* stolen from net/ieee80211.h */
57#ifndef MAC_FMT
58#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
59#define MAC_ARG(x) ((u8*)(x))[0], ((u8*)(x))[1], ((u8*)(x))[2], \
60 ((u8*)(x))[3], ((u8*)(x))[4], ((u8*)(x))[5]
61#endif
62/* frame size + 802.1q tag */ 57/* frame size + 802.1q tag */
63#define CPMAC_SKB_SIZE (ETH_FRAME_LEN + 4) 58#define CPMAC_SKB_SIZE (ETH_FRAME_LEN + 4)
64#define CPMAC_QUEUES 8 59#define CPMAC_QUEUES 8
@@ -211,6 +206,7 @@ struct cpmac_priv {
211 struct net_device *dev; 206 struct net_device *dev;
212 struct work_struct reset_work; 207 struct work_struct reset_work;
213 struct platform_device *pdev; 208 struct platform_device *pdev;
209 struct napi_struct napi;
214}; 210};
215 211
216static irqreturn_t cpmac_irq(int, void *); 212static irqreturn_t cpmac_irq(int, void *);
@@ -362,47 +358,48 @@ static void cpmac_set_multicast_list(struct net_device *dev)
362 } 358 }
363} 359}
364 360
365static struct sk_buff *cpmac_rx_one(struct net_device *dev, 361static struct sk_buff *cpmac_rx_one(struct cpmac_priv *priv,
366 struct cpmac_priv *priv,
367 struct cpmac_desc *desc) 362 struct cpmac_desc *desc)
368{ 363{
369 struct sk_buff *skb, *result = NULL; 364 struct sk_buff *skb, *result = NULL;
370 365
371 if (unlikely(netif_msg_hw(priv))) 366 if (unlikely(netif_msg_hw(priv)))
372 cpmac_dump_desc(dev, desc); 367 cpmac_dump_desc(priv->dev, desc);
373 cpmac_write(priv->regs, CPMAC_RX_ACK(0), (u32)desc->mapping); 368 cpmac_write(priv->regs, CPMAC_RX_ACK(0), (u32)desc->mapping);
374 if (unlikely(!desc->datalen)) { 369 if (unlikely(!desc->datalen)) {
375 if (netif_msg_rx_err(priv) && net_ratelimit()) 370 if (netif_msg_rx_err(priv) && net_ratelimit())
376 printk(KERN_WARNING "%s: rx: spurious interrupt\n", 371 printk(KERN_WARNING "%s: rx: spurious interrupt\n",
377 dev->name); 372 priv->dev->name);
378 return NULL; 373 return NULL;
379 } 374 }
380 375
381 skb = netdev_alloc_skb(dev, CPMAC_SKB_SIZE); 376 skb = netdev_alloc_skb(priv->dev, CPMAC_SKB_SIZE);
382 if (likely(skb)) { 377 if (likely(skb)) {
383 skb_reserve(skb, 2); 378 skb_reserve(skb, 2);
384 skb_put(desc->skb, desc->datalen); 379 skb_put(desc->skb, desc->datalen);
385 desc->skb->protocol = eth_type_trans(desc->skb, dev); 380 desc->skb->protocol = eth_type_trans(desc->skb, priv->dev);
386 desc->skb->ip_summed = CHECKSUM_NONE; 381 desc->skb->ip_summed = CHECKSUM_NONE;
387 dev->stats.rx_packets++; 382 priv->dev->stats.rx_packets++;
388 dev->stats.rx_bytes += desc->datalen; 383 priv->dev->stats.rx_bytes += desc->datalen;
389 result = desc->skb; 384 result = desc->skb;
390 dma_unmap_single(&dev->dev, desc->data_mapping, CPMAC_SKB_SIZE, 385 dma_unmap_single(&priv->dev->dev, desc->data_mapping,
391 DMA_FROM_DEVICE); 386 CPMAC_SKB_SIZE, DMA_FROM_DEVICE);
392 desc->skb = skb; 387 desc->skb = skb;
393 desc->data_mapping = dma_map_single(&dev->dev, skb->data, 388 desc->data_mapping = dma_map_single(&priv->dev->dev, skb->data,
394 CPMAC_SKB_SIZE, 389 CPMAC_SKB_SIZE,
395 DMA_FROM_DEVICE); 390 DMA_FROM_DEVICE);
396 desc->hw_data = (u32)desc->data_mapping; 391 desc->hw_data = (u32)desc->data_mapping;
397 if (unlikely(netif_msg_pktdata(priv))) { 392 if (unlikely(netif_msg_pktdata(priv))) {
398 printk(KERN_DEBUG "%s: received packet:\n", dev->name); 393 printk(KERN_DEBUG "%s: received packet:\n",
399 cpmac_dump_skb(dev, result); 394 priv->dev->name);
395 cpmac_dump_skb(priv->dev, result);
400 } 396 }
401 } else { 397 } else {
402 if (netif_msg_rx_err(priv) && net_ratelimit()) 398 if (netif_msg_rx_err(priv) && net_ratelimit())
403 printk(KERN_WARNING 399 printk(KERN_WARNING
404 "%s: low on skbs, dropping packet\n", dev->name); 400 "%s: low on skbs, dropping packet\n",
405 dev->stats.rx_dropped++; 401 priv->dev->name);
402 priv->dev->stats.rx_dropped++;
406 } 403 }
407 404
408 desc->buflen = CPMAC_SKB_SIZE; 405 desc->buflen = CPMAC_SKB_SIZE;
@@ -411,25 +408,25 @@ static struct sk_buff *cpmac_rx_one(struct net_device *dev,
411 return result; 408 return result;
412} 409}
413 410
414static int cpmac_poll(struct net_device *dev, int *budget) 411static int cpmac_poll(struct napi_struct *napi, int budget)
415{ 412{
416 struct sk_buff *skb; 413 struct sk_buff *skb;
417 struct cpmac_desc *desc; 414 struct cpmac_desc *desc;
418 int received = 0, quota = min(dev->quota, *budget); 415 int received = 0;
419 struct cpmac_priv *priv = netdev_priv(dev); 416 struct cpmac_priv *priv = container_of(napi, struct cpmac_priv, napi);
420 417
421 spin_lock(&priv->rx_lock); 418 spin_lock(&priv->rx_lock);
422 if (unlikely(!priv->rx_head)) { 419 if (unlikely(!priv->rx_head)) {
423 if (netif_msg_rx_err(priv) && net_ratelimit()) 420 if (netif_msg_rx_err(priv) && net_ratelimit())
424 printk(KERN_WARNING "%s: rx: polling, but no queue\n", 421 printk(KERN_WARNING "%s: rx: polling, but no queue\n",
425 dev->name); 422 priv->dev->name);
426 netif_rx_complete(dev); 423 netif_rx_complete(priv->dev, napi);
427 return 0; 424 return 0;
428 } 425 }
429 426
430 desc = priv->rx_head; 427 desc = priv->rx_head;
431 while ((received < quota) && ((desc->dataflags & CPMAC_OWN) == 0)) { 428 while (((desc->dataflags & CPMAC_OWN) == 0) && (received < budget)) {
432 skb = cpmac_rx_one(dev, priv, desc); 429 skb = cpmac_rx_one(priv, desc);
433 if (likely(skb)) { 430 if (likely(skb)) {
434 netif_receive_skb(skb); 431 netif_receive_skb(skb);
435 received++; 432 received++;
@@ -439,13 +436,11 @@ static int cpmac_poll(struct net_device *dev, int *budget)
439 436
440 priv->rx_head = desc; 437 priv->rx_head = desc;
441 spin_unlock(&priv->rx_lock); 438 spin_unlock(&priv->rx_lock);
442 *budget -= received;
443 dev->quota -= received;
444 if (unlikely(netif_msg_rx_status(priv))) 439 if (unlikely(netif_msg_rx_status(priv)))
445 printk(KERN_DEBUG "%s: poll processed %d packets\n", dev->name, 440 printk(KERN_DEBUG "%s: poll processed %d packets\n",
446 received); 441 priv->dev->name, received);
447 if (desc->dataflags & CPMAC_OWN) { 442 if (desc->dataflags & CPMAC_OWN) {
448 netif_rx_complete(dev); 443 netif_rx_complete(priv->dev, napi);
449 cpmac_write(priv->regs, CPMAC_RX_PTR(0), (u32)desc->mapping); 444 cpmac_write(priv->regs, CPMAC_RX_PTR(0), (u32)desc->mapping);
450 cpmac_write(priv->regs, CPMAC_RX_INT_ENABLE, 1); 445 cpmac_write(priv->regs, CPMAC_RX_INT_ENABLE, 1);
451 return 0; 446 return 0;
@@ -655,6 +650,7 @@ static void cpmac_hw_error(struct work_struct *work)
655 spin_unlock(&priv->rx_lock); 650 spin_unlock(&priv->rx_lock);
656 cpmac_clear_tx(priv->dev); 651 cpmac_clear_tx(priv->dev);
657 cpmac_hw_start(priv->dev); 652 cpmac_hw_start(priv->dev);
653 napi_enable(&priv->napi);
658 netif_start_queue(priv->dev); 654 netif_start_queue(priv->dev);
659} 655}
660 656
@@ -681,8 +677,10 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id)
681 677
682 if (status & MAC_INT_RX) { 678 if (status & MAC_INT_RX) {
683 queue = (status >> 8) & 7; 679 queue = (status >> 8) & 7;
684 netif_rx_schedule(dev); 680 if (netif_rx_schedule_prep(dev, &priv->napi)) {
685 cpmac_write(priv->regs, CPMAC_RX_INT_CLEAR, 1 << queue); 681 cpmac_write(priv->regs, CPMAC_RX_INT_CLEAR, 1 << queue);
682 __netif_rx_schedule(dev, &priv->napi);
683 }
686 } 684 }
687 685
688 cpmac_write(priv->regs, CPMAC_MAC_EOI_VECTOR, 0); 686 cpmac_write(priv->regs, CPMAC_MAC_EOI_VECTOR, 0);
@@ -692,6 +690,7 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id)
692 printk(KERN_ERR "%s: hw error, resetting...\n", 690 printk(KERN_ERR "%s: hw error, resetting...\n",
693 dev->name); 691 dev->name);
694 netif_stop_queue(dev); 692 netif_stop_queue(dev);
693 napi_disable(&priv->napi);
695 cpmac_hw_stop(dev); 694 cpmac_hw_stop(dev);
696 schedule_work(&priv->reset_work); 695 schedule_work(&priv->reset_work);
697 if (unlikely(netif_msg_hw(priv))) 696 if (unlikely(netif_msg_hw(priv)))
@@ -849,6 +848,15 @@ static void cpmac_adjust_link(struct net_device *dev)
849 spin_unlock(&priv->lock); 848 spin_unlock(&priv->lock);
850} 849}
851 850
851static int cpmac_link_update(struct net_device *dev,
852 struct fixed_phy_status *status)
853{
854 status->link = 1;
855 status->speed = 100;
856 status->duplex = 1;
857 return 0;
858}
859
852static int cpmac_open(struct net_device *dev) 860static int cpmac_open(struct net_device *dev)
853{ 861{
854 int i, size, res; 862 int i, size, res;
@@ -857,15 +865,6 @@ static int cpmac_open(struct net_device *dev)
857 struct cpmac_desc *desc; 865 struct cpmac_desc *desc;
858 struct sk_buff *skb; 866 struct sk_buff *skb;
859 867
860 priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link,
861 0, PHY_INTERFACE_MODE_MII);
862 if (IS_ERR(priv->phy)) {
863 if (netif_msg_drv(priv))
864 printk(KERN_ERR "%s: Could not attach to PHY\n",
865 dev->name);
866 return PTR_ERR(priv->phy);
867 }
868
869 mem = platform_get_resource_byname(priv->pdev, IORESOURCE_MEM, "regs"); 868 mem = platform_get_resource_byname(priv->pdev, IORESOURCE_MEM, "regs");
870 if (!request_mem_region(mem->start, mem->end - mem->start, dev->name)) { 869 if (!request_mem_region(mem->start, mem->end - mem->start, dev->name)) {
871 if (netif_msg_drv(priv)) 870 if (netif_msg_drv(priv))
@@ -927,6 +926,7 @@ static int cpmac_open(struct net_device *dev)
927 INIT_WORK(&priv->reset_work, cpmac_hw_error); 926 INIT_WORK(&priv->reset_work, cpmac_hw_error);
928 cpmac_hw_start(dev); 927 cpmac_hw_start(dev);
929 928
929 napi_enable(&priv->napi);
930 priv->phy->state = PHY_CHANGELINK; 930 priv->phy->state = PHY_CHANGELINK;
931 phy_start(priv->phy); 931 phy_start(priv->phy);
932 932
@@ -951,8 +951,6 @@ fail_remap:
951 release_mem_region(mem->start, mem->end - mem->start); 951 release_mem_region(mem->start, mem->end - mem->start);
952 952
953fail_reserve: 953fail_reserve:
954 phy_disconnect(priv->phy);
955
956 return res; 954 return res;
957} 955}
958 956
@@ -965,9 +963,8 @@ static int cpmac_stop(struct net_device *dev)
965 netif_stop_queue(dev); 963 netif_stop_queue(dev);
966 964
967 cancel_work_sync(&priv->reset_work); 965 cancel_work_sync(&priv->reset_work);
966 napi_disable(&priv->napi);
968 phy_stop(priv->phy); 967 phy_stop(priv->phy);
969 phy_disconnect(priv->phy);
970 priv->phy = NULL;
971 968
972 cpmac_hw_stop(dev); 969 cpmac_hw_stop(dev);
973 970
@@ -1001,11 +998,13 @@ static int external_switch;
1001 998
1002static int __devinit cpmac_probe(struct platform_device *pdev) 999static int __devinit cpmac_probe(struct platform_device *pdev)
1003{ 1000{
1004 int rc, phy_id; 1001 int rc, phy_id, i;
1005 struct resource *mem; 1002 struct resource *mem;
1006 struct cpmac_priv *priv; 1003 struct cpmac_priv *priv;
1007 struct net_device *dev; 1004 struct net_device *dev;
1008 struct plat_cpmac_data *pdata; 1005 struct plat_cpmac_data *pdata;
1006 struct fixed_info *fixed_phy;
1007 DECLARE_MAC_BUF(mac);
1009 1008
1010 pdata = pdev->dev.platform_data; 1009 pdata = pdev->dev.platform_data;
1011 1010
@@ -1053,21 +1052,51 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1053 dev->set_multicast_list = cpmac_set_multicast_list; 1052 dev->set_multicast_list = cpmac_set_multicast_list;
1054 dev->tx_timeout = cpmac_tx_timeout; 1053 dev->tx_timeout = cpmac_tx_timeout;
1055 dev->ethtool_ops = &cpmac_ethtool_ops; 1054 dev->ethtool_ops = &cpmac_ethtool_ops;
1056 dev->poll = cpmac_poll;
1057 dev->weight = 64;
1058 dev->features |= NETIF_F_MULTI_QUEUE; 1055 dev->features |= NETIF_F_MULTI_QUEUE;
1059 1056
1057 netif_napi_add(dev, &priv->napi, cpmac_poll, 64);
1058
1060 spin_lock_init(&priv->lock); 1059 spin_lock_init(&priv->lock);
1061 spin_lock_init(&priv->rx_lock); 1060 spin_lock_init(&priv->rx_lock);
1062 priv->dev = dev; 1061 priv->dev = dev;
1063 priv->ring_size = 64; 1062 priv->ring_size = 64;
1064 priv->msg_enable = netif_msg_init(debug_level, 0xff); 1063 priv->msg_enable = netif_msg_init(debug_level, 0xff);
1065 memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); 1064 memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
1065
1066 if (phy_id == 31) { 1066 if (phy_id == 31) {
1067 snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, 1067 snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, cpmac_mii.id,
1068 cpmac_mii.id, phy_id); 1068 phy_id);
1069 } else 1069 } else {
1070 snprintf(priv->phy_name, BUS_ID_SIZE, "fixed@%d:%d", 100, 1); 1070 /* Let's try to get a free fixed phy... */
1071 for (i = 0; i < MAX_PHY_AMNT; i++) {
1072 fixed_phy = fixed_mdio_get_phydev(i);
1073 if (!fixed_phy)
1074 continue;
1075 if (!fixed_phy->phydev->attached_dev) {
1076 strncpy(priv->phy_name,
1077 fixed_phy->phydev->dev.bus_id,
1078 BUS_ID_SIZE);
1079 fixed_mdio_set_link_update(fixed_phy->phydev,
1080 &cpmac_link_update);
1081 goto phy_found;
1082 }
1083 }
1084 if (netif_msg_drv(priv))
1085 printk(KERN_ERR "%s: Could not find fixed PHY\n",
1086 dev->name);
1087 rc = -ENODEV;
1088 goto fail;
1089 }
1090
1091phy_found:
1092 priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0,
1093 PHY_INTERFACE_MODE_MII);
1094 if (IS_ERR(priv->phy)) {
1095 if (netif_msg_drv(priv))
1096 printk(KERN_ERR "%s: Could not attach to PHY\n",
1097 dev->name);
1098 return PTR_ERR(priv->phy);
1099 }
1071 1100
1072 if ((rc = register_netdev(dev))) { 1101 if ((rc = register_netdev(dev))) {
1073 printk(KERN_ERR "cpmac: error %i registering device %s\n", rc, 1102 printk(KERN_ERR "cpmac: error %i registering device %s\n", rc,
@@ -1077,9 +1106,9 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1077 1106
1078 if (netif_msg_probe(priv)) { 1107 if (netif_msg_probe(priv)) {
1079 printk(KERN_INFO 1108 printk(KERN_INFO
1080 "cpmac: device %s (regs: %p, irq: %d, phy: %s, mac: " 1109 "cpmac: device %s (regs: %p, irq: %d, phy: %s, "
1081 MAC_FMT ")\n", dev->name, (void *)mem->start, dev->irq, 1110 "mac: %s)\n", dev->name, (void *)mem->start, dev->irq,
1082 priv->phy_name, MAC_ARG(dev->dev_addr)); 1111 priv->phy_name, print_mac(mac, dev->dev_addr));
1083 } 1112 }
1084 return 0; 1113 return 0;
1085 1114
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 781ed9968489..3b840283a9c3 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -351,4 +351,12 @@ enum e1000_state_t {
351 __E1000_DOWN 351 __E1000_DOWN
352}; 352};
353 353
354extern char e1000_driver_name[];
355extern const char e1000_driver_version[];
356
357extern void e1000_power_up_phy(struct e1000_adapter *);
358extern void e1000_set_ethtool_ops(struct net_device *netdev);
359extern void e1000_check_options(struct e1000_adapter *adapter);
360
361
354#endif /* _E1000_H_ */ 362#endif /* _E1000_H_ */
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 6c9a643426f5..667f18bcc172 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -32,9 +32,6 @@
32 32
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34 34
35extern char e1000_driver_name[];
36extern char e1000_driver_version[];
37
38extern int e1000_up(struct e1000_adapter *adapter); 35extern int e1000_up(struct e1000_adapter *adapter);
39extern void e1000_down(struct e1000_adapter *adapter); 36extern void e1000_down(struct e1000_adapter *adapter);
40extern void e1000_reinit_locked(struct e1000_adapter *adapter); 37extern void e1000_reinit_locked(struct e1000_adapter *adapter);
@@ -733,16 +730,16 @@ err_setup:
733 730
734#define REG_PATTERN_TEST(R, M, W) \ 731#define REG_PATTERN_TEST(R, M, W) \
735{ \ 732{ \
736 uint32_t pat, value; \ 733 uint32_t pat, val; \
737 uint32_t test[] = \ 734 const uint32_t test[] = \
738 {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \ 735 {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \
739 for (pat = 0; pat < ARRAY_SIZE(test); pat++) { \ 736 for (pat = 0; pat < ARRAY_SIZE(test); pat++) { \
740 E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ 737 E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \
741 value = E1000_READ_REG(&adapter->hw, R); \ 738 val = E1000_READ_REG(&adapter->hw, R); \
742 if (value != (test[pat] & W & M)) { \ 739 if (val != (test[pat] & W & M)) { \
743 DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \ 740 DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \
744 "0x%08X expected 0x%08X\n", \ 741 "0x%08X expected 0x%08X\n", \
745 E1000_##R, value, (test[pat] & W & M)); \ 742 E1000_##R, val, (test[pat] & W & M)); \
746 *data = (adapter->hw.mac_type < e1000_82543) ? \ 743 *data = (adapter->hw.mac_type < e1000_82543) ? \
747 E1000_82542_##R : E1000_##R; \ 744 E1000_82542_##R : E1000_##R; \
748 return 1; \ 745 return 1; \
@@ -752,12 +749,12 @@ err_setup:
752 749
753#define REG_SET_AND_CHECK(R, M, W) \ 750#define REG_SET_AND_CHECK(R, M, W) \
754{ \ 751{ \
755 uint32_t value; \ 752 uint32_t val; \
756 E1000_WRITE_REG(&adapter->hw, R, W & M); \ 753 E1000_WRITE_REG(&adapter->hw, R, W & M); \
757 value = E1000_READ_REG(&adapter->hw, R); \ 754 val = E1000_READ_REG(&adapter->hw, R); \
758 if ((W & M) != (value & M)) { \ 755 if ((W & M) != (val & M)) { \
759 DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\ 756 DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\
760 "expected 0x%08X\n", E1000_##R, (value & M), (W & M)); \ 757 "expected 0x%08X\n", E1000_##R, (val & M), (W & M)); \
761 *data = (adapter->hw.mac_type < e1000_82543) ? \ 758 *data = (adapter->hw.mac_type < e1000_82543) ? \
762 E1000_82542_##R : E1000_##R; \ 759 E1000_82542_##R : E1000_##R; \
763 return 1; \ 760 return 1; \
@@ -1621,8 +1618,6 @@ e1000_get_sset_count(struct net_device *netdev, int sset)
1621 } 1618 }
1622} 1619}
1623 1620
1624extern void e1000_power_up_phy(struct e1000_adapter *);
1625
1626static void 1621static void
1627e1000_diag_test(struct net_device *netdev, 1622e1000_diag_test(struct net_device *netdev,
1628 struct ethtool_test *eth_test, uint64_t *data) 1623 struct ethtool_test *eth_test, uint64_t *data)
@@ -1859,8 +1854,8 @@ e1000_phys_id(struct net_device *netdev, uint32_t data)
1859{ 1854{
1860 struct e1000_adapter *adapter = netdev_priv(netdev); 1855 struct e1000_adapter *adapter = netdev_priv(netdev);
1861 1856
1862 if (!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) 1857 if (!data)
1863 data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); 1858 data = INT_MAX;
1864 1859
1865 if (adapter->hw.mac_type < e1000_82571) { 1860 if (adapter->hw.mac_type < e1000_82571) {
1866 if (!adapter->blink_timer.function) { 1861 if (!adapter->blink_timer.function) {
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 8fa0fe4009d5..7c6888c58c21 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -8607,7 +8607,7 @@ e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index,
8607 8607
8608 DEBUGFUNC("e1000_read_ich8_data"); 8608 DEBUGFUNC("e1000_read_ich8_data");
8609 8609
8610 if (size < 1 || size > 2 || data == 0x0 || 8610 if (size < 1 || size > 2 || data == NULL ||
8611 index > ICH_FLASH_LINEAR_ADDR_MASK) 8611 index > ICH_FLASH_LINEAR_ADDR_MASK)
8612 return error; 8612 return error;
8613 8613
@@ -8841,7 +8841,7 @@ e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t *data)
8841 * amount of NVM used in each bank is a *minimum* of 4 KBytes, but in fact the 8841 * amount of NVM used in each bank is a *minimum* of 4 KBytes, but in fact the
8842 * bank size may be 4, 8 or 64 KBytes 8842 * bank size may be 4, 8 or 64 KBytes
8843 *****************************************************************************/ 8843 *****************************************************************************/
8844int32_t 8844static int32_t
8845e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank) 8845e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank)
8846{ 8846{
8847 union ich8_hws_flash_status hsfsts; 8847 union ich8_hws_flash_status hsfsts;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index f1ce348470cc..72deff0d4d90 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -37,8 +37,8 @@ static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
37#define DRIVERNAPI "-NAPI" 37#define DRIVERNAPI "-NAPI"
38#endif 38#endif
39#define DRV_VERSION "7.3.20-k2"DRIVERNAPI 39#define DRV_VERSION "7.3.20-k2"DRIVERNAPI
40char e1000_driver_version[] = DRV_VERSION; 40const char e1000_driver_version[] = DRV_VERSION;
41static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 41static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
42 42
43/* e1000_pci_tbl - PCI Device ID Table 43/* e1000_pci_tbl - PCI Device ID Table
44 * 44 *
@@ -188,7 +188,6 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
188static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); 188static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
189static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, 189static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
190 int cmd); 190 int cmd);
191void e1000_set_ethtool_ops(struct net_device *netdev);
192static void e1000_enter_82542_rst(struct e1000_adapter *adapter); 191static void e1000_enter_82542_rst(struct e1000_adapter *adapter);
193static void e1000_leave_82542_rst(struct e1000_adapter *adapter); 192static void e1000_leave_82542_rst(struct e1000_adapter *adapter);
194static void e1000_tx_timeout(struct net_device *dev); 193static void e1000_tx_timeout(struct net_device *dev);
@@ -213,8 +212,6 @@ static void e1000_shutdown(struct pci_dev *pdev);
213static void e1000_netpoll (struct net_device *netdev); 212static void e1000_netpoll (struct net_device *netdev);
214#endif 213#endif
215 214
216extern void e1000_check_options(struct e1000_adapter *adapter);
217
218#define COPYBREAK_DEFAULT 256 215#define COPYBREAK_DEFAULT 256
219static unsigned int copybreak __read_mostly = COPYBREAK_DEFAULT; 216static unsigned int copybreak __read_mostly = COPYBREAK_DEFAULT;
220module_param(copybreak, uint, 0644); 217module_param(copybreak, uint, 0644);
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index f485874a63f5..e6565ce686bc 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -46,7 +46,7 @@
46#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } 46#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
47#define E1000_PARAM(X, desc) \ 47#define E1000_PARAM(X, desc) \
48 static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ 48 static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
49 static int num_##X = 0; \ 49 static unsigned int num_##X; \
50 module_param_array_named(X, X, int, &num_##X, 0); \ 50 module_param_array_named(X, X, int, &num_##X, 0); \
51 MODULE_PARM_DESC(X, desc); 51 MODULE_PARM_DESC(X, desc);
52 52
@@ -198,9 +198,9 @@ E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
198 198
199struct e1000_option { 199struct e1000_option {
200 enum { enable_option, range_option, list_option } type; 200 enum { enable_option, range_option, list_option } type;
201 char *name; 201 const char *name;
202 char *err; 202 const char *err;
203 int def; 203 int def;
204 union { 204 union {
205 struct { /* range_option info */ 205 struct { /* range_option info */
206 int min; 206 int min;
@@ -214,8 +214,9 @@ struct e1000_option {
214}; 214};
215 215
216static int __devinit 216static int __devinit
217e1000_validate_option(int *value, struct e1000_option *opt, 217e1000_validate_option(unsigned int *value,
218 struct e1000_adapter *adapter) 218 const struct e1000_option *opt,
219 struct e1000_adapter *adapter)
219{ 220{
220 if (*value == OPTION_UNSET) { 221 if (*value == OPTION_UNSET) {
221 *value = opt->def; 222 *value = opt->def;
@@ -348,7 +349,7 @@ e1000_check_options(struct e1000_adapter *adapter)
348 }; 349 };
349 350
350 if (num_XsumRX > bd) { 351 if (num_XsumRX > bd) {
351 int rx_csum = XsumRX[bd]; 352 unsigned int rx_csum = XsumRX[bd];
352 e1000_validate_option(&rx_csum, &opt, adapter); 353 e1000_validate_option(&rx_csum, &opt, adapter);
353 adapter->rx_csum = rx_csum; 354 adapter->rx_csum = rx_csum;
354 } else { 355 } else {
@@ -374,7 +375,7 @@ e1000_check_options(struct e1000_adapter *adapter)
374 }; 375 };
375 376
376 if (num_FlowControl > bd) { 377 if (num_FlowControl > bd) {
377 int fc = FlowControl[bd]; 378 unsigned int fc = FlowControl[bd];
378 e1000_validate_option(&fc, &opt, adapter); 379 e1000_validate_option(&fc, &opt, adapter);
379 adapter->hw.fc = adapter->hw.original_fc = fc; 380 adapter->hw.fc = adapter->hw.original_fc = fc;
380 } else { 381 } else {
@@ -506,7 +507,7 @@ e1000_check_options(struct e1000_adapter *adapter)
506 }; 507 };
507 508
508 if (num_SmartPowerDownEnable > bd) { 509 if (num_SmartPowerDownEnable > bd) {
509 int spd = SmartPowerDownEnable[bd]; 510 unsigned int spd = SmartPowerDownEnable[bd];
510 e1000_validate_option(&spd, &opt, adapter); 511 e1000_validate_option(&spd, &opt, adapter);
511 adapter->smart_power_down = spd; 512 adapter->smart_power_down = spd;
512 } else { 513 } else {
@@ -522,7 +523,7 @@ e1000_check_options(struct e1000_adapter *adapter)
522 }; 523 };
523 524
524 if (num_KumeranLockLoss > bd) { 525 if (num_KumeranLockLoss > bd) {
525 int kmrn_lock_loss = KumeranLockLoss[bd]; 526 unsigned int kmrn_lock_loss = KumeranLockLoss[bd];
526 e1000_validate_option(&kmrn_lock_loss, &opt, adapter); 527 e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
527 adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss; 528 adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss;
528 } else { 529 } else {
@@ -581,7 +582,7 @@ e1000_check_fiber_options(struct e1000_adapter *adapter)
581static void __devinit 582static void __devinit
582e1000_check_copper_options(struct e1000_adapter *adapter) 583e1000_check_copper_options(struct e1000_adapter *adapter)
583{ 584{
584 int speed, dplx, an; 585 unsigned int speed, dplx, an;
585 int bd = adapter->bd_number; 586 int bd = adapter->bd_number;
586 587
587 { /* Speed */ 588 { /* Speed */
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index cf70522fc851..14141a55eaa6 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -283,7 +283,7 @@ static s32 e1000_get_invariants_82571(struct e1000_adapter *adapter)
283 adapter->flags &= ~FLAG_HAS_WOL; 283 adapter->flags &= ~FLAG_HAS_WOL;
284 /* quad ports only support WoL on port A */ 284 /* quad ports only support WoL on port A */
285 if (adapter->flags & FLAG_IS_QUAD_PORT && 285 if (adapter->flags & FLAG_IS_QUAD_PORT &&
286 (!adapter->flags & FLAG_IS_QUAD_PORT_A)) 286 (!(adapter->flags & FLAG_IS_QUAD_PORT_A)))
287 adapter->flags &= ~FLAG_HAS_WOL; 287 adapter->flags &= ~FLAG_HAS_WOL;
288 break; 288 break;
289 289
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index d2499bb07c13..473f78de4be0 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -122,7 +122,8 @@ struct e1000_buffer {
122 u16 next_to_watch; 122 u16 next_to_watch;
123 }; 123 };
124 /* RX */ 124 /* RX */
125 struct page *page; 125 /* arrays of page information for packet split */
126 struct e1000_ps_page *ps_pages;
126 }; 127 };
127 128
128}; 129};
@@ -142,8 +143,6 @@ struct e1000_ring {
142 /* array of buffer information structs */ 143 /* array of buffer information structs */
143 struct e1000_buffer *buffer_info; 144 struct e1000_buffer *buffer_info;
144 145
145 /* arrays of page information for packet split */
146 struct e1000_ps_page *ps_pages;
147 struct sk_buff *rx_skb_top; 146 struct sk_buff *rx_skb_top;
148 147
149 struct e1000_queue_stats stats; 148 struct e1000_queue_stats stats;
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 0666e62e9ad2..6a39784e7ee2 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1680,8 +1680,8 @@ static int e1000_phys_id(struct net_device *netdev, u32 data)
1680{ 1680{
1681 struct e1000_adapter *adapter = netdev_priv(netdev); 1681 struct e1000_adapter *adapter = netdev_priv(netdev);
1682 1682
1683 if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) 1683 if (!data)
1684 data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); 1684 data = INT_MAX;
1685 1685
1686 if (adapter->hw.phy.type == e1000_phy_ife) { 1686 if (adapter->hw.phy.type == e1000_phy_ife) {
1687 if (!adapter->blink_timer.function) { 1687 if (!adapter->blink_timer.function) {
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 033e124d1c1f..4fd2e23720b6 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -245,37 +245,36 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
245 rx_desc = E1000_RX_DESC_PS(*rx_ring, i); 245 rx_desc = E1000_RX_DESC_PS(*rx_ring, i);
246 246
247 for (j = 0; j < PS_PAGE_BUFFERS; j++) { 247 for (j = 0; j < PS_PAGE_BUFFERS; j++) {
248 ps_page = &rx_ring->ps_pages[(i * PS_PAGE_BUFFERS) 248 ps_page = &buffer_info->ps_pages[j];
249 + j]; 249 if (j >= adapter->rx_ps_pages) {
250 if (j < adapter->rx_ps_pages) { 250 /* all unused desc entries get hw null ptr */
251 rx_desc->read.buffer_addr[j+1] = ~0;
252 continue;
253 }
254 if (!ps_page->page) {
255 ps_page->page = alloc_page(GFP_ATOMIC);
251 if (!ps_page->page) { 256 if (!ps_page->page) {
252 ps_page->page = alloc_page(GFP_ATOMIC); 257 adapter->alloc_rx_buff_failed++;
253 if (!ps_page->page) { 258 goto no_buffers;
254 adapter->alloc_rx_buff_failed++; 259 }
255 goto no_buffers; 260 ps_page->dma = pci_map_page(pdev,
256 } 261 ps_page->page,
257 ps_page->dma = pci_map_page(pdev, 262 0, PAGE_SIZE,
258 ps_page->page, 263 PCI_DMA_FROMDEVICE);
259 0, PAGE_SIZE, 264 if (pci_dma_mapping_error(ps_page->dma)) {
260 PCI_DMA_FROMDEVICE); 265 dev_err(&adapter->pdev->dev,
261 if (pci_dma_mapping_error( 266 "RX DMA page map failed\n");
262 ps_page->dma)) { 267 adapter->rx_dma_failed++;
263 dev_err(&adapter->pdev->dev, 268 goto no_buffers;
264 "RX DMA page map failed\n");
265 adapter->rx_dma_failed++;
266 goto no_buffers;
267 }
268 } 269 }
269 /*
270 * Refresh the desc even if buffer_addrs
271 * didn't change because each write-back
272 * erases this info.
273 */
274 rx_desc->read.buffer_addr[j+1] =
275 cpu_to_le64(ps_page->dma);
276 } else {
277 rx_desc->read.buffer_addr[j+1] = ~0;
278 } 270 }
271 /*
272 * Refresh the desc even if buffer_addrs
273 * didn't change because each write-back
274 * erases this info.
275 */
276 rx_desc->read.buffer_addr[j+1] =
277 cpu_to_le64(ps_page->dma);
279 } 278 }
280 279
281 skb = netdev_alloc_skb(netdev, 280 skb = netdev_alloc_skb(netdev,
@@ -334,94 +333,6 @@ no_buffers:
334} 333}
335 334
336/** 335/**
337 * e1000_alloc_rx_buffers_jumbo - Replace used jumbo receive buffers
338 *
339 * @adapter: address of board private structure
340 * @cleaned_count: number of buffers to allocate this pass
341 **/
342static void e1000_alloc_rx_buffers_jumbo(struct e1000_adapter *adapter,
343 int cleaned_count)
344{
345 struct net_device *netdev = adapter->netdev;
346 struct pci_dev *pdev = adapter->pdev;
347 struct e1000_ring *rx_ring = adapter->rx_ring;
348 struct e1000_rx_desc *rx_desc;
349 struct e1000_buffer *buffer_info;
350 struct sk_buff *skb;
351 unsigned int i;
352 unsigned int bufsz = 256 -
353 16 /*for skb_reserve */ -
354 NET_IP_ALIGN;
355
356 i = rx_ring->next_to_use;
357 buffer_info = &rx_ring->buffer_info[i];
358
359 while (cleaned_count--) {
360 skb = buffer_info->skb;
361 if (skb) {
362 skb_trim(skb, 0);
363 goto check_page;
364 }
365
366 skb = netdev_alloc_skb(netdev, bufsz);
367 if (!skb) {
368 /* Better luck next round */
369 adapter->alloc_rx_buff_failed++;
370 break;
371 }
372
373 /* Make buffer alignment 2 beyond a 16 byte boundary
374 * this will result in a 16 byte aligned IP header after
375 * the 14 byte MAC header is removed
376 */
377 skb_reserve(skb, NET_IP_ALIGN);
378
379 buffer_info->skb = skb;
380check_page:
381 /* allocate a new page if necessary */
382 if (!buffer_info->page) {
383 buffer_info->page = alloc_page(GFP_ATOMIC);
384 if (!buffer_info->page) {
385 adapter->alloc_rx_buff_failed++;
386 break;
387 }
388 }
389
390 if (!buffer_info->dma)
391 buffer_info->dma = pci_map_page(pdev,
392 buffer_info->page, 0,
393 PAGE_SIZE,
394 PCI_DMA_FROMDEVICE);
395 if (pci_dma_mapping_error(buffer_info->dma)) {
396 dev_err(&adapter->pdev->dev, "RX DMA page map failed\n");
397 adapter->rx_dma_failed++;
398 break;
399 }
400
401 rx_desc = E1000_RX_DESC(*rx_ring, i);
402 rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
403
404 i++;
405 if (i == rx_ring->count)
406 i = 0;
407 buffer_info = &rx_ring->buffer_info[i];
408 }
409
410 if (rx_ring->next_to_use != i) {
411 rx_ring->next_to_use = i;
412 if (i-- == 0)
413 i = (rx_ring->count - 1);
414
415 /* Force memory writes to complete before letting h/w
416 * know there are new descriptors to fetch. (Only
417 * applicable for weak-ordered memory model archs,
418 * such as IA-64). */
419 wmb();
420 writel(i, adapter->hw.hw_addr + rx_ring->tail);
421 }
422}
423
424/**
425 * e1000_clean_rx_irq - Send received data up the network stack; legacy 336 * e1000_clean_rx_irq - Send received data up the network stack; legacy
426 * @adapter: board private structure 337 * @adapter: board private structure
427 * 338 *
@@ -495,10 +406,6 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
495 goto next_desc; 406 goto next_desc;
496 } 407 }
497 408
498 /* adjust length to remove Ethernet CRC */
499 length -= 4;
500
501 /* probably a little skewed due to removing CRC */
502 total_rx_bytes += length; 409 total_rx_bytes += length;
503 total_rx_packets++; 410 total_rx_packets++;
504 411
@@ -554,15 +461,6 @@ next_desc:
554 return cleaned; 461 return cleaned;
555} 462}
556 463
557static void e1000_consume_page(struct e1000_buffer *bi, struct sk_buff *skb,
558 u16 length)
559{
560 bi->page = NULL;
561 skb->len += length;
562 skb->data_len += length;
563 skb->truesize += length;
564}
565
566static void e1000_put_txbuf(struct e1000_adapter *adapter, 464static void e1000_put_txbuf(struct e1000_adapter *adapter,
567 struct e1000_buffer *buffer_info) 465 struct e1000_buffer *buffer_info)
568{ 466{
@@ -699,174 +597,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
699} 597}
700 598
701/** 599/**
702 * e1000_clean_rx_irq_jumbo - Send received data up the network stack; legacy
703 * @adapter: board private structure
704 *
705 * the return value indicates whether actual cleaning was done, there
706 * is no guarantee that everything was cleaned
707 **/
708static bool e1000_clean_rx_irq_jumbo(struct e1000_adapter *adapter,
709 int *work_done, int work_to_do)
710{
711 struct net_device *netdev = adapter->netdev;
712 struct pci_dev *pdev = adapter->pdev;
713 struct e1000_ring *rx_ring = adapter->rx_ring;
714 struct e1000_rx_desc *rx_desc, *next_rxd;
715 struct e1000_buffer *buffer_info, *next_buffer;
716 u32 length;
717 unsigned int i;
718 int cleaned_count = 0;
719 bool cleaned = 0;
720 unsigned int total_rx_bytes = 0, total_rx_packets = 0;
721
722 i = rx_ring->next_to_clean;
723 rx_desc = E1000_RX_DESC(*rx_ring, i);
724 buffer_info = &rx_ring->buffer_info[i];
725
726 while (rx_desc->status & E1000_RXD_STAT_DD) {
727 struct sk_buff *skb;
728 u8 status;
729
730 if (*work_done >= work_to_do)
731 break;
732 (*work_done)++;
733
734 status = rx_desc->status;
735 skb = buffer_info->skb;
736 buffer_info->skb = NULL;
737
738 i++;
739 if (i == rx_ring->count)
740 i = 0;
741 next_rxd = E1000_RX_DESC(*rx_ring, i);
742 prefetch(next_rxd);
743
744 next_buffer = &rx_ring->buffer_info[i];
745
746 cleaned = 1;
747 cleaned_count++;
748 pci_unmap_page(pdev,
749 buffer_info->dma,
750 PAGE_SIZE,
751 PCI_DMA_FROMDEVICE);
752 buffer_info->dma = 0;
753
754 length = le16_to_cpu(rx_desc->length);
755
756 /* errors is only valid for DD + EOP descriptors */
757 if ((status & E1000_RXD_STAT_EOP) &&
758 (rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK)) {
759 /* recycle both page and skb */
760 buffer_info->skb = skb;
761 /* an error means any chain goes out the window too */
762 if (rx_ring->rx_skb_top)
763 dev_kfree_skb(rx_ring->rx_skb_top);
764 rx_ring->rx_skb_top = NULL;
765 goto next_desc;
766 }
767
768#define rxtop rx_ring->rx_skb_top
769 if (!(status & E1000_RXD_STAT_EOP)) {
770 /* this descriptor is only the beginning (or middle) */
771 if (!rxtop) {
772 /* this is the beginning of a chain */
773 rxtop = skb;
774 skb_fill_page_desc(rxtop, 0, buffer_info->page,
775 0, length);
776 } else {
777 /* this is the middle of a chain */
778 skb_fill_page_desc(rxtop,
779 skb_shinfo(rxtop)->nr_frags,
780 buffer_info->page, 0,
781 length);
782 /* re-use the skb, only consumed the page */
783 buffer_info->skb = skb;
784 }
785 e1000_consume_page(buffer_info, rxtop, length);
786 goto next_desc;
787 } else {
788 if (rxtop) {
789 /* end of the chain */
790 skb_fill_page_desc(rxtop,
791 skb_shinfo(rxtop)->nr_frags,
792 buffer_info->page, 0, length);
793 /* re-use the current skb, we only consumed the
794 * page */
795 buffer_info->skb = skb;
796 skb = rxtop;
797 rxtop = NULL;
798 e1000_consume_page(buffer_info, skb, length);
799 } else {
800 /* no chain, got EOP, this buf is the packet
801 * copybreak to save the put_page/alloc_page */
802 if (length <= copybreak &&
803 skb_tailroom(skb) >= length) {
804 u8 *vaddr;
805 vaddr = kmap_atomic(buffer_info->page,
806 KM_SKB_DATA_SOFTIRQ);
807 memcpy(skb_tail_pointer(skb),
808 vaddr, length);
809 kunmap_atomic(vaddr,
810 KM_SKB_DATA_SOFTIRQ);
811 /* re-use the page, so don't erase
812 * buffer_info->page */
813 skb_put(skb, length);
814 } else {
815 skb_fill_page_desc(skb, 0,
816 buffer_info->page, 0,
817 length);
818 e1000_consume_page(buffer_info, skb,
819 length);
820 }
821 }
822 }
823
824 /* Receive Checksum Offload XXX recompute due to CRC strip? */
825 e1000_rx_checksum(adapter,
826 (u32)(status) |
827 ((u32)(rx_desc->errors) << 24),
828 le16_to_cpu(rx_desc->csum), skb);
829
830 pskb_trim(skb, skb->len - 4);
831
832 /* probably a little skewed due to removing CRC */
833 total_rx_bytes += skb->len;
834 total_rx_packets++;
835
836 /* eth type trans needs skb->data to point to something */
837 if (!pskb_may_pull(skb, ETH_HLEN)) {
838 ndev_err(netdev, "__pskb_pull_tail failed.\n");
839 dev_kfree_skb(skb);
840 goto next_desc;
841 }
842
843 e1000_receive_skb(adapter, netdev, skb,status,rx_desc->special);
844
845next_desc:
846 rx_desc->status = 0;
847
848 /* return some buffers to hardware, one at a time is too slow */
849 if (cleaned_count >= E1000_RX_BUFFER_WRITE) {
850 adapter->alloc_rx_buf(adapter, cleaned_count);
851 cleaned_count = 0;
852 }
853
854 /* use prefetched values */
855 rx_desc = next_rxd;
856 buffer_info = next_buffer;
857 }
858 rx_ring->next_to_clean = i;
859
860 cleaned_count = e1000_desc_unused(rx_ring);
861 if (cleaned_count)
862 adapter->alloc_rx_buf(adapter, cleaned_count);
863
864 adapter->total_rx_packets += total_rx_packets;
865 adapter->total_rx_bytes += total_rx_bytes;
866 return cleaned;
867}
868
869/**
870 * e1000_clean_rx_irq_ps - Send received data up the network stack; packet split 600 * e1000_clean_rx_irq_ps - Send received data up the network stack; packet split
871 * @adapter: board private structure 601 * @adapter: board private structure
872 * 602 *
@@ -953,7 +683,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
953 ((length + l1) <= adapter->rx_ps_bsize0)) { 683 ((length + l1) <= adapter->rx_ps_bsize0)) {
954 u8 *vaddr; 684 u8 *vaddr;
955 685
956 ps_page = &rx_ring->ps_pages[i * PS_PAGE_BUFFERS]; 686 ps_page = &buffer_info->ps_pages[0];
957 687
958 /* there is no documentation about how to call 688 /* there is no documentation about how to call
959 * kmap_atomic, so we can't hold the mapping 689 * kmap_atomic, so we can't hold the mapping
@@ -965,8 +695,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
965 kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); 695 kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ);
966 pci_dma_sync_single_for_device(pdev, ps_page->dma, 696 pci_dma_sync_single_for_device(pdev, ps_page->dma,
967 PAGE_SIZE, PCI_DMA_FROMDEVICE); 697 PAGE_SIZE, PCI_DMA_FROMDEVICE);
968 /* remove the CRC */ 698
969 l1 -= 4;
970 skb_put(skb, l1); 699 skb_put(skb, l1);
971 goto copydone; 700 goto copydone;
972 } /* if */ 701 } /* if */
@@ -977,7 +706,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
977 if (!length) 706 if (!length)
978 break; 707 break;
979 708
980 ps_page = &rx_ring->ps_pages[(i * PS_PAGE_BUFFERS) + j]; 709 ps_page = &buffer_info->ps_pages[j];
981 pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE, 710 pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE,
982 PCI_DMA_FROMDEVICE); 711 PCI_DMA_FROMDEVICE);
983 ps_page->dma = 0; 712 ps_page->dma = 0;
@@ -988,10 +717,6 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
988 skb->truesize += length; 717 skb->truesize += length;
989 } 718 }
990 719
991 /* strip the ethernet crc, problem is we're using pages now so
992 * this whole operation can get a little cpu intensive */
993 pskb_trim(skb, skb->len - 4);
994
995copydone: 720copydone:
996 total_rx_bytes += skb->len; 721 total_rx_bytes += skb->len;
997 total_rx_packets++; 722 total_rx_packets++;
@@ -1043,7 +768,6 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
1043 struct e1000_buffer *buffer_info; 768 struct e1000_buffer *buffer_info;
1044 struct e1000_ps_page *ps_page; 769 struct e1000_ps_page *ps_page;
1045 struct pci_dev *pdev = adapter->pdev; 770 struct pci_dev *pdev = adapter->pdev;
1046 unsigned long size;
1047 unsigned int i, j; 771 unsigned int i, j;
1048 772
1049 /* Free all the Rx ring sk_buffs */ 773 /* Free all the Rx ring sk_buffs */
@@ -1054,9 +778,6 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
1054 pci_unmap_single(pdev, buffer_info->dma, 778 pci_unmap_single(pdev, buffer_info->dma,
1055 adapter->rx_buffer_len, 779 adapter->rx_buffer_len,
1056 PCI_DMA_FROMDEVICE); 780 PCI_DMA_FROMDEVICE);
1057 else if (adapter->clean_rx == e1000_clean_rx_irq_jumbo)
1058 pci_unmap_page(pdev, buffer_info->dma,
1059 PAGE_SIZE, PCI_DMA_FROMDEVICE);
1060 else if (adapter->clean_rx == e1000_clean_rx_irq_ps) 781 else if (adapter->clean_rx == e1000_clean_rx_irq_ps)
1061 pci_unmap_single(pdev, buffer_info->dma, 782 pci_unmap_single(pdev, buffer_info->dma,
1062 adapter->rx_ps_bsize0, 783 adapter->rx_ps_bsize0,
@@ -1064,19 +785,13 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
1064 buffer_info->dma = 0; 785 buffer_info->dma = 0;
1065 } 786 }
1066 787
1067 if (buffer_info->page) {
1068 put_page(buffer_info->page);
1069 buffer_info->page = NULL;
1070 }
1071
1072 if (buffer_info->skb) { 788 if (buffer_info->skb) {
1073 dev_kfree_skb(buffer_info->skb); 789 dev_kfree_skb(buffer_info->skb);
1074 buffer_info->skb = NULL; 790 buffer_info->skb = NULL;
1075 } 791 }
1076 792
1077 for (j = 0; j < PS_PAGE_BUFFERS; j++) { 793 for (j = 0; j < PS_PAGE_BUFFERS; j++) {
1078 ps_page = &rx_ring->ps_pages[(i * PS_PAGE_BUFFERS) 794 ps_page = &buffer_info->ps_pages[j];
1079 + j];
1080 if (!ps_page->page) 795 if (!ps_page->page)
1081 break; 796 break;
1082 pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE, 797 pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE,
@@ -1093,12 +808,6 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
1093 rx_ring->rx_skb_top = NULL; 808 rx_ring->rx_skb_top = NULL;
1094 } 809 }
1095 810
1096 size = sizeof(struct e1000_buffer) * rx_ring->count;
1097 memset(rx_ring->buffer_info, 0, size);
1098 size = sizeof(struct e1000_ps_page)
1099 * (rx_ring->count * PS_PAGE_BUFFERS);
1100 memset(rx_ring->ps_pages, 0, size);
1101
1102 /* Zero out the descriptor ring */ 811 /* Zero out the descriptor ring */
1103 memset(rx_ring->desc, 0, rx_ring->size); 812 memset(rx_ring->desc, 0, rx_ring->size);
1104 813
@@ -1421,7 +1130,8 @@ err:
1421int e1000e_setup_rx_resources(struct e1000_adapter *adapter) 1130int e1000e_setup_rx_resources(struct e1000_adapter *adapter)
1422{ 1131{
1423 struct e1000_ring *rx_ring = adapter->rx_ring; 1132 struct e1000_ring *rx_ring = adapter->rx_ring;
1424 int size, desc_len, err = -ENOMEM; 1133 struct e1000_buffer *buffer_info;
1134 int i, size, desc_len, err = -ENOMEM;
1425 1135
1426 size = sizeof(struct e1000_buffer) * rx_ring->count; 1136 size = sizeof(struct e1000_buffer) * rx_ring->count;
1427 rx_ring->buffer_info = vmalloc(size); 1137 rx_ring->buffer_info = vmalloc(size);
@@ -1429,11 +1139,14 @@ int e1000e_setup_rx_resources(struct e1000_adapter *adapter)
1429 goto err; 1139 goto err;
1430 memset(rx_ring->buffer_info, 0, size); 1140 memset(rx_ring->buffer_info, 0, size);
1431 1141
1432 rx_ring->ps_pages = kcalloc(rx_ring->count * PS_PAGE_BUFFERS, 1142 for (i = 0; i < rx_ring->count; i++) {
1433 sizeof(struct e1000_ps_page), 1143 buffer_info = &rx_ring->buffer_info[i];
1434 GFP_KERNEL); 1144 buffer_info->ps_pages = kcalloc(PS_PAGE_BUFFERS,
1435 if (!rx_ring->ps_pages) 1145 sizeof(struct e1000_ps_page),
1436 goto err; 1146 GFP_KERNEL);
1147 if (!buffer_info->ps_pages)
1148 goto err_pages;
1149 }
1437 1150
1438 desc_len = sizeof(union e1000_rx_desc_packet_split); 1151 desc_len = sizeof(union e1000_rx_desc_packet_split);
1439 1152
@@ -1443,16 +1156,21 @@ int e1000e_setup_rx_resources(struct e1000_adapter *adapter)
1443 1156
1444 err = e1000_alloc_ring_dma(adapter, rx_ring); 1157 err = e1000_alloc_ring_dma(adapter, rx_ring);
1445 if (err) 1158 if (err)
1446 goto err; 1159 goto err_pages;
1447 1160
1448 rx_ring->next_to_clean = 0; 1161 rx_ring->next_to_clean = 0;
1449 rx_ring->next_to_use = 0; 1162 rx_ring->next_to_use = 0;
1450 rx_ring->rx_skb_top = NULL; 1163 rx_ring->rx_skb_top = NULL;
1451 1164
1452 return 0; 1165 return 0;
1166
1167err_pages:
1168 for (i = 0; i < rx_ring->count; i++) {
1169 buffer_info = &rx_ring->buffer_info[i];
1170 kfree(buffer_info->ps_pages);
1171 }
1453err: 1172err:
1454 vfree(rx_ring->buffer_info); 1173 vfree(rx_ring->buffer_info);
1455 kfree(rx_ring->ps_pages);
1456 ndev_err(adapter->netdev, 1174 ndev_err(adapter->netdev,
1457 "Unable to allocate memory for the transmit descriptor ring\n"); 1175 "Unable to allocate memory for the transmit descriptor ring\n");
1458 return err; 1176 return err;
@@ -1518,15 +1236,17 @@ void e1000e_free_rx_resources(struct e1000_adapter *adapter)
1518{ 1236{
1519 struct pci_dev *pdev = adapter->pdev; 1237 struct pci_dev *pdev = adapter->pdev;
1520 struct e1000_ring *rx_ring = adapter->rx_ring; 1238 struct e1000_ring *rx_ring = adapter->rx_ring;
1239 int i;
1521 1240
1522 e1000_clean_rx_ring(adapter); 1241 e1000_clean_rx_ring(adapter);
1523 1242
1243 for (i = 0; i < rx_ring->count; i++) {
1244 kfree(rx_ring->buffer_info[i].ps_pages);
1245 }
1246
1524 vfree(rx_ring->buffer_info); 1247 vfree(rx_ring->buffer_info);
1525 rx_ring->buffer_info = NULL; 1248 rx_ring->buffer_info = NULL;
1526 1249
1527 kfree(rx_ring->ps_pages);
1528 rx_ring->ps_pages = NULL;
1529
1530 dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc, 1250 dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc,
1531 rx_ring->dma); 1251 rx_ring->dma);
1532 rx_ring->desc = NULL; 1252 rx_ring->desc = NULL;
@@ -2032,9 +1752,11 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
2032 1752
2033 ew32(RFCTL, rfctl); 1753 ew32(RFCTL, rfctl);
2034 1754
2035 /* disable the stripping of CRC because it breaks 1755 /* Enable Packet split descriptors */
2036 * BMC firmware connected over SMBUS */ 1756 rctl |= E1000_RCTL_DTYP_PS;
2037 rctl |= E1000_RCTL_DTYP_PS /* | E1000_RCTL_SECRC */; 1757
1758 /* Enable hardware CRC frame stripping */
1759 rctl |= E1000_RCTL_SECRC;
2038 1760
2039 psrctl |= adapter->rx_ps_bsize0 >> 1761 psrctl |= adapter->rx_ps_bsize0 >>
2040 E1000_PSRCTL_BSIZE0_SHIFT; 1762 E1000_PSRCTL_BSIZE0_SHIFT;
@@ -2077,11 +1799,6 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
2077 sizeof(union e1000_rx_desc_packet_split); 1799 sizeof(union e1000_rx_desc_packet_split);
2078 adapter->clean_rx = e1000_clean_rx_irq_ps; 1800 adapter->clean_rx = e1000_clean_rx_irq_ps;
2079 adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; 1801 adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps;
2080 } else if (adapter->netdev->mtu > ETH_FRAME_LEN + VLAN_HLEN + 4) {
2081 rdlen = rx_ring->count *
2082 sizeof(struct e1000_rx_desc);
2083 adapter->clean_rx = e1000_clean_rx_irq_jumbo;
2084 adapter->alloc_rx_buf = e1000_alloc_rx_buffers_jumbo;
2085 } else { 1802 } else {
2086 rdlen = rx_ring->count * 1803 rdlen = rx_ring->count *
2087 sizeof(struct e1000_rx_desc); 1804 sizeof(struct e1000_rx_desc);
@@ -2326,8 +2043,11 @@ void e1000e_reset(struct e1000_adapter *adapter)
2326 struct e1000_mac_info *mac = &adapter->hw.mac; 2043 struct e1000_mac_info *mac = &adapter->hw.mac;
2327 struct e1000_hw *hw = &adapter->hw; 2044 struct e1000_hw *hw = &adapter->hw;
2328 u32 tx_space, min_tx_space, min_rx_space; 2045 u32 tx_space, min_tx_space, min_rx_space;
2046 u32 pba;
2329 u16 hwm; 2047 u16 hwm;
2330 2048
2049 ew32(PBA, adapter->pba);
2050
2331 if (mac->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN ) { 2051 if (mac->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN ) {
2332 /* To maintain wire speed transmits, the Tx FIFO should be 2052 /* To maintain wire speed transmits, the Tx FIFO should be
2333 * large enough to accommodate two full transmit packets, 2053 * large enough to accommodate two full transmit packets,
@@ -2335,11 +2055,11 @@ void e1000e_reset(struct e1000_adapter *adapter)
2335 * the Rx FIFO should be large enough to accommodate at least 2055 * the Rx FIFO should be large enough to accommodate at least
2336 * one full receive packet and is similarly rounded up and 2056 * one full receive packet and is similarly rounded up and
2337 * expressed in KB. */ 2057 * expressed in KB. */
2338 adapter->pba = er32(PBA); 2058 pba = er32(PBA);
2339 /* upper 16 bits has Tx packet buffer allocation size in KB */ 2059 /* upper 16 bits has Tx packet buffer allocation size in KB */
2340 tx_space = adapter->pba >> 16; 2060 tx_space = pba >> 16;
2341 /* lower 16 bits has Rx packet buffer allocation size in KB */ 2061 /* lower 16 bits has Rx packet buffer allocation size in KB */
2342 adapter->pba &= 0xffff; 2062 pba &= 0xffff;
2343 /* the tx fifo also stores 16 bytes of information about the tx 2063 /* the tx fifo also stores 16 bytes of information about the tx
2344 * but don't include ethernet FCS because hardware appends it */ 2064 * but don't include ethernet FCS because hardware appends it */
2345 min_tx_space = (mac->max_frame_size + 2065 min_tx_space = (mac->max_frame_size +
@@ -2355,20 +2075,21 @@ void e1000e_reset(struct e1000_adapter *adapter)
2355 /* If current Tx allocation is less than the min Tx FIFO size, 2075 /* If current Tx allocation is less than the min Tx FIFO size,
2356 * and the min Tx FIFO size is less than the current Rx FIFO 2076 * and the min Tx FIFO size is less than the current Rx FIFO
2357 * allocation, take space away from current Rx allocation */ 2077 * allocation, take space away from current Rx allocation */
2358 if (tx_space < min_tx_space && 2078 if ((tx_space < min_tx_space) &&
2359 ((min_tx_space - tx_space) < adapter->pba)) { 2079 ((min_tx_space - tx_space) < pba)) {
2360 adapter->pba -= - (min_tx_space - tx_space); 2080 pba -= min_tx_space - tx_space;
2361 2081
2362 /* if short on rx space, rx wins and must trump tx 2082 /* if short on rx space, rx wins and must trump tx
2363 * adjustment or use Early Receive if available */ 2083 * adjustment or use Early Receive if available */
2364 if ((adapter->pba < min_rx_space) && 2084 if ((pba < min_rx_space) &&
2365 (!(adapter->flags & FLAG_HAS_ERT))) 2085 (!(adapter->flags & FLAG_HAS_ERT)))
2366 /* ERT enabled in e1000_configure_rx */ 2086 /* ERT enabled in e1000_configure_rx */
2367 adapter->pba = min_rx_space; 2087 pba = min_rx_space;
2368 } 2088 }
2089
2090 ew32(PBA, pba);
2369 } 2091 }
2370 2092
2371 ew32(PBA, adapter->pba);
2372 2093
2373 /* flow control settings */ 2094 /* flow control settings */
2374 /* The high water mark must be low enough to fit one full frame 2095 /* The high water mark must be low enough to fit one full frame
@@ -3624,9 +3345,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
3624 /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN 3345 /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
3625 * means we reserve 2 more, this pushes us to allocate from the next 3346 * means we reserve 2 more, this pushes us to allocate from the next
3626 * larger slab size. 3347 * larger slab size.
3627 * i.e. RXBUFFER_2048 --> size-4096 slab 3348 * i.e. RXBUFFER_2048 --> size-4096 slab */
3628 * however with the new *_jumbo* routines, jumbo receives will use
3629 * fragmented skbs */
3630 3349
3631 if (max_frame <= 256) 3350 if (max_frame <= 256)
3632 adapter->rx_buffer_len = 256; 3351 adapter->rx_buffer_len = 256;
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
index e4e655efb23c..332789238b9c 100644
--- a/drivers/net/e1000e/param.c
+++ b/drivers/net/e1000e/param.c
@@ -52,10 +52,11 @@ MODULE_PARM_DESC(copybreak,
52 */ 52 */
53 53
54#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } 54#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
55#define E1000_PARAM(X, desc) \ 55#define E1000_PARAM(X, desc) \
56 static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ 56 static int __devinitdata X[E1000_MAX_NIC+1] \
57 static int num_##X; \ 57 = E1000_PARAM_INIT; \
58 module_param_array_named(X, X, int, &num_##X, 0); \ 58 static unsigned int num_##X; \
59 module_param_array_named(X, X, int, &num_##X, 0); \
59 MODULE_PARM_DESC(X, desc); 60 MODULE_PARM_DESC(X, desc);
60 61
61 62
@@ -124,9 +125,9 @@ E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
124 125
125struct e1000_option { 126struct e1000_option {
126 enum { enable_option, range_option, list_option } type; 127 enum { enable_option, range_option, list_option } type;
127 char *name; 128 const char *name;
128 char *err; 129 const char *err;
129 int def; 130 int def;
130 union { 131 union {
131 struct { /* range_option info */ 132 struct { /* range_option info */
132 int min; 133 int min;
@@ -139,8 +140,8 @@ struct e1000_option {
139 } arg; 140 } arg;
140}; 141};
141 142
142static int __devinit e1000_validate_option(int *value, 143static int __devinit e1000_validate_option(unsigned int *value,
143 struct e1000_option *opt, 144 const struct e1000_option *opt,
144 struct e1000_adapter *adapter) 145 struct e1000_adapter *adapter)
145{ 146{
146 if (*value == OPTION_UNSET) { 147 if (*value == OPTION_UNSET) {
@@ -213,7 +214,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
213 } 214 }
214 215
215 { /* Transmit Interrupt Delay */ 216 { /* Transmit Interrupt Delay */
216 struct e1000_option opt = { 217 const struct e1000_option opt = {
217 .type = range_option, 218 .type = range_option,
218 .name = "Transmit Interrupt Delay", 219 .name = "Transmit Interrupt Delay",
219 .err = "using default of " 220 .err = "using default of "
@@ -232,7 +233,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
232 } 233 }
233 } 234 }
234 { /* Transmit Absolute Interrupt Delay */ 235 { /* Transmit Absolute Interrupt Delay */
235 struct e1000_option opt = { 236 const struct e1000_option opt = {
236 .type = range_option, 237 .type = range_option,
237 .name = "Transmit Absolute Interrupt Delay", 238 .name = "Transmit Absolute Interrupt Delay",
238 .err = "using default of " 239 .err = "using default of "
@@ -277,7 +278,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
277 } 278 }
278 } 279 }
279 { /* Receive Absolute Interrupt Delay */ 280 { /* Receive Absolute Interrupt Delay */
280 struct e1000_option opt = { 281 const struct e1000_option opt = {
281 .type = range_option, 282 .type = range_option,
282 .name = "Receive Absolute Interrupt Delay", 283 .name = "Receive Absolute Interrupt Delay",
283 .err = "using default of " 284 .err = "using default of "
@@ -296,7 +297,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
296 } 297 }
297 } 298 }
298 { /* Interrupt Throttling Rate */ 299 { /* Interrupt Throttling Rate */
299 struct e1000_option opt = { 300 const struct e1000_option opt = {
300 .type = range_option, 301 .type = range_option,
301 .name = "Interrupt Throttling Rate (ints/sec)", 302 .name = "Interrupt Throttling Rate (ints/sec)",
302 .err = "using default of " 303 .err = "using default of "
@@ -344,7 +345,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
344 } 345 }
345 } 346 }
346 { /* Smart Power Down */ 347 { /* Smart Power Down */
347 struct e1000_option opt = { 348 const struct e1000_option opt = {
348 .type = enable_option, 349 .type = enable_option,
349 .name = "PHY Smart Power Down", 350 .name = "PHY Smart Power Down",
350 .err = "defaulting to Disabled", 351 .err = "defaulting to Disabled",
@@ -352,7 +353,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
352 }; 353 };
353 354
354 if (num_SmartPowerDownEnable > bd) { 355 if (num_SmartPowerDownEnable > bd) {
355 int spd = SmartPowerDownEnable[bd]; 356 unsigned int spd = SmartPowerDownEnable[bd];
356 e1000_validate_option(&spd, &opt, adapter); 357 e1000_validate_option(&spd, &opt, adapter);
357 if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) 358 if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN)
358 && spd) 359 && spd)
@@ -360,7 +361,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
360 } 361 }
361 } 362 }
362 { /* Kumeran Lock Loss Workaround */ 363 { /* Kumeran Lock Loss Workaround */
363 struct e1000_option opt = { 364 const struct e1000_option opt = {
364 .type = enable_option, 365 .type = enable_option,
365 .name = "Kumeran Lock Loss Workaround", 366 .name = "Kumeran Lock Loss Workaround",
366 .err = "defaulting to Enabled", 367 .err = "defaulting to Enabled",
@@ -368,7 +369,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
368 }; 369 };
369 370
370 if (num_KumeranLockLoss > bd) { 371 if (num_KumeranLockLoss > bd) {
371 int kmrn_lock_loss = KumeranLockLoss[bd]; 372 unsigned int kmrn_lock_loss = KumeranLockLoss[bd];
372 e1000_validate_option(&kmrn_lock_loss, &opt, adapter); 373 e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
373 if (hw->mac.type == e1000_ich8lan) 374 if (hw->mac.type == e1000_ich8lan)
374 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, 375 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw,
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index b557bb44a36f..f78e5bf7cb33 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#define DRV_NAME "ehea" 42#define DRV_NAME "ehea"
43#define DRV_VERSION "EHEA_0078" 43#define DRV_VERSION "EHEA_0080"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 2809c99906e0..f0319f1e8e05 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -33,6 +33,9 @@
33#include <linux/if.h> 33#include <linux/if.h>
34#include <linux/list.h> 34#include <linux/list.h>
35#include <linux/if_ether.h> 35#include <linux/if_ether.h>
36#include <linux/notifier.h>
37#include <linux/reboot.h>
38
36#include <net/ip.h> 39#include <net/ip.h>
37 40
38#include "ehea.h" 41#include "ehea.h"
@@ -2329,7 +2332,7 @@ static void port_napi_disable(struct ehea_port *port)
2329{ 2332{
2330 int i; 2333 int i;
2331 2334
2332 for (i = 0; i < port->num_def_qps; i++) 2335 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++)
2333 napi_disable(&port->port_res[i].napi); 2336 napi_disable(&port->port_res[i].napi);
2334} 2337}
2335 2338
@@ -2337,7 +2340,7 @@ static void port_napi_enable(struct ehea_port *port)
2337{ 2340{
2338 int i; 2341 int i;
2339 2342
2340 for (i = 0; i < port->num_def_qps; i++) 2343 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++)
2341 napi_enable(&port->port_res[i].napi); 2344 napi_enable(&port->port_res[i].napi);
2342} 2345}
2343 2346
@@ -2373,8 +2376,6 @@ static int ehea_down(struct net_device *dev)
2373 ehea_drop_multicast_list(dev); 2376 ehea_drop_multicast_list(dev);
2374 ehea_free_interrupts(dev); 2377 ehea_free_interrupts(dev);
2375 2378
2376 port_napi_disable(port);
2377
2378 port->state = EHEA_PORT_DOWN; 2379 port->state = EHEA_PORT_DOWN;
2379 2380
2380 ret = ehea_clean_all_portres(port); 2381 ret = ehea_clean_all_portres(port);
@@ -2396,6 +2397,7 @@ static int ehea_stop(struct net_device *dev)
2396 flush_scheduled_work(); 2397 flush_scheduled_work();
2397 down(&port->port_lock); 2398 down(&port->port_lock);
2398 netif_stop_queue(dev); 2399 netif_stop_queue(dev);
2400 port_napi_disable(port);
2399 ret = ehea_down(dev); 2401 ret = ehea_down(dev);
2400 up(&port->port_lock); 2402 up(&port->port_lock);
2401 return ret; 2403 return ret;
@@ -3296,6 +3298,20 @@ static int __devexit ehea_remove(struct of_device *dev)
3296 return 0; 3298 return 0;
3297} 3299}
3298 3300
3301static int ehea_reboot_notifier(struct notifier_block *nb,
3302 unsigned long action, void *unused)
3303{
3304 if (action == SYS_RESTART) {
3305 ehea_info("Reboot: freeing all eHEA resources");
3306 ibmebus_unregister_driver(&ehea_driver);
3307 }
3308 return NOTIFY_DONE;
3309}
3310
3311static struct notifier_block ehea_reboot_nb = {
3312 .notifier_call = ehea_reboot_notifier,
3313};
3314
3299static int check_module_parm(void) 3315static int check_module_parm(void)
3300{ 3316{
3301 int ret = 0; 3317 int ret = 0;
@@ -3352,6 +3368,8 @@ int __init ehea_module_init(void)
3352 if (ret) 3368 if (ret)
3353 goto out; 3369 goto out;
3354 3370
3371 register_reboot_notifier(&ehea_reboot_nb);
3372
3355 ret = ibmebus_register_driver(&ehea_driver); 3373 ret = ibmebus_register_driver(&ehea_driver);
3356 if (ret) { 3374 if (ret) {
3357 ehea_error("failed registering eHEA device driver on ebus"); 3375 ehea_error("failed registering eHEA device driver on ebus");
@@ -3363,6 +3381,7 @@ int __init ehea_module_init(void)
3363 if (ret) { 3381 if (ret) {
3364 ehea_error("failed to register capabilities attribute, ret=%d", 3382 ehea_error("failed to register capabilities attribute, ret=%d",
3365 ret); 3383 ret);
3384 unregister_reboot_notifier(&ehea_reboot_nb);
3366 ibmebus_unregister_driver(&ehea_driver); 3385 ibmebus_unregister_driver(&ehea_driver);
3367 goto out; 3386 goto out;
3368 } 3387 }
@@ -3376,6 +3395,7 @@ static void __exit ehea_module_exit(void)
3376 flush_scheduled_work(); 3395 flush_scheduled_work();
3377 driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); 3396 driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
3378 ibmebus_unregister_driver(&ehea_driver); 3397 ibmebus_unregister_driver(&ehea_driver);
3398 unregister_reboot_notifier(&ehea_reboot_nb);
3379 ehea_destroy_busmap(); 3399 ehea_destroy_busmap();
3380} 3400}
3381 3401
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
new file mode 100644
index 000000000000..a8a0ee220da6
--- /dev/null
+++ b/drivers/net/fec_mpc52xx.c
@@ -0,0 +1,1112 @@
1/*
2 * Driver for the MPC5200 Fast Ethernet Controller
3 *
4 * Originally written by Dale Farnsworth <dfarnsworth@mvista.com> and
5 * now maintained by Sylvain Munaut <tnt@246tNt.com>
6 *
7 * Copyright (C) 2007 Domen Puncer, Telargo, Inc.
8 * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com>
9 * Copyright (C) 2003-2004 MontaVista, Software, Inc.
10 *
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
14 *
15 */
16
17#include <linux/module.h>
18
19#include <linux/kernel.h>
20#include <linux/types.h>
21#include <linux/spinlock.h>
22#include <linux/errno.h>
23#include <linux/init.h>
24#include <linux/crc32.h>
25#include <linux/hardirq.h>
26#include <linux/delay.h>
27#include <linux/of_device.h>
28#include <linux/of_platform.h>
29
30#include <linux/netdevice.h>
31#include <linux/etherdevice.h>
32#include <linux/ethtool.h>
33#include <linux/skbuff.h>
34
35#include <asm/io.h>
36#include <asm/delay.h>
37#include <asm/mpc52xx.h>
38
39#include <sysdev/bestcomm/bestcomm.h>
40#include <sysdev/bestcomm/fec.h>
41
42#include "fec_mpc52xx.h"
43
44#define DRIVER_NAME "mpc52xx-fec"
45
46static irqreturn_t mpc52xx_fec_interrupt(int, void *);
47static irqreturn_t mpc52xx_fec_rx_interrupt(int, void *);
48static irqreturn_t mpc52xx_fec_tx_interrupt(int, void *);
49static void mpc52xx_fec_stop(struct net_device *dev);
50static void mpc52xx_fec_start(struct net_device *dev);
51static void mpc52xx_fec_reset(struct net_device *dev);
52
53static u8 mpc52xx_fec_mac_addr[6];
54module_param_array_named(mac, mpc52xx_fec_mac_addr, byte, NULL, 0);
55MODULE_PARM_DESC(mac, "six hex digits, ie. 0x1,0x2,0xc0,0x01,0xba,0xbe");
56
57#define MPC52xx_MESSAGES_DEFAULT ( NETIF_MSG_DRV | NETIF_MSG_PROBE | \
58 NETIF_MSG_LINK | NETIF_MSG_IFDOWN | NETIF_MSG_IFDOWN )
59static int debug = -1; /* the above default */
60module_param(debug, int, 0);
61MODULE_PARM_DESC(debug, "debugging messages level");
62
63static void mpc52xx_fec_tx_timeout(struct net_device *dev)
64{
65 dev_warn(&dev->dev, "transmit timed out\n");
66
67 mpc52xx_fec_reset(dev);
68
69 dev->stats.tx_errors++;
70
71 netif_wake_queue(dev);
72}
73
74static void mpc52xx_fec_set_paddr(struct net_device *dev, u8 *mac)
75{
76 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
77 struct mpc52xx_fec __iomem *fec = priv->fec;
78
79 out_be32(&fec->paddr1, *(u32 *)(&mac[0]));
80 out_be32(&fec->paddr2, (*(u16 *)(&mac[4]) << 16) | FEC_PADDR2_TYPE);
81}
82
83static void mpc52xx_fec_get_paddr(struct net_device *dev, u8 *mac)
84{
85 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
86 struct mpc52xx_fec __iomem *fec = priv->fec;
87
88 *(u32 *)(&mac[0]) = in_be32(&fec->paddr1);
89 *(u16 *)(&mac[4]) = in_be32(&fec->paddr2) >> 16;
90}
91
92static int mpc52xx_fec_set_mac_address(struct net_device *dev, void *addr)
93{
94 struct sockaddr *sock = addr;
95
96 memcpy(dev->dev_addr, sock->sa_data, dev->addr_len);
97
98 mpc52xx_fec_set_paddr(dev, sock->sa_data);
99 return 0;
100}
101
102static void mpc52xx_fec_free_rx_buffers(struct net_device *dev, struct bcom_task *s)
103{
104 while (!bcom_queue_empty(s)) {
105 struct bcom_fec_bd *bd;
106 struct sk_buff *skb;
107
108 skb = bcom_retrieve_buffer(s, NULL, (struct bcom_bd **)&bd);
109 dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_FROM_DEVICE);
110 kfree_skb(skb);
111 }
112}
113
114static int mpc52xx_fec_alloc_rx_buffers(struct net_device *dev, struct bcom_task *rxtsk)
115{
116 while (!bcom_queue_full(rxtsk)) {
117 struct sk_buff *skb;
118 struct bcom_fec_bd *bd;
119
120 skb = dev_alloc_skb(FEC_RX_BUFFER_SIZE);
121 if (skb == NULL)
122 return -EAGAIN;
123
124 /* zero out the initial receive buffers to aid debugging */
125 memset(skb->data, 0, FEC_RX_BUFFER_SIZE);
126
127 bd = (struct bcom_fec_bd *)bcom_prepare_next_buffer(rxtsk);
128
129 bd->status = FEC_RX_BUFFER_SIZE;
130 bd->skb_pa = dma_map_single(&dev->dev, skb->data,
131 FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);
132
133 bcom_submit_next_buffer(rxtsk, skb);
134 }
135
136 return 0;
137}
138
139/* based on generic_adjust_link from fs_enet-main.c */
140static void mpc52xx_fec_adjust_link(struct net_device *dev)
141{
142 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
143 struct phy_device *phydev = priv->phydev;
144 int new_state = 0;
145
146 if (phydev->link != PHY_DOWN) {
147 if (phydev->duplex != priv->duplex) {
148 struct mpc52xx_fec __iomem *fec = priv->fec;
149 u32 rcntrl;
150 u32 tcntrl;
151
152 new_state = 1;
153 priv->duplex = phydev->duplex;
154
155 rcntrl = in_be32(&fec->r_cntrl);
156 tcntrl = in_be32(&fec->x_cntrl);
157
158 rcntrl &= ~FEC_RCNTRL_DRT;
159 tcntrl &= ~FEC_TCNTRL_FDEN;
160 if (phydev->duplex == DUPLEX_FULL)
161 tcntrl |= FEC_TCNTRL_FDEN; /* FD enable */
162 else
163 rcntrl |= FEC_RCNTRL_DRT; /* disable Rx on Tx (HD) */
164
165 out_be32(&fec->r_cntrl, rcntrl);
166 out_be32(&fec->x_cntrl, tcntrl);
167 }
168
169 if (phydev->speed != priv->speed) {
170 new_state = 1;
171 priv->speed = phydev->speed;
172 }
173
174 if (priv->link == PHY_DOWN) {
175 new_state = 1;
176 priv->link = phydev->link;
177 netif_schedule(dev);
178 netif_carrier_on(dev);
179 netif_start_queue(dev);
180 }
181
182 } else if (priv->link) {
183 new_state = 1;
184 priv->link = PHY_DOWN;
185 priv->speed = 0;
186 priv->duplex = -1;
187 netif_stop_queue(dev);
188 netif_carrier_off(dev);
189 }
190
191 if (new_state && netif_msg_link(priv))
192 phy_print_status(phydev);
193}
194
195static int mpc52xx_fec_init_phy(struct net_device *dev)
196{
197 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
198 struct phy_device *phydev;
199 char phy_id[BUS_ID_SIZE];
200
201 snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT,
202 (unsigned int)dev->base_addr, priv->phy_addr);
203
204 priv->link = PHY_DOWN;
205 priv->speed = 0;
206 priv->duplex = -1;
207
208 phydev = phy_connect(dev, phy_id, &mpc52xx_fec_adjust_link, 0, PHY_INTERFACE_MODE_MII);
209 if (IS_ERR(phydev)) {
210 dev_err(&dev->dev, "phy_connect failed\n");
211 return PTR_ERR(phydev);
212 }
213 dev_info(&dev->dev, "attached phy %i to driver %s\n",
214 phydev->addr, phydev->drv->name);
215
216 priv->phydev = phydev;
217
218 return 0;
219}
220
221static int mpc52xx_fec_phy_start(struct net_device *dev)
222{
223 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
224 int err;
225
226 if (!priv->has_phy)
227 return 0;
228
229 err = mpc52xx_fec_init_phy(dev);
230 if (err) {
231 dev_err(&dev->dev, "mpc52xx_fec_init_phy failed\n");
232 return err;
233 }
234
235 /* reset phy - this also wakes it from PDOWN */
236 phy_write(priv->phydev, MII_BMCR, BMCR_RESET);
237 phy_start(priv->phydev);
238
239 return 0;
240}
241
242static void mpc52xx_fec_phy_stop(struct net_device *dev)
243{
244 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
245
246 if (!priv->has_phy)
247 return;
248
249 phy_disconnect(priv->phydev);
250 /* power down phy */
251 phy_stop(priv->phydev);
252 phy_write(priv->phydev, MII_BMCR, BMCR_PDOWN);
253}
254
255static int mpc52xx_fec_phy_mii_ioctl(struct mpc52xx_fec_priv *priv,
256 struct mii_ioctl_data *mii_data, int cmd)
257{
258 if (!priv->has_phy)
259 return -ENOTSUPP;
260
261 return phy_mii_ioctl(priv->phydev, mii_data, cmd);
262}
263
264static void mpc52xx_fec_phy_hw_init(struct mpc52xx_fec_priv *priv)
265{
266 struct mpc52xx_fec __iomem *fec = priv->fec;
267
268 if (!priv->has_phy)
269 return;
270
271 out_be32(&fec->mii_speed, priv->phy_speed);
272}
273
274static int mpc52xx_fec_open(struct net_device *dev)
275{
276 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
277 int err = -EBUSY;
278
279 if (request_irq(dev->irq, &mpc52xx_fec_interrupt, IRQF_SHARED,
280 DRIVER_NAME "_ctrl", dev)) {
281 dev_err(&dev->dev, "ctrl interrupt request failed\n");
282 goto out;
283 }
284 if (request_irq(priv->r_irq, &mpc52xx_fec_rx_interrupt, 0,
285 DRIVER_NAME "_rx", dev)) {
286 dev_err(&dev->dev, "rx interrupt request failed\n");
287 goto free_ctrl_irq;
288 }
289 if (request_irq(priv->t_irq, &mpc52xx_fec_tx_interrupt, 0,
290 DRIVER_NAME "_tx", dev)) {
291 dev_err(&dev->dev, "tx interrupt request failed\n");
292 goto free_2irqs;
293 }
294
295 bcom_fec_rx_reset(priv->rx_dmatsk);
296 bcom_fec_tx_reset(priv->tx_dmatsk);
297
298 err = mpc52xx_fec_alloc_rx_buffers(dev, priv->rx_dmatsk);
299 if (err) {
300 dev_err(&dev->dev, "mpc52xx_fec_alloc_rx_buffers failed\n");
301 goto free_irqs;
302 }
303
304 err = mpc52xx_fec_phy_start(dev);
305 if (err)
306 goto free_skbs;
307
308 bcom_enable(priv->rx_dmatsk);
309 bcom_enable(priv->tx_dmatsk);
310
311 mpc52xx_fec_start(dev);
312
313 netif_start_queue(dev);
314
315 return 0;
316
317 free_skbs:
318 mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk);
319
320 free_irqs:
321 free_irq(priv->t_irq, dev);
322 free_2irqs:
323 free_irq(priv->r_irq, dev);
324 free_ctrl_irq:
325 free_irq(dev->irq, dev);
326 out:
327
328 return err;
329}
330
331static int mpc52xx_fec_close(struct net_device *dev)
332{
333 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
334
335 netif_stop_queue(dev);
336
337 mpc52xx_fec_stop(dev);
338
339 mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk);
340
341 free_irq(dev->irq, dev);
342 free_irq(priv->r_irq, dev);
343 free_irq(priv->t_irq, dev);
344
345 mpc52xx_fec_phy_stop(dev);
346
347 return 0;
348}
349
350/* This will only be invoked if your driver is _not_ in XOFF state.
351 * What this means is that you need not check it, and that this
352 * invariant will hold if you make sure that the netif_*_queue()
353 * calls are done at the proper times.
354 */
355static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
356{
357 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
358 struct bcom_fec_bd *bd;
359
360 if (bcom_queue_full(priv->tx_dmatsk)) {
361 if (net_ratelimit())
362 dev_err(&dev->dev, "transmit queue overrun\n");
363 return 1;
364 }
365
366 spin_lock_irq(&priv->lock);
367 dev->trans_start = jiffies;
368
369 bd = (struct bcom_fec_bd *)
370 bcom_prepare_next_buffer(priv->tx_dmatsk);
371
372 bd->status = skb->len | BCOM_FEC_TX_BD_TFD | BCOM_FEC_TX_BD_TC;
373 bd->skb_pa = dma_map_single(&dev->dev, skb->data, skb->len, DMA_TO_DEVICE);
374
375 bcom_submit_next_buffer(priv->tx_dmatsk, skb);
376
377 if (bcom_queue_full(priv->tx_dmatsk)) {
378 netif_stop_queue(dev);
379 }
380
381 spin_unlock_irq(&priv->lock);
382
383 return 0;
384}
385
386/* This handles BestComm transmit task interrupts
387 */
388static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id)
389{
390 struct net_device *dev = dev_id;
391 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
392
393 spin_lock(&priv->lock);
394
395 while (bcom_buffer_done(priv->tx_dmatsk)) {
396 struct sk_buff *skb;
397 struct bcom_fec_bd *bd;
398 skb = bcom_retrieve_buffer(priv->tx_dmatsk, NULL,
399 (struct bcom_bd **)&bd);
400 dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_TO_DEVICE);
401
402 dev_kfree_skb_irq(skb);
403 }
404
405 netif_wake_queue(dev);
406
407 spin_unlock(&priv->lock);
408
409 return IRQ_HANDLED;
410}
411
412static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)
413{
414 struct net_device *dev = dev_id;
415 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
416
417 while (bcom_buffer_done(priv->rx_dmatsk)) {
418 struct sk_buff *skb;
419 struct sk_buff *rskb;
420 struct bcom_fec_bd *bd;
421 u32 status;
422
423 rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status,
424 (struct bcom_bd **)&bd);
425 dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_FROM_DEVICE);
426
427 /* Test for errors in received frame */
428 if (status & BCOM_FEC_RX_BD_ERRORS) {
429 /* Drop packet and reuse the buffer */
430 bd = (struct bcom_fec_bd *)
431 bcom_prepare_next_buffer(priv->rx_dmatsk);
432
433 bd->status = FEC_RX_BUFFER_SIZE;
434 bd->skb_pa = dma_map_single(&dev->dev, rskb->data,
435 FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);
436
437 bcom_submit_next_buffer(priv->rx_dmatsk, rskb);
438
439 dev->stats.rx_dropped++;
440
441 continue;
442 }
443
444 /* skbs are allocated on open, so now we allocate a new one,
445 * and remove the old (with the packet) */
446 skb = dev_alloc_skb(FEC_RX_BUFFER_SIZE);
447 if (skb) {
448 /* Process the received skb */
449 int length = status & BCOM_FEC_RX_BD_LEN_MASK;
450
451 skb_put(rskb, length - 4); /* length without CRC32 */
452
453 rskb->dev = dev;
454 rskb->protocol = eth_type_trans(rskb, dev);
455
456 netif_rx(rskb);
457 dev->last_rx = jiffies;
458 } else {
459 /* Can't get a new one : reuse the same & drop pkt */
460 dev_notice(&dev->dev, "Memory squeeze, dropping packet.\n");
461 dev->stats.rx_dropped++;
462
463 skb = rskb;
464 }
465
466 bd = (struct bcom_fec_bd *)
467 bcom_prepare_next_buffer(priv->rx_dmatsk);
468
469 bd->status = FEC_RX_BUFFER_SIZE;
470 bd->skb_pa = dma_map_single(&dev->dev, rskb->data,
471 FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);
472
473 bcom_submit_next_buffer(priv->rx_dmatsk, skb);
474 }
475
476 return IRQ_HANDLED;
477}
478
479static irqreturn_t mpc52xx_fec_interrupt(int irq, void *dev_id)
480{
481 struct net_device *dev = dev_id;
482 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
483 struct mpc52xx_fec __iomem *fec = priv->fec;
484 u32 ievent;
485
486 ievent = in_be32(&fec->ievent);
487
488 ievent &= ~FEC_IEVENT_MII; /* mii is handled separately */
489 if (!ievent)
490 return IRQ_NONE;
491
492 out_be32(&fec->ievent, ievent); /* clear pending events */
493
494 if (ievent & ~(FEC_IEVENT_RFIFO_ERROR | FEC_IEVENT_XFIFO_ERROR)) {
495 if (ievent & ~FEC_IEVENT_TFINT)
496 dev_dbg(&dev->dev, "ievent: %08x\n", ievent);
497 return IRQ_HANDLED;
498 }
499
500 if (net_ratelimit() && (ievent & FEC_IEVENT_RFIFO_ERROR))
501 dev_warn(&dev->dev, "FEC_IEVENT_RFIFO_ERROR\n");
502 if (net_ratelimit() && (ievent & FEC_IEVENT_XFIFO_ERROR))
503 dev_warn(&dev->dev, "FEC_IEVENT_XFIFO_ERROR\n");
504
505 mpc52xx_fec_reset(dev);
506
507 netif_wake_queue(dev);
508 return IRQ_HANDLED;
509}
510
511/*
512 * Get the current statistics.
513 * This may be called with the card open or closed.
514 */
515static struct net_device_stats *mpc52xx_fec_get_stats(struct net_device *dev)
516{
517 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
518 struct net_device_stats *stats = &dev->stats;
519 struct mpc52xx_fec __iomem *fec = priv->fec;
520
521 stats->rx_bytes = in_be32(&fec->rmon_r_octets);
522 stats->rx_packets = in_be32(&fec->rmon_r_packets);
523 stats->rx_errors = in_be32(&fec->rmon_r_crc_align) +
524 in_be32(&fec->rmon_r_undersize) +
525 in_be32(&fec->rmon_r_oversize) +
526 in_be32(&fec->rmon_r_frag) +
527 in_be32(&fec->rmon_r_jab);
528
529 stats->tx_bytes = in_be32(&fec->rmon_t_octets);
530 stats->tx_packets = in_be32(&fec->rmon_t_packets);
531 stats->tx_errors = in_be32(&fec->rmon_t_crc_align) +
532 in_be32(&fec->rmon_t_undersize) +
533 in_be32(&fec->rmon_t_oversize) +
534 in_be32(&fec->rmon_t_frag) +
535 in_be32(&fec->rmon_t_jab);
536
537 stats->multicast = in_be32(&fec->rmon_r_mc_pkt);
538 stats->collisions = in_be32(&fec->rmon_t_col);
539
540 /* detailed rx_errors: */
541 stats->rx_length_errors = in_be32(&fec->rmon_r_undersize)
542 + in_be32(&fec->rmon_r_oversize)
543 + in_be32(&fec->rmon_r_frag)
544 + in_be32(&fec->rmon_r_jab);
545 stats->rx_over_errors = in_be32(&fec->r_macerr);
546 stats->rx_crc_errors = in_be32(&fec->ieee_r_crc);
547 stats->rx_frame_errors = in_be32(&fec->ieee_r_align);
548 stats->rx_fifo_errors = in_be32(&fec->rmon_r_drop);
549 stats->rx_missed_errors = in_be32(&fec->rmon_r_drop);
550
551 /* detailed tx_errors: */
552 stats->tx_aborted_errors = 0;
553 stats->tx_carrier_errors = in_be32(&fec->ieee_t_cserr);
554 stats->tx_fifo_errors = in_be32(&fec->rmon_t_drop);
555 stats->tx_heartbeat_errors = in_be32(&fec->ieee_t_sqe);
556 stats->tx_window_errors = in_be32(&fec->ieee_t_lcol);
557
558 return stats;
559}
560
561/*
562 * Read MIB counters in order to reset them,
563 * then zero all the stats fields in memory
564 */
565static void mpc52xx_fec_reset_stats(struct net_device *dev)
566{
567 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
568 struct mpc52xx_fec __iomem *fec = priv->fec;
569
570 out_be32(&fec->mib_control, FEC_MIB_DISABLE);
571 memset_io(&fec->rmon_t_drop, 0, (__force u32)&fec->reserved10 -
572 (__force u32)&fec->rmon_t_drop);
573 out_be32(&fec->mib_control, 0);
574
575 memset(&dev->stats, 0, sizeof(dev->stats));
576}
577
578/*
579 * Set or clear the multicast filter for this adaptor.
580 */
581static void mpc52xx_fec_set_multicast_list(struct net_device *dev)
582{
583 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
584 struct mpc52xx_fec __iomem *fec = priv->fec;
585 u32 rx_control;
586
587 rx_control = in_be32(&fec->r_cntrl);
588
589 if (dev->flags & IFF_PROMISC) {
590 rx_control |= FEC_RCNTRL_PROM;
591 out_be32(&fec->r_cntrl, rx_control);
592 } else {
593 rx_control &= ~FEC_RCNTRL_PROM;
594 out_be32(&fec->r_cntrl, rx_control);
595
596 if (dev->flags & IFF_ALLMULTI) {
597 out_be32(&fec->gaddr1, 0xffffffff);
598 out_be32(&fec->gaddr2, 0xffffffff);
599 } else {
600 u32 crc;
601 int i;
602 struct dev_mc_list *dmi;
603 u32 gaddr1 = 0x00000000;
604 u32 gaddr2 = 0x00000000;
605
606 dmi = dev->mc_list;
607 for (i=0; i<dev->mc_count; i++) {
608 crc = ether_crc_le(6, dmi->dmi_addr) >> 26;
609 if (crc >= 32)
610 gaddr1 |= 1 << (crc-32);
611 else
612 gaddr2 |= 1 << crc;
613 dmi = dmi->next;
614 }
615 out_be32(&fec->gaddr1, gaddr1);
616 out_be32(&fec->gaddr2, gaddr2);
617 }
618 }
619}
620
621/**
622 * mpc52xx_fec_hw_init
623 * @dev: network device
624 *
625 * Setup various hardware setting, only needed once on start
626 */
627static void mpc52xx_fec_hw_init(struct net_device *dev)
628{
629 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
630 struct mpc52xx_fec __iomem *fec = priv->fec;
631 int i;
632
633 /* Whack a reset. We should wait for this. */
634 out_be32(&fec->ecntrl, FEC_ECNTRL_RESET);
635 for (i = 0; i < FEC_RESET_DELAY; ++i) {
636 if ((in_be32(&fec->ecntrl) & FEC_ECNTRL_RESET) == 0)
637 break;
638 udelay(1);
639 }
640 if (i == FEC_RESET_DELAY)
641 dev_err(&dev->dev, "FEC Reset timeout!\n");
642
643 /* set pause to 0x20 frames */
644 out_be32(&fec->op_pause, FEC_OP_PAUSE_OPCODE | 0x20);
645
646 /* high service request will be deasserted when there's < 7 bytes in fifo
647 * low service request will be deasserted when there's < 4*7 bytes in fifo
648 */
649 out_be32(&fec->rfifo_cntrl, FEC_FIFO_CNTRL_FRAME | FEC_FIFO_CNTRL_LTG_7);
650 out_be32(&fec->tfifo_cntrl, FEC_FIFO_CNTRL_FRAME | FEC_FIFO_CNTRL_LTG_7);
651
652 /* alarm when <= x bytes in FIFO */
653 out_be32(&fec->rfifo_alarm, 0x0000030c);
654 out_be32(&fec->tfifo_alarm, 0x00000100);
655
656 /* begin transmittion when 256 bytes are in FIFO (or EOF or FIFO full) */
657 out_be32(&fec->x_wmrk, FEC_FIFO_WMRK_256B);
658
659 /* enable crc generation */
660 out_be32(&fec->xmit_fsm, FEC_XMIT_FSM_APPEND_CRC | FEC_XMIT_FSM_ENABLE_CRC);
661 out_be32(&fec->iaddr1, 0x00000000); /* No individual filter */
662 out_be32(&fec->iaddr2, 0x00000000); /* No individual filter */
663
664 /* set phy speed.
665 * this can't be done in phy driver, since it needs to be called
666 * before fec stuff (even on resume) */
667 mpc52xx_fec_phy_hw_init(priv);
668}
669
670/**
671 * mpc52xx_fec_start
672 * @dev: network device
673 *
674 * This function is called to start or restart the FEC during a link
675 * change. This happens on fifo errors or when switching between half
676 * and full duplex.
677 */
678static void mpc52xx_fec_start(struct net_device *dev)
679{
680 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
681 struct mpc52xx_fec __iomem *fec = priv->fec;
682 u32 rcntrl;
683 u32 tcntrl;
684 u32 tmp;
685
686 /* clear sticky error bits */
687 tmp = FEC_FIFO_STATUS_ERR | FEC_FIFO_STATUS_UF | FEC_FIFO_STATUS_OF;
688 out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status) & tmp);
689 out_be32(&fec->tfifo_status, in_be32(&fec->tfifo_status) & tmp);
690
691 /* FIFOs will reset on mpc52xx_fec_enable */
692 out_be32(&fec->reset_cntrl, FEC_RESET_CNTRL_ENABLE_IS_RESET);
693
694 /* Set station address. */
695 mpc52xx_fec_set_paddr(dev, dev->dev_addr);
696
697 mpc52xx_fec_set_multicast_list(dev);
698
699 /* set max frame len, enable flow control, select mii mode */
700 rcntrl = FEC_RX_BUFFER_SIZE << 16; /* max frame length */
701 rcntrl |= FEC_RCNTRL_FCE;
702
703 if (priv->has_phy)
704 rcntrl |= FEC_RCNTRL_MII_MODE;
705
706 if (priv->duplex == DUPLEX_FULL)
707 tcntrl = FEC_TCNTRL_FDEN; /* FD enable */
708 else {
709 rcntrl |= FEC_RCNTRL_DRT; /* disable Rx on Tx (HD) */
710 tcntrl = 0;
711 }
712 out_be32(&fec->r_cntrl, rcntrl);
713 out_be32(&fec->x_cntrl, tcntrl);
714
715 /* Clear any outstanding interrupt. */
716 out_be32(&fec->ievent, 0xffffffff);
717
718 /* Enable interrupts we wish to service. */
719 out_be32(&fec->imask, FEC_IMASK_ENABLE);
720
721 /* And last, enable the transmit and receive processing. */
722 out_be32(&fec->ecntrl, FEC_ECNTRL_ETHER_EN);
723 out_be32(&fec->r_des_active, 0x01000000);
724}
725
726/**
727 * mpc52xx_fec_stop
728 * @dev: network device
729 *
730 * stop all activity on fec and empty dma buffers
731 */
732static void mpc52xx_fec_stop(struct net_device *dev)
733{
734 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
735 struct mpc52xx_fec __iomem *fec = priv->fec;
736 unsigned long timeout;
737
738 /* disable all interrupts */
739 out_be32(&fec->imask, 0);
740
741 /* Disable the rx task. */
742 bcom_disable(priv->rx_dmatsk);
743
744 /* Wait for tx queue to drain, but only if we're in process context */
745 if (!in_interrupt()) {
746 timeout = jiffies + msecs_to_jiffies(2000);
747 while (time_before(jiffies, timeout) &&
748 !bcom_queue_empty(priv->tx_dmatsk))
749 msleep(100);
750
751 if (time_after_eq(jiffies, timeout))
752 dev_err(&dev->dev, "queues didn't drain\n");
753#if 1
754 if (time_after_eq(jiffies, timeout)) {
755 dev_err(&dev->dev, " tx: index: %i, outdex: %i\n",
756 priv->tx_dmatsk->index,
757 priv->tx_dmatsk->outdex);
758 dev_err(&dev->dev, " rx: index: %i, outdex: %i\n",
759 priv->rx_dmatsk->index,
760 priv->rx_dmatsk->outdex);
761 }
762#endif
763 }
764
765 bcom_disable(priv->tx_dmatsk);
766
767 /* Stop FEC */
768 out_be32(&fec->ecntrl, in_be32(&fec->ecntrl) & ~FEC_ECNTRL_ETHER_EN);
769
770 return;
771}
772
773/* reset fec and bestcomm tasks */
774static void mpc52xx_fec_reset(struct net_device *dev)
775{
776 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
777 struct mpc52xx_fec __iomem *fec = priv->fec;
778
779 mpc52xx_fec_stop(dev);
780
781 out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status));
782 out_be32(&fec->reset_cntrl, FEC_RESET_CNTRL_RESET_FIFO);
783
784 mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk);
785
786 mpc52xx_fec_hw_init(dev);
787
788 phy_stop(priv->phydev);
789 phy_write(priv->phydev, MII_BMCR, BMCR_RESET);
790 phy_start(priv->phydev);
791
792 bcom_fec_rx_reset(priv->rx_dmatsk);
793 bcom_fec_tx_reset(priv->tx_dmatsk);
794
795 mpc52xx_fec_alloc_rx_buffers(dev, priv->rx_dmatsk);
796
797 bcom_enable(priv->rx_dmatsk);
798 bcom_enable(priv->tx_dmatsk);
799
800 mpc52xx_fec_start(dev);
801}
802
803
804/* ethtool interface */
805static void mpc52xx_fec_get_drvinfo(struct net_device *dev,
806 struct ethtool_drvinfo *info)
807{
808 strcpy(info->driver, DRIVER_NAME);
809}
810
811static int mpc52xx_fec_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
812{
813 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
814 return phy_ethtool_gset(priv->phydev, cmd);
815}
816
817static int mpc52xx_fec_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
818{
819 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
820 return phy_ethtool_sset(priv->phydev, cmd);
821}
822
823static u32 mpc52xx_fec_get_msglevel(struct net_device *dev)
824{
825 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
826 return priv->msg_enable;
827}
828
829static void mpc52xx_fec_set_msglevel(struct net_device *dev, u32 level)
830{
831 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
832 priv->msg_enable = level;
833}
834
835static const struct ethtool_ops mpc52xx_fec_ethtool_ops = {
836 .get_drvinfo = mpc52xx_fec_get_drvinfo,
837 .get_settings = mpc52xx_fec_get_settings,
838 .set_settings = mpc52xx_fec_set_settings,
839 .get_link = ethtool_op_get_link,
840 .get_msglevel = mpc52xx_fec_get_msglevel,
841 .set_msglevel = mpc52xx_fec_set_msglevel,
842};
843
844
845static int mpc52xx_fec_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
846{
847 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
848
849 return mpc52xx_fec_phy_mii_ioctl(priv, if_mii(rq), cmd);
850}
851
852/* ======================================================================== */
853/* OF Driver */
854/* ======================================================================== */
855
856static int __devinit
857mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match)
858{
859 int rv;
860 struct net_device *ndev;
861 struct mpc52xx_fec_priv *priv = NULL;
862 struct resource mem;
863 const phandle *ph;
864
865 phys_addr_t rx_fifo;
866 phys_addr_t tx_fifo;
867
868 /* Get the ether ndev & it's private zone */
869 ndev = alloc_etherdev(sizeof(struct mpc52xx_fec_priv));
870 if (!ndev)
871 return -ENOMEM;
872
873 priv = netdev_priv(ndev);
874
875 /* Reserve FEC control zone */
876 rv = of_address_to_resource(op->node, 0, &mem);
877 if (rv) {
878 printk(KERN_ERR DRIVER_NAME ": "
879 "Error while parsing device node resource\n" );
880 return rv;
881 }
882 if ((mem.end - mem.start + 1) < sizeof(struct mpc52xx_fec)) {
883 printk(KERN_ERR DRIVER_NAME
884 " - invalid resource size (%lx < %x), check mpc52xx_devices.c\n",
885 (unsigned long)(mem.end - mem.start + 1), sizeof(struct mpc52xx_fec));
886 return -EINVAL;
887 }
888
889 if (!request_mem_region(mem.start, sizeof(struct mpc52xx_fec), DRIVER_NAME))
890 return -EBUSY;
891
892 /* Init ether ndev with what we have */
893 ndev->open = mpc52xx_fec_open;
894 ndev->stop = mpc52xx_fec_close;
895 ndev->hard_start_xmit = mpc52xx_fec_hard_start_xmit;
896 ndev->do_ioctl = mpc52xx_fec_ioctl;
897 ndev->ethtool_ops = &mpc52xx_fec_ethtool_ops;
898 ndev->get_stats = mpc52xx_fec_get_stats;
899 ndev->set_mac_address = mpc52xx_fec_set_mac_address;
900 ndev->set_multicast_list = mpc52xx_fec_set_multicast_list;
901 ndev->tx_timeout = mpc52xx_fec_tx_timeout;
902 ndev->watchdog_timeo = FEC_WATCHDOG_TIMEOUT;
903 ndev->base_addr = mem.start;
904
905 priv->t_irq = priv->r_irq = ndev->irq = NO_IRQ; /* IRQ are free for now */
906
907 spin_lock_init(&priv->lock);
908
909 /* ioremap the zones */
910 priv->fec = ioremap(mem.start, sizeof(struct mpc52xx_fec));
911
912 if (!priv->fec) {
913 rv = -ENOMEM;
914 goto probe_error;
915 }
916
917 /* Bestcomm init */
918 rx_fifo = ndev->base_addr + offsetof(struct mpc52xx_fec, rfifo_data);
919 tx_fifo = ndev->base_addr + offsetof(struct mpc52xx_fec, tfifo_data);
920
921 priv->rx_dmatsk = bcom_fec_rx_init(FEC_RX_NUM_BD, rx_fifo, FEC_RX_BUFFER_SIZE);
922 priv->tx_dmatsk = bcom_fec_tx_init(FEC_TX_NUM_BD, tx_fifo);
923
924 if (!priv->rx_dmatsk || !priv->tx_dmatsk) {
925 printk(KERN_ERR DRIVER_NAME ": Can not init SDMA tasks\n" );
926 rv = -ENOMEM;
927 goto probe_error;
928 }
929
930 /* Get the IRQ we need one by one */
931 /* Control */
932 ndev->irq = irq_of_parse_and_map(op->node, 0);
933
934 /* RX */
935 priv->r_irq = bcom_get_task_irq(priv->rx_dmatsk);
936
937 /* TX */
938 priv->t_irq = bcom_get_task_irq(priv->tx_dmatsk);
939
940 /* MAC address init */
941 if (!is_zero_ether_addr(mpc52xx_fec_mac_addr))
942 memcpy(ndev->dev_addr, mpc52xx_fec_mac_addr, 6);
943 else
944 mpc52xx_fec_get_paddr(ndev, ndev->dev_addr);
945
946 priv->msg_enable = netif_msg_init(debug, MPC52xx_MESSAGES_DEFAULT);
947 priv->duplex = DUPLEX_FULL;
948
949 /* is the phy present in device tree? */
950 ph = of_get_property(op->node, "phy-handle", NULL);
951 if (ph) {
952 const unsigned int *prop;
953 struct device_node *phy_dn;
954 priv->has_phy = 1;
955
956 phy_dn = of_find_node_by_phandle(*ph);
957 prop = of_get_property(phy_dn, "reg", NULL);
958 priv->phy_addr = *prop;
959
960 of_node_put(phy_dn);
961
962 /* Phy speed */
963 priv->phy_speed = ((mpc52xx_find_ipb_freq(op->node) >> 20) / 5) << 1;
964 } else {
965 dev_info(&ndev->dev, "can't find \"phy-handle\" in device"
966 " tree, using 7-wire mode\n");
967 }
968
969 /* Hardware init */
970 mpc52xx_fec_hw_init(ndev);
971
972 mpc52xx_fec_reset_stats(ndev);
973
974 /* Register the new network device */
975 rv = register_netdev(ndev);
976 if (rv < 0)
977 goto probe_error;
978
979 /* We're done ! */
980 dev_set_drvdata(&op->dev, ndev);
981
982 return 0;
983
984
985 /* Error handling - free everything that might be allocated */
986probe_error:
987
988 irq_dispose_mapping(ndev->irq);
989
990 if (priv->rx_dmatsk)
991 bcom_fec_rx_release(priv->rx_dmatsk);
992 if (priv->tx_dmatsk)
993 bcom_fec_tx_release(priv->tx_dmatsk);
994
995 if (priv->fec)
996 iounmap(priv->fec);
997
998 release_mem_region(mem.start, sizeof(struct mpc52xx_fec));
999
1000 free_netdev(ndev);
1001
1002 return rv;
1003}
1004
1005static int
1006mpc52xx_fec_remove(struct of_device *op)
1007{
1008 struct net_device *ndev;
1009 struct mpc52xx_fec_priv *priv;
1010
1011 ndev = dev_get_drvdata(&op->dev);
1012 priv = netdev_priv(ndev);
1013
1014 unregister_netdev(ndev);
1015
1016 irq_dispose_mapping(ndev->irq);
1017
1018 bcom_fec_rx_release(priv->rx_dmatsk);
1019 bcom_fec_tx_release(priv->tx_dmatsk);
1020
1021 iounmap(priv->fec);
1022
1023 release_mem_region(ndev->base_addr, sizeof(struct mpc52xx_fec));
1024
1025 free_netdev(ndev);
1026
1027 dev_set_drvdata(&op->dev, NULL);
1028 return 0;
1029}
1030
1031#ifdef CONFIG_PM
1032static int mpc52xx_fec_of_suspend(struct of_device *op, pm_message_t state)
1033{
1034 struct net_device *dev = dev_get_drvdata(&op->dev);
1035
1036 if (netif_running(dev))
1037 mpc52xx_fec_close(dev);
1038
1039 return 0;
1040}
1041
1042static int mpc52xx_fec_of_resume(struct of_device *op)
1043{
1044 struct net_device *dev = dev_get_drvdata(&op->dev);
1045
1046 mpc52xx_fec_hw_init(dev);
1047 mpc52xx_fec_reset_stats(dev);
1048
1049 if (netif_running(dev))
1050 mpc52xx_fec_open(dev);
1051
1052 return 0;
1053}
1054#endif
1055
1056static struct of_device_id mpc52xx_fec_match[] = {
1057 {
1058 .type = "network",
1059 .compatible = "mpc5200-fec",
1060 },
1061 { }
1062};
1063
1064MODULE_DEVICE_TABLE(of, mpc52xx_fec_match);
1065
1066static struct of_platform_driver mpc52xx_fec_driver = {
1067 .owner = THIS_MODULE,
1068 .name = DRIVER_NAME,
1069 .match_table = mpc52xx_fec_match,
1070 .probe = mpc52xx_fec_probe,
1071 .remove = mpc52xx_fec_remove,
1072#ifdef CONFIG_PM
1073 .suspend = mpc52xx_fec_of_suspend,
1074 .resume = mpc52xx_fec_of_resume,
1075#endif
1076};
1077
1078
1079/* ======================================================================== */
1080/* Module */
1081/* ======================================================================== */
1082
1083static int __init
1084mpc52xx_fec_init(void)
1085{
1086#ifdef CONFIG_FEC_MPC52xx_MDIO
1087 int ret;
1088 ret = of_register_platform_driver(&mpc52xx_fec_mdio_driver);
1089 if (ret) {
1090 printk(KERN_ERR DRIVER_NAME ": failed to register mdio driver\n");
1091 return ret;
1092 }
1093#endif
1094 return of_register_platform_driver(&mpc52xx_fec_driver);
1095}
1096
1097static void __exit
1098mpc52xx_fec_exit(void)
1099{
1100 of_unregister_platform_driver(&mpc52xx_fec_driver);
1101#ifdef CONFIG_FEC_MPC52xx_MDIO
1102 of_unregister_platform_driver(&mpc52xx_fec_mdio_driver);
1103#endif
1104}
1105
1106
1107module_init(mpc52xx_fec_init);
1108module_exit(mpc52xx_fec_exit);
1109
1110MODULE_LICENSE("GPL");
1111MODULE_AUTHOR("Dale Farnsworth");
1112MODULE_DESCRIPTION("Ethernet driver for the Freescale MPC52xx FEC");
diff --git a/drivers/net/fec_mpc52xx.h b/drivers/net/fec_mpc52xx.h
new file mode 100644
index 000000000000..8b1f75397b9a
--- /dev/null
+++ b/drivers/net/fec_mpc52xx.h
@@ -0,0 +1,313 @@
1/*
2 * drivers/drivers/net/fec_mpc52xx/fec.h
3 *
4 * Driver for the MPC5200 Fast Ethernet Controller
5 *
6 * Author: Dale Farnsworth <dfarnsworth@mvista.com>
7 *
8 * 2003-2004 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifndef __DRIVERS_NET_MPC52XX_FEC_H__
15#define __DRIVERS_NET_MPC52XX_FEC_H__
16
17#include <linux/phy.h>
18
19/* Tunable constant */
20/* FEC_RX_BUFFER_SIZE includes 4 bytes for CRC32 */
21#define FEC_RX_BUFFER_SIZE 1522 /* max receive packet size */
22#define FEC_RX_NUM_BD 256
23#define FEC_TX_NUM_BD 64
24
25#define FEC_RESET_DELAY 50 /* uS */
26
27#define FEC_WATCHDOG_TIMEOUT ((400*HZ)/1000)
28
29struct mpc52xx_fec_priv {
30 int duplex;
31 int r_irq;
32 int t_irq;
33 struct mpc52xx_fec __iomem *fec;
34 struct bcom_task *rx_dmatsk;
35 struct bcom_task *tx_dmatsk;
36 spinlock_t lock;
37 int msg_enable;
38
39 int has_phy;
40 unsigned int phy_speed;
41 unsigned int phy_addr;
42 struct phy_device *phydev;
43 enum phy_state link;
44 int speed;
45};
46
47
48/* ======================================================================== */
49/* Hardware register sets & bits */
50/* ======================================================================== */
51
52struct mpc52xx_fec {
53 u32 fec_id; /* FEC + 0x000 */
54 u32 ievent; /* FEC + 0x004 */
55 u32 imask; /* FEC + 0x008 */
56
57 u32 reserved0[1]; /* FEC + 0x00C */
58 u32 r_des_active; /* FEC + 0x010 */
59 u32 x_des_active; /* FEC + 0x014 */
60 u32 r_des_active_cl; /* FEC + 0x018 */
61 u32 x_des_active_cl; /* FEC + 0x01C */
62 u32 ivent_set; /* FEC + 0x020 */
63 u32 ecntrl; /* FEC + 0x024 */
64
65 u32 reserved1[6]; /* FEC + 0x028-03C */
66 u32 mii_data; /* FEC + 0x040 */
67 u32 mii_speed; /* FEC + 0x044 */
68 u32 mii_status; /* FEC + 0x048 */
69
70 u32 reserved2[5]; /* FEC + 0x04C-05C */
71 u32 mib_data; /* FEC + 0x060 */
72 u32 mib_control; /* FEC + 0x064 */
73
74 u32 reserved3[6]; /* FEC + 0x068-7C */
75 u32 r_activate; /* FEC + 0x080 */
76 u32 r_cntrl; /* FEC + 0x084 */
77 u32 r_hash; /* FEC + 0x088 */
78 u32 r_data; /* FEC + 0x08C */
79 u32 ar_done; /* FEC + 0x090 */
80 u32 r_test; /* FEC + 0x094 */
81 u32 r_mib; /* FEC + 0x098 */
82 u32 r_da_low; /* FEC + 0x09C */
83 u32 r_da_high; /* FEC + 0x0A0 */
84
85 u32 reserved4[7]; /* FEC + 0x0A4-0BC */
86 u32 x_activate; /* FEC + 0x0C0 */
87 u32 x_cntrl; /* FEC + 0x0C4 */
88 u32 backoff; /* FEC + 0x0C8 */
89 u32 x_data; /* FEC + 0x0CC */
90 u32 x_status; /* FEC + 0x0D0 */
91 u32 x_mib; /* FEC + 0x0D4 */
92 u32 x_test; /* FEC + 0x0D8 */
93 u32 fdxfc_da1; /* FEC + 0x0DC */
94 u32 fdxfc_da2; /* FEC + 0x0E0 */
95 u32 paddr1; /* FEC + 0x0E4 */
96 u32 paddr2; /* FEC + 0x0E8 */
97 u32 op_pause; /* FEC + 0x0EC */
98
99 u32 reserved5[4]; /* FEC + 0x0F0-0FC */
100 u32 instr_reg; /* FEC + 0x100 */
101 u32 context_reg; /* FEC + 0x104 */
102 u32 test_cntrl; /* FEC + 0x108 */
103 u32 acc_reg; /* FEC + 0x10C */
104 u32 ones; /* FEC + 0x110 */
105 u32 zeros; /* FEC + 0x114 */
106 u32 iaddr1; /* FEC + 0x118 */
107 u32 iaddr2; /* FEC + 0x11C */
108 u32 gaddr1; /* FEC + 0x120 */
109 u32 gaddr2; /* FEC + 0x124 */
110 u32 random; /* FEC + 0x128 */
111 u32 rand1; /* FEC + 0x12C */
112 u32 tmp; /* FEC + 0x130 */
113
114 u32 reserved6[3]; /* FEC + 0x134-13C */
115 u32 fifo_id; /* FEC + 0x140 */
116 u32 x_wmrk; /* FEC + 0x144 */
117 u32 fcntrl; /* FEC + 0x148 */
118 u32 r_bound; /* FEC + 0x14C */
119 u32 r_fstart; /* FEC + 0x150 */
120 u32 r_count; /* FEC + 0x154 */
121 u32 r_lag; /* FEC + 0x158 */
122 u32 r_read; /* FEC + 0x15C */
123 u32 r_write; /* FEC + 0x160 */
124 u32 x_count; /* FEC + 0x164 */
125 u32 x_lag; /* FEC + 0x168 */
126 u32 x_retry; /* FEC + 0x16C */
127 u32 x_write; /* FEC + 0x170 */
128 u32 x_read; /* FEC + 0x174 */
129
130 u32 reserved7[2]; /* FEC + 0x178-17C */
131 u32 fm_cntrl; /* FEC + 0x180 */
132 u32 rfifo_data; /* FEC + 0x184 */
133 u32 rfifo_status; /* FEC + 0x188 */
134 u32 rfifo_cntrl; /* FEC + 0x18C */
135 u32 rfifo_lrf_ptr; /* FEC + 0x190 */
136 u32 rfifo_lwf_ptr; /* FEC + 0x194 */
137 u32 rfifo_alarm; /* FEC + 0x198 */
138 u32 rfifo_rdptr; /* FEC + 0x19C */
139 u32 rfifo_wrptr; /* FEC + 0x1A0 */
140 u32 tfifo_data; /* FEC + 0x1A4 */
141 u32 tfifo_status; /* FEC + 0x1A8 */
142 u32 tfifo_cntrl; /* FEC + 0x1AC */
143 u32 tfifo_lrf_ptr; /* FEC + 0x1B0 */
144 u32 tfifo_lwf_ptr; /* FEC + 0x1B4 */
145 u32 tfifo_alarm; /* FEC + 0x1B8 */
146 u32 tfifo_rdptr; /* FEC + 0x1BC */
147 u32 tfifo_wrptr; /* FEC + 0x1C0 */
148
149 u32 reset_cntrl; /* FEC + 0x1C4 */
150 u32 xmit_fsm; /* FEC + 0x1C8 */
151
152 u32 reserved8[3]; /* FEC + 0x1CC-1D4 */
153 u32 rdes_data0; /* FEC + 0x1D8 */
154 u32 rdes_data1; /* FEC + 0x1DC */
155 u32 r_length; /* FEC + 0x1E0 */
156 u32 x_length; /* FEC + 0x1E4 */
157 u32 x_addr; /* FEC + 0x1E8 */
158 u32 cdes_data; /* FEC + 0x1EC */
159 u32 status; /* FEC + 0x1F0 */
160 u32 dma_control; /* FEC + 0x1F4 */
161 u32 des_cmnd; /* FEC + 0x1F8 */
162 u32 data; /* FEC + 0x1FC */
163
164 u32 rmon_t_drop; /* FEC + 0x200 */
165 u32 rmon_t_packets; /* FEC + 0x204 */
166 u32 rmon_t_bc_pkt; /* FEC + 0x208 */
167 u32 rmon_t_mc_pkt; /* FEC + 0x20C */
168 u32 rmon_t_crc_align; /* FEC + 0x210 */
169 u32 rmon_t_undersize; /* FEC + 0x214 */
170 u32 rmon_t_oversize; /* FEC + 0x218 */
171 u32 rmon_t_frag; /* FEC + 0x21C */
172 u32 rmon_t_jab; /* FEC + 0x220 */
173 u32 rmon_t_col; /* FEC + 0x224 */
174 u32 rmon_t_p64; /* FEC + 0x228 */
175 u32 rmon_t_p65to127; /* FEC + 0x22C */
176 u32 rmon_t_p128to255; /* FEC + 0x230 */
177 u32 rmon_t_p256to511; /* FEC + 0x234 */
178 u32 rmon_t_p512to1023; /* FEC + 0x238 */
179 u32 rmon_t_p1024to2047; /* FEC + 0x23C */
180 u32 rmon_t_p_gte2048; /* FEC + 0x240 */
181 u32 rmon_t_octets; /* FEC + 0x244 */
182 u32 ieee_t_drop; /* FEC + 0x248 */
183 u32 ieee_t_frame_ok; /* FEC + 0x24C */
184 u32 ieee_t_1col; /* FEC + 0x250 */
185 u32 ieee_t_mcol; /* FEC + 0x254 */
186 u32 ieee_t_def; /* FEC + 0x258 */
187 u32 ieee_t_lcol; /* FEC + 0x25C */
188 u32 ieee_t_excol; /* FEC + 0x260 */
189 u32 ieee_t_macerr; /* FEC + 0x264 */
190 u32 ieee_t_cserr; /* FEC + 0x268 */
191 u32 ieee_t_sqe; /* FEC + 0x26C */
192 u32 t_fdxfc; /* FEC + 0x270 */
193 u32 ieee_t_octets_ok; /* FEC + 0x274 */
194
195 u32 reserved9[2]; /* FEC + 0x278-27C */
196 u32 rmon_r_drop; /* FEC + 0x280 */
197 u32 rmon_r_packets; /* FEC + 0x284 */
198 u32 rmon_r_bc_pkt; /* FEC + 0x288 */
199 u32 rmon_r_mc_pkt; /* FEC + 0x28C */
200 u32 rmon_r_crc_align; /* FEC + 0x290 */
201 u32 rmon_r_undersize; /* FEC + 0x294 */
202 u32 rmon_r_oversize; /* FEC + 0x298 */
203 u32 rmon_r_frag; /* FEC + 0x29C */
204 u32 rmon_r_jab; /* FEC + 0x2A0 */
205
206 u32 rmon_r_resvd_0; /* FEC + 0x2A4 */
207
208 u32 rmon_r_p64; /* FEC + 0x2A8 */
209 u32 rmon_r_p65to127; /* FEC + 0x2AC */
210 u32 rmon_r_p128to255; /* FEC + 0x2B0 */
211 u32 rmon_r_p256to511; /* FEC + 0x2B4 */
212 u32 rmon_r_p512to1023; /* FEC + 0x2B8 */
213 u32 rmon_r_p1024to2047; /* FEC + 0x2BC */
214 u32 rmon_r_p_gte2048; /* FEC + 0x2C0 */
215 u32 rmon_r_octets; /* FEC + 0x2C4 */
216 u32 ieee_r_drop; /* FEC + 0x2C8 */
217 u32 ieee_r_frame_ok; /* FEC + 0x2CC */
218 u32 ieee_r_crc; /* FEC + 0x2D0 */
219 u32 ieee_r_align; /* FEC + 0x2D4 */
220 u32 r_macerr; /* FEC + 0x2D8 */
221 u32 r_fdxfc; /* FEC + 0x2DC */
222 u32 ieee_r_octets_ok; /* FEC + 0x2E0 */
223
224 u32 reserved10[7]; /* FEC + 0x2E4-2FC */
225
226 u32 reserved11[64]; /* FEC + 0x300-3FF */
227};
228
229#define FEC_MIB_DISABLE 0x80000000
230
231#define FEC_IEVENT_HBERR 0x80000000
232#define FEC_IEVENT_BABR 0x40000000
233#define FEC_IEVENT_BABT 0x20000000
234#define FEC_IEVENT_GRA 0x10000000
235#define FEC_IEVENT_TFINT 0x08000000
236#define FEC_IEVENT_MII 0x00800000
237#define FEC_IEVENT_LATE_COL 0x00200000
238#define FEC_IEVENT_COL_RETRY_LIM 0x00100000
239#define FEC_IEVENT_XFIFO_UN 0x00080000
240#define FEC_IEVENT_XFIFO_ERROR 0x00040000
241#define FEC_IEVENT_RFIFO_ERROR 0x00020000
242
243#define FEC_IMASK_HBERR 0x80000000
244#define FEC_IMASK_BABR 0x40000000
245#define FEC_IMASK_BABT 0x20000000
246#define FEC_IMASK_GRA 0x10000000
247#define FEC_IMASK_MII 0x00800000
248#define FEC_IMASK_LATE_COL 0x00200000
249#define FEC_IMASK_COL_RETRY_LIM 0x00100000
250#define FEC_IMASK_XFIFO_UN 0x00080000
251#define FEC_IMASK_XFIFO_ERROR 0x00040000
252#define FEC_IMASK_RFIFO_ERROR 0x00020000
253
254/* all but MII, which is enabled separately */
255#define FEC_IMASK_ENABLE (FEC_IMASK_HBERR | FEC_IMASK_BABR | \
256 FEC_IMASK_BABT | FEC_IMASK_GRA | FEC_IMASK_LATE_COL | \
257 FEC_IMASK_COL_RETRY_LIM | FEC_IMASK_XFIFO_UN | \
258 FEC_IMASK_XFIFO_ERROR | FEC_IMASK_RFIFO_ERROR)
259
260#define FEC_RCNTRL_MAX_FL_SHIFT 16
261#define FEC_RCNTRL_LOOP 0x01
262#define FEC_RCNTRL_DRT 0x02
263#define FEC_RCNTRL_MII_MODE 0x04
264#define FEC_RCNTRL_PROM 0x08
265#define FEC_RCNTRL_BC_REJ 0x10
266#define FEC_RCNTRL_FCE 0x20
267
268#define FEC_TCNTRL_GTS 0x00000001
269#define FEC_TCNTRL_HBC 0x00000002
270#define FEC_TCNTRL_FDEN 0x00000004
271#define FEC_TCNTRL_TFC_PAUSE 0x00000008
272#define FEC_TCNTRL_RFC_PAUSE 0x00000010
273
274#define FEC_ECNTRL_RESET 0x00000001
275#define FEC_ECNTRL_ETHER_EN 0x00000002
276
277#define FEC_MII_DATA_ST 0x40000000 /* Start frame */
278#define FEC_MII_DATA_OP_RD 0x20000000 /* Perform read */
279#define FEC_MII_DATA_OP_WR 0x10000000 /* Perform write */
280#define FEC_MII_DATA_PA_MSK 0x0f800000 /* PHY Address mask */
281#define FEC_MII_DATA_RA_MSK 0x007c0000 /* PHY Register mask */
282#define FEC_MII_DATA_TA 0x00020000 /* Turnaround */
283#define FEC_MII_DATA_DATAMSK 0x0000ffff /* PHY data mask */
284
285#define FEC_MII_READ_FRAME (FEC_MII_DATA_ST | FEC_MII_DATA_OP_RD | FEC_MII_DATA_TA)
286#define FEC_MII_WRITE_FRAME (FEC_MII_DATA_ST | FEC_MII_DATA_OP_WR | FEC_MII_DATA_TA)
287
288#define FEC_MII_DATA_RA_SHIFT 0x12 /* MII reg addr bits */
289#define FEC_MII_DATA_PA_SHIFT 0x17 /* MII PHY addr bits */
290
291#define FEC_PADDR2_TYPE 0x8808
292
293#define FEC_OP_PAUSE_OPCODE 0x00010000
294
295#define FEC_FIFO_WMRK_256B 0x3
296
297#define FEC_FIFO_STATUS_ERR 0x00400000
298#define FEC_FIFO_STATUS_UF 0x00200000
299#define FEC_FIFO_STATUS_OF 0x00100000
300
301#define FEC_FIFO_CNTRL_FRAME 0x08000000
302#define FEC_FIFO_CNTRL_LTG_7 0x07000000
303
304#define FEC_RESET_CNTRL_RESET_FIFO 0x02000000
305#define FEC_RESET_CNTRL_ENABLE_IS_RESET 0x01000000
306
307#define FEC_XMIT_FSM_APPEND_CRC 0x02000000
308#define FEC_XMIT_FSM_ENABLE_CRC 0x01000000
309
310
311extern struct of_platform_driver mpc52xx_fec_mdio_driver;
312
313#endif /* __DRIVERS_NET_MPC52XX_FEC_H__ */
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c
new file mode 100644
index 000000000000..ba6e8b218e0a
--- /dev/null
+++ b/drivers/net/fec_mpc52xx_phy.c
@@ -0,0 +1,198 @@
1/*
2 * Driver for the MPC5200 Fast Ethernet Controller - MDIO bus driver
3 *
4 * Copyright (C) 2007 Domen Puncer, Telargo, Inc.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/module.h>
13#include <linux/netdevice.h>
14#include <linux/phy.h>
15#include <linux/of_platform.h>
16#include <asm/io.h>
17#include <asm/mpc52xx.h>
18#include "fec_mpc52xx.h"
19
20struct mpc52xx_fec_mdio_priv {
21 struct mpc52xx_fec __iomem *regs;
22};
23
24static int mpc52xx_fec_mdio_read(struct mii_bus *bus, int phy_id, int reg)
25{
26 struct mpc52xx_fec_mdio_priv *priv = bus->priv;
27 struct mpc52xx_fec __iomem *fec;
28 int tries = 100;
29 u32 request = FEC_MII_READ_FRAME;
30
31 fec = priv->regs;
32 out_be32(&fec->ievent, FEC_IEVENT_MII);
33
34 request |= (phy_id << FEC_MII_DATA_PA_SHIFT) & FEC_MII_DATA_PA_MSK;
35 request |= (reg << FEC_MII_DATA_RA_SHIFT) & FEC_MII_DATA_RA_MSK;
36
37 out_be32(&priv->regs->mii_data, request);
38
39 /* wait for it to finish, this takes about 23 us on lite5200b */
40 while (!(in_be32(&fec->ievent) & FEC_IEVENT_MII) && --tries)
41 udelay(5);
42
43 if (tries == 0)
44 return -ETIMEDOUT;
45
46 return in_be32(&priv->regs->mii_data) & FEC_MII_DATA_DATAMSK;
47}
48
49static int mpc52xx_fec_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 data)
50{
51 struct mpc52xx_fec_mdio_priv *priv = bus->priv;
52 struct mpc52xx_fec __iomem *fec;
53 u32 value = data;
54 int tries = 100;
55
56 fec = priv->regs;
57 out_be32(&fec->ievent, FEC_IEVENT_MII);
58
59 value |= FEC_MII_WRITE_FRAME;
60 value |= (phy_id << FEC_MII_DATA_PA_SHIFT) & FEC_MII_DATA_PA_MSK;
61 value |= (reg << FEC_MII_DATA_RA_SHIFT) & FEC_MII_DATA_RA_MSK;
62
63 out_be32(&priv->regs->mii_data, value);
64
65 /* wait for request to finish */
66 while (!(in_be32(&fec->ievent) & FEC_IEVENT_MII) && --tries)
67 udelay(5);
68
69 if (tries == 0)
70 return -ETIMEDOUT;
71
72 return 0;
73}
74
75static int mpc52xx_fec_mdio_probe(struct of_device *of, const struct of_device_id *match)
76{
77 struct device *dev = &of->dev;
78 struct device_node *np = of->node;
79 struct device_node *child = NULL;
80 struct mii_bus *bus;
81 struct mpc52xx_fec_mdio_priv *priv;
82 struct resource res = {};
83 int err;
84 int i;
85
86 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
87 if (bus == NULL)
88 return -ENOMEM;
89 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
90 if (priv == NULL) {
91 err = -ENOMEM;
92 goto out_free;
93 }
94
95 bus->name = "mpc52xx MII bus";
96 bus->read = mpc52xx_fec_mdio_read;
97 bus->write = mpc52xx_fec_mdio_write;
98
99 /* setup irqs */
100 bus->irq = kmalloc(sizeof(bus->irq[0]) * PHY_MAX_ADDR, GFP_KERNEL);
101 if (bus->irq == NULL) {
102 err = -ENOMEM;
103 goto out_free;
104 }
105 for (i=0; i<PHY_MAX_ADDR; i++)
106 bus->irq[i] = PHY_POLL;
107
108 while ((child = of_get_next_child(np, child)) != NULL) {
109 int irq = irq_of_parse_and_map(child, 0);
110 if (irq != NO_IRQ) {
111 const u32 *id = of_get_property(child, "reg", NULL);
112 bus->irq[*id] = irq;
113 }
114 }
115
116 /* setup registers */
117 err = of_address_to_resource(np, 0, &res);
118 if (err)
119 goto out_free;
120 priv->regs = ioremap(res.start, res.end - res.start + 1);
121 if (priv->regs == NULL) {
122 err = -ENOMEM;
123 goto out_free;
124 }
125
126 bus->id = res.start;
127 bus->priv = priv;
128
129 bus->dev = dev;
130 dev_set_drvdata(dev, bus);
131
132 /* set MII speed */
133 out_be32(&priv->regs->mii_speed, ((mpc52xx_find_ipb_freq(of->node) >> 20) / 5) << 1);
134
135 /* enable MII interrupt */
136 out_be32(&priv->regs->imask, in_be32(&priv->regs->imask) | FEC_IMASK_MII);
137
138 err = mdiobus_register(bus);
139 if (err)
140 goto out_unmap;
141
142 return 0;
143
144 out_unmap:
145 iounmap(priv->regs);
146 out_free:
147 for (i=0; i<PHY_MAX_ADDR; i++)
148 if (bus->irq[i] != PHY_POLL)
149 irq_dispose_mapping(bus->irq[i]);
150 kfree(bus->irq);
151 kfree(priv);
152 kfree(bus);
153
154 return err;
155}
156
157static int mpc52xx_fec_mdio_remove(struct of_device *of)
158{
159 struct device *dev = &of->dev;
160 struct mii_bus *bus = dev_get_drvdata(dev);
161 struct mpc52xx_fec_mdio_priv *priv = bus->priv;
162 int i;
163
164 mdiobus_unregister(bus);
165 dev_set_drvdata(dev, NULL);
166
167 iounmap(priv->regs);
168 for (i=0; i<PHY_MAX_ADDR; i++)
169 if (bus->irq[i])
170 irq_dispose_mapping(bus->irq[i]);
171 kfree(priv);
172 kfree(bus->irq);
173 kfree(bus);
174
175 return 0;
176}
177
178
179static struct of_device_id mpc52xx_fec_mdio_match[] = {
180 {
181 .type = "mdio",
182 .compatible = "mpc5200b-fec-phy",
183 },
184 {},
185};
186
187struct of_platform_driver mpc52xx_fec_mdio_driver = {
188 .name = "mpc5200b-fec-phy",
189 .probe = mpc52xx_fec_mdio_probe,
190 .remove = mpc52xx_fec_mdio_remove,
191 .match_table = mpc52xx_fec_mdio_match,
192};
193
194/* let fec driver call it, since this has to be registered before it */
195EXPORT_SYMBOL_GPL(mpc52xx_fec_mdio_driver);
196
197
198MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 70ddf1acfd88..92ce2e38f0d5 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -5597,6 +5597,22 @@ static struct pci_device_id pci_tbl[] = {
5597 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_31), 5597 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_31),
5598 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, 5598 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
5599 }, 5599 },
5600 { /* MCP77 Ethernet Controller */
5601 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32),
5602 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5603 },
5604 { /* MCP77 Ethernet Controller */
5605 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33),
5606 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5607 },
5608 { /* MCP77 Ethernet Controller */
5609 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34),
5610 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5611 },
5612 { /* MCP77 Ethernet Controller */
5613 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35),
5614 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5615 },
5600 {0,}, 5616 {0,},
5601}; 5617};
5602 5618
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 68887235d7e9..dbd23bb65d1e 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -55,6 +55,26 @@ MODULE_DESCRIPTION("IC Plus IP1000 Gigabit Ethernet Adapter Linux Driver "
55 DrvVer); 55 DrvVer);
56MODULE_LICENSE("GPL"); 56MODULE_LICENSE("GPL");
57 57
58//variable record -- index by leading revision/length
59//Revision/Length(=N*4), Address1, Data1, Address2, Data2,...,AddressN,DataN
60static unsigned short DefaultPhyParam[] = {
61 // 11/12/03 IP1000A v1-3 rev=0x40
62 /*--------------------------------------------------------------------------
63 (0x4000|(15*4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 22, 0x85bd, 24, 0xfff2,
64 27, 0x0c10, 28, 0x0c10, 29, 0x2c10, 31, 0x0003, 23, 0x92f6,
65 31, 0x0000, 23, 0x003d, 30, 0x00de, 20, 0x20e7, 9, 0x0700,
66 --------------------------------------------------------------------------*/
67 // 12/17/03 IP1000A v1-4 rev=0x40
68 (0x4000 | (07 * 4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 27, 0xeb8e, 31,
69 0x0000,
70 30, 0x005e, 9, 0x0700,
71 // 01/09/04 IP1000A v1-5 rev=0x41
72 (0x4100 | (07 * 4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 27, 0xeb8e, 31,
73 0x0000,
74 30, 0x005e, 9, 0x0700,
75 0x0000
76};
77
58static const char *ipg_brand_name[] = { 78static const char *ipg_brand_name[] = {
59 "IC PLUS IP1000 1000/100/10 based NIC", 79 "IC PLUS IP1000 1000/100/10 based NIC",
60 "Sundance Technology ST2021 based NIC", 80 "Sundance Technology ST2021 based NIC",
@@ -990,7 +1010,7 @@ static void ipg_nic_txcleanup(struct net_device *dev)
990} 1010}
991 1011
992/* Provides statistical information about the IPG NIC. */ 1012/* Provides statistical information about the IPG NIC. */
993struct net_device_stats *ipg_nic_get_stats(struct net_device *dev) 1013static struct net_device_stats *ipg_nic_get_stats(struct net_device *dev)
994{ 1014{
995 struct ipg_nic_private *sp = netdev_priv(dev); 1015 struct ipg_nic_private *sp = netdev_priv(dev);
996 void __iomem *ioaddr = sp->ioaddr; 1016 void __iomem *ioaddr = sp->ioaddr;
diff --git a/drivers/net/ipg.h b/drivers/net/ipg.h
index e418b9035cac..d5d092c9d0af 100644
--- a/drivers/net/ipg.h
+++ b/drivers/net/ipg.h
@@ -833,24 +833,4 @@ struct ipg_nic_private {
833 struct delayed_work task; 833 struct delayed_work task;
834}; 834};
835 835
836//variable record -- index by leading revision/length
837//Revision/Length(=N*4), Address1, Data1, Address2, Data2,...,AddressN,DataN
838unsigned short DefaultPhyParam[] = {
839 // 11/12/03 IP1000A v1-3 rev=0x40
840 /*--------------------------------------------------------------------------
841 (0x4000|(15*4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 22, 0x85bd, 24, 0xfff2,
842 27, 0x0c10, 28, 0x0c10, 29, 0x2c10, 31, 0x0003, 23, 0x92f6,
843 31, 0x0000, 23, 0x003d, 30, 0x00de, 20, 0x20e7, 9, 0x0700,
844 --------------------------------------------------------------------------*/
845 // 12/17/03 IP1000A v1-4 rev=0x40
846 (0x4000 | (07 * 4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 27, 0xeb8e, 31,
847 0x0000,
848 30, 0x005e, 9, 0x0700,
849 // 01/09/04 IP1000A v1-5 rev=0x41
850 (0x4100 | (07 * 4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 27, 0xeb8e, 31,
851 0x0000,
852 30, 0x005e, 9, 0x0700,
853 0x0000
854};
855
856#endif /* __LINUX_IPG_H */ 836#endif /* __LINUX_IPG_H */
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c
index 4dbdfaaf37bf..a1e4508717c8 100644
--- a/drivers/net/irda/au1k_ir.c
+++ b/drivers/net/irda/au1k_ir.c
@@ -627,19 +627,16 @@ static int au1k_irda_rx(struct net_device *dev)
627} 627}
628 628
629 629
630void au1k_irda_interrupt(int irq, void *dev_id) 630static irqreturn_t au1k_irda_interrupt(int dummy, void *dev_id)
631{ 631{
632 struct net_device *dev = (struct net_device *) dev_id; 632 struct net_device *dev = dev_id;
633
634 if (dev == NULL) {
635 printk(KERN_ERR "%s: isr: null dev ptr\n", dev->name);
636 return;
637 }
638 633
639 writel(0, IR_INT_CLEAR); /* ack irda interrupts */ 634 writel(0, IR_INT_CLEAR); /* ack irda interrupts */
640 635
641 au1k_irda_rx(dev); 636 au1k_irda_rx(dev);
642 au1k_tx_ack(dev); 637 au1k_tx_ack(dev);
638
639 return IRQ_HANDLED;
643} 640}
644 641
645 642
diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index 1eee8894c732..3d2e7217e9af 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -196,4 +196,11 @@ struct ixgb_adapter {
196 uint32_t alloc_rx_buff_failed; 196 uint32_t alloc_rx_buff_failed;
197 boolean_t have_msi; 197 boolean_t have_msi;
198}; 198};
199
200/* Exported from other modules */
201extern void ixgb_check_options(struct ixgb_adapter *adapter);
202extern void ixgb_set_ethtool_ops(struct net_device *netdev);
203extern char ixgb_driver_name[];
204extern const char ixgb_driver_version[];
205
199#endif /* _IXGB_H_ */ 206#endif /* _IXGB_H_ */
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index fddd5844168d..a267dd862520 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -32,9 +32,6 @@
32 32
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34 34
35extern char ixgb_driver_name[];
36extern char ixgb_driver_version[];
37
38extern int ixgb_up(struct ixgb_adapter *adapter); 35extern int ixgb_up(struct ixgb_adapter *adapter);
39extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog); 36extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog);
40extern void ixgb_reset(struct ixgb_adapter *adapter); 37extern void ixgb_reset(struct ixgb_adapter *adapter);
@@ -639,8 +636,8 @@ ixgb_phys_id(struct net_device *netdev, uint32_t data)
639{ 636{
640 struct ixgb_adapter *adapter = netdev_priv(netdev); 637 struct ixgb_adapter *adapter = netdev_priv(netdev);
641 638
642 if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) 639 if (!data)
643 data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); 640 data = INT_MAX;
644 641
645 if(!adapter->blink_timer.function) { 642 if(!adapter->blink_timer.function) {
646 init_timer(&adapter->blink_timer); 643 init_timer(&adapter->blink_timer);
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index ecbf45861c68..2c6367ace3cd 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -1174,7 +1174,7 @@ mac_addr_valid(uint8_t *mac_addr)
1174 * 1174 *
1175 * hw - Struct containing variables accessed by shared code 1175 * hw - Struct containing variables accessed by shared code
1176 *****************************************************************************/ 1176 *****************************************************************************/
1177boolean_t 1177static boolean_t
1178ixgb_link_reset(struct ixgb_hw *hw) 1178ixgb_link_reset(struct ixgb_hw *hw)
1179{ 1179{
1180 boolean_t link_status = FALSE; 1180 boolean_t link_status = FALSE;
@@ -1205,7 +1205,7 @@ ixgb_link_reset(struct ixgb_hw *hw)
1205 * 1205 *
1206 * hw - Struct containing variables accessed by shared code 1206 * hw - Struct containing variables accessed by shared code
1207 *****************************************************************************/ 1207 *****************************************************************************/
1208void 1208static void
1209ixgb_optics_reset(struct ixgb_hw *hw) 1209ixgb_optics_reset(struct ixgb_hw *hw)
1210{ 1210{
1211 if (hw->phy_type == ixgb_phy_type_txn17401) { 1211 if (hw->phy_type == ixgb_phy_type_txn17401) {
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index d444de58ba34..3021234b1e17 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -37,8 +37,8 @@ static char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver";
37#define DRIVERNAPI "-NAPI" 37#define DRIVERNAPI "-NAPI"
38#endif 38#endif
39#define DRV_VERSION "1.0.126-k2"DRIVERNAPI 39#define DRV_VERSION "1.0.126-k2"DRIVERNAPI
40char ixgb_driver_version[] = DRV_VERSION; 40const char ixgb_driver_version[] = DRV_VERSION;
41static char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 41static const char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
42 42
43/* ixgb_pci_tbl - PCI Device ID Table 43/* ixgb_pci_tbl - PCI Device ID Table
44 * 44 *
@@ -104,7 +104,6 @@ static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter,
104static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter); 104static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter);
105#endif 105#endif
106static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter); 106static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter);
107void ixgb_set_ethtool_ops(struct net_device *netdev);
108static void ixgb_tx_timeout(struct net_device *dev); 107static void ixgb_tx_timeout(struct net_device *dev);
109static void ixgb_tx_timeout_task(struct work_struct *work); 108static void ixgb_tx_timeout_task(struct work_struct *work);
110static void ixgb_vlan_rx_register(struct net_device *netdev, 109static void ixgb_vlan_rx_register(struct net_device *netdev,
@@ -123,9 +122,6 @@ static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev,
123static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev); 122static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev);
124static void ixgb_io_resume (struct pci_dev *pdev); 123static void ixgb_io_resume (struct pci_dev *pdev);
125 124
126/* Exported from other modules */
127extern void ixgb_check_options(struct ixgb_adapter *adapter);
128
129static struct pci_error_handlers ixgb_err_handler = { 125static struct pci_error_handlers ixgb_err_handler = {
130 .error_detected = ixgb_io_error_detected, 126 .error_detected = ixgb_io_error_detected,
131 .slot_reset = ixgb_io_slot_reset, 127 .slot_reset = ixgb_io_slot_reset,
@@ -1085,7 +1081,8 @@ ixgb_set_multi(struct net_device *netdev)
1085 rctl |= IXGB_RCTL_MPE; 1081 rctl |= IXGB_RCTL_MPE;
1086 IXGB_WRITE_REG(hw, RCTL, rctl); 1082 IXGB_WRITE_REG(hw, RCTL, rctl);
1087 } else { 1083 } else {
1088 uint8_t mta[netdev->mc_count * IXGB_ETH_LENGTH_OF_ADDRESS]; 1084 uint8_t mta[IXGB_MAX_NUM_MULTICAST_ADDRESSES *
1085 IXGB_ETH_LENGTH_OF_ADDRESS];
1089 1086
1090 IXGB_WRITE_REG(hw, RCTL, rctl); 1087 IXGB_WRITE_REG(hw, RCTL, rctl);
1091 1088
@@ -1324,8 +1321,8 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
1324 1321
1325 /* Workaround for premature desc write-backs 1322 /* Workaround for premature desc write-backs
1326 * in TSO mode. Append 4-byte sentinel desc */ 1323 * in TSO mode. Append 4-byte sentinel desc */
1327 if (unlikely(mss && !nr_frags && size == len 1324 if (unlikely(mss && (f == (nr_frags - 1))
1328 && size > 8)) 1325 && size == len && size > 8))
1329 size -= 4; 1326 size -= 4;
1330 1327
1331 buffer_info->length = size; 1328 buffer_info->length = size;
diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
index 5d5ddabf4360..865d14d6e5a7 100644
--- a/drivers/net/ixgb/ixgb_param.c
+++ b/drivers/net/ixgb/ixgb_param.c
@@ -44,10 +44,11 @@
44 */ 44 */
45 45
46#define IXGB_PARAM_INIT { [0 ... IXGB_MAX_NIC] = OPTION_UNSET } 46#define IXGB_PARAM_INIT { [0 ... IXGB_MAX_NIC] = OPTION_UNSET }
47#define IXGB_PARAM(X, desc) \ 47#define IXGB_PARAM(X, desc) \
48 static int __devinitdata X[IXGB_MAX_NIC+1] = IXGB_PARAM_INIT; \ 48 static int __devinitdata X[IXGB_MAX_NIC+1] \
49 static int num_##X = 0; \ 49 = IXGB_PARAM_INIT; \
50 module_param_array_named(X, X, int, &num_##X, 0); \ 50 static unsigned int num_##X = 0; \
51 module_param_array_named(X, X, int, &num_##X, 0); \
51 MODULE_PARM_DESC(X, desc); 52 MODULE_PARM_DESC(X, desc);
52 53
53/* Transmit Descriptor Count 54/* Transmit Descriptor Count
@@ -178,8 +179,8 @@ IXGB_PARAM(IntDelayEnable, "Transmit Interrupt Delay Enable");
178 179
179struct ixgb_option { 180struct ixgb_option {
180 enum { enable_option, range_option, list_option } type; 181 enum { enable_option, range_option, list_option } type;
181 char *name; 182 const char *name;
182 char *err; 183 const char *err;
183 int def; 184 int def;
184 union { 185 union {
185 struct { /* range_option info */ 186 struct { /* range_option info */
@@ -197,7 +198,7 @@ struct ixgb_option {
197}; 198};
198 199
199static int __devinit 200static int __devinit
200ixgb_validate_option(int *value, struct ixgb_option *opt) 201ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt)
201{ 202{
202 if(*value == OPTION_UNSET) { 203 if(*value == OPTION_UNSET) {
203 *value = opt->def; 204 *value = opt->def;
@@ -266,7 +267,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
266 } 267 }
267 268
268 { /* Transmit Descriptor Count */ 269 { /* Transmit Descriptor Count */
269 struct ixgb_option opt = { 270 const struct ixgb_option opt = {
270 .type = range_option, 271 .type = range_option,
271 .name = "Transmit Descriptors", 272 .name = "Transmit Descriptors",
272 .err = "using default of " __MODULE_STRING(DEFAULT_TXD), 273 .err = "using default of " __MODULE_STRING(DEFAULT_TXD),
@@ -285,7 +286,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
285 tx_ring->count = ALIGN(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); 286 tx_ring->count = ALIGN(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);
286 } 287 }
287 { /* Receive Descriptor Count */ 288 { /* Receive Descriptor Count */
288 struct ixgb_option opt = { 289 const struct ixgb_option opt = {
289 .type = range_option, 290 .type = range_option,
290 .name = "Receive Descriptors", 291 .name = "Receive Descriptors",
291 .err = "using default of " __MODULE_STRING(DEFAULT_RXD), 292 .err = "using default of " __MODULE_STRING(DEFAULT_RXD),
@@ -304,7 +305,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
304 rx_ring->count = ALIGN(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); 305 rx_ring->count = ALIGN(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE);
305 } 306 }
306 { /* Receive Checksum Offload Enable */ 307 { /* Receive Checksum Offload Enable */
307 struct ixgb_option opt = { 308 const struct ixgb_option opt = {
308 .type = enable_option, 309 .type = enable_option,
309 .name = "Receive Checksum Offload", 310 .name = "Receive Checksum Offload",
310 .err = "defaulting to Enabled", 311 .err = "defaulting to Enabled",
@@ -312,7 +313,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
312 }; 313 };
313 314
314 if(num_XsumRX > bd) { 315 if(num_XsumRX > bd) {
315 int rx_csum = XsumRX[bd]; 316 unsigned int rx_csum = XsumRX[bd];
316 ixgb_validate_option(&rx_csum, &opt); 317 ixgb_validate_option(&rx_csum, &opt);
317 adapter->rx_csum = rx_csum; 318 adapter->rx_csum = rx_csum;
318 } else { 319 } else {
@@ -328,7 +329,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
328 { ixgb_fc_full, "Flow Control Enabled" }, 329 { ixgb_fc_full, "Flow Control Enabled" },
329 { ixgb_fc_default, "Flow Control Hardware Default" }}; 330 { ixgb_fc_default, "Flow Control Hardware Default" }};
330 331
331 struct ixgb_option opt = { 332 const struct ixgb_option opt = {
332 .type = list_option, 333 .type = list_option,
333 .name = "Flow Control", 334 .name = "Flow Control",
334 .err = "reading default settings from EEPROM", 335 .err = "reading default settings from EEPROM",
@@ -338,7 +339,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
338 }; 339 };
339 340
340 if(num_FlowControl > bd) { 341 if(num_FlowControl > bd) {
341 int fc = FlowControl[bd]; 342 unsigned int fc = FlowControl[bd];
342 ixgb_validate_option(&fc, &opt); 343 ixgb_validate_option(&fc, &opt);
343 adapter->hw.fc.type = fc; 344 adapter->hw.fc.type = fc;
344 } else { 345 } else {
@@ -346,7 +347,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
346 } 347 }
347 } 348 }
348 { /* Receive Flow Control High Threshold */ 349 { /* Receive Flow Control High Threshold */
349 struct ixgb_option opt = { 350 const struct ixgb_option opt = {
350 .type = range_option, 351 .type = range_option,
351 .name = "Rx Flow Control High Threshold", 352 .name = "Rx Flow Control High Threshold",
352 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTH), 353 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTH),
@@ -366,7 +367,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
366 "Ignoring RxFCHighThresh when no RxFC\n"); 367 "Ignoring RxFCHighThresh when no RxFC\n");
367 } 368 }
368 { /* Receive Flow Control Low Threshold */ 369 { /* Receive Flow Control Low Threshold */
369 struct ixgb_option opt = { 370 const struct ixgb_option opt = {
370 .type = range_option, 371 .type = range_option,
371 .name = "Rx Flow Control Low Threshold", 372 .name = "Rx Flow Control Low Threshold",
372 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTL), 373 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTL),
@@ -386,7 +387,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
386 "Ignoring RxFCLowThresh when no RxFC\n"); 387 "Ignoring RxFCLowThresh when no RxFC\n");
387 } 388 }
388 { /* Flow Control Pause Time Request*/ 389 { /* Flow Control Pause Time Request*/
389 struct ixgb_option opt = { 390 const struct ixgb_option opt = {
390 .type = range_option, 391 .type = range_option,
391 .name = "Flow Control Pause Time Request", 392 .name = "Flow Control Pause Time Request",
392 .err = "using default of "__MODULE_STRING(DEFAULT_FCPAUSE), 393 .err = "using default of "__MODULE_STRING(DEFAULT_FCPAUSE),
@@ -396,7 +397,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
396 }; 397 };
397 398
398 if(num_FCReqTimeout > bd) { 399 if(num_FCReqTimeout > bd) {
399 int pause_time = FCReqTimeout[bd]; 400 unsigned int pause_time = FCReqTimeout[bd];
400 ixgb_validate_option(&pause_time, &opt); 401 ixgb_validate_option(&pause_time, &opt);
401 adapter->hw.fc.pause_time = pause_time; 402 adapter->hw.fc.pause_time = pause_time;
402 } else { 403 } else {
@@ -419,7 +420,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
419 } 420 }
420 } 421 }
421 { /* Receive Interrupt Delay */ 422 { /* Receive Interrupt Delay */
422 struct ixgb_option opt = { 423 const struct ixgb_option opt = {
423 .type = range_option, 424 .type = range_option,
424 .name = "Receive Interrupt Delay", 425 .name = "Receive Interrupt Delay",
425 .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), 426 .err = "using default of " __MODULE_STRING(DEFAULT_RDTR),
@@ -436,7 +437,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
436 } 437 }
437 } 438 }
438 { /* Transmit Interrupt Delay */ 439 { /* Transmit Interrupt Delay */
439 struct ixgb_option opt = { 440 const struct ixgb_option opt = {
440 .type = range_option, 441 .type = range_option,
441 .name = "Transmit Interrupt Delay", 442 .name = "Transmit Interrupt Delay",
442 .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), 443 .err = "using default of " __MODULE_STRING(DEFAULT_TIDV),
@@ -454,7 +455,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
454 } 455 }
455 456
456 { /* Transmit Interrupt Delay Enable */ 457 { /* Transmit Interrupt Delay Enable */
457 struct ixgb_option opt = { 458 const struct ixgb_option opt = {
458 .type = enable_option, 459 .type = enable_option,
459 .name = "Tx Interrupt Delay Enable", 460 .name = "Tx Interrupt Delay Enable",
460 .err = "defaulting to Enabled", 461 .err = "defaulting to Enabled",
@@ -462,7 +463,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
462 }; 463 };
463 464
464 if(num_IntDelayEnable > bd) { 465 if(num_IntDelayEnable > bd) {
465 int ide = IntDelayEnable[bd]; 466 unsigned int ide = IntDelayEnable[bd];
466 ixgb_validate_option(&ide, &opt); 467 ixgb_validate_option(&ide, &opt);
467 adapter->tx_int_delay_enable = ide; 468 adapter->tx_int_delay_enable = ide;
468 } else { 469 } else {
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index c160a7d91e21..bc51432b8d26 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -244,7 +244,7 @@ extern struct ixgbe_info ixgbe_82598EB_info;
244extern struct ixgbe_info ixgbe_82598AT_info; 244extern struct ixgbe_info ixgbe_82598AT_info;
245 245
246extern char ixgbe_driver_name[]; 246extern char ixgbe_driver_name[];
247extern char ixgbe_driver_version[]; 247extern const char ixgbe_driver_version[];
248 248
249extern int ixgbe_up(struct ixgbe_adapter *adapter); 249extern int ixgbe_up(struct ixgbe_adapter *adapter);
250extern void ixgbe_down(struct ixgbe_adapter *adapter); 250extern void ixgbe_down(struct ixgbe_adapter *adapter);
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index 00ee20125ca9..4d64673164ca 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -30,8 +30,7 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32 32
33#include "ixgbe_type.h" 33#include "ixgbe.h"
34#include "ixgbe_common.h"
35#include "ixgbe_phy.h" 34#include "ixgbe_phy.h"
36 35
37#define IXGBE_82598_MAX_TX_QUEUES 32 36#define IXGBE_82598_MAX_TX_QUEUES 32
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index b75f1c6efc42..00bc525c6560 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -45,12 +45,13 @@
45#include "ixgbe_common.h" 45#include "ixgbe_common.h"
46 46
47char ixgbe_driver_name[] = "ixgbe"; 47char ixgbe_driver_name[] = "ixgbe";
48static char ixgbe_driver_string[] = 48static const char ixgbe_driver_string[] =
49 "Intel(R) 10 Gigabit PCI Express Network Driver"; 49 "Intel(R) 10 Gigabit PCI Express Network Driver";
50 50
51#define DRV_VERSION "1.1.18" 51#define DRV_VERSION "1.1.18"
52char ixgbe_driver_version[] = DRV_VERSION; 52const char ixgbe_driver_version[] = DRV_VERSION;
53static char ixgbe_copyright[] = "Copyright (c) 1999-2007 Intel Corporation."; 53static const char ixgbe_copyright[] =
54 "Copyright (c) 1999-2007 Intel Corporation.";
54 55
55static const struct ixgbe_info *ixgbe_info_tbl[] = { 56static const struct ixgbe_info *ixgbe_info_tbl[] = {
56 [board_82598AF] = &ixgbe_82598AF_info, 57 [board_82598AF] = &ixgbe_82598AF_info,
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 662b8d16803c..45f30a2974b8 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -284,7 +284,7 @@ static __net_exit void loopback_net_exit(struct net *net)
284 unregister_netdev(dev); 284 unregister_netdev(dev);
285} 285}
286 286
287static struct pernet_operations __net_initdata loopback_net_ops = { 287static struct pernet_operations loopback_net_ops = {
288 .init = loopback_net_init, 288 .init = loopback_net_init,
289 .exit = loopback_net_exit, 289 .exit = loopback_net_exit,
290}; 290};
diff --git a/drivers/net/mlx4/icm.c b/drivers/net/mlx4/icm.c
index 887633b207d9..2a5bef6388fe 100644
--- a/drivers/net/mlx4/icm.c
+++ b/drivers/net/mlx4/icm.c
@@ -101,9 +101,7 @@ static int mlx4_alloc_icm_pages(struct scatterlist *mem, int order, gfp_t gfp_ma
101 if (!page) 101 if (!page)
102 return -ENOMEM; 102 return -ENOMEM;
103 103
104 sg_set_page(mem, page); 104 sg_set_page(mem, page, PAGE_SIZE << order, 0);
105 mem->length = PAGE_SIZE << order;
106 mem->offset = 0;
107 return 0; 105 return 0;
108} 106}
109 107
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 366e62a2b1e5..0f306ddb5630 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1151,7 +1151,7 @@ static inline int myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int budget)
1151 u16 length; 1151 u16 length;
1152 __wsum checksum; 1152 __wsum checksum;
1153 1153
1154 while (rx_done->entry[idx].length != 0 && work_done++ < budget) { 1154 while (rx_done->entry[idx].length != 0 && work_done < budget) {
1155 length = ntohs(rx_done->entry[idx].length); 1155 length = ntohs(rx_done->entry[idx].length);
1156 rx_done->entry[idx].length = 0; 1156 rx_done->entry[idx].length = 0;
1157 checksum = csum_unfold(rx_done->entry[idx].checksum); 1157 checksum = csum_unfold(rx_done->entry[idx].checksum);
@@ -1167,6 +1167,7 @@ static inline int myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int budget)
1167 rx_bytes += rx_ok * (unsigned long)length; 1167 rx_bytes += rx_ok * (unsigned long)length;
1168 cnt++; 1168 cnt++;
1169 idx = cnt & (myri10ge_max_intr_slots - 1); 1169 idx = cnt & (myri10ge_max_intr_slots - 1);
1170 work_done++;
1170 } 1171 }
1171 rx_done->idx = idx; 1172 rx_done->idx = idx;
1172 rx_done->cnt = cnt; 1173 rx_done->cnt = cnt;
@@ -1233,13 +1234,12 @@ static int myri10ge_poll(struct napi_struct *napi, int budget)
1233 struct myri10ge_priv *mgp = 1234 struct myri10ge_priv *mgp =
1234 container_of(napi, struct myri10ge_priv, napi); 1235 container_of(napi, struct myri10ge_priv, napi);
1235 struct net_device *netdev = mgp->dev; 1236 struct net_device *netdev = mgp->dev;
1236 struct myri10ge_rx_done *rx_done = &mgp->rx_done;
1237 int work_done; 1237 int work_done;
1238 1238
1239 /* process as many rx events as NAPI will allow */ 1239 /* process as many rx events as NAPI will allow */
1240 work_done = myri10ge_clean_rx_done(mgp, budget); 1240 work_done = myri10ge_clean_rx_done(mgp, budget);
1241 1241
1242 if (rx_done->entry[rx_done->idx].length == 0 || !netif_running(netdev)) { 1242 if (work_done < budget || !netif_running(netdev)) {
1243 netif_rx_complete(netdev, napi); 1243 netif_rx_complete(netdev, napi);
1244 put_be32(htonl(3), mgp->irq_claim); 1244 put_be32(htonl(3), mgp->irq_claim);
1245 } 1245 }
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 953117152bbd..87cde062fd63 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -864,6 +864,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
864 864
865 np = netdev_priv(dev); 865 np = netdev_priv(dev);
866 netif_napi_add(dev, &np->napi, natsemi_poll, 64); 866 netif_napi_add(dev, &np->napi, natsemi_poll, 64);
867 np->dev = dev;
867 868
868 np->pci_dev = pdev; 869 np->pci_dev = pdev;
869 pci_set_drvdata(pdev, dev); 870 pci_set_drvdata(pdev, dev);
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 73dcbb7296da..ad134a61302a 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -274,7 +274,7 @@ static int tc574_probe(struct pcmcia_device *link)
274 spin_lock_init(&lp->window_lock); 274 spin_lock_init(&lp->window_lock);
275 link->io.NumPorts1 = 32; 275 link->io.NumPorts1 = 32;
276 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 276 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
277 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 277 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT;
278 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 278 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
279 link->irq.Handler = &el3_interrupt; 279 link->irq.Handler = &el3_interrupt;
280 link->irq.Instance = dev; 280 link->irq.Instance = dev;
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 32076ca6a9e1..a98fe07cce70 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -188,7 +188,7 @@ static int tc589_probe(struct pcmcia_device *link)
188 spin_lock_init(&lp->lock); 188 spin_lock_init(&lp->lock);
189 link->io.NumPorts1 = 16; 189 link->io.NumPorts1 = 16;
190 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 190 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
191 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 191 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT;
192 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 192 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
193 link->irq.Handler = &el3_interrupt; 193 link->irq.Handler = &el3_interrupt;
194 link->irq.Instance = dev; 194 link->irq.Instance = dev;
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index a95a2cae6b23..8d910a372f89 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -158,7 +158,7 @@ static int axnet_probe(struct pcmcia_device *link)
158 info = PRIV(dev); 158 info = PRIV(dev);
159 info->p_dev = link; 159 info->p_dev = link;
160 link->priv = dev; 160 link->priv = dev;
161 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 161 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
162 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 162 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
163 link->conf.Attributes = CONF_ENABLE_IRQ; 163 link->conf.Attributes = CONF_ENABLE_IRQ;
164 link->conf.IntType = INT_MEMORY_AND_IO; 164 link->conf.IntType = INT_MEMORY_AND_IO;
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 62844677c784..8c719b4df544 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -249,7 +249,7 @@ static int fmvj18x_probe(struct pcmcia_device *link)
249 link->io.IOAddrLines = 5; 249 link->io.IOAddrLines = 5;
250 250
251 /* Interrupt setup */ 251 /* Interrupt setup */
252 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 252 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT;
253 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 253 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
254 link->irq.Handler = &fjn_interrupt; 254 link->irq.Handler = &fjn_interrupt;
255 link->irq.Instance = dev; 255 link->irq.Instance = dev;
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 9d45e9696e16..db6a97d1d7b1 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -254,7 +254,7 @@ static int pcnet_probe(struct pcmcia_device *link)
254 info->p_dev = link; 254 info->p_dev = link;
255 link->priv = dev; 255 link->priv = dev;
256 256
257 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 257 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
258 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 258 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
259 link->conf.Attributes = CONF_ENABLE_IRQ; 259 link->conf.Attributes = CONF_ENABLE_IRQ;
260 link->conf.IntType = INT_MEMORY_AND_IO; 260 link->conf.IntType = INT_MEMORY_AND_IO;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 58d716fd17cf..c9868e9dac4c 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -328,7 +328,7 @@ static int smc91c92_probe(struct pcmcia_device *link)
328 link->io.NumPorts1 = 16; 328 link->io.NumPorts1 = 16;
329 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 329 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
330 link->io.IOAddrLines = 4; 330 link->io.IOAddrLines = 4;
331 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 331 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT;
332 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 332 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
333 link->irq.Handler = &smc_interrupt; 333 link->irq.Handler = &smc_interrupt;
334 link->irq.Instance = dev; 334 link->irq.Instance = dev;
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index c3b69602e275..1f09bea6db5a 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -886,7 +886,7 @@ xirc2ps_config(struct pcmcia_device * link)
886 } 886 }
887 printk(KNOT_XIRC "no ports available\n"); 887 printk(KNOT_XIRC "no ports available\n");
888 } else { 888 } else {
889 link->irq.Attributes |= IRQ_TYPE_EXCLUSIVE; 889 link->irq.Attributes |= IRQ_TYPE_DYNAMIC_SHARING;
890 link->io.NumPorts1 = 16; 890 link->io.NumPorts1 = 16;
891 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 891 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
892 link->io.BasePort1 = ioaddr; 892 link->io.BasePort1 = ioaddr;
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c
index bcb0885011c8..b35d79449500 100644
--- a/drivers/net/ppp_mppe.c
+++ b/drivers/net/ppp_mppe.c
@@ -68,7 +68,7 @@ MODULE_VERSION("1.0.2");
68static unsigned int 68static unsigned int
69setup_sg(struct scatterlist *sg, const void *address, unsigned int length) 69setup_sg(struct scatterlist *sg, const void *address, unsigned int length)
70{ 70{
71 sg_init_one(sg, address, length); 71 sg_set_buf(sg, address, length);
72 return length; 72 return length;
73} 73}
74 74
@@ -140,6 +140,8 @@ static void get_new_key_from_sha(struct ppp_mppe_state * state)
140 struct scatterlist sg[4]; 140 struct scatterlist sg[4];
141 unsigned int nbytes; 141 unsigned int nbytes;
142 142
143 sg_init_table(sg, 4);
144
143 nbytes = setup_sg(&sg[0], state->master_key, state->keylen); 145 nbytes = setup_sg(&sg[0], state->master_key, state->keylen);
144 nbytes += setup_sg(&sg[1], sha_pad->sha_pad1, 146 nbytes += setup_sg(&sg[1], sha_pad->sha_pad1,
145 sizeof(sha_pad->sha_pad1)); 147 sizeof(sha_pad->sha_pad1));
@@ -166,6 +168,8 @@ static void mppe_rekey(struct ppp_mppe_state * state, int initial_key)
166 if (!initial_key) { 168 if (!initial_key) {
167 crypto_blkcipher_setkey(state->arc4, state->sha1_digest, 169 crypto_blkcipher_setkey(state->arc4, state->sha1_digest,
168 state->keylen); 170 state->keylen);
171 sg_init_table(sg_in, 1);
172 sg_init_table(sg_out, 1);
169 setup_sg(sg_in, state->sha1_digest, state->keylen); 173 setup_sg(sg_in, state->sha1_digest, state->keylen);
170 setup_sg(sg_out, state->session_key, state->keylen); 174 setup_sg(sg_out, state->session_key, state->keylen);
171 if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, 175 if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in,
@@ -421,6 +425,8 @@ mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf,
421 isize -= 2; 425 isize -= 2;
422 426
423 /* Encrypt packet */ 427 /* Encrypt packet */
428 sg_init_table(sg_in, 1);
429 sg_init_table(sg_out, 1);
424 setup_sg(sg_in, ibuf, isize); 430 setup_sg(sg_in, ibuf, isize);
425 setup_sg(sg_out, obuf, osize); 431 setup_sg(sg_out, obuf, osize);
426 if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, isize) != 0) { 432 if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, isize) != 0) {
@@ -608,6 +614,8 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
608 * Decrypt the first byte in order to check if it is 614 * Decrypt the first byte in order to check if it is
609 * a compressed or uncompressed protocol field. 615 * a compressed or uncompressed protocol field.
610 */ 616 */
617 sg_init_table(sg_in, 1);
618 sg_init_table(sg_out, 1);
611 setup_sg(sg_in, ibuf, 1); 619 setup_sg(sg_in, ibuf, 1);
612 setup_sg(sg_out, obuf, 1); 620 setup_sg(sg_out, obuf, 1);
613 if (crypto_blkcipher_decrypt(&desc, sg_out, sg_in, 1) != 0) { 621 if (crypto_blkcipher_decrypt(&desc, sg_out, sg_in, 1) != 0) {
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 8936ed3469cf..a005d8f4c38e 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -491,7 +491,7 @@ static int pppoe_create(struct net *net, struct socket *sock)
491 int error = -ENOMEM; 491 int error = -ENOMEM;
492 struct sock *sk; 492 struct sock *sk;
493 493
494 sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto, 1); 494 sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto);
495 if (!sk) 495 if (!sk)
496 goto out; 496 goto out;
497 497
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index 921d4ef6d14b..f8904fd92369 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -1416,7 +1416,7 @@ static int pppol2tp_create(struct net *net, struct socket *sock)
1416 int error = -ENOMEM; 1416 int error = -ENOMEM;
1417 struct sock *sk; 1417 struct sock *sk;
1418 1418
1419 sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto, 1); 1419 sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto);
1420 if (!sk) 1420 if (!sk)
1421 goto out; 1421 goto out;
1422 1422
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index e8960f294a6e..b94fa7ef1955 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -392,7 +392,9 @@ struct rtl8169_private {
392 void __iomem *mmio_addr; /* memory map physical address */ 392 void __iomem *mmio_addr; /* memory map physical address */
393 struct pci_dev *pci_dev; /* Index of PCI device */ 393 struct pci_dev *pci_dev; /* Index of PCI device */
394 struct net_device *dev; 394 struct net_device *dev;
395#ifdef CONFIG_R8169_NAPI
395 struct napi_struct napi; 396 struct napi_struct napi;
397#endif
396 spinlock_t lock; /* spin lock flag */ 398 spinlock_t lock; /* spin lock flag */
397 u32 msg_enable; 399 u32 msg_enable;
398 int chipset; 400 int chipset;
@@ -2989,13 +2991,16 @@ static void rtl8169_down(struct net_device *dev)
2989{ 2991{
2990 struct rtl8169_private *tp = netdev_priv(dev); 2992 struct rtl8169_private *tp = netdev_priv(dev);
2991 void __iomem *ioaddr = tp->mmio_addr; 2993 void __iomem *ioaddr = tp->mmio_addr;
2992 unsigned int poll_locked = 0;
2993 unsigned int intrmask; 2994 unsigned int intrmask;
2994 2995
2995 rtl8169_delete_timer(dev); 2996 rtl8169_delete_timer(dev);
2996 2997
2997 netif_stop_queue(dev); 2998 netif_stop_queue(dev);
2998 2999
3000#ifdef CONFIG_R8169_NAPI
3001 napi_disable(&tp->napi);
3002#endif
3003
2999core_down: 3004core_down:
3000 spin_lock_irq(&tp->lock); 3005 spin_lock_irq(&tp->lock);
3001 3006
@@ -3009,11 +3014,6 @@ core_down:
3009 3014
3010 synchronize_irq(dev->irq); 3015 synchronize_irq(dev->irq);
3011 3016
3012 if (!poll_locked) {
3013 napi_disable(&tp->napi);
3014 poll_locked++;
3015 }
3016
3017 /* Give a racing hard_start_xmit a few cycles to complete. */ 3017 /* Give a racing hard_start_xmit a few cycles to complete. */
3018 synchronize_sched(); /* FIXME: should this be synchronize_irq()? */ 3018 synchronize_sched(); /* FIXME: should this be synchronize_irq()? */
3019 3019
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c
index 19152f54ef2b..b822859c8de3 100644
--- a/drivers/net/rrunner.c
+++ b/drivers/net/rrunner.c
@@ -79,12 +79,10 @@ static char version[] __devinitdata = "rrunner.c: v0.50 11/11/2002 Jes Sorensen
79 */ 79 */
80 80
81/* 81/*
82 * These are checked at init time to see if they are at least 256KB 82 * sysctl_[wr]mem_max are checked at init time to see if they are at
83 * and increased to 256KB if they are not. This is done to avoid ending 83 * least 256KB and increased to 256KB if they are not. This is done to
84 * up with socket buffers smaller than the MTU size, 84 * avoid ending up with socket buffers smaller than the MTU size,
85 */ 85 */
86extern __u32 sysctl_wmem_max;
87extern __u32 sysctl_rmem_max;
88 86
89static int __devinit rr_init_one(struct pci_dev *pdev, 87static int __devinit rr_init_one(struct pci_dev *pdev,
90 const struct pci_device_id *ent) 88 const struct pci_device_id *ent)
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 9741d613ba6f..a3ff270593f1 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2214,9 +2214,7 @@ static void ucc_geth_set_multi(struct net_device *dev)
2214 struct dev_mc_list *dmi; 2214 struct dev_mc_list *dmi;
2215 struct ucc_fast *uf_regs; 2215 struct ucc_fast *uf_regs;
2216 struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt; 2216 struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
2217 u8 tempaddr[6]; 2217 int i;
2218 u8 *mcptr, *tdptr;
2219 int i, j;
2220 2218
2221 ugeth = netdev_priv(dev); 2219 ugeth = netdev_priv(dev);
2222 2220
@@ -2255,19 +2253,10 @@ static void ucc_geth_set_multi(struct net_device *dev)
2255 if (!(dmi->dmi_addr[0] & 1)) 2253 if (!(dmi->dmi_addr[0] & 1))
2256 continue; 2254 continue;
2257 2255
2258 /* The address in dmi_addr is LSB first,
2259 * and taddr is MSB first. We have to
2260 * copy bytes MSB first from dmi_addr.
2261 */
2262 mcptr = (u8 *) dmi->dmi_addr + 5;
2263 tdptr = (u8 *) tempaddr;
2264 for (j = 0; j < 6; j++)
2265 *tdptr++ = *mcptr--;
2266
2267 /* Ask CPM to run CRC and set bit in 2256 /* Ask CPM to run CRC and set bit in
2268 * filter mask. 2257 * filter mask.
2269 */ 2258 */
2270 hw_add_addr_in_hash(ugeth, tempaddr); 2259 hw_add_addr_in_hash(ugeth, dmi->dmi_addr);
2271 } 2260 }
2272 } 2261 }
2273 } 2262 }
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index a2de32fabc17..2c685734b7a4 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -586,6 +586,10 @@ static const struct usb_device_id products[] = {
586 USB_DEVICE(0x0a46, 0x0268), /* ShanTou ST268 USB NIC */ 586 USB_DEVICE(0x0a46, 0x0268), /* ShanTou ST268 USB NIC */
587 .driver_info = (unsigned long)&dm9601_info, 587 .driver_info = (unsigned long)&dm9601_info,
588 }, 588 },
589 {
590 USB_DEVICE(0x0a46, 0x8515), /* ADMtek ADM8515 USB NIC */
591 .driver_info = (unsigned long)&dm9601_info,
592 },
589 {}, // END 593 {}, // END
590}; 594};
591 595
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index cd991a0f75bb..1ebe3259be0d 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -512,11 +512,19 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
512 } 512 }
513 tmp = le32_to_cpu(u.init_c->max_transfer_size); 513 tmp = le32_to_cpu(u.init_c->max_transfer_size);
514 if (tmp < dev->hard_mtu) { 514 if (tmp < dev->hard_mtu) {
515 dev_err(&intf->dev, 515 if (tmp <= net->hard_header_len) {
516 "dev can't take %u byte packets (max %u)\n", 516 dev_err(&intf->dev,
517 dev->hard_mtu, tmp); 517 "dev can't take %u byte packets (max %u)\n",
518 retval = -EINVAL; 518 dev->hard_mtu, tmp);
519 goto fail_and_release; 519 retval = -EINVAL;
520 goto fail_and_release;
521 }
522 dev->hard_mtu = tmp;
523 net->mtu = dev->hard_mtu - net->hard_header_len;
524 dev_warn(&intf->dev,
525 "dev can't take %u byte packets (max %u), "
526 "adjusting MTU to %u\n",
527 dev->hard_mtu, tmp, net->mtu);
520 } 528 }
521 529
522 /* REVISIT: peripheral "alignment" request is ignored ... */ 530 /* REVISIT: peripheral "alignment" request is ignored ... */
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 5ea877221f46..37c52e131750 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -142,9 +142,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
142 * To date internally, just copy this out to the user. 142 * To date internally, just copy this out to the user.
143 */ 143 */
144 case LMCIOCGINFO: /*fold01*/ 144 case LMCIOCGINFO: /*fold01*/
145 if (copy_to_user(ifr->ifr_data, &sc->ictl, sizeof (lmc_ctl_t))) 145 if (copy_to_user(ifr->ifr_data, &sc->ictl, sizeof(lmc_ctl_t)))
146 return -EFAULT; 146 ret = -EFAULT;
147 ret = 0; 147 else
148 ret = 0;
148 break; 149 break;
149 150
150 case LMCIOCSINFO: /*fold01*/ 151 case LMCIOCSINFO: /*fold01*/
@@ -159,8 +160,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
159 break; 160 break;
160 } 161 }
161 162
162 if (copy_from_user(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t))) 163 if (copy_from_user(&ctl, ifr->ifr_data, sizeof(lmc_ctl_t))) {
163 return -EFAULT; 164 ret = -EFAULT;
165 break;
166 }
164 167
165 sc->lmc_media->set_status (sc, &ctl); 168 sc->lmc_media->set_status (sc, &ctl);
166 169
@@ -190,8 +193,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
190 break; 193 break;
191 } 194 }
192 195
193 if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u_int16_t))) 196 if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u_int16_t))) {
194 return -EFAULT; 197 ret = -EFAULT;
198 break;
199 }
195 200
196 201
197 if (new_type == old_type) 202 if (new_type == old_type)
@@ -229,9 +234,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
229 sc->lmc_xinfo.Magic1 = 0xDEADBEEF; 234 sc->lmc_xinfo.Magic1 = 0xDEADBEEF;
230 235
231 if (copy_to_user(ifr->ifr_data, &sc->lmc_xinfo, 236 if (copy_to_user(ifr->ifr_data, &sc->lmc_xinfo,
232 sizeof (struct lmc_xinfo))) 237 sizeof(struct lmc_xinfo)))
233 return -EFAULT; 238 ret = -EFAULT;
234 ret = 0; 239 else
240 ret = 0;
235 241
236 break; 242 break;
237 243
@@ -262,9 +268,9 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
262 268
263 if (copy_to_user(ifr->ifr_data, &sc->stats, 269 if (copy_to_user(ifr->ifr_data, &sc->stats,
264 sizeof (struct lmc_statistics))) 270 sizeof (struct lmc_statistics)))
265 return -EFAULT; 271 ret = -EFAULT;
266 272 else
267 ret = 0; 273 ret = 0;
268 break; 274 break;
269 275
270 case LMCIOCCLEARLMCSTATS: /*fold01*/ 276 case LMCIOCCLEARLMCSTATS: /*fold01*/
@@ -292,8 +298,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
292 break; 298 break;
293 } 299 }
294 300
295 if (copy_from_user(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t))) 301 if (copy_from_user(&ctl, ifr->ifr_data, sizeof(lmc_ctl_t))) {
296 return -EFAULT; 302 ret = -EFAULT;
303 break;
304 }
297 sc->lmc_media->set_circuit_type(sc, ctl.circuit_type); 305 sc->lmc_media->set_circuit_type(sc, ctl.circuit_type);
298 sc->ictl.circuit_type = ctl.circuit_type; 306 sc->ictl.circuit_type = ctl.circuit_type;
299 ret = 0; 307 ret = 0;
@@ -318,12 +326,15 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
318 326
319#ifdef DEBUG 327#ifdef DEBUG
320 case LMCIOCDUMPEVENTLOG: 328 case LMCIOCDUMPEVENTLOG:
321 if (copy_to_user(ifr->ifr_data, &lmcEventLogIndex, sizeof (u32))) 329 if (copy_to_user(ifr->ifr_data, &lmcEventLogIndex, sizeof(u32))) {
322 return -EFAULT; 330 ret = -EFAULT;
331 break;
332 }
323 if (copy_to_user(ifr->ifr_data + sizeof (u32), lmcEventLogBuf, sizeof (lmcEventLogBuf))) 333 if (copy_to_user(ifr->ifr_data + sizeof (u32), lmcEventLogBuf, sizeof (lmcEventLogBuf)))
324 return -EFAULT; 334 ret = -EFAULT;
335 else
336 ret = 0;
325 337
326 ret = 0;
327 break; 338 break;
328#endif /* end ifdef _DBG_EVENTLOG */ 339#endif /* end ifdef _DBG_EVENTLOG */
329 case LMCIOCT1CONTROL: /*fold01*/ 340 case LMCIOCT1CONTROL: /*fold01*/
@@ -346,8 +357,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
346 */ 357 */
347 netif_stop_queue(dev); 358 netif_stop_queue(dev);
348 359
349 if (copy_from_user(&xc, ifr->ifr_data, sizeof (struct lmc_xilinx_control))) 360 if (copy_from_user(&xc, ifr->ifr_data, sizeof(struct lmc_xilinx_control))) {
350 return -EFAULT; 361 ret = -EFAULT;
362 break;
363 }
351 switch(xc.command){ 364 switch(xc.command){
352 case lmc_xilinx_reset: /*fold02*/ 365 case lmc_xilinx_reset: /*fold02*/
353 { 366 {
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 9d9ff76a9bc6..5058e60e5703 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2391,7 +2391,7 @@ out_requeue:
2391 if (b43_debug(dev, B43_DBG_PWORK_FAST)) 2391 if (b43_debug(dev, B43_DBG_PWORK_FAST))
2392 delay = msecs_to_jiffies(50); 2392 delay = msecs_to_jiffies(50);
2393 else 2393 else
2394 delay = round_jiffies(HZ * 15); 2394 delay = round_jiffies_relative(HZ * 15);
2395 queue_delayed_work(wl->hw->workqueue, &dev->periodic_work, delay); 2395 queue_delayed_work(wl->hw->workqueue, &dev->periodic_work, delay);
2396out: 2396out:
2397 mutex_unlock(&wl->mutex); 2397 mutex_unlock(&wl->mutex);
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index d09479e816cd..f0e56dfc9ecf 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2260,7 +2260,7 @@ out_requeue:
2260 if (b43legacy_debug(dev, B43legacy_DBG_PWORK_FAST)) 2260 if (b43legacy_debug(dev, B43legacy_DBG_PWORK_FAST))
2261 delay = msecs_to_jiffies(50); 2261 delay = msecs_to_jiffies(50);
2262 else 2262 else
2263 delay = round_jiffies(HZ); 2263 delay = round_jiffies_relative(HZ);
2264 queue_delayed_work(dev->wl->hw->workqueue, 2264 queue_delayed_work(dev->wl->hw->workqueue,
2265 &dev->periodic_work, delay); 2265 &dev->periodic_work, delay);
2266out: 2266out:
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index a6c7904de282..8d53d08b9691 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -1769,7 +1769,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
1769 if (priv->stop_rf_kill) { 1769 if (priv->stop_rf_kill) {
1770 priv->stop_rf_kill = 0; 1770 priv->stop_rf_kill = 0;
1771 queue_delayed_work(priv->workqueue, &priv->rf_kill, 1771 queue_delayed_work(priv->workqueue, &priv->rf_kill,
1772 round_jiffies(HZ)); 1772 round_jiffies_relative(HZ));
1773 } 1773 }
1774 1774
1775 deferred = 1; 1775 deferred = 1;
@@ -2086,7 +2086,8 @@ static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status)
2086 /* Make sure the RF Kill check timer is running */ 2086 /* Make sure the RF Kill check timer is running */
2087 priv->stop_rf_kill = 0; 2087 priv->stop_rf_kill = 0;
2088 cancel_delayed_work(&priv->rf_kill); 2088 cancel_delayed_work(&priv->rf_kill);
2089 queue_delayed_work(priv->workqueue, &priv->rf_kill, round_jiffies(HZ)); 2089 queue_delayed_work(priv->workqueue, &priv->rf_kill,
2090 round_jiffies_relative(HZ));
2090} 2091}
2091 2092
2092static void send_scan_event(void *data) 2093static void send_scan_event(void *data)
@@ -2123,7 +2124,7 @@ static void isr_scan_complete(struct ipw2100_priv *priv, u32 status)
2123 if (!delayed_work_pending(&priv->scan_event_later)) 2124 if (!delayed_work_pending(&priv->scan_event_later))
2124 queue_delayed_work(priv->workqueue, 2125 queue_delayed_work(priv->workqueue,
2125 &priv->scan_event_later, 2126 &priv->scan_event_later,
2126 round_jiffies(msecs_to_jiffies(4000))); 2127 round_jiffies_relative(msecs_to_jiffies(4000)));
2127 } else { 2128 } else {
2128 priv->user_requested_scan = 0; 2129 priv->user_requested_scan = 0;
2129 cancel_delayed_work(&priv->scan_event_later); 2130 cancel_delayed_work(&priv->scan_event_later);
@@ -4242,7 +4243,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio)
4242 priv->stop_rf_kill = 0; 4243 priv->stop_rf_kill = 0;
4243 cancel_delayed_work(&priv->rf_kill); 4244 cancel_delayed_work(&priv->rf_kill);
4244 queue_delayed_work(priv->workqueue, &priv->rf_kill, 4245 queue_delayed_work(priv->workqueue, &priv->rf_kill,
4245 round_jiffies(HZ)); 4246 round_jiffies_relative(HZ));
4246 } else 4247 } else
4247 schedule_reset(priv); 4248 schedule_reset(priv);
4248 } 4249 }
@@ -5981,7 +5982,7 @@ static void ipw2100_rf_kill(struct work_struct *work)
5981 IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n"); 5982 IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n");
5982 if (!priv->stop_rf_kill) 5983 if (!priv->stop_rf_kill)
5983 queue_delayed_work(priv->workqueue, &priv->rf_kill, 5984 queue_delayed_work(priv->workqueue, &priv->rf_kill,
5984 round_jiffies(HZ)); 5985 round_jiffies_relative(HZ));
5985 goto exit_unlock; 5986 goto exit_unlock;
5986 } 5987 }
5987 5988
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index e3c828401b9a..54f44e5473c0 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1753,7 +1753,7 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
1753 /* Make sure the RF_KILL check timer is running */ 1753 /* Make sure the RF_KILL check timer is running */
1754 cancel_delayed_work(&priv->rf_kill); 1754 cancel_delayed_work(&priv->rf_kill);
1755 queue_delayed_work(priv->workqueue, &priv->rf_kill, 1755 queue_delayed_work(priv->workqueue, &priv->rf_kill,
1756 round_jiffies(2 * HZ)); 1756 round_jiffies_relative(2 * HZ));
1757 } else 1757 } else
1758 queue_work(priv->workqueue, &priv->up); 1758 queue_work(priv->workqueue, &priv->up);
1759 } 1759 }
@@ -4364,7 +4364,7 @@ static void handle_scan_event(struct ipw_priv *priv)
4364 if (!priv->user_requested_scan) { 4364 if (!priv->user_requested_scan) {
4365 if (!delayed_work_pending(&priv->scan_event)) 4365 if (!delayed_work_pending(&priv->scan_event))
4366 queue_delayed_work(priv->workqueue, &priv->scan_event, 4366 queue_delayed_work(priv->workqueue, &priv->scan_event,
4367 round_jiffies(msecs_to_jiffies(4000))); 4367 round_jiffies_relative(msecs_to_jiffies(4000)));
4368 } else { 4368 } else {
4369 union iwreq_data wrqu; 4369 union iwreq_data wrqu;
4370 4370
@@ -4728,7 +4728,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4728 && priv->status & STATUS_ASSOCIATED) 4728 && priv->status & STATUS_ASSOCIATED)
4729 queue_delayed_work(priv->workqueue, 4729 queue_delayed_work(priv->workqueue,
4730 &priv->request_scan, 4730 &priv->request_scan,
4731 round_jiffies(HZ)); 4731 round_jiffies_relative(HZ));
4732 4732
4733 /* Send an empty event to user space. 4733 /* Send an empty event to user space.
4734 * We don't send the received data on the event because 4734 * We don't send the received data on the event because
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index 25cfc6c32509..8d52a26c248a 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -96,8 +96,8 @@ config IWL4965
96 96
97 If you want to compile the driver as a module ( = code which can be 97 If you want to compile the driver as a module ( = code which can be
98 inserted in and remvoed from the running kernel whenever you want), 98 inserted in and remvoed from the running kernel whenever you want),
99 say M here and read <file:Documentation/modules.txt>. The module 99 say M here and read <file:Documentation/kbuild/modules.txt>. The
100 will be called iwl4965.ko. 100 module will be called iwl4965.ko.
101 101
102config IWL3945 102config IWL3945
103 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" 103 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
@@ -124,5 +124,5 @@ config IWL3945
124 124
125 If you want to compile the driver as a module ( = code which can be 125 If you want to compile the driver as a module ( = code which can be
126 inserted in and remvoed from the running kernel whenever you want), 126 inserted in and remvoed from the running kernel whenever you want),
127 say M here and read <file:Documentation/modules.txt>. The module 127 say M here and read <file:Documentation/kbuild/modules.txt>. The
128 will be called iwl3945.ko. 128 module will be called iwl3945.ko.
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 557deebca1b9..891f90d2f019 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -3232,9 +3232,7 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
3232 tx->rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[rate_index].plcp, 3232 tx->rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[rate_index].plcp,
3233 rate_flags); 3233 rate_flags);
3234 3234
3235 if (ieee80211_is_probe_request(fc)) 3235 if (ieee80211_is_back_request(fc))
3236 tx->tx_flags |= TX_CMD_FLG_TSF_MSK;
3237 else if (ieee80211_is_back_request(fc))
3238 tx->tx_flags |= TX_CMD_FLG_ACK_MSK | 3236 tx->tx_flags |= TX_CMD_FLG_ACK_MSK |
3239 TX_CMD_FLG_IMM_BA_RSP_MASK; 3237 TX_CMD_FLG_IMM_BA_RSP_MASK;
3240#ifdef CONFIG_IWLWIFI_HT 3238#ifdef CONFIG_IWLWIFI_HT
@@ -3872,7 +3870,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3872 */ 3870 */
3873 case IEEE80211_STYPE_ASSOC_RESP: 3871 case IEEE80211_STYPE_ASSOC_RESP:
3874 case IEEE80211_STYPE_REASSOC_RESP: 3872 case IEEE80211_STYPE_REASSOC_RESP:
3875 if (network_packet && iwl_is_associated(priv)) { 3873 if (network_packet) {
3876#ifdef CONFIG_IWLWIFI_HT 3874#ifdef CONFIG_IWLWIFI_HT
3877 u8 *pos = NULL; 3875 u8 *pos = NULL;
3878 struct ieee802_11_elems elems; 3876 struct ieee802_11_elems elems;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 83019d1d7ccc..4f22a7174caf 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6478,8 +6478,9 @@ static void iwl_bg_scan_check(struct work_struct *data)
6478 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, 6478 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN,
6479 "Scan completion watchdog resetting adapter (%dms)\n", 6479 "Scan completion watchdog resetting adapter (%dms)\n",
6480 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); 6480 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
6481
6481 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) 6482 if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
6482 queue_work(priv->workqueue, &priv->restart); 6483 iwl_send_scan_abort(priv);
6483 } 6484 }
6484 mutex_unlock(&priv->mutex); 6485 mutex_unlock(&priv->mutex);
6485} 6486}
@@ -6575,7 +6576,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6575 spin_unlock_irqrestore(&priv->lock, flags); 6576 spin_unlock_irqrestore(&priv->lock, flags);
6576 6577
6577 scan->suspend_time = 0; 6578 scan->suspend_time = 0;
6578 scan->max_out_time = cpu_to_le32(600 * 1024); 6579 scan->max_out_time = cpu_to_le32(200 * 1024);
6579 if (!interval) 6580 if (!interval)
6580 interval = suspend_time; 6581 interval = suspend_time;
6581 /* 6582 /*
@@ -6605,7 +6606,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6605 memcpy(scan->direct_scan[0].ssid, 6606 memcpy(scan->direct_scan[0].ssid,
6606 priv->direct_ssid, priv->direct_ssid_len); 6607 priv->direct_ssid, priv->direct_ssid_len);
6607 direct_mask = 1; 6608 direct_mask = 1;
6608 } else if (!iwl_is_associated(priv)) { 6609 } else if (!iwl_is_associated(priv) && priv->essid_len) {
6609 scan->direct_scan[0].id = WLAN_EID_SSID; 6610 scan->direct_scan[0].id = WLAN_EID_SSID;
6610 scan->direct_scan[0].len = priv->essid_len; 6611 scan->direct_scan[0].len = priv->essid_len;
6611 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 6612 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
@@ -6744,6 +6745,12 @@ static void iwl_bg_post_associate(struct work_struct *data)
6744 6745
6745 mutex_lock(&priv->mutex); 6746 mutex_lock(&priv->mutex);
6746 6747
6748 if (!priv->interface_id || !priv->is_open) {
6749 mutex_unlock(&priv->mutex);
6750 return;
6751 }
6752 iwl_scan_cancel_timeout(priv, 200);
6753
6747 conf = ieee80211_get_hw_conf(priv->hw); 6754 conf = ieee80211_get_hw_conf(priv->hw);
6748 6755
6749 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 6756 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
@@ -6882,9 +6889,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw)
6882 struct iwl_priv *priv = hw->priv; 6889 struct iwl_priv *priv = hw->priv;
6883 6890
6884 IWL_DEBUG_MAC80211("enter\n"); 6891 IWL_DEBUG_MAC80211("enter\n");
6892
6893
6894 mutex_lock(&priv->mutex);
6895 /* stop mac, cancel any scan request and clear
6896 * RXON_FILTER_ASSOC_MSK BIT
6897 */
6885 priv->is_open = 0; 6898 priv->is_open = 0;
6886 /*netif_stop_queue(dev); */ 6899 iwl_scan_cancel_timeout(priv, 100);
6887 flush_workqueue(priv->workqueue); 6900 cancel_delayed_work(&priv->post_associate);
6901 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
6902 iwl_commit_rxon(priv);
6903 mutex_unlock(&priv->mutex);
6904
6888 IWL_DEBUG_MAC80211("leave\n"); 6905 IWL_DEBUG_MAC80211("leave\n");
6889} 6906}
6890 6907
@@ -7169,8 +7186,6 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7169 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 7186 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
7170 iwl_config_ap(priv); 7187 iwl_config_ap(priv);
7171 else { 7188 else {
7172 priv->staging_rxon.filter_flags |=
7173 RXON_FILTER_ASSOC_MSK;
7174 rc = iwl_commit_rxon(priv); 7189 rc = iwl_commit_rxon(priv);
7175 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) 7190 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc)
7176 iwl_add_station(priv, 7191 iwl_add_station(priv,
@@ -7178,6 +7193,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7178 } 7193 }
7179 7194
7180 } else { 7195 } else {
7196 iwl_scan_cancel_timeout(priv, 100);
7181 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7197 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7182 iwl_commit_rxon(priv); 7198 iwl_commit_rxon(priv);
7183 } 7199 }
@@ -7217,6 +7233,12 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw,
7217 IWL_DEBUG_MAC80211("enter\n"); 7233 IWL_DEBUG_MAC80211("enter\n");
7218 7234
7219 mutex_lock(&priv->mutex); 7235 mutex_lock(&priv->mutex);
7236
7237 iwl_scan_cancel_timeout(priv, 100);
7238 cancel_delayed_work(&priv->post_associate);
7239 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7240 iwl_commit_rxon(priv);
7241
7220 if (priv->interface_id == conf->if_id) { 7242 if (priv->interface_id == conf->if_id) {
7221 priv->interface_id = 0; 7243 priv->interface_id = 0;
7222 memset(priv->bssid, 0, ETH_ALEN); 7244 memset(priv->bssid, 0, ETH_ALEN);
@@ -7238,6 +7260,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7238 7260
7239 IWL_DEBUG_MAC80211("enter\n"); 7261 IWL_DEBUG_MAC80211("enter\n");
7240 7262
7263 mutex_lock(&priv->mutex);
7241 spin_lock_irqsave(&priv->lock, flags); 7264 spin_lock_irqsave(&priv->lock, flags);
7242 7265
7243 if (!iwl_is_ready_rf(priv)) { 7266 if (!iwl_is_ready_rf(priv)) {
@@ -7268,7 +7291,8 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7268 priv->direct_ssid_len = (u8) 7291 priv->direct_ssid_len = (u8)
7269 min((u8) len, (u8) IW_ESSID_MAX_SIZE); 7292 min((u8) len, (u8) IW_ESSID_MAX_SIZE);
7270 memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); 7293 memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len);
7271 } 7294 } else
7295 priv->one_direct_scan = 0;
7272 7296
7273 rc = iwl_scan_initiate(priv); 7297 rc = iwl_scan_initiate(priv);
7274 7298
@@ -7276,6 +7300,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7276 7300
7277out_unlock: 7301out_unlock:
7278 spin_unlock_irqrestore(&priv->lock, flags); 7302 spin_unlock_irqrestore(&priv->lock, flags);
7303 mutex_unlock(&priv->mutex);
7279 7304
7280 return rc; 7305 return rc;
7281} 7306}
@@ -7310,6 +7335,8 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7310 7335
7311 mutex_lock(&priv->mutex); 7336 mutex_lock(&priv->mutex);
7312 7337
7338 iwl_scan_cancel_timeout(priv, 100);
7339
7313 switch (cmd) { 7340 switch (cmd) {
7314 case SET_KEY: 7341 case SET_KEY:
7315 rc = iwl_update_sta_key_info(priv, key, sta_id); 7342 rc = iwl_update_sta_key_info(priv, key, sta_id);
@@ -7479,8 +7506,18 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7479 7506
7480 spin_unlock_irqrestore(&priv->lock, flags); 7507 spin_unlock_irqrestore(&priv->lock, flags);
7481 7508
7509 /* we are restarting association process
7510 * clear RXON_FILTER_ASSOC_MSK bit
7511 */
7512 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) {
7513 iwl_scan_cancel_timeout(priv, 100);
7514 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7515 iwl_commit_rxon(priv);
7516 }
7517
7482 /* Per mac80211.h: This is only used in IBSS mode... */ 7518 /* Per mac80211.h: This is only used in IBSS mode... */
7483 if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { 7519 if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) {
7520
7484 IWL_DEBUG_MAC80211("leave - not in IBSS\n"); 7521 IWL_DEBUG_MAC80211("leave - not in IBSS\n");
7485 mutex_unlock(&priv->mutex); 7522 mutex_unlock(&priv->mutex);
7486 return; 7523 return;
@@ -8558,6 +8595,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
8558 iwl_rate_control_unregister(priv->hw); 8595 iwl_rate_control_unregister(priv->hw);
8559 } 8596 }
8560 8597
8598 /*netif_stop_queue(dev); */
8599 flush_workqueue(priv->workqueue);
8600
8561 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes 8601 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes
8562 * priv->workqueue... so we can't take down the workqueue 8602 * priv->workqueue... so we can't take down the workqueue
8563 * until now... */ 8603 * until now... */
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 5e1279263b22..d60adcb9bd4a 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -6845,8 +6845,9 @@ static void iwl_bg_scan_check(struct work_struct *data)
6845 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, 6845 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN,
6846 "Scan completion watchdog resetting adapter (%dms)\n", 6846 "Scan completion watchdog resetting adapter (%dms)\n",
6847 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); 6847 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
6848
6848 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) 6849 if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
6849 queue_work(priv->workqueue, &priv->restart); 6850 iwl_send_scan_abort(priv);
6850 } 6851 }
6851 mutex_unlock(&priv->mutex); 6852 mutex_unlock(&priv->mutex);
6852} 6853}
@@ -6942,7 +6943,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6942 spin_unlock_irqrestore(&priv->lock, flags); 6943 spin_unlock_irqrestore(&priv->lock, flags);
6943 6944
6944 scan->suspend_time = 0; 6945 scan->suspend_time = 0;
6945 scan->max_out_time = cpu_to_le32(600 * 1024); 6946 scan->max_out_time = cpu_to_le32(200 * 1024);
6946 if (!interval) 6947 if (!interval)
6947 interval = suspend_time; 6948 interval = suspend_time;
6948 6949
@@ -6965,7 +6966,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6965 memcpy(scan->direct_scan[0].ssid, 6966 memcpy(scan->direct_scan[0].ssid,
6966 priv->direct_ssid, priv->direct_ssid_len); 6967 priv->direct_ssid, priv->direct_ssid_len);
6967 direct_mask = 1; 6968 direct_mask = 1;
6968 } else if (!iwl_is_associated(priv)) { 6969 } else if (!iwl_is_associated(priv) && priv->essid_len) {
6969 scan->direct_scan[0].id = WLAN_EID_SSID; 6970 scan->direct_scan[0].id = WLAN_EID_SSID;
6970 scan->direct_scan[0].len = priv->essid_len; 6971 scan->direct_scan[0].len = priv->essid_len;
6971 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 6972 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
@@ -7118,6 +7119,12 @@ static void iwl_bg_post_associate(struct work_struct *data)
7118 7119
7119 mutex_lock(&priv->mutex); 7120 mutex_lock(&priv->mutex);
7120 7121
7122 if (!priv->interface_id || !priv->is_open) {
7123 mutex_unlock(&priv->mutex);
7124 return;
7125 }
7126 iwl_scan_cancel_timeout(priv, 200);
7127
7121 conf = ieee80211_get_hw_conf(priv->hw); 7128 conf = ieee80211_get_hw_conf(priv->hw);
7122 7129
7123 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7130 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
@@ -7271,9 +7278,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw)
7271 struct iwl_priv *priv = hw->priv; 7278 struct iwl_priv *priv = hw->priv;
7272 7279
7273 IWL_DEBUG_MAC80211("enter\n"); 7280 IWL_DEBUG_MAC80211("enter\n");
7281
7282
7283 mutex_lock(&priv->mutex);
7284 /* stop mac, cancel any scan request and clear
7285 * RXON_FILTER_ASSOC_MSK BIT
7286 */
7274 priv->is_open = 0; 7287 priv->is_open = 0;
7275 /*netif_stop_queue(dev); */ 7288 iwl_scan_cancel_timeout(priv, 100);
7276 flush_workqueue(priv->workqueue); 7289 cancel_delayed_work(&priv->post_associate);
7290 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7291 iwl_commit_rxon(priv);
7292 mutex_unlock(&priv->mutex);
7293
7277 IWL_DEBUG_MAC80211("leave\n"); 7294 IWL_DEBUG_MAC80211("leave\n");
7278} 7295}
7279 7296
@@ -7573,8 +7590,6 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7573 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 7590 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
7574 iwl_config_ap(priv); 7591 iwl_config_ap(priv);
7575 else { 7592 else {
7576 priv->staging_rxon.filter_flags |=
7577 RXON_FILTER_ASSOC_MSK;
7578 rc = iwl_commit_rxon(priv); 7593 rc = iwl_commit_rxon(priv);
7579 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) 7594 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc)
7580 iwl_rxon_add_station( 7595 iwl_rxon_add_station(
@@ -7582,6 +7597,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7582 } 7597 }
7583 7598
7584 } else { 7599 } else {
7600 iwl_scan_cancel_timeout(priv, 100);
7585 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7601 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7586 iwl_commit_rxon(priv); 7602 iwl_commit_rxon(priv);
7587 } 7603 }
@@ -7621,6 +7637,12 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw,
7621 IWL_DEBUG_MAC80211("enter\n"); 7637 IWL_DEBUG_MAC80211("enter\n");
7622 7638
7623 mutex_lock(&priv->mutex); 7639 mutex_lock(&priv->mutex);
7640
7641 iwl_scan_cancel_timeout(priv, 100);
7642 cancel_delayed_work(&priv->post_associate);
7643 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7644 iwl_commit_rxon(priv);
7645
7624 if (priv->interface_id == conf->if_id) { 7646 if (priv->interface_id == conf->if_id) {
7625 priv->interface_id = 0; 7647 priv->interface_id = 0;
7626 memset(priv->bssid, 0, ETH_ALEN); 7648 memset(priv->bssid, 0, ETH_ALEN);
@@ -7642,6 +7664,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7642 7664
7643 IWL_DEBUG_MAC80211("enter\n"); 7665 IWL_DEBUG_MAC80211("enter\n");
7644 7666
7667 mutex_lock(&priv->mutex);
7645 spin_lock_irqsave(&priv->lock, flags); 7668 spin_lock_irqsave(&priv->lock, flags);
7646 7669
7647 if (!iwl_is_ready_rf(priv)) { 7670 if (!iwl_is_ready_rf(priv)) {
@@ -7672,7 +7695,8 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7672 priv->direct_ssid_len = (u8) 7695 priv->direct_ssid_len = (u8)
7673 min((u8) len, (u8) IW_ESSID_MAX_SIZE); 7696 min((u8) len, (u8) IW_ESSID_MAX_SIZE);
7674 memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); 7697 memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len);
7675 } 7698 } else
7699 priv->one_direct_scan = 0;
7676 7700
7677 rc = iwl_scan_initiate(priv); 7701 rc = iwl_scan_initiate(priv);
7678 7702
@@ -7680,6 +7704,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7680 7704
7681out_unlock: 7705out_unlock:
7682 spin_unlock_irqrestore(&priv->lock, flags); 7706 spin_unlock_irqrestore(&priv->lock, flags);
7707 mutex_unlock(&priv->mutex);
7683 7708
7684 return rc; 7709 return rc;
7685} 7710}
@@ -7713,6 +7738,8 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7713 7738
7714 mutex_lock(&priv->mutex); 7739 mutex_lock(&priv->mutex);
7715 7740
7741 iwl_scan_cancel_timeout(priv, 100);
7742
7716 switch (cmd) { 7743 switch (cmd) {
7717 case SET_KEY: 7744 case SET_KEY:
7718 rc = iwl_update_sta_key_info(priv, key, sta_id); 7745 rc = iwl_update_sta_key_info(priv, key, sta_id);
@@ -7903,8 +7930,18 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7903 7930
7904 spin_unlock_irqrestore(&priv->lock, flags); 7931 spin_unlock_irqrestore(&priv->lock, flags);
7905 7932
7933 /* we are restarting association process
7934 * clear RXON_FILTER_ASSOC_MSK bit
7935 */
7936 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) {
7937 iwl_scan_cancel_timeout(priv, 100);
7938 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7939 iwl_commit_rxon(priv);
7940 }
7941
7906 /* Per mac80211.h: This is only used in IBSS mode... */ 7942 /* Per mac80211.h: This is only used in IBSS mode... */
7907 if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { 7943 if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) {
7944
7908 IWL_DEBUG_MAC80211("leave - not in IBSS\n"); 7945 IWL_DEBUG_MAC80211("leave - not in IBSS\n");
7909 mutex_unlock(&priv->mutex); 7946 mutex_unlock(&priv->mutex);
7910 return; 7947 return;
@@ -9152,6 +9189,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
9152 iwl_rate_control_unregister(priv->hw); 9189 iwl_rate_control_unregister(priv->hw);
9153 } 9190 }
9154 9191
9192 /*netif_stop_queue(dev); */
9193 flush_workqueue(priv->workqueue);
9194
9155 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes 9195 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes
9156 * priv->workqueue... so we can't take down the workqueue 9196 * priv->workqueue... so we can't take down the workqueue
9157 * until now... */ 9197 * until now... */
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 298faa9d3f61..06d9bc0015c0 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -30,7 +30,7 @@
30 * Interval defines 30 * Interval defines
31 * Both the link tuner as the rfkill will be called once per second. 31 * Both the link tuner as the rfkill will be called once per second.
32 */ 32 */
33#define LINK_TUNE_INTERVAL ( round_jiffies(HZ) ) 33#define LINK_TUNE_INTERVAL ( round_jiffies_relative(HZ) )
34#define RFKILL_POLL_INTERVAL ( 1000 ) 34#define RFKILL_POLL_INTERVAL ( 1000 )
35 35
36/* 36/*
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index de61c8fe6492..e454ae83e97a 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -433,6 +433,9 @@ static int rtl8187_start(struct ieee80211_hw *dev)
433 433
434 rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF); 434 rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF);
435 435
436 rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0);
437 rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0);
438
436 rtl8187_init_urbs(dev); 439 rtl8187_init_urbs(dev);
437 440
438 reg = RTL818X_RX_CONF_ONLYERLPKT | 441 reg = RTL818X_RX_CONF_ONLYERLPKT |
@@ -582,32 +585,31 @@ static int rtl8187_config_interface(struct ieee80211_hw *dev, int if_id,
582static void rtl8187_configure_filter(struct ieee80211_hw *dev, 585static void rtl8187_configure_filter(struct ieee80211_hw *dev,
583 unsigned int changed_flags, 586 unsigned int changed_flags,
584 unsigned int *total_flags, 587 unsigned int *total_flags,
585 int mc_count, struct dev_addr_list *mc_list) 588 int mc_count, struct dev_addr_list *mclist)
586{ 589{
587 struct rtl8187_priv *priv = dev->priv; 590 struct rtl8187_priv *priv = dev->priv;
588 591
589 *total_flags = 0;
590
591 if (changed_flags & FIF_ALLMULTI)
592 priv->rx_conf ^= RTL818X_RX_CONF_MULTICAST;
593 if (changed_flags & FIF_FCSFAIL) 592 if (changed_flags & FIF_FCSFAIL)
594 priv->rx_conf ^= RTL818X_RX_CONF_FCS; 593 priv->rx_conf ^= RTL818X_RX_CONF_FCS;
595 if (changed_flags & FIF_CONTROL) 594 if (changed_flags & FIF_CONTROL)
596 priv->rx_conf ^= RTL818X_RX_CONF_CTRL; 595 priv->rx_conf ^= RTL818X_RX_CONF_CTRL;
597 if (changed_flags & FIF_OTHER_BSS) 596 if (changed_flags & FIF_OTHER_BSS)
598 priv->rx_conf ^= RTL818X_RX_CONF_MONITOR; 597 priv->rx_conf ^= RTL818X_RX_CONF_MONITOR;
599 598 if (*total_flags & FIF_ALLMULTI || mc_count > 0)
600 if (mc_count > 0)
601 priv->rx_conf |= RTL818X_RX_CONF_MULTICAST; 599 priv->rx_conf |= RTL818X_RX_CONF_MULTICAST;
600 else
601 priv->rx_conf &= ~RTL818X_RX_CONF_MULTICAST;
602
603 *total_flags = 0;
602 604
603 if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST)
604 *total_flags |= FIF_ALLMULTI;
605 if (priv->rx_conf & RTL818X_RX_CONF_FCS) 605 if (priv->rx_conf & RTL818X_RX_CONF_FCS)
606 *total_flags |= FIF_FCSFAIL; 606 *total_flags |= FIF_FCSFAIL;
607 if (priv->rx_conf & RTL818X_RX_CONF_CTRL) 607 if (priv->rx_conf & RTL818X_RX_CONF_CTRL)
608 *total_flags |= FIF_CONTROL; 608 *total_flags |= FIF_CONTROL;
609 if (priv->rx_conf & RTL818X_RX_CONF_MONITOR) 609 if (priv->rx_conf & RTL818X_RX_CONF_MONITOR)
610 *total_flags |= FIF_OTHER_BSS; 610 *total_flags |= FIF_OTHER_BSS;
611 if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST)
612 *total_flags |= FIF_ALLMULTI;
611 613
612 rtl818x_iowrite32_async(priv, &priv->map->RX_CONF, priv->rx_conf); 614 rtl818x_iowrite32_async(priv, &priv->map->RX_CONF, priv->rx_conf);
613} 615}
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 0c4ab3b07274..e079a5237c94 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -34,7 +34,7 @@
34#include "intel-iommu.h" 34#include "intel-iommu.h"
35#include <asm/proto.h> /* force_iommu in this header in x86-64*/ 35#include <asm/proto.h> /* force_iommu in this header in x86-64*/
36#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
37#include <asm/iommu.h> 37#include <asm/gart.h>
38#include "pci.h" 38#include "pci.h"
39 39
40#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) 40#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
@@ -745,12 +745,12 @@ static char *fault_reason_strings[] =
745 "non-zero reserved fields in PTE", 745 "non-zero reserved fields in PTE",
746 "Unknown" 746 "Unknown"
747}; 747};
748#define MAX_FAULT_REASON_IDX ARRAY_SIZE(fault_reason_strings) 748#define MAX_FAULT_REASON_IDX ARRAY_SIZE(fault_reason_strings) - 1
749 749
750char *dmar_get_fault_reason(u8 fault_reason) 750char *dmar_get_fault_reason(u8 fault_reason)
751{ 751{
752 if (fault_reason > MAX_FAULT_REASON_IDX) 752 if (fault_reason >= MAX_FAULT_REASON_IDX)
753 return fault_reason_strings[MAX_FAULT_REASON_IDX]; 753 return fault_reason_strings[MAX_FAULT_REASON_IDX - 1];
754 else 754 else
755 return fault_reason_strings[fault_reason]; 755 return fault_reason_strings[fault_reason];
756} 756}
@@ -995,7 +995,6 @@ static struct intel_iommu *alloc_iommu(struct dmar_drhd_unit *drhd)
995 return iommu; 995 return iommu;
996error_unmap: 996error_unmap:
997 iounmap(iommu->reg); 997 iounmap(iommu->reg);
998 iommu->reg = 0;
999error: 998error:
1000 kfree(iommu); 999 kfree(iommu);
1001 return NULL; 1000 return NULL;
@@ -1808,7 +1807,7 @@ get_valid_domain_for_dev(struct pci_dev *pdev)
1808 if (!domain) { 1807 if (!domain) {
1809 printk(KERN_ERR 1808 printk(KERN_ERR
1810 "Allocating domain for %s failed", pci_name(pdev)); 1809 "Allocating domain for %s failed", pci_name(pdev));
1811 return 0; 1810 return NULL;
1812 } 1811 }
1813 1812
1814 /* make sure context mapping is ok */ 1813 /* make sure context mapping is ok */
@@ -1818,7 +1817,7 @@ get_valid_domain_for_dev(struct pci_dev *pdev)
1818 printk(KERN_ERR 1817 printk(KERN_ERR
1819 "Domain context map for %s failed", 1818 "Domain context map for %s failed",
1820 pci_name(pdev)); 1819 pci_name(pdev));
1821 return 0; 1820 return NULL;
1822 } 1821 }
1823 } 1822 }
1824 1823
diff --git a/drivers/pci/intel-iommu.h b/drivers/pci/intel-iommu.h
index ee88dd2400cb..459ad1f9dc54 100644
--- a/drivers/pci/intel-iommu.h
+++ b/drivers/pci/intel-iommu.h
@@ -58,7 +58,7 @@
58 hi = readl(dmar + reg + 4); \ 58 hi = readl(dmar + reg + 4); \
59 (((u64) hi) << 32) + lo; }) 59 (((u64) hi) << 32) + lo; })
60*/ 60*/
61static inline u64 dmar_readq(void *addr) 61static inline u64 dmar_readq(void __iomem *addr)
62{ 62{
63 u32 lo, hi; 63 u32 lo, hi;
64 lo = readl(addr); 64 lo = readl(addr);
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 8c1012b432bb..e2041b4d0c85 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -542,8 +542,6 @@ static int s3c_rtc_probe(struct platform_device *pdev)
542 542
543/* RTC Power management control */ 543/* RTC Power management control */
544 544
545static struct timespec s3c_rtc_delta;
546
547static int ticnt_save; 545static int ticnt_save;
548 546
549static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) 547static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state)
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index fd5d0c1570df..00118499018b 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -562,8 +562,6 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size)
562 sg_init_table(sg_list->sg, sg_list->count); 562 sg_init_table(sg_list->sg, sg_list->count);
563 563
564 for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) { 564 for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) {
565 sg->length = min(size, PAGE_SIZE);
566 sg->offset = 0;
567 address = (void *) get_zeroed_page(GFP_KERNEL); 565 address = (void *) get_zeroed_page(GFP_KERNEL);
568 if (address == NULL) { 566 if (address == NULL) {
569 sg_list->count = i; 567 sg_list->count = i;
@@ -571,7 +569,7 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size)
571 retval = -ENOMEM; 569 retval = -ENOMEM;
572 goto out; 570 goto out;
573 } 571 }
574 zfcp_address_to_sg(address, sg); 572 zfcp_address_to_sg(address, sg, min(size, PAGE_SIZE));
575 size -= sg->length; 573 size -= sg->length;
576 } 574 }
577 575
@@ -1518,13 +1516,13 @@ zfcp_gid_pn_buffers_alloc(struct zfcp_gid_pn_data **gid_pn, mempool_t *pool)
1518 return -ENOMEM; 1516 return -ENOMEM;
1519 1517
1520 memset(data, 0, sizeof(*data)); 1518 memset(data, 0, sizeof(*data));
1519 sg_init_table(&data->req , 1);
1520 sg_init_table(&data->resp , 1);
1521 data->ct.req = &data->req; 1521 data->ct.req = &data->req;
1522 data->ct.resp = &data->resp; 1522 data->ct.resp = &data->resp;
1523 data->ct.req_count = data->ct.resp_count = 1; 1523 data->ct.req_count = data->ct.resp_count = 1;
1524 zfcp_address_to_sg(&data->ct_iu_req, &data->req); 1524 zfcp_address_to_sg(&data->ct_iu_req, &data->req, sizeof(struct ct_iu_gid_pn_req));
1525 zfcp_address_to_sg(&data->ct_iu_resp, &data->resp); 1525 zfcp_address_to_sg(&data->ct_iu_resp, &data->resp, sizeof(struct ct_iu_gid_pn_resp));
1526 data->req.length = sizeof(struct ct_iu_gid_pn_req);
1527 data->resp.length = sizeof(struct ct_iu_gid_pn_resp);
1528 1526
1529 *gid_pn = data; 1527 *gid_pn = data;
1530 return 0; 1528 return 0;
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 326e7ee232cb..e268f79bdbd2 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -70,12 +70,12 @@ zfcp_sg_to_address(struct scatterlist *list)
70 * zfcp_address_to_sg - set up struct scatterlist from kernel address 70 * zfcp_address_to_sg - set up struct scatterlist from kernel address
71 * @address: kernel address 71 * @address: kernel address
72 * @list: struct scatterlist 72 * @list: struct scatterlist
73 * @size: buffer size
73 */ 74 */
74static inline void 75static inline void
75zfcp_address_to_sg(void *address, struct scatterlist *list) 76zfcp_address_to_sg(void *address, struct scatterlist *list, unsigned int size)
76{ 77{
77 sg_set_page(list, virt_to_page(address)); 78 sg_set_buf(list, address, size);
78 list->offset = ((unsigned long) address) & (PAGE_SIZE - 1);
79} 79}
80 80
81#define REQUEST_LIST_SIZE 128 81#define REQUEST_LIST_SIZE 128
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 9438d0b28799..5552b755c08a 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -322,9 +322,9 @@ zfcp_erp_adisc(struct zfcp_port *port)
322 if (address == NULL) 322 if (address == NULL)
323 goto nomem; 323 goto nomem;
324 324
325 zfcp_address_to_sg(address, send_els->req); 325 zfcp_address_to_sg(address, send_els->req, sizeof(struct zfcp_ls_adisc));
326 address += PAGE_SIZE >> 1; 326 address += PAGE_SIZE >> 1;
327 zfcp_address_to_sg(address, send_els->resp); 327 zfcp_address_to_sg(address, send_els->resp, sizeof(struct zfcp_ls_adisc_acc));
328 send_els->req_count = send_els->resp_count = 1; 328 send_els->req_count = send_els->resp_count = 1;
329 329
330 send_els->adapter = adapter; 330 send_els->adapter = adapter;
@@ -336,9 +336,6 @@ zfcp_erp_adisc(struct zfcp_port *port)
336 adisc = zfcp_sg_to_address(send_els->req); 336 adisc = zfcp_sg_to_address(send_els->req);
337 send_els->ls_code = adisc->code = ZFCP_LS_ADISC; 337 send_els->ls_code = adisc->code = ZFCP_LS_ADISC;
338 338
339 send_els->req->length = sizeof(struct zfcp_ls_adisc);
340 send_els->resp->length = sizeof(struct zfcp_ls_adisc_acc);
341
342 /* acc. to FC-FS, hard_nport_id in ADISC should not be set for ports 339 /* acc. to FC-FS, hard_nport_id in ADISC should not be set for ports
343 without FC-AL-2 capability, so we don't set it */ 340 without FC-AL-2 capability, so we don't set it */
344 adisc->wwpn = fc_host_port_name(adapter->scsi_host); 341 adisc->wwpn = fc_host_port_name(adapter->scsi_host);
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a5763c6e9362..86cf10efb0c1 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -172,12 +172,12 @@ config CHR_DEV_SCH
172 don't need this for those tiny 6-slot cdrom changers. Media 172 don't need this for those tiny 6-slot cdrom changers. Media
173 changers are listed as "Type: Medium Changer" in /proc/scsi/scsi. 173 changers are listed as "Type: Medium Changer" in /proc/scsi/scsi.
174 If you have such hardware and want to use it with linux, say Y 174 If you have such hardware and want to use it with linux, say Y
175 here. Check <file:Documentation/scsi-changer.txt> for details. 175 here. Check <file:Documentation/scsi/scsi-changer.txt> for details.
176 176
177 If you want to compile this as a module ( = code which can be 177 If you want to compile this as a module ( = code which can be
178 inserted in and removed from the running kernel whenever you want), 178 inserted in and removed from the running kernel whenever you want),
179 say M here and read <file:Documentation/kbuild/modules.txt> and 179 say M here and read <file:Documentation/kbuild/modules.txt> and
180 <file:Documentation/scsi.txt>. The module will be called ch.o. 180 <file:Documentation/scsi/scsi.txt>. The module will be called ch.o.
181 If unsure, say N. 181 If unsure, say N.
182 182
183 183
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 72b0393b4596..1e6d7a9c75bf 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -391,7 +391,7 @@ static int close_getadapter_fib(struct aac_dev * dev, void __user *arg)
391 /* 391 /*
392 * Extract the fibctx from the input parameters 392 * Extract the fibctx from the input parameters
393 */ 393 */
394 if (fibctx->unique == (u32)(ptrdiff_t)arg) /* We found a winner */ 394 if (fibctx->unique == (u32)(uintptr_t)arg) /* We found a winner */
395 break; 395 break;
396 entry = entry->next; 396 entry = entry->next;
397 fibctx = NULL; 397 fibctx = NULL;
@@ -590,7 +590,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
590 } 590 }
591 addr = (u64)upsg->sg[i].addr[0]; 591 addr = (u64)upsg->sg[i].addr[0];
592 addr += ((u64)upsg->sg[i].addr[1]) << 32; 592 addr += ((u64)upsg->sg[i].addr[1]) << 32;
593 sg_user[i] = (void __user *)(ptrdiff_t)addr; 593 sg_user[i] = (void __user *)(uintptr_t)addr;
594 sg_list[i] = p; // save so we can clean up later 594 sg_list[i] = p; // save so we can clean up later
595 sg_indx = i; 595 sg_indx = i;
596 596
@@ -633,7 +633,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
633 rcode = -ENOMEM; 633 rcode = -ENOMEM;
634 goto cleanup; 634 goto cleanup;
635 } 635 }
636 sg_user[i] = (void __user *)(ptrdiff_t)usg->sg[i].addr; 636 sg_user[i] = (void __user *)(uintptr_t)usg->sg[i].addr;
637 sg_list[i] = p; // save so we can clean up later 637 sg_list[i] = p; // save so we can clean up later
638 sg_indx = i; 638 sg_indx = i;
639 639
@@ -664,7 +664,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
664 if (actual_fibsize64 == fibsize) { 664 if (actual_fibsize64 == fibsize) {
665 struct user_sgmap64* usg = (struct user_sgmap64 *)upsg; 665 struct user_sgmap64* usg = (struct user_sgmap64 *)upsg;
666 for (i = 0; i < upsg->count; i++) { 666 for (i = 0; i < upsg->count; i++) {
667 u64 addr; 667 uintptr_t addr;
668 void* p; 668 void* p;
669 /* Does this really need to be GFP_DMA? */ 669 /* Does this really need to be GFP_DMA? */
670 p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA); 670 p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA);
@@ -676,7 +676,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
676 } 676 }
677 addr = (u64)usg->sg[i].addr[0]; 677 addr = (u64)usg->sg[i].addr[0];
678 addr += ((u64)usg->sg[i].addr[1]) << 32; 678 addr += ((u64)usg->sg[i].addr[1]) << 32;
679 sg_user[i] = (void __user *)(ptrdiff_t)addr; 679 sg_user[i] = (void __user *)addr;
680 sg_list[i] = p; // save so we can clean up later 680 sg_list[i] = p; // save so we can clean up later
681 sg_indx = i; 681 sg_indx = i;
682 682
@@ -704,7 +704,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
704 rcode = -ENOMEM; 704 rcode = -ENOMEM;
705 goto cleanup; 705 goto cleanup;
706 } 706 }
707 sg_user[i] = (void __user *)(ptrdiff_t)upsg->sg[i].addr; 707 sg_user[i] = (void __user *)(uintptr_t)upsg->sg[i].addr;
708 sg_list[i] = p; // save so we can clean up later 708 sg_list[i] = p; // save so we can clean up later
709 sg_indx = i; 709 sg_indx = i;
710 710
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 3009ad8c4073..8736813a0296 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -110,7 +110,7 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co
110 /* 110 /*
111 * Align the beginning of Headers to commalign 111 * Align the beginning of Headers to commalign
112 */ 112 */
113 align = (commalign - ((ptrdiff_t)(base) & (commalign - 1))); 113 align = (commalign - ((uintptr_t)(base) & (commalign - 1)));
114 base = base + align; 114 base = base + align;
115 phys = phys + align; 115 phys = phys + align;
116 /* 116 /*
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c
index fcd25f7d0bc6..e6032ffc66a6 100644
--- a/drivers/scsi/aacraid/dpcsup.c
+++ b/drivers/scsi/aacraid/dpcsup.c
@@ -254,7 +254,7 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index)
254 kfree (fib); 254 kfree (fib);
255 return 1; 255 return 1;
256 } 256 }
257 memcpy(hw_fib, (struct hw_fib *)(((ptrdiff_t)(dev->regs.sa)) + 257 memcpy(hw_fib, (struct hw_fib *)(((uintptr_t)(dev->regs.sa)) +
258 (index & ~0x00000002L)), sizeof(struct hw_fib)); 258 (index & ~0x00000002L)), sizeof(struct hw_fib));
259 INIT_LIST_HEAD(&fib->fiblink); 259 INIT_LIST_HEAD(&fib->fiblink);
260 fib->type = FSAFS_NTC_FIB_CONTEXT; 260 fib->type = FSAFS_NTC_FIB_CONTEXT;
diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
index ace7a15b413e..a67e29f83ae5 100644
--- a/drivers/scsi/arcmsr/arcmsr.h
+++ b/drivers/scsi/arcmsr/arcmsr.h
@@ -141,14 +141,14 @@ struct CMD_MESSAGE_FIELD
141#define IS_SG64_ADDR 0x01000000 /* bit24 */ 141#define IS_SG64_ADDR 0x01000000 /* bit24 */
142struct SG32ENTRY 142struct SG32ENTRY
143{ 143{
144 uint32_t length; 144 __le32 length;
145 uint32_t address; 145 __le32 address;
146}; 146};
147struct SG64ENTRY 147struct SG64ENTRY
148{ 148{
149 uint32_t length; 149 __le32 length;
150 uint32_t address; 150 __le32 address;
151 uint32_t addresshigh; 151 __le32 addresshigh;
152}; 152};
153struct SGENTRY_UNION 153struct SGENTRY_UNION
154{ 154{
@@ -339,23 +339,15 @@ struct MessageUnit_B
339 uint32_t done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE]; 339 uint32_t done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
340 uint32_t postq_index; 340 uint32_t postq_index;
341 uint32_t doneq_index; 341 uint32_t doneq_index;
342 uint32_t *drv2iop_doorbell_reg; 342 uint32_t __iomem *drv2iop_doorbell_reg;
343 uint32_t *drv2iop_doorbell_mask_reg; 343 uint32_t __iomem *drv2iop_doorbell_mask_reg;
344 uint32_t *iop2drv_doorbell_reg; 344 uint32_t __iomem *iop2drv_doorbell_reg;
345 uint32_t *iop2drv_doorbell_mask_reg; 345 uint32_t __iomem *iop2drv_doorbell_mask_reg;
346 uint32_t *msgcode_rwbuffer_reg; 346 uint32_t __iomem *msgcode_rwbuffer_reg;
347 uint32_t *ioctl_wbuffer_reg; 347 uint32_t __iomem *ioctl_wbuffer_reg;
348 uint32_t *ioctl_rbuffer_reg; 348 uint32_t __iomem *ioctl_rbuffer_reg;
349}; 349};
350 350
351struct MessageUnit
352{
353 union
354 {
355 struct MessageUnit_A pmu_A;
356 struct MessageUnit_B pmu_B;
357 } u;
358};
359/* 351/*
360******************************************************************************* 352*******************************************************************************
361** Adapter Control Block 353** Adapter Control Block
@@ -374,7 +366,10 @@ struct AdapterControlBlock
374 /* Offset is used in making arc cdb physical to virtual calculations */ 366 /* Offset is used in making arc cdb physical to virtual calculations */
375 uint32_t outbound_int_enable; 367 uint32_t outbound_int_enable;
376 368
377 struct MessageUnit * pmu; 369 union {
370 struct MessageUnit_A __iomem * pmuA;
371 struct MessageUnit_B * pmuB;
372 };
378 /* message unit ATU inbound base address0 */ 373 /* message unit ATU inbound base address0 */
379 374
380 uint32_t acb_flags; 375 uint32_t acb_flags;
@@ -558,7 +553,7 @@ struct SENSE_DATA
558 553
559extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *); 554extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *);
560extern void arcmsr_iop_message_read(struct AdapterControlBlock *); 555extern void arcmsr_iop_message_read(struct AdapterControlBlock *);
561extern struct QBUFFER *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *); 556extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *);
562extern struct class_device_attribute *arcmsr_host_attrs[]; 557extern struct class_device_attribute *arcmsr_host_attrs[];
563extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *); 558extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *);
564void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb); 559void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb);
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c
index d04d1aa28fa4..7d7b0a554276 100644
--- a/drivers/scsi/arcmsr/arcmsr_attr.c
+++ b/drivers/scsi/arcmsr/arcmsr_attr.c
@@ -85,13 +85,13 @@ static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj,
85 allxfer_len++; 85 allxfer_len++;
86 } 86 }
87 if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) { 87 if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
88 struct QBUFFER *prbuffer; 88 struct QBUFFER __iomem *prbuffer;
89 uint8_t *iop_data; 89 uint8_t __iomem *iop_data;
90 int32_t iop_len; 90 int32_t iop_len;
91 91
92 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; 92 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
93 prbuffer = arcmsr_get_iop_rqbuffer(acb); 93 prbuffer = arcmsr_get_iop_rqbuffer(acb);
94 iop_data = (uint8_t *)prbuffer->data; 94 iop_data = prbuffer->data;
95 iop_len = readl(&prbuffer->data_len); 95 iop_len = readl(&prbuffer->data_len);
96 while (iop_len > 0) { 96 while (iop_len > 0) {
97 acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data); 97 acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data);
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index f7a252885a5c..d466a2dac1db 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -236,18 +236,22 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
236 uint32_t intmask_org; 236 uint32_t intmask_org;
237 int i, j; 237 int i, j;
238 238
239 acb->pmu = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); 239 acb->pmuA = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
240 if (!acb->pmu) { 240 if (!acb->pmuA) {
241 printk(KERN_NOTICE "arcmsr%d: memory mapping region fail \n", 241 printk(KERN_NOTICE "arcmsr%d: memory mapping region fail \n",
242 acb->host->host_no); 242 acb->host->host_no);
243 return -ENOMEM;
243 } 244 }
244 245
245 dma_coherent = dma_alloc_coherent(&pdev->dev, 246 dma_coherent = dma_alloc_coherent(&pdev->dev,
246 ARCMSR_MAX_FREECCB_NUM * 247 ARCMSR_MAX_FREECCB_NUM *
247 sizeof (struct CommandControlBlock) + 0x20, 248 sizeof (struct CommandControlBlock) + 0x20,
248 &dma_coherent_handle, GFP_KERNEL); 249 &dma_coherent_handle, GFP_KERNEL);
249 if (!dma_coherent) 250
251 if (!dma_coherent) {
252 iounmap(acb->pmuA);
250 return -ENOMEM; 253 return -ENOMEM;
254 }
251 255
252 acb->dma_coherent = dma_coherent; 256 acb->dma_coherent = dma_coherent;
253 acb->dma_coherent_handle = dma_coherent_handle; 257 acb->dma_coherent_handle = dma_coherent_handle;
@@ -287,7 +291,7 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
287 291
288 struct pci_dev *pdev = acb->pdev; 292 struct pci_dev *pdev = acb->pdev;
289 struct MessageUnit_B *reg; 293 struct MessageUnit_B *reg;
290 void *mem_base0, *mem_base1; 294 void __iomem *mem_base0, *mem_base1;
291 void *dma_coherent; 295 void *dma_coherent;
292 dma_addr_t dma_coherent_handle, dma_addr; 296 dma_addr_t dma_coherent_handle, dma_addr;
293 uint32_t intmask_org; 297 uint32_t intmask_org;
@@ -328,25 +332,28 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
328 332
329 reg = (struct MessageUnit_B *)(dma_coherent + 333 reg = (struct MessageUnit_B *)(dma_coherent +
330 ARCMSR_MAX_FREECCB_NUM * sizeof(struct CommandControlBlock)); 334 ARCMSR_MAX_FREECCB_NUM * sizeof(struct CommandControlBlock));
331 acb->pmu = (struct MessageUnit *)reg; 335 acb->pmuB = reg;
332 mem_base0 = ioremap(pci_resource_start(pdev, 0), 336 mem_base0 = ioremap(pci_resource_start(pdev, 0),
333 pci_resource_len(pdev, 0)); 337 pci_resource_len(pdev, 0));
338 if (!mem_base0)
339 goto out;
340
334 mem_base1 = ioremap(pci_resource_start(pdev, 2), 341 mem_base1 = ioremap(pci_resource_start(pdev, 2),
335 pci_resource_len(pdev, 2)); 342 pci_resource_len(pdev, 2));
336 reg->drv2iop_doorbell_reg = (uint32_t *)((char *)mem_base0 + 343 if (!mem_base1) {
337 ARCMSR_DRV2IOP_DOORBELL); 344 iounmap(mem_base0);
338 reg->drv2iop_doorbell_mask_reg = (uint32_t *)((char *)mem_base0 + 345 goto out;
339 ARCMSR_DRV2IOP_DOORBELL_MASK); 346 }
340 reg->iop2drv_doorbell_reg = (uint32_t *)((char *)mem_base0 + 347
341 ARCMSR_IOP2DRV_DOORBELL); 348 reg->drv2iop_doorbell_reg = mem_base0 + ARCMSR_DRV2IOP_DOORBELL;
342 reg->iop2drv_doorbell_mask_reg = (uint32_t *)((char *)mem_base0 + 349 reg->drv2iop_doorbell_mask_reg = mem_base0 +
343 ARCMSR_IOP2DRV_DOORBELL_MASK); 350 ARCMSR_DRV2IOP_DOORBELL_MASK;
344 reg->ioctl_wbuffer_reg = (uint32_t *)((char *)mem_base1 + 351 reg->iop2drv_doorbell_reg = mem_base0 + ARCMSR_IOP2DRV_DOORBELL;
345 ARCMSR_IOCTL_WBUFFER); 352 reg->iop2drv_doorbell_mask_reg = mem_base0 +
346 reg->ioctl_rbuffer_reg = (uint32_t *)((char *)mem_base1 + 353 ARCMSR_IOP2DRV_DOORBELL_MASK;
347 ARCMSR_IOCTL_RBUFFER); 354 reg->ioctl_wbuffer_reg = mem_base1 + ARCMSR_IOCTL_WBUFFER;
348 reg->msgcode_rwbuffer_reg = (uint32_t *)((char *)mem_base1 + 355 reg->ioctl_rbuffer_reg = mem_base1 + ARCMSR_IOCTL_RBUFFER;
349 ARCMSR_MSGCODE_RWBUFFER); 356 reg->msgcode_rwbuffer_reg = mem_base1 + ARCMSR_MSGCODE_RWBUFFER;
350 357
351 acb->vir2phy_offset = (unsigned long)ccb_tmp -(unsigned long)dma_addr; 358 acb->vir2phy_offset = (unsigned long)ccb_tmp -(unsigned long)dma_addr;
352 for (i = 0; i < ARCMSR_MAX_TARGETID; i++) 359 for (i = 0; i < ARCMSR_MAX_TARGETID; i++)
@@ -362,6 +369,12 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
362 break; 369 break;
363 } 370 }
364 return 0; 371 return 0;
372
373out:
374 dma_free_coherent(&acb->pdev->dev,
375 ARCMSR_MAX_FREECCB_NUM * sizeof(struct CommandControlBlock) + 0x20,
376 acb->dma_coherent, acb->dma_coherent_handle);
377 return -ENOMEM;
365} 378}
366 379
367static int arcmsr_probe(struct pci_dev *pdev, 380static int arcmsr_probe(struct pci_dev *pdev,
@@ -454,7 +467,6 @@ static int arcmsr_probe(struct pci_dev *pdev,
454 free_irq(pdev->irq, acb); 467 free_irq(pdev->irq, acb);
455 out_free_ccb_pool: 468 out_free_ccb_pool:
456 arcmsr_free_ccb_pool(acb); 469 arcmsr_free_ccb_pool(acb);
457 iounmap(acb->pmu);
458 out_release_regions: 470 out_release_regions:
459 pci_release_regions(pdev); 471 pci_release_regions(pdev);
460 out_host_put: 472 out_host_put:
@@ -467,7 +479,7 @@ static int arcmsr_probe(struct pci_dev *pdev,
467 479
468static uint8_t arcmsr_hba_wait_msgint_ready(struct AdapterControlBlock *acb) 480static uint8_t arcmsr_hba_wait_msgint_ready(struct AdapterControlBlock *acb)
469{ 481{
470 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 482 struct MessageUnit_A __iomem *reg = acb->pmuA;
471 uint32_t Index; 483 uint32_t Index;
472 uint8_t Retries = 0x00; 484 uint8_t Retries = 0x00;
473 485
@@ -488,7 +500,7 @@ static uint8_t arcmsr_hba_wait_msgint_ready(struct AdapterControlBlock *acb)
488 500
489static uint8_t arcmsr_hbb_wait_msgint_ready(struct AdapterControlBlock *acb) 501static uint8_t arcmsr_hbb_wait_msgint_ready(struct AdapterControlBlock *acb)
490{ 502{
491 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 503 struct MessageUnit_B *reg = acb->pmuB;
492 uint32_t Index; 504 uint32_t Index;
493 uint8_t Retries = 0x00; 505 uint8_t Retries = 0x00;
494 506
@@ -509,7 +521,7 @@ static uint8_t arcmsr_hbb_wait_msgint_ready(struct AdapterControlBlock *acb)
509 521
510static void arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb) 522static void arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb)
511{ 523{
512 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 524 struct MessageUnit_A __iomem *reg = acb->pmuA;
513 525
514 writel(ARCMSR_INBOUND_MESG0_ABORT_CMD, &reg->inbound_msgaddr0); 526 writel(ARCMSR_INBOUND_MESG0_ABORT_CMD, &reg->inbound_msgaddr0);
515 if (arcmsr_hba_wait_msgint_ready(acb)) 527 if (arcmsr_hba_wait_msgint_ready(acb))
@@ -520,7 +532,7 @@ static void arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb)
520 532
521static void arcmsr_abort_hbb_allcmd(struct AdapterControlBlock *acb) 533static void arcmsr_abort_hbb_allcmd(struct AdapterControlBlock *acb)
522{ 534{
523 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 535 struct MessageUnit_B *reg = acb->pmuB;
524 536
525 writel(ARCMSR_MESSAGE_ABORT_CMD, reg->drv2iop_doorbell_reg); 537 writel(ARCMSR_MESSAGE_ABORT_CMD, reg->drv2iop_doorbell_reg);
526 if (arcmsr_hbb_wait_msgint_ready(acb)) 538 if (arcmsr_hbb_wait_msgint_ready(acb))
@@ -566,7 +578,7 @@ static void arcmsr_ccb_complete(struct CommandControlBlock *ccb, int stand_flag)
566 578
567static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb) 579static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb)
568{ 580{
569 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 581 struct MessageUnit_A __iomem *reg = acb->pmuA;
570 int retry_count = 30; 582 int retry_count = 30;
571 583
572 writel(ARCMSR_INBOUND_MESG0_FLUSH_CACHE, &reg->inbound_msgaddr0); 584 writel(ARCMSR_INBOUND_MESG0_FLUSH_CACHE, &reg->inbound_msgaddr0);
@@ -583,7 +595,7 @@ static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb)
583 595
584static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb) 596static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb)
585{ 597{
586 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 598 struct MessageUnit_B *reg = acb->pmuB;
587 int retry_count = 30; 599 int retry_count = 30;
588 600
589 writel(ARCMSR_MESSAGE_FLUSH_CACHE, reg->drv2iop_doorbell_reg); 601 writel(ARCMSR_MESSAGE_FLUSH_CACHE, reg->drv2iop_doorbell_reg);
@@ -637,7 +649,7 @@ static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb)
637 switch (acb->adapter_type) { 649 switch (acb->adapter_type) {
638 650
639 case ACB_ADAPTER_TYPE_A : { 651 case ACB_ADAPTER_TYPE_A : {
640 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 652 struct MessageUnit_A __iomem *reg = acb->pmuA;
641 orig_mask = readl(&reg->outbound_intmask)|\ 653 orig_mask = readl(&reg->outbound_intmask)|\
642 ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE; 654 ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE;
643 writel(orig_mask|ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE, \ 655 writel(orig_mask|ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE, \
@@ -646,7 +658,7 @@ static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb)
646 break; 658 break;
647 659
648 case ACB_ADAPTER_TYPE_B : { 660 case ACB_ADAPTER_TYPE_B : {
649 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 661 struct MessageUnit_B *reg = acb->pmuB;
650 orig_mask = readl(reg->iop2drv_doorbell_mask_reg) & \ 662 orig_mask = readl(reg->iop2drv_doorbell_mask_reg) & \
651 (~ARCMSR_IOP2DRV_MESSAGE_CMD_DONE); 663 (~ARCMSR_IOP2DRV_MESSAGE_CMD_DONE);
652 writel(0, reg->iop2drv_doorbell_mask_reg); 664 writel(0, reg->iop2drv_doorbell_mask_reg);
@@ -748,14 +760,13 @@ static void arcmsr_done4abort_postqueue(struct AdapterControlBlock *acb)
748 switch (acb->adapter_type) { 760 switch (acb->adapter_type) {
749 761
750 case ACB_ADAPTER_TYPE_A: { 762 case ACB_ADAPTER_TYPE_A: {
751 struct MessageUnit_A __iomem *reg = \ 763 struct MessageUnit_A __iomem *reg = acb->pmuA;
752 (struct MessageUnit_A *)acb->pmu;
753 uint32_t outbound_intstatus; 764 uint32_t outbound_intstatus;
754 outbound_intstatus = readl(&reg->outbound_intstatus) & \ 765 outbound_intstatus = readl(&reg->outbound_intstatus) &
755 acb->outbound_int_enable; 766 acb->outbound_int_enable;
756 /*clear and abort all outbound posted Q*/ 767 /*clear and abort all outbound posted Q*/
757 writel(outbound_intstatus, &reg->outbound_intstatus);/*clear interrupt*/ 768 writel(outbound_intstatus, &reg->outbound_intstatus);/*clear interrupt*/
758 while (((flag_ccb = readl(&reg->outbound_queueport)) != 0xFFFFFFFF) \ 769 while (((flag_ccb = readl(&reg->outbound_queueport)) != 0xFFFFFFFF)
759 && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) { 770 && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) {
760 arcmsr_drain_donequeue(acb, flag_ccb); 771 arcmsr_drain_donequeue(acb, flag_ccb);
761 } 772 }
@@ -763,7 +774,7 @@ static void arcmsr_done4abort_postqueue(struct AdapterControlBlock *acb)
763 break; 774 break;
764 775
765 case ACB_ADAPTER_TYPE_B: { 776 case ACB_ADAPTER_TYPE_B: {
766 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 777 struct MessageUnit_B *reg = acb->pmuB;
767 /*clear all outbound posted Q*/ 778 /*clear all outbound posted Q*/
768 for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) { 779 for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) {
769 if ((flag_ccb = readl(&reg->done_qbuffer[i])) != 0) { 780 if ((flag_ccb = readl(&reg->done_qbuffer[i])) != 0) {
@@ -816,7 +827,6 @@ static void arcmsr_remove(struct pci_dev *pdev)
816 } 827 }
817 828
818 free_irq(pdev->irq, acb); 829 free_irq(pdev->irq, acb);
819 iounmap(acb->pmu);
820 arcmsr_free_ccb_pool(acb); 830 arcmsr_free_ccb_pool(acb);
821 pci_release_regions(pdev); 831 pci_release_regions(pdev);
822 832
@@ -859,7 +869,7 @@ static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb, \
859 switch (acb->adapter_type) { 869 switch (acb->adapter_type) {
860 870
861 case ACB_ADAPTER_TYPE_A : { 871 case ACB_ADAPTER_TYPE_A : {
862 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 872 struct MessageUnit_A __iomem *reg = acb->pmuA;
863 mask = intmask_org & ~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE | 873 mask = intmask_org & ~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE |
864 ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE); 874 ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE);
865 writel(mask, &reg->outbound_intmask); 875 writel(mask, &reg->outbound_intmask);
@@ -868,7 +878,7 @@ static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb, \
868 break; 878 break;
869 879
870 case ACB_ADAPTER_TYPE_B : { 880 case ACB_ADAPTER_TYPE_B : {
871 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 881 struct MessageUnit_B *reg = acb->pmuB;
872 mask = intmask_org | (ARCMSR_IOP2DRV_DATA_WRITE_OK | \ 882 mask = intmask_org | (ARCMSR_IOP2DRV_DATA_WRITE_OK | \
873 ARCMSR_IOP2DRV_DATA_READ_OK | ARCMSR_IOP2DRV_CDB_DONE); 883 ARCMSR_IOP2DRV_DATA_READ_OK | ARCMSR_IOP2DRV_CDB_DONE);
874 writel(mask, reg->iop2drv_doorbell_mask_reg); 884 writel(mask, reg->iop2drv_doorbell_mask_reg);
@@ -882,7 +892,7 @@ static void arcmsr_build_ccb(struct AdapterControlBlock *acb,
882{ 892{
883 struct ARCMSR_CDB *arcmsr_cdb = (struct ARCMSR_CDB *)&ccb->arcmsr_cdb; 893 struct ARCMSR_CDB *arcmsr_cdb = (struct ARCMSR_CDB *)&ccb->arcmsr_cdb;
884 int8_t *psge = (int8_t *)&arcmsr_cdb->u; 894 int8_t *psge = (int8_t *)&arcmsr_cdb->u;
885 uint32_t address_lo, address_hi; 895 __le32 address_lo, address_hi;
886 int arccdbsize = 0x30; 896 int arccdbsize = 0x30;
887 int nseg; 897 int nseg;
888 898
@@ -900,7 +910,8 @@ static void arcmsr_build_ccb(struct AdapterControlBlock *acb,
900 BUG_ON(nseg < 0); 910 BUG_ON(nseg < 0);
901 911
902 if (nseg) { 912 if (nseg) {
903 int length, i, cdb_sgcount = 0; 913 __le32 length;
914 int i, cdb_sgcount = 0;
904 struct scatterlist *sg; 915 struct scatterlist *sg;
905 916
906 /* map stor port SG list to our iop SG List. */ 917 /* map stor port SG list to our iop SG List. */
@@ -921,7 +932,7 @@ static void arcmsr_build_ccb(struct AdapterControlBlock *acb,
921 932
922 pdma_sg->addresshigh = address_hi; 933 pdma_sg->addresshigh = address_hi;
923 pdma_sg->address = address_lo; 934 pdma_sg->address = address_lo;
924 pdma_sg->length = length|IS_SG64_ADDR; 935 pdma_sg->length = length|cpu_to_le32(IS_SG64_ADDR);
925 psge += sizeof (struct SG64ENTRY); 936 psge += sizeof (struct SG64ENTRY);
926 arccdbsize += sizeof (struct SG64ENTRY); 937 arccdbsize += sizeof (struct SG64ENTRY);
927 } 938 }
@@ -947,7 +958,7 @@ static void arcmsr_post_ccb(struct AdapterControlBlock *acb, struct CommandContr
947 958
948 switch (acb->adapter_type) { 959 switch (acb->adapter_type) {
949 case ACB_ADAPTER_TYPE_A: { 960 case ACB_ADAPTER_TYPE_A: {
950 struct MessageUnit_A *reg = (struct MessageUnit_A *)acb->pmu; 961 struct MessageUnit_A __iomem *reg = acb->pmuA;
951 962
952 if (arcmsr_cdb->Flags & ARCMSR_CDB_FLAG_SGL_BSIZE) 963 if (arcmsr_cdb->Flags & ARCMSR_CDB_FLAG_SGL_BSIZE)
953 writel(cdb_shifted_phyaddr | ARCMSR_CCBPOST_FLAG_SGL_BSIZE, 964 writel(cdb_shifted_phyaddr | ARCMSR_CCBPOST_FLAG_SGL_BSIZE,
@@ -959,7 +970,7 @@ static void arcmsr_post_ccb(struct AdapterControlBlock *acb, struct CommandContr
959 break; 970 break;
960 971
961 case ACB_ADAPTER_TYPE_B: { 972 case ACB_ADAPTER_TYPE_B: {
962 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 973 struct MessageUnit_B *reg = acb->pmuB;
963 uint32_t ending_index, index = reg->postq_index; 974 uint32_t ending_index, index = reg->postq_index;
964 975
965 ending_index = ((index + 1) % ARCMSR_MAX_HBB_POSTQUEUE); 976 ending_index = ((index + 1) % ARCMSR_MAX_HBB_POSTQUEUE);
@@ -982,7 +993,7 @@ static void arcmsr_post_ccb(struct AdapterControlBlock *acb, struct CommandContr
982 993
983static void arcmsr_stop_hba_bgrb(struct AdapterControlBlock *acb) 994static void arcmsr_stop_hba_bgrb(struct AdapterControlBlock *acb)
984{ 995{
985 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 996 struct MessageUnit_A __iomem *reg = acb->pmuA;
986 acb->acb_flags &= ~ACB_F_MSG_START_BGRB; 997 acb->acb_flags &= ~ACB_F_MSG_START_BGRB;
987 writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, &reg->inbound_msgaddr0); 998 writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, &reg->inbound_msgaddr0);
988 999
@@ -995,7 +1006,7 @@ static void arcmsr_stop_hba_bgrb(struct AdapterControlBlock *acb)
995 1006
996static void arcmsr_stop_hbb_bgrb(struct AdapterControlBlock *acb) 1007static void arcmsr_stop_hbb_bgrb(struct AdapterControlBlock *acb)
997{ 1008{
998 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1009 struct MessageUnit_B *reg = acb->pmuB;
999 acb->acb_flags &= ~ACB_F_MSG_START_BGRB; 1010 acb->acb_flags &= ~ACB_F_MSG_START_BGRB;
1000 writel(ARCMSR_MESSAGE_STOP_BGRB, reg->drv2iop_doorbell_reg); 1011 writel(ARCMSR_MESSAGE_STOP_BGRB, reg->drv2iop_doorbell_reg);
1001 1012
@@ -1023,6 +1034,17 @@ static void arcmsr_stop_adapter_bgrb(struct AdapterControlBlock *acb)
1023 1034
1024static void arcmsr_free_ccb_pool(struct AdapterControlBlock *acb) 1035static void arcmsr_free_ccb_pool(struct AdapterControlBlock *acb)
1025{ 1036{
1037 switch (acb->adapter_type) {
1038 case ACB_ADAPTER_TYPE_A: {
1039 iounmap(acb->pmuA);
1040 break;
1041 }
1042 case ACB_ADAPTER_TYPE_B: {
1043 struct MessageUnit_B *reg = acb->pmuB;
1044 iounmap(reg->drv2iop_doorbell_reg - ARCMSR_DRV2IOP_DOORBELL);
1045 iounmap(reg->ioctl_wbuffer_reg - ARCMSR_IOCTL_WBUFFER);
1046 }
1047 }
1026 dma_free_coherent(&acb->pdev->dev, 1048 dma_free_coherent(&acb->pdev->dev,
1027 ARCMSR_MAX_FREECCB_NUM * sizeof (struct CommandControlBlock) + 0x20, 1049 ARCMSR_MAX_FREECCB_NUM * sizeof (struct CommandControlBlock) + 0x20,
1028 acb->dma_coherent, 1050 acb->dma_coherent,
@@ -1033,13 +1055,13 @@ void arcmsr_iop_message_read(struct AdapterControlBlock *acb)
1033{ 1055{
1034 switch (acb->adapter_type) { 1056 switch (acb->adapter_type) {
1035 case ACB_ADAPTER_TYPE_A: { 1057 case ACB_ADAPTER_TYPE_A: {
1036 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1058 struct MessageUnit_A __iomem *reg = acb->pmuA;
1037 writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, &reg->inbound_doorbell); 1059 writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, &reg->inbound_doorbell);
1038 } 1060 }
1039 break; 1061 break;
1040 1062
1041 case ACB_ADAPTER_TYPE_B: { 1063 case ACB_ADAPTER_TYPE_B: {
1042 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1064 struct MessageUnit_B *reg = acb->pmuB;
1043 writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg); 1065 writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg);
1044 } 1066 }
1045 break; 1067 break;
@@ -1050,7 +1072,7 @@ static void arcmsr_iop_message_wrote(struct AdapterControlBlock *acb)
1050{ 1072{
1051 switch (acb->adapter_type) { 1073 switch (acb->adapter_type) {
1052 case ACB_ADAPTER_TYPE_A: { 1074 case ACB_ADAPTER_TYPE_A: {
1053 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1075 struct MessageUnit_A __iomem *reg = acb->pmuA;
1054 /* 1076 /*
1055 ** push inbound doorbell tell iop, driver data write ok 1077 ** push inbound doorbell tell iop, driver data write ok
1056 ** and wait reply on next hwinterrupt for next Qbuffer post 1078 ** and wait reply on next hwinterrupt for next Qbuffer post
@@ -1060,7 +1082,7 @@ static void arcmsr_iop_message_wrote(struct AdapterControlBlock *acb)
1060 break; 1082 break;
1061 1083
1062 case ACB_ADAPTER_TYPE_B: { 1084 case ACB_ADAPTER_TYPE_B: {
1063 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1085 struct MessageUnit_B *reg = acb->pmuB;
1064 /* 1086 /*
1065 ** push inbound doorbell tell iop, driver data write ok 1087 ** push inbound doorbell tell iop, driver data write ok
1066 ** and wait reply on next hwinterrupt for next Qbuffer post 1088 ** and wait reply on next hwinterrupt for next Qbuffer post
@@ -1071,41 +1093,41 @@ static void arcmsr_iop_message_wrote(struct AdapterControlBlock *acb)
1071 } 1093 }
1072} 1094}
1073 1095
1074struct QBUFFER *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *acb) 1096struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *acb)
1075{ 1097{
1076 static struct QBUFFER *qbuffer; 1098 struct QBUFFER __iomem *qbuffer = NULL;
1077 1099
1078 switch (acb->adapter_type) { 1100 switch (acb->adapter_type) {
1079 1101
1080 case ACB_ADAPTER_TYPE_A: { 1102 case ACB_ADAPTER_TYPE_A: {
1081 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1103 struct MessageUnit_A __iomem *reg = acb->pmuA;
1082 qbuffer = (struct QBUFFER __iomem *) &reg->message_rbuffer; 1104 qbuffer = (struct QBUFFER __iomem *)&reg->message_rbuffer;
1083 } 1105 }
1084 break; 1106 break;
1085 1107
1086 case ACB_ADAPTER_TYPE_B: { 1108 case ACB_ADAPTER_TYPE_B: {
1087 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1109 struct MessageUnit_B *reg = acb->pmuB;
1088 qbuffer = (struct QBUFFER __iomem *) reg->ioctl_rbuffer_reg; 1110 qbuffer = (struct QBUFFER __iomem *)reg->ioctl_rbuffer_reg;
1089 } 1111 }
1090 break; 1112 break;
1091 } 1113 }
1092 return qbuffer; 1114 return qbuffer;
1093} 1115}
1094 1116
1095static struct QBUFFER *arcmsr_get_iop_wqbuffer(struct AdapterControlBlock *acb) 1117static struct QBUFFER __iomem *arcmsr_get_iop_wqbuffer(struct AdapterControlBlock *acb)
1096{ 1118{
1097 static struct QBUFFER *pqbuffer; 1119 struct QBUFFER __iomem *pqbuffer = NULL;
1098 1120
1099 switch (acb->adapter_type) { 1121 switch (acb->adapter_type) {
1100 1122
1101 case ACB_ADAPTER_TYPE_A: { 1123 case ACB_ADAPTER_TYPE_A: {
1102 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1124 struct MessageUnit_A __iomem *reg = acb->pmuA;
1103 pqbuffer = (struct QBUFFER *) &reg->message_wbuffer; 1125 pqbuffer = (struct QBUFFER __iomem *) &reg->message_wbuffer;
1104 } 1126 }
1105 break; 1127 break;
1106 1128
1107 case ACB_ADAPTER_TYPE_B: { 1129 case ACB_ADAPTER_TYPE_B: {
1108 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1130 struct MessageUnit_B *reg = acb->pmuB;
1109 pqbuffer = (struct QBUFFER __iomem *)reg->ioctl_wbuffer_reg; 1131 pqbuffer = (struct QBUFFER __iomem *)reg->ioctl_wbuffer_reg;
1110 } 1132 }
1111 break; 1133 break;
@@ -1115,15 +1137,15 @@ static struct QBUFFER *arcmsr_get_iop_wqbuffer(struct AdapterControlBlock *acb)
1115 1137
1116static void arcmsr_iop2drv_data_wrote_handle(struct AdapterControlBlock *acb) 1138static void arcmsr_iop2drv_data_wrote_handle(struct AdapterControlBlock *acb)
1117{ 1139{
1118 struct QBUFFER *prbuffer; 1140 struct QBUFFER __iomem *prbuffer;
1119 struct QBUFFER *pQbuffer; 1141 struct QBUFFER *pQbuffer;
1120 uint8_t *iop_data; 1142 uint8_t __iomem *iop_data;
1121 int32_t my_empty_len, iop_len, rqbuf_firstindex, rqbuf_lastindex; 1143 int32_t my_empty_len, iop_len, rqbuf_firstindex, rqbuf_lastindex;
1122 1144
1123 rqbuf_lastindex = acb->rqbuf_lastindex; 1145 rqbuf_lastindex = acb->rqbuf_lastindex;
1124 rqbuf_firstindex = acb->rqbuf_firstindex; 1146 rqbuf_firstindex = acb->rqbuf_firstindex;
1125 prbuffer = arcmsr_get_iop_rqbuffer(acb); 1147 prbuffer = arcmsr_get_iop_rqbuffer(acb);
1126 iop_data = (uint8_t *)prbuffer->data; 1148 iop_data = (uint8_t __iomem *)prbuffer->data;
1127 iop_len = prbuffer->data_len; 1149 iop_len = prbuffer->data_len;
1128 my_empty_len = (rqbuf_firstindex - rqbuf_lastindex -1)&(ARCMSR_MAX_QBUFFER -1); 1150 my_empty_len = (rqbuf_firstindex - rqbuf_lastindex -1)&(ARCMSR_MAX_QBUFFER -1);
1129 1151
@@ -1151,8 +1173,8 @@ static void arcmsr_iop2drv_data_read_handle(struct AdapterControlBlock *acb)
1151 acb->acb_flags |= ACB_F_MESSAGE_WQBUFFER_READED; 1173 acb->acb_flags |= ACB_F_MESSAGE_WQBUFFER_READED;
1152 if (acb->wqbuf_firstindex != acb->wqbuf_lastindex) { 1174 if (acb->wqbuf_firstindex != acb->wqbuf_lastindex) {
1153 uint8_t *pQbuffer; 1175 uint8_t *pQbuffer;
1154 struct QBUFFER *pwbuffer; 1176 struct QBUFFER __iomem *pwbuffer;
1155 uint8_t *iop_data; 1177 uint8_t __iomem *iop_data;
1156 int32_t allxfer_len = 0; 1178 int32_t allxfer_len = 0;
1157 1179
1158 acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READED); 1180 acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READED);
@@ -1181,7 +1203,7 @@ static void arcmsr_iop2drv_data_read_handle(struct AdapterControlBlock *acb)
1181static void arcmsr_hba_doorbell_isr(struct AdapterControlBlock *acb) 1203static void arcmsr_hba_doorbell_isr(struct AdapterControlBlock *acb)
1182{ 1204{
1183 uint32_t outbound_doorbell; 1205 uint32_t outbound_doorbell;
1184 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1206 struct MessageUnit_A __iomem *reg = acb->pmuA;
1185 1207
1186 outbound_doorbell = readl(&reg->outbound_doorbell); 1208 outbound_doorbell = readl(&reg->outbound_doorbell);
1187 writel(outbound_doorbell, &reg->outbound_doorbell); 1209 writel(outbound_doorbell, &reg->outbound_doorbell);
@@ -1197,7 +1219,7 @@ static void arcmsr_hba_doorbell_isr(struct AdapterControlBlock *acb)
1197static void arcmsr_hba_postqueue_isr(struct AdapterControlBlock *acb) 1219static void arcmsr_hba_postqueue_isr(struct AdapterControlBlock *acb)
1198{ 1220{
1199 uint32_t flag_ccb; 1221 uint32_t flag_ccb;
1200 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1222 struct MessageUnit_A __iomem *reg = acb->pmuA;
1201 1223
1202 while ((flag_ccb = readl(&reg->outbound_queueport)) != 0xFFFFFFFF) { 1224 while ((flag_ccb = readl(&reg->outbound_queueport)) != 0xFFFFFFFF) {
1203 arcmsr_drain_donequeue(acb, flag_ccb); 1225 arcmsr_drain_donequeue(acb, flag_ccb);
@@ -1208,7 +1230,7 @@ static void arcmsr_hbb_postqueue_isr(struct AdapterControlBlock *acb)
1208{ 1230{
1209 uint32_t index; 1231 uint32_t index;
1210 uint32_t flag_ccb; 1232 uint32_t flag_ccb;
1211 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1233 struct MessageUnit_B *reg = acb->pmuB;
1212 1234
1213 index = reg->doneq_index; 1235 index = reg->doneq_index;
1214 1236
@@ -1224,7 +1246,7 @@ static void arcmsr_hbb_postqueue_isr(struct AdapterControlBlock *acb)
1224static int arcmsr_handle_hba_isr(struct AdapterControlBlock *acb) 1246static int arcmsr_handle_hba_isr(struct AdapterControlBlock *acb)
1225{ 1247{
1226 uint32_t outbound_intstatus; 1248 uint32_t outbound_intstatus;
1227 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1249 struct MessageUnit_A __iomem *reg = acb->pmuA;
1228 1250
1229 outbound_intstatus = readl(&reg->outbound_intstatus) & \ 1251 outbound_intstatus = readl(&reg->outbound_intstatus) & \
1230 acb->outbound_int_enable; 1252 acb->outbound_int_enable;
@@ -1244,7 +1266,7 @@ static int arcmsr_handle_hba_isr(struct AdapterControlBlock *acb)
1244static int arcmsr_handle_hbb_isr(struct AdapterControlBlock *acb) 1266static int arcmsr_handle_hbb_isr(struct AdapterControlBlock *acb)
1245{ 1267{
1246 uint32_t outbound_doorbell; 1268 uint32_t outbound_doorbell;
1247 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1269 struct MessageUnit_B *reg = acb->pmuB;
1248 1270
1249 outbound_doorbell = readl(reg->iop2drv_doorbell_reg) & \ 1271 outbound_doorbell = readl(reg->iop2drv_doorbell_reg) & \
1250 acb->outbound_int_enable; 1272 acb->outbound_int_enable;
@@ -1305,8 +1327,8 @@ void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *acb)
1305{ 1327{
1306 int32_t wqbuf_firstindex, wqbuf_lastindex; 1328 int32_t wqbuf_firstindex, wqbuf_lastindex;
1307 uint8_t *pQbuffer; 1329 uint8_t *pQbuffer;
1308 struct QBUFFER *pwbuffer; 1330 struct QBUFFER __iomem *pwbuffer;
1309 uint8_t *iop_data; 1331 uint8_t __iomem *iop_data;
1310 int32_t allxfer_len = 0; 1332 int32_t allxfer_len = 0;
1311 1333
1312 pwbuffer = arcmsr_get_iop_wqbuffer(acb); 1334 pwbuffer = arcmsr_get_iop_wqbuffer(acb);
@@ -1380,13 +1402,13 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, \
1380 } 1402 }
1381 if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) { 1403 if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
1382 1404
1383 struct QBUFFER *prbuffer; 1405 struct QBUFFER __iomem *prbuffer;
1384 uint8_t *iop_data; 1406 uint8_t __iomem *iop_data;
1385 int32_t iop_len; 1407 int32_t iop_len;
1386 1408
1387 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; 1409 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
1388 prbuffer = arcmsr_get_iop_rqbuffer(acb); 1410 prbuffer = arcmsr_get_iop_rqbuffer(acb);
1389 iop_data = (uint8_t *)prbuffer->data; 1411 iop_data = prbuffer->data;
1390 iop_len = readl(&prbuffer->data_len); 1412 iop_len = readl(&prbuffer->data_len);
1391 while (iop_len > 0) { 1413 while (iop_len > 0) {
1392 acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data); 1414 acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data);
@@ -1669,11 +1691,11 @@ static int arcmsr_queue_command(struct scsi_cmnd *cmd,
1669 1691
1670static void arcmsr_get_hba_config(struct AdapterControlBlock *acb) 1692static void arcmsr_get_hba_config(struct AdapterControlBlock *acb)
1671{ 1693{
1672 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1694 struct MessageUnit_A __iomem *reg = acb->pmuA;
1673 char *acb_firm_model = acb->firm_model; 1695 char *acb_firm_model = acb->firm_model;
1674 char *acb_firm_version = acb->firm_version; 1696 char *acb_firm_version = acb->firm_version;
1675 char *iop_firm_model = (char *) (&reg->message_rwbuffer[15]); 1697 char __iomem *iop_firm_model = (char __iomem *)(&reg->message_rwbuffer[15]);
1676 char *iop_firm_version = (char *) (&reg->message_rwbuffer[17]); 1698 char __iomem *iop_firm_version = (char __iomem *)(&reg->message_rwbuffer[17]);
1677 int count; 1699 int count;
1678 1700
1679 writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, &reg->inbound_msgaddr0); 1701 writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, &reg->inbound_msgaddr0);
@@ -1710,13 +1732,13 @@ static void arcmsr_get_hba_config(struct AdapterControlBlock *acb)
1710 1732
1711static void arcmsr_get_hbb_config(struct AdapterControlBlock *acb) 1733static void arcmsr_get_hbb_config(struct AdapterControlBlock *acb)
1712{ 1734{
1713 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1735 struct MessageUnit_B *reg = acb->pmuB;
1714 uint32_t *lrwbuffer = reg->msgcode_rwbuffer_reg; 1736 uint32_t __iomem *lrwbuffer = reg->msgcode_rwbuffer_reg;
1715 char *acb_firm_model = acb->firm_model; 1737 char *acb_firm_model = acb->firm_model;
1716 char *acb_firm_version = acb->firm_version; 1738 char *acb_firm_version = acb->firm_version;
1717 char *iop_firm_model = (char *) (&lrwbuffer[15]); 1739 char __iomem *iop_firm_model = (char __iomem *)(&lrwbuffer[15]);
1718 /*firm_model,15,60-67*/ 1740 /*firm_model,15,60-67*/
1719 char *iop_firm_version = (char *) (&lrwbuffer[17]); 1741 char __iomem *iop_firm_version = (char __iomem *)(&lrwbuffer[17]);
1720 /*firm_version,17,68-83*/ 1742 /*firm_version,17,68-83*/
1721 int count; 1743 int count;
1722 1744
@@ -1777,7 +1799,7 @@ static void arcmsr_get_firmware_spec(struct AdapterControlBlock *acb)
1777static void arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb, 1799static void arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb,
1778 struct CommandControlBlock *poll_ccb) 1800 struct CommandControlBlock *poll_ccb)
1779{ 1801{
1780 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1802 struct MessageUnit_A __iomem *reg = acb->pmuA;
1781 struct CommandControlBlock *ccb; 1803 struct CommandControlBlock *ccb;
1782 uint32_t flag_ccb, outbound_intstatus, poll_ccb_done = 0, poll_count = 0; 1804 uint32_t flag_ccb, outbound_intstatus, poll_ccb_done = 0, poll_count = 0;
1783 1805
@@ -1826,7 +1848,7 @@ static void arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb,
1826static void arcmsr_polling_hbb_ccbdone(struct AdapterControlBlock *acb, \ 1848static void arcmsr_polling_hbb_ccbdone(struct AdapterControlBlock *acb, \
1827 struct CommandControlBlock *poll_ccb) 1849 struct CommandControlBlock *poll_ccb)
1828{ 1850{
1829 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1851 struct MessageUnit_B *reg = acb->pmuB;
1830 struct CommandControlBlock *ccb; 1852 struct CommandControlBlock *ccb;
1831 uint32_t flag_ccb, poll_ccb_done = 0, poll_count = 0; 1853 uint32_t flag_ccb, poll_ccb_done = 0, poll_count = 0;
1832 int index; 1854 int index;
@@ -1918,8 +1940,7 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb)
1918 1940
1919 case ACB_ADAPTER_TYPE_A: { 1941 case ACB_ADAPTER_TYPE_A: {
1920 if (ccb_phyaddr_hi32 != 0) { 1942 if (ccb_phyaddr_hi32 != 0) {
1921 struct MessageUnit_A __iomem *reg = \ 1943 struct MessageUnit_A __iomem *reg = acb->pmuA;
1922 (struct MessageUnit_A *)acb->pmu;
1923 uint32_t intmask_org; 1944 uint32_t intmask_org;
1924 intmask_org = arcmsr_disable_outbound_ints(acb); 1945 intmask_org = arcmsr_disable_outbound_ints(acb);
1925 writel(ARCMSR_SIGNATURE_SET_CONFIG, \ 1946 writel(ARCMSR_SIGNATURE_SET_CONFIG, \
@@ -1940,9 +1961,9 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb)
1940 1961
1941 case ACB_ADAPTER_TYPE_B: { 1962 case ACB_ADAPTER_TYPE_B: {
1942 unsigned long post_queue_phyaddr; 1963 unsigned long post_queue_phyaddr;
1943 uint32_t *rwbuffer; 1964 uint32_t __iomem *rwbuffer;
1944 1965
1945 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1966 struct MessageUnit_B *reg = acb->pmuB;
1946 uint32_t intmask_org; 1967 uint32_t intmask_org;
1947 intmask_org = arcmsr_disable_outbound_ints(acb); 1968 intmask_org = arcmsr_disable_outbound_ints(acb);
1948 reg->postq_index = 0; 1969 reg->postq_index = 0;
@@ -1994,7 +2015,7 @@ static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb)
1994 switch (acb->adapter_type) { 2015 switch (acb->adapter_type) {
1995 2016
1996 case ACB_ADAPTER_TYPE_A: { 2017 case ACB_ADAPTER_TYPE_A: {
1997 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 2018 struct MessageUnit_A __iomem *reg = acb->pmuA;
1998 do { 2019 do {
1999 firmware_state = readl(&reg->outbound_msgaddr1); 2020 firmware_state = readl(&reg->outbound_msgaddr1);
2000 } while ((firmware_state & ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK) == 0); 2021 } while ((firmware_state & ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK) == 0);
@@ -2002,7 +2023,7 @@ static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb)
2002 break; 2023 break;
2003 2024
2004 case ACB_ADAPTER_TYPE_B: { 2025 case ACB_ADAPTER_TYPE_B: {
2005 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 2026 struct MessageUnit_B *reg = acb->pmuB;
2006 do { 2027 do {
2007 firmware_state = readl(reg->iop2drv_doorbell_reg); 2028 firmware_state = readl(reg->iop2drv_doorbell_reg);
2008 } while ((firmware_state & ARCMSR_MESSAGE_FIRMWARE_OK) == 0); 2029 } while ((firmware_state & ARCMSR_MESSAGE_FIRMWARE_OK) == 0);
@@ -2013,7 +2034,7 @@ static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb)
2013 2034
2014static void arcmsr_start_hba_bgrb(struct AdapterControlBlock *acb) 2035static void arcmsr_start_hba_bgrb(struct AdapterControlBlock *acb)
2015{ 2036{
2016 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 2037 struct MessageUnit_A __iomem *reg = acb->pmuA;
2017 acb->acb_flags |= ACB_F_MSG_START_BGRB; 2038 acb->acb_flags |= ACB_F_MSG_START_BGRB;
2018 writel(ARCMSR_INBOUND_MESG0_START_BGRB, &reg->inbound_msgaddr0); 2039 writel(ARCMSR_INBOUND_MESG0_START_BGRB, &reg->inbound_msgaddr0);
2019 if (arcmsr_hba_wait_msgint_ready(acb)) { 2040 if (arcmsr_hba_wait_msgint_ready(acb)) {
@@ -2024,7 +2045,7 @@ static void arcmsr_start_hba_bgrb(struct AdapterControlBlock *acb)
2024 2045
2025static void arcmsr_start_hbb_bgrb(struct AdapterControlBlock *acb) 2046static void arcmsr_start_hbb_bgrb(struct AdapterControlBlock *acb)
2026{ 2047{
2027 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 2048 struct MessageUnit_B *reg = acb->pmuB;
2028 acb->acb_flags |= ACB_F_MSG_START_BGRB; 2049 acb->acb_flags |= ACB_F_MSG_START_BGRB;
2029 writel(ARCMSR_MESSAGE_START_BGRB, reg->drv2iop_doorbell_reg); 2050 writel(ARCMSR_MESSAGE_START_BGRB, reg->drv2iop_doorbell_reg);
2030 if (arcmsr_hbb_wait_msgint_ready(acb)) { 2051 if (arcmsr_hbb_wait_msgint_ready(acb)) {
@@ -2049,7 +2070,7 @@ static void arcmsr_clear_doorbell_queue_buffer(struct AdapterControlBlock *acb)
2049{ 2070{
2050 switch (acb->adapter_type) { 2071 switch (acb->adapter_type) {
2051 case ACB_ADAPTER_TYPE_A: { 2072 case ACB_ADAPTER_TYPE_A: {
2052 struct MessageUnit_A *reg = (struct MessageUnit_A *)acb->pmu; 2073 struct MessageUnit_A __iomem *reg = acb->pmuA;
2053 uint32_t outbound_doorbell; 2074 uint32_t outbound_doorbell;
2054 /* empty doorbell Qbuffer if door bell ringed */ 2075 /* empty doorbell Qbuffer if door bell ringed */
2055 outbound_doorbell = readl(&reg->outbound_doorbell); 2076 outbound_doorbell = readl(&reg->outbound_doorbell);
@@ -2060,7 +2081,7 @@ static void arcmsr_clear_doorbell_queue_buffer(struct AdapterControlBlock *acb)
2060 break; 2081 break;
2061 2082
2062 case ACB_ADAPTER_TYPE_B: { 2083 case ACB_ADAPTER_TYPE_B: {
2063 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 2084 struct MessageUnit_B *reg = acb->pmuB;
2064 /*clear interrupt and message state*/ 2085 /*clear interrupt and message state*/
2065 writel(ARCMSR_MESSAGE_INT_CLEAR_PATTERN, reg->iop2drv_doorbell_reg); 2086 writel(ARCMSR_MESSAGE_INT_CLEAR_PATTERN, reg->iop2drv_doorbell_reg);
2066 writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg); 2087 writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg);
diff --git a/drivers/scsi/arm/scsi.h b/drivers/scsi/arm/scsi.h
index 21ba57155bea..bb6550e31926 100644
--- a/drivers/scsi/arm/scsi.h
+++ b/drivers/scsi/arm/scsi.h
@@ -38,9 +38,7 @@ static inline int next_SCp(struct scsi_pointer *SCp)
38 if (ret) { 38 if (ret) {
39 SCp->buffer++; 39 SCp->buffer++;
40 SCp->buffers_residual--; 40 SCp->buffers_residual--;
41 SCp->ptr = (char *) 41 SCp->ptr = sg_virt(SCp->buffer);
42 (page_address(SCp->buffer->page) +
43 SCp->buffer->offset);
44 SCp->this_residual = SCp->buffer->length; 42 SCp->this_residual = SCp->buffer->length;
45 } else { 43 } else {
46 SCp->ptr = NULL; 44 SCp->ptr = NULL;
@@ -76,9 +74,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
76 74
77 SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; 75 SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
78 SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; 76 SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
79 SCpnt->SCp.ptr = (char *) 77 SCpnt->SCp.ptr = sg_virt(SCpnt->SCp.buffer);
80 (page_address(SCpnt->SCp.buffer->page) +
81 SCpnt->SCp.buffer->offset);
82 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; 78 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
83 SCpnt->SCp.phase = SCpnt->request_bufflen; 79 SCpnt->SCp.phase = SCpnt->request_bufflen;
84 80
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index d1780980fb20..a9680b5e8ac6 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -477,10 +477,9 @@ static void merge_contiguous_buffers(Scsi_Cmnd *cmd)
477 477
478 for (endaddr = virt_to_phys(cmd->SCp.ptr + cmd->SCp.this_residual - 1) + 1; 478 for (endaddr = virt_to_phys(cmd->SCp.ptr + cmd->SCp.this_residual - 1) + 1;
479 cmd->SCp.buffers_residual && 479 cmd->SCp.buffers_residual &&
480 virt_to_phys(page_address(cmd->SCp.buffer[1].page) + 480 virt_to_phys(sg_virt(&cmd->SCp.buffer[1])) == endaddr;) {
481 cmd->SCp.buffer[1].offset) == endaddr;) {
482 MER_PRINTK("VTOP(%p) == %08lx -> merging\n", 481 MER_PRINTK("VTOP(%p) == %08lx -> merging\n",
483 page_address(cmd->SCp.buffer[1].page), endaddr); 482 page_address(sg_page(&cmd->SCp.buffer[1])), endaddr);
484#if (NDEBUG & NDEBUG_MERGING) 483#if (NDEBUG & NDEBUG_MERGING)
485 ++cnt; 484 ++cnt;
486#endif 485#endif
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 439b97a6a269..0841df01bc19 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -2890,7 +2890,7 @@ static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len)
2890 return NULL; 2890 return NULL;
2891 } 2891 }
2892 2892
2893 sg_set_page(&scatterlist[i], page); 2893 sg_set_page(&scatterlist[i], page, 0, 0);
2894 } 2894 }
2895 2895
2896 return sglist; 2896 return sglist;
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 6ce4109efdf3..4bcf916c21a7 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -79,9 +79,7 @@ static inline void
79iscsi_buf_init_sg(struct iscsi_buf *ibuf, struct scatterlist *sg) 79iscsi_buf_init_sg(struct iscsi_buf *ibuf, struct scatterlist *sg)
80{ 80{
81 sg_init_table(&ibuf->sg, 1); 81 sg_init_table(&ibuf->sg, 1);
82 sg_set_page(&ibuf->sg, sg_page(sg)); 82 sg_set_page(&ibuf->sg, sg_page(sg), sg->length, sg->offset);
83 ibuf->sg.offset = sg->offset;
84 ibuf->sg.length = sg->length;
85 /* 83 /*
86 * Fastpath: sg element fits into single page 84 * Fastpath: sg element fits into single page
87 */ 85 */
@@ -676,9 +674,8 @@ partial_sg_digest_update(struct hash_desc *desc, struct scatterlist *sg,
676{ 674{
677 struct scatterlist temp; 675 struct scatterlist temp;
678 676
679 memcpy(&temp, sg, sizeof(struct scatterlist)); 677 sg_init_table(&temp, 1);
680 temp.offset = offset; 678 sg_set_page(&temp, sg_page(sg), length, offset);
681 temp.length = length;
682 crypto_hash_update(desc, &temp, length); 679 crypto_hash_update(desc, &temp, length);
683} 680}
684 681
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 1c5c4b68f20f..4652ad22516b 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -5256,8 +5256,7 @@ static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma)
5256 5256
5257 STbuffer->sg[0].offset = 0; 5257 STbuffer->sg[0].offset = 0;
5258 if (page != NULL) { 5258 if (page != NULL) {
5259 sg_set_page(&STbuffer->sg[0], page); 5259 sg_set_page(&STbuffer->sg[0], page, b_size, 0);
5260 STbuffer->sg[0].length = b_size;
5261 STbuffer->b_data = page_address(page); 5260 STbuffer->b_data = page_address(page);
5262 break; 5261 break;
5263 } 5262 }
@@ -5285,8 +5284,7 @@ static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma)
5285 normalize_buffer(STbuffer); 5284 normalize_buffer(STbuffer);
5286 return 0; 5285 return 0;
5287 } 5286 }
5288 sg_set_page(&STbuffer->sg[segs], page); 5287 sg_set_page(&STbuffer->sg[segs], page, (OS_FRAME_SIZE - got <= PAGE_SIZE / 2) ? (OS_FRAME_SIZE - got) : b_size, 0);
5289 STbuffer->sg[segs].length = (OS_FRAME_SIZE - got <= PAGE_SIZE / 2) ? (OS_FRAME_SIZE - got) : b_size;
5290 got += STbuffer->sg[segs].length; 5288 got += STbuffer->sg[segs].length;
5291 STbuffer->buffer_size = got; 5289 STbuffer->buffer_size = got;
5292 STbuffer->sg_segs = ++segs; 5290 STbuffer->sg_segs = ++segs;
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index cc1971002846..f1871ea04045 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
1652 schp->buffer = kzalloc(sg_bufflen, gfp_flags); 1652 schp->buffer = kzalloc(sg_bufflen, gfp_flags);
1653 if (!schp->buffer) 1653 if (!schp->buffer)
1654 return -ENOMEM; 1654 return -ENOMEM;
1655 sg_init_table(schp->buffer, tablesize);
1655 schp->sglist_len = sg_bufflen; 1656 schp->sglist_len = sg_bufflen;
1656 return tablesize; /* number of scat_gath elements allocated */ 1657 return tablesize; /* number of scat_gath elements allocated */
1657} 1658}
@@ -1717,16 +1718,12 @@ st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages,
1717 goto out_unlock; */ 1718 goto out_unlock; */
1718 } 1719 }
1719 1720
1720 sg_set_page(sgl, pages[0]); 1721 sg_set_page(sgl, pages[0], 0, uaddr & ~PAGE_MASK);
1721 sgl[0].offset = uaddr & ~PAGE_MASK;
1722 if (nr_pages > 1) { 1722 if (nr_pages > 1) {
1723 sgl[0].length = PAGE_SIZE - sgl[0].offset; 1723 sgl[0].length = PAGE_SIZE - sgl[0].offset;
1724 count -= sgl[0].length; 1724 count -= sgl[0].length;
1725 for (i=1; i < nr_pages ; i++) { 1725 for (i=1; i < nr_pages ; i++)
1726 sg_set_page(&sgl[i], pages[i]); 1726 sg_set_page(&sgl[i], pages[i], count < PAGE_SIZE ? count : PAGE_SIZE, 0);
1727 sgl[i].length = count < PAGE_SIZE ? count : PAGE_SIZE;
1728 count -= PAGE_SIZE;
1729 }
1730 } 1727 }
1731 else { 1728 else {
1732 sgl[0].length = count; 1729 sgl[0].length = count;
@@ -1854,8 +1851,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
1854 scatter_elem_sz_prev = ret_sz; 1851 scatter_elem_sz_prev = ret_sz;
1855 } 1852 }
1856 } 1853 }
1857 sg_set_page(sg, p); 1854 sg_set_page(sg, p, (ret_sz > num) ? num : ret_sz, 0);
1858 sg->length = (ret_sz > num) ? num : ret_sz;
1859 1855
1860 SCSI_LOG_TIMEOUT(5, printk("sg_build_indirect: k=%d, num=%d, " 1856 SCSI_LOG_TIMEOUT(5, printk("sg_build_indirect: k=%d, num=%d, "
1861 "ret_sz=%d\n", k, num, ret_sz)); 1857 "ret_sz=%d\n", k, num, ret_sz));
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index ce69b9efc102..98dfd6ea209c 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3797,13 +3797,11 @@ static void buf_to_sg(struct st_buffer *STbp, unsigned int length)
3797 sg = &(STbp->sg[0]); 3797 sg = &(STbp->sg[0]);
3798 frp = STbp->frp; 3798 frp = STbp->frp;
3799 for (i=count=0; count < length; i++) { 3799 for (i=count=0; count < length; i++) {
3800 sg_set_page(&sg[i], frp[i].page);
3801 if (length - count > frp[i].length) 3800 if (length - count > frp[i].length)
3802 sg[i].length = frp[i].length; 3801 sg_set_page(&sg[i], frp[i].page, frp[i].length, 0);
3803 else 3802 else
3804 sg[i].length = length - count; 3803 sg_set_page(&sg[i], frp[i].page, length - count, 0);
3805 count += sg[i].length; 3804 count += sg[i].length;
3806 sg[i].offset = 0;
3807 } 3805 }
3808 STbp->sg_segs = i; 3806 STbp->sg_segs = i;
3809 STbp->frp_sg_current = length; 3807 STbp->frp_sg_current = length;
@@ -4446,15 +4444,13 @@ static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int max_pa
4446 } 4444 }
4447 4445
4448 /* Populate the scatter/gather list */ 4446 /* Populate the scatter/gather list */
4449 sg_set_page(&sgl[0], pages[0]); 4447 sg_set_page(&sgl[0], pages[0], 0, uaddr & ~PAGE_MASK);
4450 sgl[0].offset = uaddr & ~PAGE_MASK;
4451 if (nr_pages > 1) { 4448 if (nr_pages > 1) {
4452 sgl[0].length = PAGE_SIZE - sgl[0].offset; 4449 sgl[0].length = PAGE_SIZE - sgl[0].offset;
4453 count -= sgl[0].length; 4450 count -= sgl[0].length;
4454 for (i=1; i < nr_pages ; i++) { 4451 for (i=1; i < nr_pages ; i++) {
4455 sg_set_page(&sgl[i], pages[i]);; 4452 sg_set_page(&sgl[i], pages[i],
4456 sgl[i].offset = 0; 4453 count < PAGE_SIZE ? count : PAGE_SIZE, 0);;
4457 sgl[i].length = count < PAGE_SIZE ? count : PAGE_SIZE;
4458 count -= PAGE_SIZE; 4454 count -= PAGE_SIZE;
4459 } 4455 }
4460 } 4456 }
diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
index 80fb3f88af2e..1bc41907a038 100644
--- a/drivers/scsi/sun3x_esp.c
+++ b/drivers/scsi/sun3x_esp.c
@@ -332,8 +332,8 @@ static void dma_mmu_get_scsi_sgl (struct NCR_ESP *esp, Scsi_Cmnd *sp)
332 struct scatterlist *sg = sp->SCp.buffer; 332 struct scatterlist *sg = sp->SCp.buffer;
333 333
334 while (sz >= 0) { 334 while (sz >= 0) {
335 sg[sz].dma_address = dvma_map((unsigned long)page_address(sg[sz].page) + 335 sg[sz].dma_address = dvma_map((unsigned long)sg_virt(&sg[sz]),
336 sg[sz].offset, sg[sz].length); 336 sg[sz].length);
337 sz--; 337 sz--;
338 } 338 }
339 sp->SCp.ptr=(char *)((unsigned long)sp->SCp.buffer->dma_address); 339 sp->SCp.ptr=(char *)((unsigned long)sp->SCp.buffer->dma_address);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 103189095c80..3bb5d241dd40 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1875,6 +1875,7 @@ uart_set_options(struct uart_port *port, struct console *co,
1875 int baud, int parity, int bits, int flow) 1875 int baud, int parity, int bits, int flow)
1876{ 1876{
1877 struct ktermios termios; 1877 struct ktermios termios;
1878 static struct ktermios dummy;
1878 int i; 1879 int i;
1879 1880
1880 /* 1881 /*
@@ -1920,7 +1921,7 @@ uart_set_options(struct uart_port *port, struct console *co,
1920 */ 1921 */
1921 port->mctrl |= TIOCM_DTR; 1922 port->mctrl |= TIOCM_DTR;
1922 1923
1923 port->ops->set_termios(port, &termios, NULL); 1924 port->ops->set_termios(port, &termios, &dummy);
1924 co->cflag = termios.c_cflag; 1925 co->cflag = termios.c_cflag;
1925 1926
1926 return 0; 1927 return 0;
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 5afcb2fa7cd3..d8b660061c13 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -345,7 +345,7 @@ static int serial_probe(struct pcmcia_device *link)
345 345
346 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 346 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
347 link->io.NumPorts1 = 8; 347 link->io.NumPorts1 = 8;
348 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 348 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
349 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 349 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
350 link->conf.Attributes = CONF_ENABLE_IRQ; 350 link->conf.Attributes = CONF_ENABLE_IRQ;
351 if (do_sound) { 351 if (do_sound) {
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
index 6846a6c38b6d..7ad21925869a 100644
--- a/drivers/serial/serial_txx9.c
+++ b/drivers/serial/serial_txx9.c
@@ -657,7 +657,15 @@ static void
657serial_txx9_pm(struct uart_port *port, unsigned int state, 657serial_txx9_pm(struct uart_port *port, unsigned int state,
658 unsigned int oldstate) 658 unsigned int oldstate)
659{ 659{
660 if (state == 0) 660 /*
661 * If oldstate was -1 this is called from
662 * uart_configure_port(). In this case do not initialize the
663 * port now, because the port was already initialized (for
664 * non-console port) or should not be initialized here (for
665 * console port). If we initialized the port here we lose
666 * serial console settings.
667 */
668 if (state == 0 && oldstate != -1)
661 serial_txx9_initialize(port); 669 serial_txx9_initialize(port);
662} 670}
663 671
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 161d1021b7eb..e52a6296ca46 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -601,8 +601,7 @@ static int match_maple_bus_driver(struct device *devptr,
601 return 0; 601 return 0;
602} 602}
603 603
604static int maple_bus_uevent(struct device *dev, char **envp, 604static int maple_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
605 int num_envp, char *buffer, int buffer_size)
606{ 605{
607 return 0; 606 return 0;
608} 607}
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index c55459c592b8..b3518ca9f04e 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -184,14 +184,14 @@ static int spidev_message(struct spidev_data *spidev,
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, (u8 __user *) 186 if (!access_ok(VERIFY_WRITE, (u8 __user *)
187 (ptrdiff_t) u_tmp->rx_buf, 187 (uintptr_t) u_tmp->rx_buf,
188 u_tmp->len)) 188 u_tmp->len))
189 goto done; 189 goto done;
190 } 190 }
191 if (u_tmp->tx_buf) { 191 if (u_tmp->tx_buf) {
192 k_tmp->tx_buf = buf; 192 k_tmp->tx_buf = buf;
193 if (copy_from_user(buf, (const u8 __user *) 193 if (copy_from_user(buf, (const u8 __user *)
194 (ptrdiff_t) u_tmp->tx_buf, 194 (uintptr_t) u_tmp->tx_buf,
195 u_tmp->len)) 195 u_tmp->len))
196 goto done; 196 goto done;
197 } 197 }
@@ -224,7 +224,7 @@ static int spidev_message(struct spidev_data *spidev,
224 for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { 224 for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) {
225 if (u_tmp->rx_buf) { 225 if (u_tmp->rx_buf) {
226 if (__copy_to_user((u8 __user *) 226 if (__copy_to_user((u8 __user *)
227 (ptrdiff_t) u_tmp->rx_buf, buf, 227 (uintptr_t) u_tmp->rx_buf, buf,
228 u_tmp->len)) { 228 u_tmp->len)) {
229 status = -EFAULT; 229 status = -EFAULT;
230 goto done; 230 goto done;
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 8bdaa157ffe7..316a746e0080 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -434,7 +434,7 @@ int usb_sg_init (
434 if (dma) { 434 if (dma) {
435 io->urbs [i]->transfer_dma = sg_dma_address (sg + i); 435 io->urbs [i]->transfer_dma = sg_dma_address (sg + i);
436 len = sg_dma_len (sg + i); 436 len = sg_dma_len (sg + i);
437#if defined(CONFIG_HIGHMEM) || defined(CONFIG_IOMMU) 437#if defined(CONFIG_HIGHMEM) || defined(CONFIG_GART_IOMMU)
438 io->urbs[i]->transfer_buffer = NULL; 438 io->urbs[i]->transfer_buffer = NULL;
439#else 439#else
440 io->urbs[i]->transfer_buffer = sg_virt(&sg[i]); 440 io->urbs[i]->transfer_buffer = sg_virt(&sg[i]);
@@ -1641,7 +1641,13 @@ free_interfaces:
1641 intf->dev.bus_id, ret); 1641 intf->dev.bus_id, ret);
1642 continue; 1642 continue;
1643 } 1643 }
1644 usb_create_sysfs_intf_files (intf); 1644
1645 /* The driver's probe method can call usb_set_interface(),
1646 * which would mean the interface's sysfs files are already
1647 * created. Just in case, we'll remove them first.
1648 */
1649 usb_remove_sysfs_intf_files(intf);
1650 usb_create_sysfs_intf_files(intf);
1645 } 1651 }
1646 1652
1647 usb_autosuspend_device(dev); 1653 usb_autosuspend_device(dev);
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index c20c03aaf012..d05ead20081c 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -372,7 +372,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
372 372
373 /* enforce simple/standard policy */ 373 /* enforce simple/standard policy */
374 allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP | 374 allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP |
375 URB_NO_INTERRUPT | URB_DIR_MASK); 375 URB_NO_INTERRUPT | URB_DIR_MASK | URB_FREE_BUFFER);
376 switch (xfertype) { 376 switch (xfertype) {
377 case USB_ENDPOINT_XFER_BULK: 377 case USB_ENDPOINT_XFER_BULK:
378 if (is_out) 378 if (is_out)
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index 1c8040602525..c72e9620bf8d 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -3289,7 +3289,7 @@ static int udc_pci_probe(
3289 dev->chiprev = pdev->revision; 3289 dev->chiprev = pdev->revision;
3290 3290
3291 pci_set_master(pdev); 3291 pci_set_master(pdev);
3292 pci_set_mwi(pdev); 3292 pci_try_set_mwi(pdev);
3293 3293
3294 /* init dma pools */ 3294 /* init dma pools */
3295 if (use_dma) { 3295 if (use_dma) {
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index c978d622fa8a..177e78ed241b 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -156,7 +156,7 @@ config USB_OHCI_HCD_PCI
156 156
157config USB_OHCI_HCD_SSB 157config USB_OHCI_HCD_SSB
158 bool "OHCI support for Broadcom SSB OHCI core" 158 bool "OHCI support for Broadcom SSB OHCI core"
159 depends on USB_OHCI_HCD && SSB && EXPERIMENTAL 159 depends on USB_OHCI_HCD && (SSB = y || SSB = CONFIG_USB_OHCI_HCD) && EXPERIMENTAL
160 default n 160 default n
161 ---help--- 161 ---help---
162 Support for the Sonics Silicon Backplane (SSB) attached 162 Support for the Sonics Silicon Backplane (SSB) attached
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 240c7f507541..704f33fdd2f1 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -80,7 +80,10 @@ static const char hcd_name [] = "ohci_hcd";
80static void ohci_dump (struct ohci_hcd *ohci, int verbose); 80static void ohci_dump (struct ohci_hcd *ohci, int verbose);
81static int ohci_init (struct ohci_hcd *ohci); 81static int ohci_init (struct ohci_hcd *ohci);
82static void ohci_stop (struct usb_hcd *hcd); 82static void ohci_stop (struct usb_hcd *hcd);
83
84#if defined(CONFIG_PM) || defined(CONFIG_PCI)
83static int ohci_restart (struct ohci_hcd *ohci); 85static int ohci_restart (struct ohci_hcd *ohci);
86#endif
84 87
85#include "ohci-hub.c" 88#include "ohci-hub.c"
86#include "ohci-dbg.c" 89#include "ohci-dbg.c"
@@ -396,7 +399,7 @@ static int check_ed(struct ohci_hcd *ohci, struct ed *ed)
396 */ 399 */
397static void unlink_watchdog_func(unsigned long _ohci) 400static void unlink_watchdog_func(unsigned long _ohci)
398{ 401{
399 long flags; 402 unsigned long flags;
400 unsigned max; 403 unsigned max;
401 unsigned seen_count = 0; 404 unsigned seen_count = 0;
402 unsigned i; 405 unsigned i;
@@ -893,6 +896,8 @@ static void ohci_stop (struct usb_hcd *hcd)
893 896
894/*-------------------------------------------------------------------------*/ 897/*-------------------------------------------------------------------------*/
895 898
899#if defined(CONFIG_PM) || defined(CONFIG_PCI)
900
896/* must not be called from interrupt context */ 901/* must not be called from interrupt context */
897static int ohci_restart (struct ohci_hcd *ohci) 902static int ohci_restart (struct ohci_hcd *ohci)
898{ 903{
@@ -954,6 +959,8 @@ static int ohci_restart (struct ohci_hcd *ohci)
954 return 0; 959 return 0;
955} 960}
956 961
962#endif
963
957/*-------------------------------------------------------------------------*/ 964/*-------------------------------------------------------------------------*/
958 965
959#define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC 966#define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index e5d60d5b105a..60379b17bbc1 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -1271,7 +1271,8 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb,
1271 } else if (qh->period != urb->interval) { 1271 } else if (qh->period != urb->interval) {
1272 return -EINVAL; /* Can't change the period */ 1272 return -EINVAL; /* Can't change the period */
1273 1273
1274 } else { /* Pick up where the last URB leaves off */ 1274 } else {
1275 /* Find the next unused frame */
1275 if (list_empty(&qh->queue)) { 1276 if (list_empty(&qh->queue)) {
1276 frame = qh->iso_frame; 1277 frame = qh->iso_frame;
1277 } else { 1278 } else {
@@ -1283,10 +1284,18 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb,
1283 lurb->number_of_packets * 1284 lurb->number_of_packets *
1284 lurb->interval; 1285 lurb->interval;
1285 } 1286 }
1286 if (urb->transfer_flags & URB_ISO_ASAP) 1287 if (urb->transfer_flags & URB_ISO_ASAP) {
1287 urb->start_frame = frame; 1288 /* Skip some frames if necessary to insure
1288 else if (urb->start_frame != frame) 1289 * the start frame is in the future.
1289 return -EINVAL; 1290 */
1291 uhci_get_current_frame_number(uhci);
1292 if (uhci_frame_before_eq(frame, uhci->frame_number)) {
1293 frame = uhci->frame_number + 1;
1294 frame += ((qh->phase - frame) &
1295 (qh->period - 1));
1296 }
1297 } /* Otherwise pick up where the last URB leaves off */
1298 urb->start_frame = frame;
1290 } 1299 }
1291 1300
1292 /* Make sure we won't have to go too far into the future */ 1301 /* Make sure we won't have to go too far into the future */
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
index 2677fea147d9..1cd9e7eba93b 100644
--- a/drivers/usb/misc/cytherm.c
+++ b/drivers/usb/misc/cytherm.c
@@ -399,7 +399,6 @@ static void cytherm_disconnect(struct usb_interface *interface)
399 struct usb_cytherm *dev; 399 struct usb_cytherm *dev;
400 400
401 dev = usb_get_intfdata (interface); 401 dev = usb_get_intfdata (interface);
402 usb_set_intfdata (interface, NULL);
403 402
404 device_remove_file(&interface->dev, &dev_attr_brightness); 403 device_remove_file(&interface->dev, &dev_attr_brightness);
405 device_remove_file(&interface->dev, &dev_attr_temp); 404 device_remove_file(&interface->dev, &dev_attr_temp);
@@ -407,6 +406,9 @@ static void cytherm_disconnect(struct usb_interface *interface)
407 device_remove_file(&interface->dev, &dev_attr_port0); 406 device_remove_file(&interface->dev, &dev_attr_port0);
408 device_remove_file(&interface->dev, &dev_attr_port1); 407 device_remove_file(&interface->dev, &dev_attr_port1);
409 408
409 /* first remove the files, then NULL the pointer */
410 usb_set_intfdata (interface, NULL);
411
410 usb_put_dev(dev->udev); 412 usb_put_dev(dev->udev);
411 413
412 kfree(dev); 414 kfree(dev);
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c
index cd137577bb2d..4a09b87bdd28 100644
--- a/drivers/usb/misc/emi26.c
+++ b/drivers/usb/misc/emi26.c
@@ -114,6 +114,10 @@ static int emi26_load_firmware (struct usb_device *dev)
114 114
115 /* De-assert reset (let the CPU run) */ 115 /* De-assert reset (let the CPU run) */
116 err = emi26_set_reset(dev,0); 116 err = emi26_set_reset(dev,0);
117 if (err < 0) {
118 err("%s - error loading firmware: error = %d", __FUNCTION__, err);
119 goto wraperr;
120 }
117 msleep(250); /* let device settle */ 121 msleep(250); /* let device settle */
118 122
119 /* 2. We upload the FPGA firmware into the EMI 123 /* 2. We upload the FPGA firmware into the EMI
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c
index 4758cc5ccebc..d1362415922c 100644
--- a/drivers/usb/misc/emi62.c
+++ b/drivers/usb/misc/emi62.c
@@ -123,6 +123,10 @@ static int emi62_load_firmware (struct usb_device *dev)
123 123
124 /* De-assert reset (let the CPU run) */ 124 /* De-assert reset (let the CPU run) */
125 err = emi62_set_reset(dev,0); 125 err = emi62_set_reset(dev,0);
126 if (err < 0) {
127 err("%s - error loading firmware: error = %d", __FUNCTION__, err);
128 goto wraperr;
129 }
126 msleep(250); /* let device settle */ 130 msleep(250); /* let device settle */
127 131
128 /* 2. We upload the FPGA firmware into the EMI 132 /* 2. We upload the FPGA firmware into the EMI
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index d3d8cd6ff103..148b7fe639b2 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -147,7 +147,7 @@ struct u132_target {
147/* Structure to hold all of our device specific stuff*/ 147/* Structure to hold all of our device specific stuff*/
148struct usb_ftdi { 148struct usb_ftdi {
149 struct list_head ftdi_list; 149 struct list_head ftdi_list;
150 struct semaphore u132_lock; 150 struct mutex u132_lock;
151 int command_next; 151 int command_next;
152 int command_head; 152 int command_head;
153 struct u132_command command[COMMAND_SIZE]; 153 struct u132_command command[COMMAND_SIZE];
@@ -330,39 +330,39 @@ static int ftdi_elan_hcd_init(struct usb_ftdi *ftdi)
330 330
331static void ftdi_elan_abandon_completions(struct usb_ftdi *ftdi) 331static void ftdi_elan_abandon_completions(struct usb_ftdi *ftdi)
332{ 332{
333 down(&ftdi->u132_lock); 333 mutex_lock(&ftdi->u132_lock);
334 while (ftdi->respond_next > ftdi->respond_head) { 334 while (ftdi->respond_next > ftdi->respond_head) {
335 struct u132_respond *respond = &ftdi->respond[RESPOND_MASK & 335 struct u132_respond *respond = &ftdi->respond[RESPOND_MASK &
336 ftdi->respond_head++]; 336 ftdi->respond_head++];
337 *respond->result = -ESHUTDOWN; 337 *respond->result = -ESHUTDOWN;
338 *respond->value = 0; 338 *respond->value = 0;
339 complete(&respond->wait_completion); 339 complete(&respond->wait_completion);
340 } up(&ftdi->u132_lock); 340 } mutex_unlock(&ftdi->u132_lock);
341} 341}
342 342
343static void ftdi_elan_abandon_targets(struct usb_ftdi *ftdi) 343static void ftdi_elan_abandon_targets(struct usb_ftdi *ftdi)
344{ 344{
345 int ed_number = 4; 345 int ed_number = 4;
346 down(&ftdi->u132_lock); 346 mutex_lock(&ftdi->u132_lock);
347 while (ed_number-- > 0) { 347 while (ed_number-- > 0) {
348 struct u132_target *target = &ftdi->target[ed_number]; 348 struct u132_target *target = &ftdi->target[ed_number];
349 if (target->active == 1) { 349 if (target->active == 1) {
350 target->condition_code = TD_DEVNOTRESP; 350 target->condition_code = TD_DEVNOTRESP;
351 up(&ftdi->u132_lock); 351 mutex_unlock(&ftdi->u132_lock);
352 ftdi_elan_do_callback(ftdi, target, NULL, 0); 352 ftdi_elan_do_callback(ftdi, target, NULL, 0);
353 down(&ftdi->u132_lock); 353 mutex_lock(&ftdi->u132_lock);
354 } 354 }
355 } 355 }
356 ftdi->recieved = 0; 356 ftdi->recieved = 0;
357 ftdi->expected = 4; 357 ftdi->expected = 4;
358 ftdi->ed_found = 0; 358 ftdi->ed_found = 0;
359 up(&ftdi->u132_lock); 359 mutex_unlock(&ftdi->u132_lock);
360} 360}
361 361
362static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) 362static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi)
363{ 363{
364 int ed_number = 4; 364 int ed_number = 4;
365 down(&ftdi->u132_lock); 365 mutex_lock(&ftdi->u132_lock);
366 while (ed_number-- > 0) { 366 while (ed_number-- > 0) {
367 struct u132_target *target = &ftdi->target[ed_number]; 367 struct u132_target *target = &ftdi->target[ed_number];
368 target->abandoning = 1; 368 target->abandoning = 1;
@@ -382,9 +382,9 @@ static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi)
382 ftdi->command_next += 1; 382 ftdi->command_next += 1;
383 ftdi_elan_kick_command_queue(ftdi); 383 ftdi_elan_kick_command_queue(ftdi);
384 } else { 384 } else {
385 up(&ftdi->u132_lock); 385 mutex_unlock(&ftdi->u132_lock);
386 msleep(100); 386 msleep(100);
387 down(&ftdi->u132_lock); 387 mutex_lock(&ftdi->u132_lock);
388 goto wait_1; 388 goto wait_1;
389 } 389 }
390 } 390 }
@@ -404,9 +404,9 @@ static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi)
404 ftdi->command_next += 1; 404 ftdi->command_next += 1;
405 ftdi_elan_kick_command_queue(ftdi); 405 ftdi_elan_kick_command_queue(ftdi);
406 } else { 406 } else {
407 up(&ftdi->u132_lock); 407 mutex_unlock(&ftdi->u132_lock);
408 msleep(100); 408 msleep(100);
409 down(&ftdi->u132_lock); 409 mutex_lock(&ftdi->u132_lock);
410 goto wait_2; 410 goto wait_2;
411 } 411 }
412 } 412 }
@@ -414,13 +414,13 @@ static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi)
414 ftdi->recieved = 0; 414 ftdi->recieved = 0;
415 ftdi->expected = 4; 415 ftdi->expected = 4;
416 ftdi->ed_found = 0; 416 ftdi->ed_found = 0;
417 up(&ftdi->u132_lock); 417 mutex_unlock(&ftdi->u132_lock);
418} 418}
419 419
420static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi) 420static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi)
421{ 421{
422 int ed_number = 4; 422 int ed_number = 4;
423 down(&ftdi->u132_lock); 423 mutex_lock(&ftdi->u132_lock);
424 while (ed_number-- > 0) { 424 while (ed_number-- > 0) {
425 struct u132_target *target = &ftdi->target[ed_number]; 425 struct u132_target *target = &ftdi->target[ed_number];
426 target->abandoning = 1; 426 target->abandoning = 1;
@@ -440,9 +440,9 @@ static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi)
440 ftdi->command_next += 1; 440 ftdi->command_next += 1;
441 ftdi_elan_kick_command_queue(ftdi); 441 ftdi_elan_kick_command_queue(ftdi);
442 } else { 442 } else {
443 up(&ftdi->u132_lock); 443 mutex_unlock(&ftdi->u132_lock);
444 msleep(100); 444 msleep(100);
445 down(&ftdi->u132_lock); 445 mutex_lock(&ftdi->u132_lock);
446 goto wait; 446 goto wait;
447 } 447 }
448 } 448 }
@@ -450,7 +450,7 @@ static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi)
450 ftdi->recieved = 0; 450 ftdi->recieved = 0;
451 ftdi->expected = 4; 451 ftdi->expected = 4;
452 ftdi->ed_found = 0; 452 ftdi->ed_found = 0;
453 up(&ftdi->u132_lock); 453 mutex_unlock(&ftdi->u132_lock);
454} 454}
455 455
456static void ftdi_elan_kick_command_queue(struct usb_ftdi *ftdi) 456static void ftdi_elan_kick_command_queue(struct usb_ftdi *ftdi)
@@ -886,14 +886,14 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
886 char *b) 886 char *b)
887{ 887{
888 int payload = (ed_length >> 0) & 0x07FF; 888 int payload = (ed_length >> 0) & 0x07FF;
889 down(&ftdi->u132_lock); 889 mutex_lock(&ftdi->u132_lock);
890 target->actual = 0; 890 target->actual = 0;
891 target->non_null = (ed_length >> 15) & 0x0001; 891 target->non_null = (ed_length >> 15) & 0x0001;
892 target->repeat_number = (ed_length >> 11) & 0x000F; 892 target->repeat_number = (ed_length >> 11) & 0x000F;
893 if (ed_type == 0x02) { 893 if (ed_type == 0x02) {
894 if (payload == 0 || target->abandoning > 0) { 894 if (payload == 0 || target->abandoning > 0) {
895 target->abandoning = 0; 895 target->abandoning = 0;
896 up(&ftdi->u132_lock); 896 mutex_unlock(&ftdi->u132_lock);
897 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, 897 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
898 payload); 898 payload);
899 ftdi->recieved = 0; 899 ftdi->recieved = 0;
@@ -903,13 +903,13 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
903 } else { 903 } else {
904 ftdi->expected = 4 + payload; 904 ftdi->expected = 4 + payload;
905 ftdi->ed_found = 1; 905 ftdi->ed_found = 1;
906 up(&ftdi->u132_lock); 906 mutex_unlock(&ftdi->u132_lock);
907 return b; 907 return b;
908 } 908 }
909 } else if (ed_type == 0x03) { 909 } else if (ed_type == 0x03) {
910 if (payload == 0 || target->abandoning > 0) { 910 if (payload == 0 || target->abandoning > 0) {
911 target->abandoning = 0; 911 target->abandoning = 0;
912 up(&ftdi->u132_lock); 912 mutex_unlock(&ftdi->u132_lock);
913 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, 913 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
914 payload); 914 payload);
915 ftdi->recieved = 0; 915 ftdi->recieved = 0;
@@ -919,12 +919,12 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
919 } else { 919 } else {
920 ftdi->expected = 4 + payload; 920 ftdi->expected = 4 + payload;
921 ftdi->ed_found = 1; 921 ftdi->ed_found = 1;
922 up(&ftdi->u132_lock); 922 mutex_unlock(&ftdi->u132_lock);
923 return b; 923 return b;
924 } 924 }
925 } else if (ed_type == 0x01) { 925 } else if (ed_type == 0x01) {
926 target->abandoning = 0; 926 target->abandoning = 0;
927 up(&ftdi->u132_lock); 927 mutex_unlock(&ftdi->u132_lock);
928 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, 928 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
929 payload); 929 payload);
930 ftdi->recieved = 0; 930 ftdi->recieved = 0;
@@ -933,7 +933,7 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
933 return ftdi->response; 933 return ftdi->response;
934 } else { 934 } else {
935 target->abandoning = 0; 935 target->abandoning = 0;
936 up(&ftdi->u132_lock); 936 mutex_unlock(&ftdi->u132_lock);
937 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, 937 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
938 payload); 938 payload);
939 ftdi->recieved = 0; 939 ftdi->recieved = 0;
@@ -947,12 +947,12 @@ static char *have_ed_get_response(struct usb_ftdi *ftdi,
947 struct u132_target *target, u16 ed_length, int ed_number, int ed_type, 947 struct u132_target *target, u16 ed_length, int ed_number, int ed_type,
948 char *b) 948 char *b)
949{ 949{
950 down(&ftdi->u132_lock); 950 mutex_lock(&ftdi->u132_lock);
951 target->condition_code = TD_DEVNOTRESP; 951 target->condition_code = TD_DEVNOTRESP;
952 target->actual = (ed_length >> 0) & 0x01FF; 952 target->actual = (ed_length >> 0) & 0x01FF;
953 target->non_null = (ed_length >> 15) & 0x0001; 953 target->non_null = (ed_length >> 15) & 0x0001;
954 target->repeat_number = (ed_length >> 11) & 0x000F; 954 target->repeat_number = (ed_length >> 11) & 0x000F;
955 up(&ftdi->u132_lock); 955 mutex_unlock(&ftdi->u132_lock);
956 if (target->active) 956 if (target->active)
957 ftdi_elan_do_callback(ftdi, target, NULL, 0); 957 ftdi_elan_do_callback(ftdi, target, NULL, 0);
958 target->abandoning = 0; 958 target->abandoning = 0;
@@ -1278,7 +1278,7 @@ static int ftdi_elan_write_reg(struct usb_ftdi *ftdi, u32 data)
1278 return -ENODEV; 1278 return -ENODEV;
1279 } else { 1279 } else {
1280 int command_size; 1280 int command_size;
1281 down(&ftdi->u132_lock); 1281 mutex_lock(&ftdi->u132_lock);
1282 command_size = ftdi->command_next - ftdi->command_head; 1282 command_size = ftdi->command_next - ftdi->command_head;
1283 if (command_size < COMMAND_SIZE) { 1283 if (command_size < COMMAND_SIZE) {
1284 struct u132_command *command = &ftdi->command[ 1284 struct u132_command *command = &ftdi->command[
@@ -1292,10 +1292,10 @@ static int ftdi_elan_write_reg(struct usb_ftdi *ftdi, u32 data)
1292 command->buffer = &command->value; 1292 command->buffer = &command->value;
1293 ftdi->command_next += 1; 1293 ftdi->command_next += 1;
1294 ftdi_elan_kick_command_queue(ftdi); 1294 ftdi_elan_kick_command_queue(ftdi);
1295 up(&ftdi->u132_lock); 1295 mutex_unlock(&ftdi->u132_lock);
1296 return 0; 1296 return 0;
1297 } else { 1297 } else {
1298 up(&ftdi->u132_lock); 1298 mutex_unlock(&ftdi->u132_lock);
1299 msleep(100); 1299 msleep(100);
1300 goto wait; 1300 goto wait;
1301 } 1301 }
@@ -1310,7 +1310,7 @@ static int ftdi_elan_write_config(struct usb_ftdi *ftdi, int config_offset,
1310 return -ENODEV; 1310 return -ENODEV;
1311 } else { 1311 } else {
1312 int command_size; 1312 int command_size;
1313 down(&ftdi->u132_lock); 1313 mutex_lock(&ftdi->u132_lock);
1314 command_size = ftdi->command_next - ftdi->command_head; 1314 command_size = ftdi->command_next - ftdi->command_head;
1315 if (command_size < COMMAND_SIZE) { 1315 if (command_size < COMMAND_SIZE) {
1316 struct u132_command *command = &ftdi->command[ 1316 struct u132_command *command = &ftdi->command[
@@ -1324,10 +1324,10 @@ static int ftdi_elan_write_config(struct usb_ftdi *ftdi, int config_offset,
1324 command->buffer = &command->value; 1324 command->buffer = &command->value;
1325 ftdi->command_next += 1; 1325 ftdi->command_next += 1;
1326 ftdi_elan_kick_command_queue(ftdi); 1326 ftdi_elan_kick_command_queue(ftdi);
1327 up(&ftdi->u132_lock); 1327 mutex_unlock(&ftdi->u132_lock);
1328 return 0; 1328 return 0;
1329 } else { 1329 } else {
1330 up(&ftdi->u132_lock); 1330 mutex_unlock(&ftdi->u132_lock);
1331 msleep(100); 1331 msleep(100);
1332 goto wait; 1332 goto wait;
1333 } 1333 }
@@ -1342,7 +1342,7 @@ static int ftdi_elan_write_pcimem(struct usb_ftdi *ftdi, int mem_offset,
1342 return -ENODEV; 1342 return -ENODEV;
1343 } else { 1343 } else {
1344 int command_size; 1344 int command_size;
1345 down(&ftdi->u132_lock); 1345 mutex_lock(&ftdi->u132_lock);
1346 command_size = ftdi->command_next - ftdi->command_head; 1346 command_size = ftdi->command_next - ftdi->command_head;
1347 if (command_size < COMMAND_SIZE) { 1347 if (command_size < COMMAND_SIZE) {
1348 struct u132_command *command = &ftdi->command[ 1348 struct u132_command *command = &ftdi->command[
@@ -1356,10 +1356,10 @@ static int ftdi_elan_write_pcimem(struct usb_ftdi *ftdi, int mem_offset,
1356 command->buffer = &command->value; 1356 command->buffer = &command->value;
1357 ftdi->command_next += 1; 1357 ftdi->command_next += 1;
1358 ftdi_elan_kick_command_queue(ftdi); 1358 ftdi_elan_kick_command_queue(ftdi);
1359 up(&ftdi->u132_lock); 1359 mutex_unlock(&ftdi->u132_lock);
1360 return 0; 1360 return 0;
1361 } else { 1361 } else {
1362 up(&ftdi->u132_lock); 1362 mutex_unlock(&ftdi->u132_lock);
1363 msleep(100); 1363 msleep(100);
1364 goto wait; 1364 goto wait;
1365 } 1365 }
@@ -1382,7 +1382,7 @@ static int ftdi_elan_read_reg(struct usb_ftdi *ftdi, u32 *data)
1382 } else { 1382 } else {
1383 int command_size; 1383 int command_size;
1384 int respond_size; 1384 int respond_size;
1385 down(&ftdi->u132_lock); 1385 mutex_lock(&ftdi->u132_lock);
1386 command_size = ftdi->command_next - ftdi->command_head; 1386 command_size = ftdi->command_next - ftdi->command_head;
1387 respond_size = ftdi->respond_next - ftdi->respond_head; 1387 respond_size = ftdi->respond_next - ftdi->respond_head;
1388 if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) 1388 if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE)
@@ -1405,11 +1405,11 @@ static int ftdi_elan_read_reg(struct usb_ftdi *ftdi, u32 *data)
1405 ftdi->command_next += 1; 1405 ftdi->command_next += 1;
1406 ftdi->respond_next += 1; 1406 ftdi->respond_next += 1;
1407 ftdi_elan_kick_command_queue(ftdi); 1407 ftdi_elan_kick_command_queue(ftdi);
1408 up(&ftdi->u132_lock); 1408 mutex_unlock(&ftdi->u132_lock);
1409 wait_for_completion(&respond->wait_completion); 1409 wait_for_completion(&respond->wait_completion);
1410 return result; 1410 return result;
1411 } else { 1411 } else {
1412 up(&ftdi->u132_lock); 1412 mutex_unlock(&ftdi->u132_lock);
1413 msleep(100); 1413 msleep(100);
1414 goto wait; 1414 goto wait;
1415 } 1415 }
@@ -1425,7 +1425,7 @@ static int ftdi_elan_read_config(struct usb_ftdi *ftdi, int config_offset,
1425 } else { 1425 } else {
1426 int command_size; 1426 int command_size;
1427 int respond_size; 1427 int respond_size;
1428 down(&ftdi->u132_lock); 1428 mutex_lock(&ftdi->u132_lock);
1429 command_size = ftdi->command_next - ftdi->command_head; 1429 command_size = ftdi->command_next - ftdi->command_head;
1430 respond_size = ftdi->respond_next - ftdi->respond_head; 1430 respond_size = ftdi->respond_next - ftdi->respond_head;
1431 if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) 1431 if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE)
@@ -1449,11 +1449,11 @@ static int ftdi_elan_read_config(struct usb_ftdi *ftdi, int config_offset,
1449 ftdi->command_next += 1; 1449 ftdi->command_next += 1;
1450 ftdi->respond_next += 1; 1450 ftdi->respond_next += 1;
1451 ftdi_elan_kick_command_queue(ftdi); 1451 ftdi_elan_kick_command_queue(ftdi);
1452 up(&ftdi->u132_lock); 1452 mutex_unlock(&ftdi->u132_lock);
1453 wait_for_completion(&respond->wait_completion); 1453 wait_for_completion(&respond->wait_completion);
1454 return result; 1454 return result;
1455 } else { 1455 } else {
1456 up(&ftdi->u132_lock); 1456 mutex_unlock(&ftdi->u132_lock);
1457 msleep(100); 1457 msleep(100);
1458 goto wait; 1458 goto wait;
1459 } 1459 }
@@ -1469,7 +1469,7 @@ static int ftdi_elan_read_pcimem(struct usb_ftdi *ftdi, int mem_offset,
1469 } else { 1469 } else {
1470 int command_size; 1470 int command_size;
1471 int respond_size; 1471 int respond_size;
1472 down(&ftdi->u132_lock); 1472 mutex_lock(&ftdi->u132_lock);
1473 command_size = ftdi->command_next - ftdi->command_head; 1473 command_size = ftdi->command_next - ftdi->command_head;
1474 respond_size = ftdi->respond_next - ftdi->respond_head; 1474 respond_size = ftdi->respond_next - ftdi->respond_head;
1475 if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) 1475 if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE)
@@ -1493,11 +1493,11 @@ static int ftdi_elan_read_pcimem(struct usb_ftdi *ftdi, int mem_offset,
1493 ftdi->command_next += 1; 1493 ftdi->command_next += 1;
1494 ftdi->respond_next += 1; 1494 ftdi->respond_next += 1;
1495 ftdi_elan_kick_command_queue(ftdi); 1495 ftdi_elan_kick_command_queue(ftdi);
1496 up(&ftdi->u132_lock); 1496 mutex_unlock(&ftdi->u132_lock);
1497 wait_for_completion(&respond->wait_completion); 1497 wait_for_completion(&respond->wait_completion);
1498 return result; 1498 return result;
1499 } else { 1499 } else {
1500 up(&ftdi->u132_lock); 1500 mutex_unlock(&ftdi->u132_lock);
1501 msleep(100); 1501 msleep(100);
1502 goto wait; 1502 goto wait;
1503 } 1503 }
@@ -1529,7 +1529,7 @@ static int ftdi_elan_edset_setup(struct usb_ftdi *ftdi, u8 ed_number,
1529 return -ENODEV; 1529 return -ENODEV;
1530 } else { 1530 } else {
1531 int command_size; 1531 int command_size;
1532 down(&ftdi->u132_lock); 1532 mutex_lock(&ftdi->u132_lock);
1533 command_size = ftdi->command_next - ftdi->command_head; 1533 command_size = ftdi->command_next - ftdi->command_head;
1534 if (command_size < COMMAND_SIZE) { 1534 if (command_size < COMMAND_SIZE) {
1535 struct u132_target *target = &ftdi->target[ed]; 1535 struct u132_target *target = &ftdi->target[ed];
@@ -1550,10 +1550,10 @@ static int ftdi_elan_edset_setup(struct usb_ftdi *ftdi, u8 ed_number,
1550 target->active = 1; 1550 target->active = 1;
1551 ftdi->command_next += 1; 1551 ftdi->command_next += 1;
1552 ftdi_elan_kick_command_queue(ftdi); 1552 ftdi_elan_kick_command_queue(ftdi);
1553 up(&ftdi->u132_lock); 1553 mutex_unlock(&ftdi->u132_lock);
1554 return 0; 1554 return 0;
1555 } else { 1555 } else {
1556 up(&ftdi->u132_lock); 1556 mutex_unlock(&ftdi->u132_lock);
1557 msleep(100); 1557 msleep(100);
1558 goto wait; 1558 goto wait;
1559 } 1559 }
@@ -1586,7 +1586,7 @@ static int ftdi_elan_edset_input(struct usb_ftdi *ftdi, u8 ed_number,
1586 return -ENODEV; 1586 return -ENODEV;
1587 } else { 1587 } else {
1588 int command_size; 1588 int command_size;
1589 down(&ftdi->u132_lock); 1589 mutex_lock(&ftdi->u132_lock);
1590 command_size = ftdi->command_next - ftdi->command_head; 1590 command_size = ftdi->command_next - ftdi->command_head;
1591 if (command_size < COMMAND_SIZE) { 1591 if (command_size < COMMAND_SIZE) {
1592 struct u132_target *target = &ftdi->target[ed]; 1592 struct u132_target *target = &ftdi->target[ed];
@@ -1615,10 +1615,10 @@ static int ftdi_elan_edset_input(struct usb_ftdi *ftdi, u8 ed_number,
1615 target->active = 1; 1615 target->active = 1;
1616 ftdi->command_next += 1; 1616 ftdi->command_next += 1;
1617 ftdi_elan_kick_command_queue(ftdi); 1617 ftdi_elan_kick_command_queue(ftdi);
1618 up(&ftdi->u132_lock); 1618 mutex_unlock(&ftdi->u132_lock);
1619 return 0; 1619 return 0;
1620 } else { 1620 } else {
1621 up(&ftdi->u132_lock); 1621 mutex_unlock(&ftdi->u132_lock);
1622 msleep(100); 1622 msleep(100);
1623 goto wait; 1623 goto wait;
1624 } 1624 }
@@ -1651,7 +1651,7 @@ static int ftdi_elan_edset_empty(struct usb_ftdi *ftdi, u8 ed_number,
1651 return -ENODEV; 1651 return -ENODEV;
1652 } else { 1652 } else {
1653 int command_size; 1653 int command_size;
1654 down(&ftdi->u132_lock); 1654 mutex_lock(&ftdi->u132_lock);
1655 command_size = ftdi->command_next - ftdi->command_head; 1655 command_size = ftdi->command_next - ftdi->command_head;
1656 if (command_size < COMMAND_SIZE) { 1656 if (command_size < COMMAND_SIZE) {
1657 struct u132_target *target = &ftdi->target[ed]; 1657 struct u132_target *target = &ftdi->target[ed];
@@ -1672,10 +1672,10 @@ static int ftdi_elan_edset_empty(struct usb_ftdi *ftdi, u8 ed_number,
1672 target->active = 1; 1672 target->active = 1;
1673 ftdi->command_next += 1; 1673 ftdi->command_next += 1;
1674 ftdi_elan_kick_command_queue(ftdi); 1674 ftdi_elan_kick_command_queue(ftdi);
1675 up(&ftdi->u132_lock); 1675 mutex_unlock(&ftdi->u132_lock);
1676 return 0; 1676 return 0;
1677 } else { 1677 } else {
1678 up(&ftdi->u132_lock); 1678 mutex_unlock(&ftdi->u132_lock);
1679 msleep(100); 1679 msleep(100);
1680 goto wait; 1680 goto wait;
1681 } 1681 }
@@ -1708,7 +1708,7 @@ static int ftdi_elan_edset_output(struct usb_ftdi *ftdi, u8 ed_number,
1708 return -ENODEV; 1708 return -ENODEV;
1709 } else { 1709 } else {
1710 int command_size; 1710 int command_size;
1711 down(&ftdi->u132_lock); 1711 mutex_lock(&ftdi->u132_lock);
1712 command_size = ftdi->command_next - ftdi->command_head; 1712 command_size = ftdi->command_next - ftdi->command_head;
1713 if (command_size < COMMAND_SIZE) { 1713 if (command_size < COMMAND_SIZE) {
1714 u8 *b; 1714 u8 *b;
@@ -1751,10 +1751,10 @@ static int ftdi_elan_edset_output(struct usb_ftdi *ftdi, u8 ed_number,
1751 target->active = 1; 1751 target->active = 1;
1752 ftdi->command_next += 1; 1752 ftdi->command_next += 1;
1753 ftdi_elan_kick_command_queue(ftdi); 1753 ftdi_elan_kick_command_queue(ftdi);
1754 up(&ftdi->u132_lock); 1754 mutex_unlock(&ftdi->u132_lock);
1755 return 0; 1755 return 0;
1756 } else { 1756 } else {
1757 up(&ftdi->u132_lock); 1757 mutex_unlock(&ftdi->u132_lock);
1758 msleep(100); 1758 msleep(100);
1759 goto wait; 1759 goto wait;
1760 } 1760 }
@@ -1787,7 +1787,7 @@ static int ftdi_elan_edset_single(struct usb_ftdi *ftdi, u8 ed_number,
1787 return -ENODEV; 1787 return -ENODEV;
1788 } else { 1788 } else {
1789 int command_size; 1789 int command_size;
1790 down(&ftdi->u132_lock); 1790 mutex_lock(&ftdi->u132_lock);
1791 command_size = ftdi->command_next - ftdi->command_head; 1791 command_size = ftdi->command_next - ftdi->command_head;
1792 if (command_size < COMMAND_SIZE) { 1792 if (command_size < COMMAND_SIZE) {
1793 int remaining_length = urb->transfer_buffer_length - 1793 int remaining_length = urb->transfer_buffer_length -
@@ -1816,10 +1816,10 @@ static int ftdi_elan_edset_single(struct usb_ftdi *ftdi, u8 ed_number,
1816 target->active = 1; 1816 target->active = 1;
1817 ftdi->command_next += 1; 1817 ftdi->command_next += 1;
1818 ftdi_elan_kick_command_queue(ftdi); 1818 ftdi_elan_kick_command_queue(ftdi);
1819 up(&ftdi->u132_lock); 1819 mutex_unlock(&ftdi->u132_lock);
1820 return 0; 1820 return 0;
1821 } else { 1821 } else {
1822 up(&ftdi->u132_lock); 1822 mutex_unlock(&ftdi->u132_lock);
1823 msleep(100); 1823 msleep(100);
1824 goto wait; 1824 goto wait;
1825 } 1825 }
@@ -1849,9 +1849,9 @@ static int ftdi_elan_edset_flush(struct usb_ftdi *ftdi, u8 ed_number,
1849 return -ENODEV; 1849 return -ENODEV;
1850 } else { 1850 } else {
1851 struct u132_target *target = &ftdi->target[ed]; 1851 struct u132_target *target = &ftdi->target[ed];
1852 down(&ftdi->u132_lock); 1852 mutex_lock(&ftdi->u132_lock);
1853 if (target->abandoning > 0) { 1853 if (target->abandoning > 0) {
1854 up(&ftdi->u132_lock); 1854 mutex_unlock(&ftdi->u132_lock);
1855 return 0; 1855 return 0;
1856 } else { 1856 } else {
1857 target->abandoning = 1; 1857 target->abandoning = 1;
@@ -1873,13 +1873,13 @@ static int ftdi_elan_edset_flush(struct usb_ftdi *ftdi, u8 ed_number,
1873 ftdi->command_next += 1; 1873 ftdi->command_next += 1;
1874 ftdi_elan_kick_command_queue(ftdi); 1874 ftdi_elan_kick_command_queue(ftdi);
1875 } else { 1875 } else {
1876 up(&ftdi->u132_lock); 1876 mutex_unlock(&ftdi->u132_lock);
1877 msleep(100); 1877 msleep(100);
1878 down(&ftdi->u132_lock); 1878 mutex_lock(&ftdi->u132_lock);
1879 goto wait_1; 1879 goto wait_1;
1880 } 1880 }
1881 } 1881 }
1882 up(&ftdi->u132_lock); 1882 mutex_unlock(&ftdi->u132_lock);
1883 return 0; 1883 return 0;
1884 } 1884 }
1885 } 1885 }
@@ -2793,7 +2793,7 @@ static int ftdi_elan_probe(struct usb_interface *interface,
2793 init_MUTEX(&ftdi->sw_lock); 2793 init_MUTEX(&ftdi->sw_lock);
2794 ftdi->udev = usb_get_dev(interface_to_usbdev(interface)); 2794 ftdi->udev = usb_get_dev(interface_to_usbdev(interface));
2795 ftdi->interface = interface; 2795 ftdi->interface = interface;
2796 init_MUTEX(&ftdi->u132_lock); 2796 mutex_init(&ftdi->u132_lock);
2797 ftdi->expected = 4; 2797 ftdi->expected = 4;
2798 iface_desc = interface->cur_altsetting; 2798 iface_desc = interface->cur_altsetting;
2799 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { 2799 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index e6fd024024f5..4bcf7fb4e5da 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -66,6 +66,7 @@ static struct usb_device_id idmouse_table[] = {
66 USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT, value, index, NULL, 0, 1000) 66 USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT, value, index, NULL, 0, 1000)
67 67
68MODULE_DEVICE_TABLE(usb, idmouse_table); 68MODULE_DEVICE_TABLE(usb, idmouse_table);
69static DEFINE_MUTEX(open_disc_mutex);
69 70
70/* structure to hold all of our device specific stuff */ 71/* structure to hold all of our device specific stuff */
71struct usb_idmouse { 72struct usb_idmouse {
@@ -80,7 +81,7 @@ struct usb_idmouse {
80 81
81 int open; /* if the port is open or not */ 82 int open; /* if the port is open or not */
82 int present; /* if the device is not disconnected */ 83 int present; /* if the device is not disconnected */
83 struct semaphore sem; /* locks this structure */ 84 struct mutex lock; /* locks this structure */
84 85
85}; 86};
86 87
@@ -213,13 +214,17 @@ static int idmouse_open(struct inode *inode, struct file *file)
213 if (!interface) 214 if (!interface)
214 return -ENODEV; 215 return -ENODEV;
215 216
217 mutex_lock(&open_disc_mutex);
216 /* get the device information block from the interface */ 218 /* get the device information block from the interface */
217 dev = usb_get_intfdata(interface); 219 dev = usb_get_intfdata(interface);
218 if (!dev) 220 if (!dev) {
221 mutex_unlock(&open_disc_mutex);
219 return -ENODEV; 222 return -ENODEV;
223 }
220 224
221 /* lock this device */ 225 /* lock this device */
222 down(&dev->sem); 226 mutex_lock(&dev->lock);
227 mutex_unlock(&open_disc_mutex);
223 228
224 /* check if already open */ 229 /* check if already open */
225 if (dev->open) { 230 if (dev->open) {
@@ -245,7 +250,7 @@ static int idmouse_open(struct inode *inode, struct file *file)
245error: 250error:
246 251
247 /* unlock this device */ 252 /* unlock this device */
248 up(&dev->sem); 253 mutex_unlock(&dev->lock);
249 return result; 254 return result;
250} 255}
251 256
@@ -258,12 +263,14 @@ static int idmouse_release(struct inode *inode, struct file *file)
258 if (dev == NULL) 263 if (dev == NULL)
259 return -ENODEV; 264 return -ENODEV;
260 265
266 mutex_lock(&open_disc_mutex);
261 /* lock our device */ 267 /* lock our device */
262 down(&dev->sem); 268 mutex_lock(&dev->lock);
263 269
264 /* are we really open? */ 270 /* are we really open? */
265 if (dev->open <= 0) { 271 if (dev->open <= 0) {
266 up(&dev->sem); 272 mutex_unlock(&dev->lock);
273 mutex_unlock(&open_disc_mutex);
267 return -ENODEV; 274 return -ENODEV;
268 } 275 }
269 276
@@ -271,10 +278,12 @@ static int idmouse_release(struct inode *inode, struct file *file)
271 278
272 if (!dev->present) { 279 if (!dev->present) {
273 /* the device was unplugged before the file was released */ 280 /* the device was unplugged before the file was released */
274 up(&dev->sem); 281 mutex_unlock(&dev->lock);
282 mutex_unlock(&open_disc_mutex);
275 idmouse_delete(dev); 283 idmouse_delete(dev);
276 } else { 284 } else {
277 up(&dev->sem); 285 mutex_unlock(&dev->lock);
286 mutex_unlock(&open_disc_mutex);
278 } 287 }
279 return 0; 288 return 0;
280} 289}
@@ -286,18 +295,18 @@ static ssize_t idmouse_read(struct file *file, char __user *buffer, size_t count
286 int result; 295 int result;
287 296
288 /* lock this object */ 297 /* lock this object */
289 down(&dev->sem); 298 mutex_lock(&dev->lock);
290 299
291 /* verify that the device wasn't unplugged */ 300 /* verify that the device wasn't unplugged */
292 if (!dev->present) { 301 if (!dev->present) {
293 up(&dev->sem); 302 mutex_unlock(&dev->lock);
294 return -ENODEV; 303 return -ENODEV;
295 } 304 }
296 305
297 result = simple_read_from_buffer(buffer, count, ppos, 306 result = simple_read_from_buffer(buffer, count, ppos,
298 dev->bulk_in_buffer, IMGSIZE); 307 dev->bulk_in_buffer, IMGSIZE);
299 /* unlock the device */ 308 /* unlock the device */
300 up(&dev->sem); 309 mutex_unlock(&dev->lock);
301 return result; 310 return result;
302} 311}
303 312
@@ -320,7 +329,7 @@ static int idmouse_probe(struct usb_interface *interface,
320 if (dev == NULL) 329 if (dev == NULL)
321 return -ENOMEM; 330 return -ENOMEM;
322 331
323 init_MUTEX(&dev->sem); 332 mutex_init(&dev->lock);
324 dev->udev = udev; 333 dev->udev = udev;
325 dev->interface = interface; 334 dev->interface = interface;
326 335
@@ -372,24 +381,26 @@ static void idmouse_disconnect(struct usb_interface *interface)
372 381
373 /* get device structure */ 382 /* get device structure */
374 dev = usb_get_intfdata(interface); 383 dev = usb_get_intfdata(interface);
375 usb_set_intfdata(interface, NULL);
376 384
377 /* give back our minor */ 385 /* give back our minor */
378 usb_deregister_dev(interface, &idmouse_class); 386 usb_deregister_dev(interface, &idmouse_class);
379 387
380 /* lock it */ 388 mutex_lock(&open_disc_mutex);
381 down(&dev->sem); 389 usb_set_intfdata(interface, NULL);
390 /* lock the device */
391 mutex_lock(&dev->lock);
392 mutex_unlock(&open_disc_mutex);
382 393
383 /* prevent device read, write and ioctl */ 394 /* prevent device read, write and ioctl */
384 dev->present = 0; 395 dev->present = 0;
385 396
386 /* if the device is opened, idmouse_release will clean this up */ 397 /* if the device is opened, idmouse_release will clean this up */
387 if (!dev->open) { 398 if (!dev->open) {
388 up(&dev->sem); 399 mutex_unlock(&dev->lock);
389 idmouse_delete(dev); 400 idmouse_delete(dev);
390 } else { 401 } else {
391 /* unlock */ 402 /* unlock */
392 up(&dev->sem); 403 mutex_unlock(&dev->lock);
393 } 404 }
394 405
395 info("%s disconnected", DRIVER_DESC); 406 info("%s disconnected", DRIVER_DESC);
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index d372fbc4effb..764696ff1e8e 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -66,6 +66,7 @@ module_param(debug, bool, 0644);
66MODULE_PARM_DESC(debug, "debug=1 enables debugging messages"); 66MODULE_PARM_DESC(debug, "debug=1 enables debugging messages");
67 67
68static struct usb_driver iowarrior_driver; 68static struct usb_driver iowarrior_driver;
69static DEFINE_MUTEX(iowarrior_open_disc_lock);
69 70
70/*--------------*/ 71/*--------------*/
71/* data */ 72/* data */
@@ -351,7 +352,7 @@ static ssize_t iowarrior_write(struct file *file,
351 352
352 mutex_lock(&dev->mutex); 353 mutex_lock(&dev->mutex);
353 /* verify that the device wasn't unplugged */ 354 /* verify that the device wasn't unplugged */
354 if (dev == NULL || !dev->present) { 355 if (!dev->present) {
355 retval = -ENODEV; 356 retval = -ENODEV;
356 goto exit; 357 goto exit;
357 } 358 }
@@ -608,11 +609,15 @@ static int iowarrior_open(struct inode *inode, struct file *file)
608 return -ENODEV; 609 return -ENODEV;
609 } 610 }
610 611
612 mutex_lock(&iowarrior_open_disc_lock);
611 dev = usb_get_intfdata(interface); 613 dev = usb_get_intfdata(interface);
612 if (!dev) 614 if (!dev) {
615 mutex_unlock(&iowarrior_open_disc_lock);
613 return -ENODEV; 616 return -ENODEV;
617 }
614 618
615 mutex_lock(&dev->mutex); 619 mutex_lock(&dev->mutex);
620 mutex_unlock(&iowarrior_open_disc_lock);
616 621
617 /* Only one process can open each device, no sharing. */ 622 /* Only one process can open each device, no sharing. */
618 if (dev->opened) { 623 if (dev->opened) {
@@ -866,6 +871,7 @@ static void iowarrior_disconnect(struct usb_interface *interface)
866 int minor; 871 int minor;
867 872
868 dev = usb_get_intfdata(interface); 873 dev = usb_get_intfdata(interface);
874 mutex_lock(&iowarrior_open_disc_lock);
869 usb_set_intfdata(interface, NULL); 875 usb_set_intfdata(interface, NULL);
870 876
871 minor = dev->minor; 877 minor = dev->minor;
@@ -879,6 +885,7 @@ static void iowarrior_disconnect(struct usb_interface *interface)
879 dev->present = 0; 885 dev->present = 0;
880 886
881 mutex_unlock(&dev->mutex); 887 mutex_unlock(&dev->mutex);
888 mutex_unlock(&iowarrior_open_disc_lock);
882 889
883 if (dev->opened) { 890 if (dev->opened) {
884 /* There is a process that holds a filedescriptor to the device , 891 /* There is a process that holds a filedescriptor to the device ,
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 561970b889a5..aab320085ebf 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -198,6 +198,7 @@ static struct usb_device_id tower_table [] = {
198}; 198};
199 199
200MODULE_DEVICE_TABLE (usb, tower_table); 200MODULE_DEVICE_TABLE (usb, tower_table);
201static DEFINE_MUTEX(open_disc_mutex);
201 202
202#define LEGO_USB_TOWER_MINOR_BASE 160 203#define LEGO_USB_TOWER_MINOR_BASE 160
203 204
@@ -350,25 +351,31 @@ static int tower_open (struct inode *inode, struct file *file)
350 goto exit; 351 goto exit;
351 } 352 }
352 353
354 mutex_lock(&open_disc_mutex);
353 dev = usb_get_intfdata(interface); 355 dev = usb_get_intfdata(interface);
354 356
355 if (!dev) { 357 if (!dev) {
358 mutex_unlock(&open_disc_mutex);
356 retval = -ENODEV; 359 retval = -ENODEV;
357 goto exit; 360 goto exit;
358 } 361 }
359 362
360 /* lock this device */ 363 /* lock this device */
361 if (down_interruptible (&dev->sem)) { 364 if (down_interruptible (&dev->sem)) {
365 mutex_unlock(&open_disc_mutex);
362 retval = -ERESTARTSYS; 366 retval = -ERESTARTSYS;
363 goto exit; 367 goto exit;
364 } 368 }
365 369
370
366 /* allow opening only once */ 371 /* allow opening only once */
367 if (dev->open_count) { 372 if (dev->open_count) {
373 mutex_unlock(&open_disc_mutex);
368 retval = -EBUSY; 374 retval = -EBUSY;
369 goto unlock_exit; 375 goto unlock_exit;
370 } 376 }
371 dev->open_count = 1; 377 dev->open_count = 1;
378 mutex_unlock(&open_disc_mutex);
372 379
373 /* reset the tower */ 380 /* reset the tower */
374 result = usb_control_msg (dev->udev, 381 result = usb_control_msg (dev->udev,
@@ -437,9 +444,10 @@ static int tower_release (struct inode *inode, struct file *file)
437 if (dev == NULL) { 444 if (dev == NULL) {
438 dbg(1, "%s: object is NULL", __FUNCTION__); 445 dbg(1, "%s: object is NULL", __FUNCTION__);
439 retval = -ENODEV; 446 retval = -ENODEV;
440 goto exit; 447 goto exit_nolock;
441 } 448 }
442 449
450 mutex_lock(&open_disc_mutex);
443 if (down_interruptible (&dev->sem)) { 451 if (down_interruptible (&dev->sem)) {
444 retval = -ERESTARTSYS; 452 retval = -ERESTARTSYS;
445 goto exit; 453 goto exit;
@@ -468,6 +476,8 @@ unlock_exit:
468 up (&dev->sem); 476 up (&dev->sem);
469 477
470exit: 478exit:
479 mutex_unlock(&open_disc_mutex);
480exit_nolock:
471 dbg(2, "%s: leave, return value %d", __FUNCTION__, retval); 481 dbg(2, "%s: leave, return value %d", __FUNCTION__, retval);
472 return retval; 482 return retval;
473} 483}
@@ -989,6 +999,7 @@ static void tower_disconnect (struct usb_interface *interface)
989 dbg(2, "%s: enter", __FUNCTION__); 999 dbg(2, "%s: enter", __FUNCTION__);
990 1000
991 dev = usb_get_intfdata (interface); 1001 dev = usb_get_intfdata (interface);
1002 mutex_lock(&open_disc_mutex);
992 usb_set_intfdata (interface, NULL); 1003 usb_set_intfdata (interface, NULL);
993 1004
994 minor = dev->minor; 1005 minor = dev->minor;
@@ -997,6 +1008,7 @@ static void tower_disconnect (struct usb_interface *interface)
997 usb_deregister_dev (interface, &tower_class); 1008 usb_deregister_dev (interface, &tower_class);
998 1009
999 down (&dev->sem); 1010 down (&dev->sem);
1011 mutex_unlock(&open_disc_mutex);
1000 1012
1001 /* if the device is not opened, then we clean up right now */ 1013 /* if the device is not opened, then we clean up right now */
1002 if (!dev->open_count) { 1014 if (!dev->open_count) {
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c
index 88f6abe73624..330c18e390b8 100644
--- a/drivers/usb/misc/rio500.c
+++ b/drivers/usb/misc/rio500.c
@@ -118,10 +118,7 @@ ioctl_rio(struct inode *inode, struct file *file, unsigned int cmd,
118 118
119 mutex_lock(&(rio->lock)); 119 mutex_lock(&(rio->lock));
120 /* Sanity check to make sure rio is connected, powered, etc */ 120 /* Sanity check to make sure rio is connected, powered, etc */
121 if ( rio == NULL || 121 if (rio->present == 0 || rio->rio_dev == NULL) {
122 rio->present == 0 ||
123 rio->rio_dev == NULL )
124 {
125 retval = -ENODEV; 122 retval = -ENODEV;
126 goto err_out; 123 goto err_out;
127 } 124 }
@@ -280,10 +277,7 @@ write_rio(struct file *file, const char __user *buffer,
280 if (intr) 277 if (intr)
281 return -EINTR; 278 return -EINTR;
282 /* Sanity check to make sure rio is connected, powered, etc */ 279 /* Sanity check to make sure rio is connected, powered, etc */
283 if ( rio == NULL || 280 if (rio->present == 0 || rio->rio_dev == NULL) {
284 rio->present == 0 ||
285 rio->rio_dev == NULL )
286 {
287 mutex_unlock(&(rio->lock)); 281 mutex_unlock(&(rio->lock));
288 return -ENODEV; 282 return -ENODEV;
289 } 283 }
@@ -369,10 +363,7 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
369 if (intr) 363 if (intr)
370 return -EINTR; 364 return -EINTR;
371 /* Sanity check to make sure rio is connected, powered, etc */ 365 /* Sanity check to make sure rio is connected, powered, etc */
372 if ( rio == NULL || 366 if (rio->present == 0 || rio->rio_dev == NULL) {
373 rio->present == 0 ||
374 rio->rio_dev == NULL )
375 {
376 mutex_unlock(&(rio->lock)); 367 mutex_unlock(&(rio->lock));
377 return -ENODEV; 368 return -ENODEV;
378 } 369 }
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index 719842032712..20777d01db62 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/mutex.h>
20#include <asm/uaccess.h> 21#include <asm/uaccess.h>
21#include <linux/usb.h> 22#include <linux/usb.h>
22 23
@@ -34,6 +35,8 @@ static struct usb_device_id id_table [] = {
34}; 35};
35MODULE_DEVICE_TABLE (usb, id_table); 36MODULE_DEVICE_TABLE (usb, id_table);
36 37
38static DEFINE_MUTEX(open_disc_mutex);
39
37 40
38struct usb_lcd { 41struct usb_lcd {
39 struct usb_device * udev; /* init: probe_lcd */ 42 struct usb_device * udev; /* init: probe_lcd */
@@ -79,12 +82,16 @@ static int lcd_open(struct inode *inode, struct file *file)
79 return -ENODEV; 82 return -ENODEV;
80 } 83 }
81 84
85 mutex_lock(&open_disc_mutex);
82 dev = usb_get_intfdata(interface); 86 dev = usb_get_intfdata(interface);
83 if (!dev) 87 if (!dev) {
88 mutex_unlock(&open_disc_mutex);
84 return -ENODEV; 89 return -ENODEV;
90 }
85 91
86 /* increment our usage count for the device */ 92 /* increment our usage count for the device */
87 kref_get(&dev->kref); 93 kref_get(&dev->kref);
94 mutex_unlock(&open_disc_mutex);
88 95
89 /* grab a power reference */ 96 /* grab a power reference */
90 r = usb_autopm_get_interface(interface); 97 r = usb_autopm_get_interface(interface);
@@ -393,8 +400,10 @@ static void lcd_disconnect(struct usb_interface *interface)
393 struct usb_lcd *dev; 400 struct usb_lcd *dev;
394 int minor = interface->minor; 401 int minor = interface->minor;
395 402
403 mutex_lock(&open_disc_mutex);
396 dev = usb_get_intfdata(interface); 404 dev = usb_get_intfdata(interface);
397 usb_set_intfdata(interface, NULL); 405 usb_set_intfdata(interface, NULL);
406 mutex_unlock(&open_disc_mutex);
398 407
399 /* give back our minor */ 408 /* give back our minor */
400 usb_deregister_dev(interface, &lcd_class); 409 usb_deregister_dev(interface, &lcd_class);
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 2a8e537cb046..ddfee918000d 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -161,7 +161,8 @@ static void ark3116_set_termios(struct usb_serial_port *port,
161{ 161{
162 struct usb_serial *serial = port->serial; 162 struct usb_serial *serial = port->serial;
163 struct ark3116_private *priv = usb_get_serial_port_data(port); 163 struct ark3116_private *priv = usb_get_serial_port_data(port);
164 unsigned int cflag = port->tty->termios->c_cflag; 164 struct ktermios *termios = port->tty->termios;
165 unsigned int cflag = termios->c_cflag;
165 unsigned long flags; 166 unsigned long flags;
166 int baud; 167 int baud;
167 int ark3116_baud; 168 int ark3116_baud;
@@ -177,11 +178,14 @@ static void ark3116_set_termios(struct usb_serial_port *port,
177 *(port->tty->termios) = tty_std_termios; 178 *(port->tty->termios) = tty_std_termios;
178 port->tty->termios->c_cflag = B9600 | CS8 179 port->tty->termios->c_cflag = B9600 | CS8
179 | CREAD | HUPCL | CLOCAL; 180 | CREAD | HUPCL | CLOCAL;
181 termios->c_ispeed = 9600;
182 termios->c_ospeed = 9600;
180 priv->termios_initialized = 1; 183 priv->termios_initialized = 1;
181 } 184 }
182 spin_unlock_irqrestore(&priv->lock, flags); 185 spin_unlock_irqrestore(&priv->lock, flags);
183 186
184 cflag = port->tty->termios->c_cflag; 187 cflag = termios->c_cflag;
188 termios->c_cflag &= ~(CMSPAR|CRTSCTS);
185 189
186 buf = kmalloc(1, GFP_KERNEL); 190 buf = kmalloc(1, GFP_KERNEL);
187 if (!buf) { 191 if (!buf) {
@@ -254,9 +258,13 @@ static void ark3116_set_termios(struct usb_serial_port *port,
254 case 115200: 258 case 115200:
255 case 230400: 259 case 230400:
256 case 460800: 260 case 460800:
261 /* Report the resulting rate back to the caller */
262 tty_encode_baud_rate(port->tty, baud, baud);
257 break; 263 break;
258 /* set 9600 as default (if given baudrate is invalid for example) */ 264 /* set 9600 as default (if given baudrate is invalid for example) */
259 default: 265 default:
266 tty_encode_baud_rate(port->tty, 9600, 9600);
267 case 0:
260 baud = 9600; 268 baud = 9600;
261 } 269 }
262 270
@@ -302,6 +310,7 @@ static void ark3116_set_termios(struct usb_serial_port *port,
302 /* TEST ARK3116_SND(154, 0xFE, 0x40, 0xFFFF, 0x0006); */ 310 /* TEST ARK3116_SND(154, 0xFE, 0x40, 0xFFFF, 0x0006); */
303 311
304 kfree(buf); 312 kfree(buf);
313
305 return; 314 return;
306} 315}
307 316
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 6b252ceb39a8..42582d49b69c 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -272,9 +272,6 @@ static void ch341_set_termios(struct usb_serial_port *port,
272 272
273 dbg("ch341_set_termios()"); 273 dbg("ch341_set_termios()");
274 274
275 if (!tty || !tty->termios)
276 return;
277
278 baud_rate = tty_get_baud_rate(tty); 275 baud_rate = tty_get_baud_rate(tty);
279 276
280 switch (baud_rate) { 277 switch (baud_rate) {
@@ -299,6 +296,11 @@ static void ch341_set_termios(struct usb_serial_port *port,
299 * (cflag & PARENB) : parity {NONE, EVEN, ODD} 296 * (cflag & PARENB) : parity {NONE, EVEN, ODD}
300 * (cflag & CSTOPB) : stop bits [1, 2] 297 * (cflag & CSTOPB) : stop bits [1, 2]
301 */ 298 */
299
300 /* Copy back the old hardware settings */
301 tty_termios_copy_hw(tty->termios, old_termios);
302 /* And re-encode with the new baud */
303 tty_encode_baud_rate(tty, baud_rate, baud_rate);
302} 304}
303 305
304static struct usb_driver ch341_driver = { 306static struct usb_driver ch341_driver = {
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 9386e216d681..0362654d3b52 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -164,6 +164,7 @@ static int usb_console_setup(struct console *co, char *options)
164 } 164 }
165 165
166 if (serial->type->set_termios) { 166 if (serial->type->set_termios) {
167 struct ktermios dummy;
167 /* build up a fake tty structure so that the open call has something 168 /* build up a fake tty structure so that the open call has something
168 * to look at to get the cflag value */ 169 * to look at to get the cflag value */
169 tty = kzalloc(sizeof(*tty), GFP_KERNEL); 170 tty = kzalloc(sizeof(*tty), GFP_KERNEL);
@@ -177,12 +178,13 @@ static int usb_console_setup(struct console *co, char *options)
177 kfree (tty); 178 kfree (tty);
178 return -ENOMEM; 179 return -ENOMEM;
179 } 180 }
181 memset(&dummy, 0, sizeof(struct ktermios));
180 termios->c_cflag = cflag; 182 termios->c_cflag = cflag;
181 tty->termios = termios; 183 tty->termios = termios;
182 port->tty = tty; 184 port->tty = tty;
183 185
184 /* set up the initial termios settings */ 186 /* set up the initial termios settings */
185 serial->type->set_termios(port, NULL); 187 serial->type->set_termios(port, &dummy);
186 port->tty = NULL; 188 port->tty = NULL;
187 kfree (termios); 189 kfree (termios);
188 kfree (tty); 190 kfree (tty);
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index eb7df1835c11..3a83cb4c4bc2 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -361,7 +361,6 @@ static void cp2101_get_termios (struct usb_serial_port *port)
361 dbg("%s - no tty structures", __FUNCTION__); 361 dbg("%s - no tty structures", __FUNCTION__);
362 return; 362 return;
363 } 363 }
364 cflag = port->tty->termios->c_cflag;
365 364
366 cp2101_get_config(port, CP2101_BAUDRATE, &baud, 2); 365 cp2101_get_config(port, CP2101_BAUDRATE, &baud, 2);
367 /* Convert to baudrate */ 366 /* Convert to baudrate */
@@ -369,40 +368,9 @@ static void cp2101_get_termios (struct usb_serial_port *port)
369 baud = BAUD_RATE_GEN_FREQ / baud; 368 baud = BAUD_RATE_GEN_FREQ / baud;
370 369
371 dbg("%s - baud rate = %d", __FUNCTION__, baud); 370 dbg("%s - baud rate = %d", __FUNCTION__, baud);
372 cflag &= ~CBAUD; 371
373 switch (baud) { 372 tty_encode_baud_rate(port->tty, baud, baud);
374 /* 373 cflag = port->tty->termios->c_cflag;
375 * The baud rates which are commented out below
376 * appear to be supported by the device
377 * but are non-standard
378 */
379 case 600: cflag |= B600; break;
380 case 1200: cflag |= B1200; break;
381 case 1800: cflag |= B1800; break;
382 case 2400: cflag |= B2400; break;
383 case 4800: cflag |= B4800; break;
384 /*case 7200: cflag |= B7200; break;*/
385 case 9600: cflag |= B9600; break;
386 /*case 14400: cflag |= B14400; break;*/
387 case 19200: cflag |= B19200; break;
388 /*case 28800: cflag |= B28800; break;*/
389 case 38400: cflag |= B38400; break;
390 /*case 55854: cflag |= B55054; break;*/
391 case 57600: cflag |= B57600; break;
392 case 115200: cflag |= B115200; break;
393 /*case 127117: cflag |= B127117; break;*/
394 case 230400: cflag |= B230400; break;
395 case 460800: cflag |= B460800; break;
396 case 921600: cflag |= B921600; break;
397 /*case 3686400: cflag |= B3686400; break;*/
398 default:
399 dbg("%s - Baud rate is not supported, "
400 "using 9600 baud", __FUNCTION__);
401 cflag |= B9600;
402 cp2101_set_config_single(port, CP2101_BAUDRATE,
403 (BAUD_RATE_GEN_FREQ/9600));
404 break;
405 }
406 374
407 cp2101_get_config(port, CP2101_BITS, &bits, 2); 375 cp2101_get_config(port, CP2101_BITS, &bits, 2);
408 cflag &= ~CSIZE; 376 cflag &= ~CSIZE;
@@ -516,7 +484,7 @@ static void cp2101_get_termios (struct usb_serial_port *port)
516static void cp2101_set_termios (struct usb_serial_port *port, 484static void cp2101_set_termios (struct usb_serial_port *port,
517 struct ktermios *old_termios) 485 struct ktermios *old_termios)
518{ 486{
519 unsigned int cflag, old_cflag=0; 487 unsigned int cflag, old_cflag;
520 int baud=0, bits; 488 int baud=0, bits;
521 unsigned int modem_ctl[4]; 489 unsigned int modem_ctl[4];
522 490
@@ -526,6 +494,8 @@ static void cp2101_set_termios (struct usb_serial_port *port,
526 dbg("%s - no tty structures", __FUNCTION__); 494 dbg("%s - no tty structures", __FUNCTION__);
527 return; 495 return;
528 } 496 }
497 port->tty->termios->c_cflag &= ~CMSPAR;
498
529 cflag = port->tty->termios->c_cflag; 499 cflag = port->tty->termios->c_cflag;
530 old_cflag = old_termios->c_cflag; 500 old_cflag = old_termios->c_cflag;
531 baud = tty_get_baud_rate(port->tty); 501 baud = tty_get_baud_rate(port->tty);
@@ -563,11 +533,15 @@ static void cp2101_set_termios (struct usb_serial_port *port,
563 dbg("%s - Setting baud rate to %d baud", __FUNCTION__, 533 dbg("%s - Setting baud rate to %d baud", __FUNCTION__,
564 baud); 534 baud);
565 if (cp2101_set_config_single(port, CP2101_BAUDRATE, 535 if (cp2101_set_config_single(port, CP2101_BAUDRATE,
566 (BAUD_RATE_GEN_FREQ / baud))) 536 (BAUD_RATE_GEN_FREQ / baud))) {
567 dev_err(&port->dev, "Baud rate requested not " 537 dev_err(&port->dev, "Baud rate requested not "
568 "supported by device\n"); 538 "supported by device\n");
539 baud = tty_termios_baud_rate(old_termios);
540 }
569 } 541 }
570 } 542 }
543 /* Report back the resulting baud rate */
544 tty_encode_baud_rate(port->tty, baud, baud);
571 545
572 /* If the number of data bits is to be updated */ 546 /* If the number of data bits is to be updated */
573 if ((cflag & CSIZE) != (old_cflag & CSIZE)) { 547 if ((cflag & CSIZE) != (old_cflag & CSIZE)) {
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index dab2e66d111d..ae410c4678ea 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -973,6 +973,8 @@ static void digi_set_termios(struct usb_serial_port *port,
973 } 973 }
974 } 974 }
975 /* set parity */ 975 /* set parity */
976 tty->termios->c_cflag &= ~CMSPAR;
977
976 if ((cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD))) { 978 if ((cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD))) {
977 if (cflag&PARENB) { 979 if (cflag&PARENB) {
978 if (cflag&PARODD) 980 if (cflag&PARODD)
@@ -1054,15 +1056,15 @@ static void digi_set_termios(struct usb_serial_port *port,
1054 } 1056 }
1055 1057
1056 /* set output flow control */ 1058 /* set output flow control */
1057 if ((iflag&IXON) != (old_iflag&IXON) 1059 if ((iflag & IXON) != (old_iflag & IXON)
1058 || (cflag&CRTSCTS) != (old_cflag&CRTSCTS)) { 1060 || (cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
1059 arg = 0; 1061 arg = 0;
1060 if (iflag&IXON) 1062 if (iflag & IXON)
1061 arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; 1063 arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF;
1062 else 1064 else
1063 arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; 1065 arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF;
1064 1066
1065 if (cflag&CRTSCTS) { 1067 if (cflag & CRTSCTS) {
1066 arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS; 1068 arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS;
1067 } else { 1069 } else {
1068 arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS; 1070 arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS;
@@ -1076,8 +1078,8 @@ static void digi_set_termios(struct usb_serial_port *port,
1076 } 1078 }
1077 1079
1078 /* set receive enable/disable */ 1080 /* set receive enable/disable */
1079 if ((cflag&CREAD) != (old_cflag&CREAD)) { 1081 if ((cflag & CREAD) != (old_cflag & CREAD)) {
1080 if (cflag&CREAD) 1082 if (cflag & CREAD)
1081 arg = DIGI_ENABLE; 1083 arg = DIGI_ENABLE;
1082 else 1084 else
1083 arg = DIGI_DISABLE; 1085 arg = DIGI_DISABLE;
@@ -1089,7 +1091,7 @@ static void digi_set_termios(struct usb_serial_port *port,
1089 } 1091 }
1090 if ((ret = digi_write_oob_command(port, buf, i, 1)) != 0) 1092 if ((ret = digi_write_oob_command(port, buf, i, 1)) != 0)
1091 dbg("digi_set_termios: write oob failed, ret=%d", ret); 1093 dbg("digi_set_termios: write oob failed, ret=%d", ret);
1092 1094 tty_encode_baud_rate(tty, baud, baud);
1093} 1095}
1094 1096
1095 1097
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
index 050fcc996f56..a5c8e1e17ea5 100644
--- a/drivers/usb/serial/empeg.c
+++ b/drivers/usb/serial/empeg.c
@@ -449,14 +449,9 @@ static int empeg_ioctl (struct usb_serial_port *port, struct file * file, unsign
449 449
450static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) 450static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
451{ 451{
452 452 struct ktermios *termios = port->tty->termios;
453 dbg("%s - port %d", __FUNCTION__, port->number); 453 dbg("%s - port %d", __FUNCTION__, port->number);
454 454
455 if ((!port->tty) || (!port->tty->termios)) {
456 dbg("%s - no tty structures", __FUNCTION__);
457 return;
458 }
459
460 /* 455 /*
461 * The empeg-car player wants these particular tty settings. 456 * The empeg-car player wants these particular tty settings.
462 * You could, for example, change the baud rate, however the 457 * You could, for example, change the baud rate, however the
@@ -466,7 +461,7 @@ static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *ol
466 * 461 *
467 * The default requirements for this device are: 462 * The default requirements for this device are:
468 */ 463 */
469 port->tty->termios->c_iflag 464 termios->c_iflag
470 &= ~(IGNBRK /* disable ignore break */ 465 &= ~(IGNBRK /* disable ignore break */
471 | BRKINT /* disable break causes interrupt */ 466 | BRKINT /* disable break causes interrupt */
472 | PARMRK /* disable mark parity errors */ 467 | PARMRK /* disable mark parity errors */
@@ -476,24 +471,23 @@ static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *ol
476 | ICRNL /* disable translate CR to NL */ 471 | ICRNL /* disable translate CR to NL */
477 | IXON); /* disable enable XON/XOFF flow control */ 472 | IXON); /* disable enable XON/XOFF flow control */
478 473
479 port->tty->termios->c_oflag 474 termios->c_oflag
480 &= ~OPOST; /* disable postprocess output characters */ 475 &= ~OPOST; /* disable postprocess output characters */
481 476
482 port->tty->termios->c_lflag 477 termios->c_lflag
483 &= ~(ECHO /* disable echo input characters */ 478 &= ~(ECHO /* disable echo input characters */
484 | ECHONL /* disable echo new line */ 479 | ECHONL /* disable echo new line */
485 | ICANON /* disable erase, kill, werase, and rprnt special characters */ 480 | ICANON /* disable erase, kill, werase, and rprnt special characters */
486 | ISIG /* disable interrupt, quit, and suspend special characters */ 481 | ISIG /* disable interrupt, quit, and suspend special characters */
487 | IEXTEN); /* disable non-POSIX special characters */ 482 | IEXTEN); /* disable non-POSIX special characters */
488 483
489 port->tty->termios->c_cflag 484 termios->c_cflag
490 &= ~(CSIZE /* no size */ 485 &= ~(CSIZE /* no size */
491 | PARENB /* disable parity bit */ 486 | PARENB /* disable parity bit */
492 | CBAUD); /* clear current baud rate */ 487 | CBAUD); /* clear current baud rate */
493 488
494 port->tty->termios->c_cflag 489 termios->c_cflag
495 |= (CS8 /* character size 8 bits */ 490 |= CS8; /* character size 8 bits */
496 | B115200); /* baud rate 115200 */
497 491
498 /* 492 /*
499 * Force low_latency on; otherwise the pushes are scheduled; 493 * Force low_latency on; otherwise the pushes are scheduled;
@@ -501,8 +495,7 @@ static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *ol
501 * on the floor. We don't want to drop bytes on the floor. :) 495 * on the floor. We don't want to drop bytes on the floor. :)
502 */ 496 */
503 port->tty->low_latency = 1; 497 port->tty->low_latency = 1;
504 498 tty_encode_baud_rate(port->tty, 115200, 115200);
505 return;
506} 499}
507 500
508 501
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 8a8a6b9fb05b..c40e77dccf8e 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -294,7 +294,7 @@ struct ftdi_private {
294 294
295 __u16 interface; /* FT2232C port interface (0 for FT232/245) */ 295 __u16 interface; /* FT2232C port interface (0 for FT232/245) */
296 296
297 int force_baud; /* if non-zero, force the baud rate to this value */ 297 speed_t force_baud; /* if non-zero, force the baud rate to this value */
298 int force_rtscts; /* if non-zero, force RTS-CTS to always be enabled */ 298 int force_rtscts; /* if non-zero, force RTS-CTS to always be enabled */
299 299
300 spinlock_t tx_lock; /* spinlock for transmit state */ 300 spinlock_t tx_lock; /* spinlock for transmit state */
@@ -878,6 +878,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port)
878 if (div_value == 0) { 878 if (div_value == 0) {
879 dbg("%s - Baudrate (%d) requested is not supported", __FUNCTION__, baud); 879 dbg("%s - Baudrate (%d) requested is not supported", __FUNCTION__, baud);
880 div_value = ftdi_sio_b9600; 880 div_value = ftdi_sio_b9600;
881 baud = 9600;
881 div_okay = 0; 882 div_okay = 0;
882 } 883 }
883 break; 884 break;
@@ -886,6 +887,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port)
886 div_value = ftdi_232am_baud_to_divisor(baud); 887 div_value = ftdi_232am_baud_to_divisor(baud);
887 } else { 888 } else {
888 dbg("%s - Baud rate too high!", __FUNCTION__); 889 dbg("%s - Baud rate too high!", __FUNCTION__);
890 baud = 9600;
889 div_value = ftdi_232am_baud_to_divisor(9600); 891 div_value = ftdi_232am_baud_to_divisor(9600);
890 div_okay = 0; 892 div_okay = 0;
891 } 893 }
@@ -899,6 +901,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port)
899 dbg("%s - Baud rate too high!", __FUNCTION__); 901 dbg("%s - Baud rate too high!", __FUNCTION__);
900 div_value = ftdi_232bm_baud_to_divisor(9600); 902 div_value = ftdi_232bm_baud_to_divisor(9600);
901 div_okay = 0; 903 div_okay = 0;
904 baud = 9600;
902 } 905 }
903 break; 906 break;
904 } /* priv->chip_type */ 907 } /* priv->chip_type */
@@ -909,6 +912,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port)
909 ftdi_chip_name[priv->chip_type]); 912 ftdi_chip_name[priv->chip_type]);
910 } 913 }
911 914
915 tty_encode_baud_rate(port->tty, baud, baud);
912 return(div_value); 916 return(div_value);
913} 917}
914 918
@@ -1263,7 +1267,7 @@ static void ftdi_USB_UIRT_setup (struct ftdi_private *priv)
1263 1267
1264 priv->flags |= ASYNC_SPD_CUST; 1268 priv->flags |= ASYNC_SPD_CUST;
1265 priv->custom_divisor = 77; 1269 priv->custom_divisor = 77;
1266 priv->force_baud = B38400; 1270 priv->force_baud = 38400;
1267} /* ftdi_USB_UIRT_setup */ 1271} /* ftdi_USB_UIRT_setup */
1268 1272
1269/* Setup for the HE-TIRA1 device, which requires hardwired 1273/* Setup for the HE-TIRA1 device, which requires hardwired
@@ -1274,7 +1278,7 @@ static void ftdi_HE_TIRA1_setup (struct ftdi_private *priv)
1274 1278
1275 priv->flags |= ASYNC_SPD_CUST; 1279 priv->flags |= ASYNC_SPD_CUST;
1276 priv->custom_divisor = 240; 1280 priv->custom_divisor = 240;
1277 priv->force_baud = B38400; 1281 priv->force_baud = 38400;
1278 priv->force_rtscts = 1; 1282 priv->force_rtscts = 1;
1279} /* ftdi_HE_TIRA1_setup */ 1283} /* ftdi_HE_TIRA1_setup */
1280 1284
@@ -1363,7 +1367,7 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp)
1363 1367
1364 /* ftdi_set_termios will send usb control messages */ 1368 /* ftdi_set_termios will send usb control messages */
1365 if (port->tty) 1369 if (port->tty)
1366 ftdi_set_termios(port, NULL); 1370 ftdi_set_termios(port, port->tty->termios);
1367 1371
1368 /* FIXME: Flow control might be enabled, so it should be checked - 1372 /* FIXME: Flow control might be enabled, so it should be checked -
1369 we have no control of defaults! */ 1373 we have no control of defaults! */
@@ -1933,32 +1937,33 @@ static void ftdi_break_ctl( struct usb_serial_port *port, int break_state )
1933static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) 1937static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
1934{ /* ftdi_termios */ 1938{ /* ftdi_termios */
1935 struct usb_device *dev = port->serial->dev; 1939 struct usb_device *dev = port->serial->dev;
1936 unsigned int cflag = port->tty->termios->c_cflag;
1937 struct ftdi_private *priv = usb_get_serial_port_data(port); 1940 struct ftdi_private *priv = usb_get_serial_port_data(port);
1941 struct ktermios *termios = port->tty->termios;
1942 unsigned int cflag = termios->c_cflag;
1938 __u16 urb_value; /* will hold the new flags */ 1943 __u16 urb_value; /* will hold the new flags */
1939 char buf[1]; /* Perhaps I should dynamically alloc this? */ 1944 char buf[1]; /* Perhaps I should dynamically alloc this? */
1940 1945
1941 // Added for xon/xoff support 1946 // Added for xon/xoff support
1942 unsigned int iflag = port->tty->termios->c_iflag; 1947 unsigned int iflag = termios->c_iflag;
1943 unsigned char vstop; 1948 unsigned char vstop;
1944 unsigned char vstart; 1949 unsigned char vstart;
1945 1950
1946 dbg("%s", __FUNCTION__); 1951 dbg("%s", __FUNCTION__);
1947 1952
1948 /* Force baud rate if this device requires it, unless it is set to B0. */ 1953 /* Force baud rate if this device requires it, unless it is set to B0. */
1949 if (priv->force_baud && ((port->tty->termios->c_cflag & CBAUD) != B0)) { 1954 if (priv->force_baud && ((termios->c_cflag & CBAUD) != B0)) {
1950 dbg("%s: forcing baud rate for this device", __FUNCTION__); 1955 dbg("%s: forcing baud rate for this device", __FUNCTION__);
1951 port->tty->termios->c_cflag &= ~CBAUD; 1956 tty_encode_baud_rate(port->tty, priv->force_baud,
1952 port->tty->termios->c_cflag |= priv->force_baud; 1957 priv->force_baud);
1953 } 1958 }
1954 1959
1955 /* Force RTS-CTS if this device requires it. */ 1960 /* Force RTS-CTS if this device requires it. */
1956 if (priv->force_rtscts) { 1961 if (priv->force_rtscts) {
1957 dbg("%s: forcing rtscts for this device", __FUNCTION__); 1962 dbg("%s: forcing rtscts for this device", __FUNCTION__);
1958 port->tty->termios->c_cflag |= CRTSCTS; 1963 termios->c_cflag |= CRTSCTS;
1959 } 1964 }
1960 1965
1961 cflag = port->tty->termios->c_cflag; 1966 cflag = termios->c_cflag;
1962 1967
1963 /* FIXME -For this cut I don't care if the line is really changing or 1968 /* FIXME -For this cut I don't care if the line is really changing or
1964 not - so just do the change regardless - should be able to 1969 not - so just do the change regardless - should be able to
@@ -1969,6 +1974,8 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old
1969 1974
1970 /* Set number of data bits, parity, stop bits */ 1975 /* Set number of data bits, parity, stop bits */
1971 1976
1977 termios->c_cflag &= ~CMSPAR;
1978
1972 urb_value = 0; 1979 urb_value = 0;
1973 urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 : 1980 urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 :
1974 FTDI_SIO_SET_DATA_STOP_BITS_1); 1981 FTDI_SIO_SET_DATA_STOP_BITS_1);
@@ -2048,8 +2055,8 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old
2048 // Set the vstart and vstop -- could have been done up above where 2055 // Set the vstart and vstop -- could have been done up above where
2049 // a lot of other dereferencing is done but that would be very 2056 // a lot of other dereferencing is done but that would be very
2050 // inefficient as vstart and vstop are not always needed 2057 // inefficient as vstart and vstop are not always needed
2051 vstart=port->tty->termios->c_cc[VSTART]; 2058 vstart = termios->c_cc[VSTART];
2052 vstop=port->tty->termios->c_cc[VSTOP]; 2059 vstop = termios->c_cc[VSTOP];
2053 urb_value=(vstop << 8) | (vstart); 2060 urb_value=(vstop << 8) | (vstart);
2054 2061
2055 if (usb_control_msg(dev, 2062 if (usb_control_msg(dev,
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 88a2c7dce335..9eb4a65ee4d9 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -208,14 +208,15 @@ int usb_serial_generic_write(struct usb_serial_port *port, const unsigned char *
208 208
209 /* only do something if we have a bulk out endpoint */ 209 /* only do something if we have a bulk out endpoint */
210 if (serial->num_bulk_out) { 210 if (serial->num_bulk_out) {
211 spin_lock_bh(&port->lock); 211 unsigned long flags;
212 spin_lock_irqsave(&port->lock, flags);
212 if (port->write_urb_busy) { 213 if (port->write_urb_busy) {
213 spin_unlock_bh(&port->lock); 214 spin_unlock_irqrestore(&port->lock, flags);
214 dbg("%s - already writing", __FUNCTION__); 215 dbg("%s - already writing", __FUNCTION__);
215 return 0; 216 return 0;
216 } 217 }
217 port->write_urb_busy = 1; 218 port->write_urb_busy = 1;
218 spin_unlock_bh(&port->lock); 219 spin_unlock_irqrestore(&port->lock, flags);
219 220
220 count = (count > port->bulk_out_size) ? port->bulk_out_size : count; 221 count = (count > port->bulk_out_size) ? port->bulk_out_size : count;
221 222
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 8dd3abc99d63..a5d2e115e167 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -1503,22 +1503,16 @@ static void edge_unthrottle (struct usb_serial_port *port)
1503 *****************************************************************************/ 1503 *****************************************************************************/
1504static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) 1504static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
1505{ 1505{
1506 /* FIXME: This function appears unused ?? */
1506 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 1507 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
1507 struct tty_struct *tty = port->tty; 1508 struct tty_struct *tty = port->tty;
1508 unsigned int cflag; 1509 unsigned int cflag;
1509 1510
1510 if (!port->tty || !port->tty->termios) {
1511 dbg ("%s - no tty or termios", __FUNCTION__);
1512 return;
1513 }
1514
1515 cflag = tty->termios->c_cflag; 1511 cflag = tty->termios->c_cflag;
1516 dbg("%s - clfag %08x iflag %08x", __FUNCTION__, 1512 dbg("%s - clfag %08x iflag %08x", __FUNCTION__,
1517 tty->termios->c_cflag, tty->termios->c_iflag); 1513 tty->termios->c_cflag, tty->termios->c_iflag);
1518 if (old_termios) { 1514 dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__,
1519 dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, 1515 old_termios->c_cflag, old_termios->c_iflag);
1520 old_termios->c_cflag, old_termios->c_iflag);
1521 }
1522 1516
1523 dbg("%s - port %d", __FUNCTION__, port->number); 1517 dbg("%s - port %d", __FUNCTION__, port->number);
1524 1518
@@ -2653,7 +2647,11 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi
2653 2647
2654 dbg("%s - baud rate = %d", __FUNCTION__, baud); 2648 dbg("%s - baud rate = %d", __FUNCTION__, baud);
2655 status = send_cmd_write_baud_rate (edge_port, baud); 2649 status = send_cmd_write_baud_rate (edge_port, baud);
2656 2650 if (status == -1) {
2651 /* Speed change was not possible - put back the old speed */
2652 baud = tty_termios_baud_rate(old_termios);
2653 tty_encode_baud_rate(tty, baud, baud);
2654 }
2657 return; 2655 return;
2658} 2656}
2659 2657
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index 5ab6a0c5ac52..6b803ab98543 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -504,11 +504,6 @@ static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_t
504 504
505 dbg("%s - port %d", __FUNCTION__, port->number); 505 dbg("%s - port %d", __FUNCTION__, port->number);
506 506
507 if ((!port->tty) || (!port->tty->termios)) {
508 dbg("%s - no tty structures", __FUNCTION__);
509 return;
510 }
511
512 baud = tty_get_baud_rate(port->tty); 507 baud = tty_get_baud_rate(port->tty);
513 508
514 /* 509 /*
@@ -531,8 +526,6 @@ static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_t
531 default: 526 default:
532 ir_baud = SPEED_9600; 527 ir_baud = SPEED_9600;
533 baud = 9600; 528 baud = 9600;
534 /* And once the new tty stuff is all done we need to
535 call back to correct the baud bits */
536 } 529 }
537 530
538 if (xbof == -1) 531 if (xbof == -1)
@@ -562,6 +555,10 @@ static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_t
562 result = usb_submit_urb (port->write_urb, GFP_KERNEL); 555 result = usb_submit_urb (port->write_urb, GFP_KERNEL);
563 if (result) 556 if (result)
564 dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, result); 557 dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, result);
558
559 /* Only speed changes are supported */
560 tty_termios_copy_hw(port->tty->termios, old_termios);
561 tty_encode_baud_rate(port->tty, baud, baud);
565} 562}
566 563
567 564
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index f2a6fce5de1e..6bfdba6a213f 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -278,29 +278,35 @@ static void keyspan_set_termios (struct usb_serial_port *port,
278 struct keyspan_port_private *p_priv; 278 struct keyspan_port_private *p_priv;
279 const struct keyspan_device_details *d_details; 279 const struct keyspan_device_details *d_details;
280 unsigned int cflag; 280 unsigned int cflag;
281 struct tty_struct *tty = port->tty;
281 282
282 dbg("%s", __FUNCTION__); 283 dbg("%s", __FUNCTION__);
283 284
284 p_priv = usb_get_serial_port_data(port); 285 p_priv = usb_get_serial_port_data(port);
285 d_details = p_priv->device_details; 286 d_details = p_priv->device_details;
286 cflag = port->tty->termios->c_cflag; 287 cflag = tty->termios->c_cflag;
287 device_port = port->number - port->serial->minor; 288 device_port = port->number - port->serial->minor;
288 289
289 /* Baud rate calculation takes baud rate as an integer 290 /* Baud rate calculation takes baud rate as an integer
290 so other rates can be generated if desired. */ 291 so other rates can be generated if desired. */
291 baud_rate = tty_get_baud_rate(port->tty); 292 baud_rate = tty_get_baud_rate(tty);
292 /* If no match or invalid, don't change */ 293 /* If no match or invalid, don't change */
293 if (baud_rate >= 0 294 if (d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
294 && d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
295 NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { 295 NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
296 /* FIXME - more to do here to ensure rate changes cleanly */ 296 /* FIXME - more to do here to ensure rate changes cleanly */
297 /* FIXME - calcuate exact rate from divisor ? */
297 p_priv->baud = baud_rate; 298 p_priv->baud = baud_rate;
298 } 299 } else
300 baud_rate = tty_termios_baud_rate(old_termios);
299 301
302 tty_encode_baud_rate(tty, baud_rate, baud_rate);
300 /* set CTS/RTS handshake etc. */ 303 /* set CTS/RTS handshake etc. */
301 p_priv->cflag = cflag; 304 p_priv->cflag = cflag;
302 p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none; 305 p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none;
303 306
307 /* Mark/Space not supported */
308 tty->termios->c_cflag &= ~CMSPAR;
309
304 keyspan_send_setup(port, 0); 310 keyspan_send_setup(port, 0);
305} 311}
306 312
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 6f224195bd25..aee450246bfd 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -616,8 +616,9 @@ static void kobil_set_termios(struct usb_serial_port *port, struct ktermios *old
616 case 1200: 616 case 1200:
617 urb_val = SUSBCR_SBR_1200; 617 urb_val = SUSBCR_SBR_1200;
618 break; 618 break;
619 case 9600:
620 default: 619 default:
620 speed = 9600;
621 case 9600:
621 urb_val = SUSBCR_SBR_9600; 622 urb_val = SUSBCR_SBR_9600;
622 break; 623 break;
623 } 624 }
@@ -641,6 +642,8 @@ static void kobil_set_termios(struct usb_serial_port *port, struct ktermios *old
641 urb_val |= SUSBCR_SPASB_NoParity; 642 urb_val |= SUSBCR_SPASB_NoParity;
642 strcat(settings, "No Parity"); 643 strcat(settings, "No Parity");
643 } 644 }
645 port->tty->termios->c_cflag &= ~CMSPAR;
646 tty_encode_baud_rate(port->tty, speed, speed);
644 647
645 result = usb_control_msg( port->serial->dev, 648 result = usb_control_msg( port->serial->dev,
646 usb_rcvctrlpipe(port->serial->dev, 0 ), 649 usb_rcvctrlpipe(port->serial->dev, 0 ),
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index f76480f1455d..a5ced7e08cbf 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1977,11 +1977,6 @@ static void mos7840_change_port_settings(struct moschip_port *mos7840_port,
1977 1977
1978 tty = mos7840_port->port->tty; 1978 tty = mos7840_port->port->tty;
1979 1979
1980 if ((!tty) || (!tty->termios)) {
1981 dbg("%s - no tty structures", __FUNCTION__);
1982 return;
1983 }
1984
1985 dbg("%s", "Entering .......... \n"); 1980 dbg("%s", "Entering .......... \n");
1986 1981
1987 lData = LCR_BITS_8; 1982 lData = LCR_BITS_8;
@@ -2151,11 +2146,6 @@ static void mos7840_set_termios(struct usb_serial_port *port,
2151 2146
2152 tty = port->tty; 2147 tty = port->tty;
2153 2148
2154 if (!port->tty || !port->tty->termios) {
2155 dbg("%s - no tty or termios", __FUNCTION__);
2156 return;
2157 }
2158
2159 if (!mos7840_port->open) { 2149 if (!mos7840_port->open) {
2160 dbg("%s - port not opened", __FUNCTION__); 2150 dbg("%s - port not opened", __FUNCTION__);
2161 return; 2151 return;
@@ -2165,19 +2155,10 @@ static void mos7840_set_termios(struct usb_serial_port *port,
2165 2155
2166 cflag = tty->termios->c_cflag; 2156 cflag = tty->termios->c_cflag;
2167 2157
2168 if (!cflag) {
2169 dbg("%s %s\n", __FUNCTION__, "cflag is NULL");
2170 return;
2171 }
2172
2173 dbg("%s - clfag %08x iflag %08x", __FUNCTION__, 2158 dbg("%s - clfag %08x iflag %08x", __FUNCTION__,
2174 tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag)); 2159 tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag));
2175 2160 dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__,
2176 if (old_termios) { 2161 old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
2177 dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__,
2178 old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
2179 }
2180
2181 dbg("%s - port %d", __FUNCTION__, port->number); 2162 dbg("%s - port %d", __FUNCTION__, port->number);
2182 2163
2183 /* change the port settings to the new ones specified */ 2164 /* change the port settings to the new ones specified */
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index a18659e0700c..4590124cf888 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -172,6 +172,8 @@ static struct usb_device_id option_ids[] = {
172 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */ 172 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */
173 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ 173 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */
174 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */ 174 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */
175 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4100) }, /* Novatel U727 */
176 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4400) }, /* Novatel MC950 */
175 { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ 177 { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */
176 { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ 178 { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
177 { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ 179 { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
@@ -311,7 +313,8 @@ static void option_set_termios(struct usb_serial_port *port,
311 struct ktermios *old_termios) 313 struct ktermios *old_termios)
312{ 314{
313 dbg("%s", __FUNCTION__); 315 dbg("%s", __FUNCTION__);
314 316 /* Doesn't support option setting */
317 tty_termios_copy_hw(port->tty->termios, old_termios);
315 option_send_setup(port); 318 option_send_setup(port);
316} 319}
317 320
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 1da57fd9ea23..2cd3f1d4b687 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -56,6 +56,7 @@ static struct usb_device_id id_table [] = {
56 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, 56 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) },
57 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, 57 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) },
58 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, 58 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
59 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
59 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, 60 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
60 { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) }, 61 { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) },
61 { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, 62 { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) },
@@ -470,16 +471,13 @@ static void pl2303_set_termios(struct usb_serial_port *port,
470 471
471 dbg("%s - port %d", __FUNCTION__, port->number); 472 dbg("%s - port %d", __FUNCTION__, port->number);
472 473
473 if ((!port->tty) || (!port->tty->termios)) {
474 dbg("%s - no tty structures", __FUNCTION__);
475 return;
476 }
477
478 spin_lock_irqsave(&priv->lock, flags); 474 spin_lock_irqsave(&priv->lock, flags);
479 if (!priv->termios_initialized) { 475 if (!priv->termios_initialized) {
480 *(port->tty->termios) = tty_std_termios; 476 *(port->tty->termios) = tty_std_termios;
481 port->tty->termios->c_cflag = B9600 | CS8 | CREAD | 477 port->tty->termios->c_cflag = B9600 | CS8 | CREAD |
482 HUPCL | CLOCAL; 478 HUPCL | CLOCAL;
479 port->tty->termios->c_ispeed = 9600;
480 port->tty->termios->c_ospeed = 9600;
483 priv->termios_initialized = 1; 481 priv->termios_initialized = 1;
484 } 482 }
485 spin_unlock_irqrestore(&priv->lock, flags); 483 spin_unlock_irqrestore(&priv->lock, flags);
@@ -596,6 +594,10 @@ static void pl2303_set_termios(struct usb_serial_port *port,
596 dbg ("0x40:0x1:0x0:0x0 %d", i); 594 dbg ("0x40:0x1:0x0:0x0 %d", i);
597 } 595 }
598 596
597 /* FIXME: Need to read back resulting baud rate */
598 if (baud)
599 tty_encode_baud_rate(port->tty, baud, baud);
600
599 kfree(buf); 601 kfree(buf);
600} 602}
601 603
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index c39bace5cbcc..ed603e3decd6 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -20,6 +20,7 @@
20 20
21#define IODATA_VENDOR_ID 0x04bb 21#define IODATA_VENDOR_ID 0x04bb
22#define IODATA_PRODUCT_ID 0x0a03 22#define IODATA_PRODUCT_ID 0x0a03
23#define IODATA_PRODUCT_ID_RSAQ5 0x0a0e
23 24
24#define ELCOM_VENDOR_ID 0x056e 25#define ELCOM_VENDOR_ID 0x056e
25#define ELCOM_PRODUCT_ID 0x5003 26#define ELCOM_PRODUCT_ID 0x5003
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 959b3e4e9077..833f6e1e3721 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -224,7 +224,7 @@ static void sierra_set_termios(struct usb_serial_port *port,
224 struct ktermios *old_termios) 224 struct ktermios *old_termios)
225{ 225{
226 dbg("%s", __FUNCTION__); 226 dbg("%s", __FUNCTION__);
227 227 tty_termios_copy_hw(port->tty->termios, old_termios);
228 sierra_send_setup(port); 228 sierra_send_setup(port);
229} 229}
230 230
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 4b1bd7def4a5..497e29a700ca 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -429,6 +429,8 @@ static void serial_set_termios (struct tty_struct *tty, struct ktermios * old)
429 /* pass on to the driver specific version of this function if it is available */ 429 /* pass on to the driver specific version of this function if it is available */
430 if (port->serial->type->set_termios) 430 if (port->serial->type->set_termios)
431 port->serial->type->set_termios(port, old); 431 port->serial->type->set_termios(port, old);
432 else
433 tty_termios_copy_hw(tty->termios, old);
432} 434}
433 435
434static void serial_break (struct tty_struct *tty, int break_state) 436static void serial_break (struct tty_struct *tty, int break_state)
@@ -1121,7 +1123,9 @@ int usb_serial_resume(struct usb_interface *intf)
1121{ 1123{
1122 struct usb_serial *serial = usb_get_intfdata(intf); 1124 struct usb_serial *serial = usb_get_intfdata(intf);
1123 1125
1124 return serial->type->resume(serial); 1126 if (serial->type->resume)
1127 return serial->type->resume(serial);
1128 return 0;
1125} 1129}
1126EXPORT_SYMBOL(usb_serial_resume); 1130EXPORT_SYMBOL(usb_serial_resume);
1127 1131
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index cc8b44c08712..ee5dd8b5a713 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -885,16 +885,7 @@ static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, un
885static void whiteheat_set_termios(struct usb_serial_port *port, struct ktermios *old_termios) 885static void whiteheat_set_termios(struct usb_serial_port *port, struct ktermios *old_termios)
886{ 886{
887 dbg("%s -port %d", __FUNCTION__, port->number); 887 dbg("%s -port %d", __FUNCTION__, port->number);
888
889 if ((!port->tty) || (!port->tty->termios)) {
890 dbg("%s - no tty structures", __FUNCTION__);
891 goto exit;
892 }
893
894 firm_setup_port(port); 888 firm_setup_port(port);
895
896exit:
897 return;
898} 889}
899 890
900 891
@@ -1244,6 +1235,8 @@ static int firm_setup_port(struct usb_serial_port *port) {
1244 port_settings.baud = tty_get_baud_rate(port->tty); 1235 port_settings.baud = tty_get_baud_rate(port->tty);
1245 dbg("%s - baud rate = %d", __FUNCTION__, port_settings.baud); 1236 dbg("%s - baud rate = %d", __FUNCTION__, port_settings.baud);
1246 1237
1238 /* fixme: should set validated settings */
1239 tty_encode_baud_rate(port->tty, port_settings.baud, port_settings.baud);
1247 /* handle any settings that aren't specified in the tty structure */ 1240 /* handle any settings that aren't specified in the tty structure */
1248 port_settings.lloop = 0; 1241 port_settings.lloop = 0;
1249 1242
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index fe2c4cd53f5a..7e53333be013 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -48,7 +48,6 @@ config USB_STORAGE_FREECOM
48config USB_STORAGE_ISD200 48config USB_STORAGE_ISD200
49 bool "ISD-200 USB/ATA Bridge support" 49 bool "ISD-200 USB/ATA Bridge support"
50 depends on USB_STORAGE 50 depends on USB_STORAGE
51 depends on BLK_DEV_IDE=y || BLK_DEV_IDE=USB_STORAGE
52 ---help--- 51 ---help---
53 Say Y here if you want to use USB Mass Store devices based 52 Say Y here if you want to use USB Mass Store devices based
54 on the In-Systems Design ISD-200 USB/ATA bridge. 53 on the In-Systems Design ISD-200 USB/ATA bridge.
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 93a7724e167a..49ba6c0ff1e8 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -977,6 +977,109 @@ static int isd200_manual_enum(struct us_data *us)
977 return(retStatus); 977 return(retStatus);
978} 978}
979 979
980/*
981 * We are the last non IDE user of the legacy IDE ident structures
982 * and we thus want to keep a private copy of this function so the
983 * driver can be used without the obsolete drivers/ide layer
984 */
985
986static void isd200_fix_driveid (struct hd_driveid *id)
987{
988#ifndef __LITTLE_ENDIAN
989# ifdef __BIG_ENDIAN
990 int i;
991 u16 *stringcast;
992
993 id->config = __le16_to_cpu(id->config);
994 id->cyls = __le16_to_cpu(id->cyls);
995 id->reserved2 = __le16_to_cpu(id->reserved2);
996 id->heads = __le16_to_cpu(id->heads);
997 id->track_bytes = __le16_to_cpu(id->track_bytes);
998 id->sector_bytes = __le16_to_cpu(id->sector_bytes);
999 id->sectors = __le16_to_cpu(id->sectors);
1000 id->vendor0 = __le16_to_cpu(id->vendor0);
1001 id->vendor1 = __le16_to_cpu(id->vendor1);
1002 id->vendor2 = __le16_to_cpu(id->vendor2);
1003 stringcast = (u16 *)&id->serial_no[0];
1004 for (i = 0; i < (20/2); i++)
1005 stringcast[i] = __le16_to_cpu(stringcast[i]);
1006 id->buf_type = __le16_to_cpu(id->buf_type);
1007 id->buf_size = __le16_to_cpu(id->buf_size);
1008 id->ecc_bytes = __le16_to_cpu(id->ecc_bytes);
1009 stringcast = (u16 *)&id->fw_rev[0];
1010 for (i = 0; i < (8/2); i++)
1011 stringcast[i] = __le16_to_cpu(stringcast[i]);
1012 stringcast = (u16 *)&id->model[0];
1013 for (i = 0; i < (40/2); i++)
1014 stringcast[i] = __le16_to_cpu(stringcast[i]);
1015 id->dword_io = __le16_to_cpu(id->dword_io);
1016 id->reserved50 = __le16_to_cpu(id->reserved50);
1017 id->field_valid = __le16_to_cpu(id->field_valid);
1018 id->cur_cyls = __le16_to_cpu(id->cur_cyls);
1019 id->cur_heads = __le16_to_cpu(id->cur_heads);
1020 id->cur_sectors = __le16_to_cpu(id->cur_sectors);
1021 id->cur_capacity0 = __le16_to_cpu(id->cur_capacity0);
1022 id->cur_capacity1 = __le16_to_cpu(id->cur_capacity1);
1023 id->lba_capacity = __le32_to_cpu(id->lba_capacity);
1024 id->dma_1word = __le16_to_cpu(id->dma_1word);
1025 id->dma_mword = __le16_to_cpu(id->dma_mword);
1026 id->eide_pio_modes = __le16_to_cpu(id->eide_pio_modes);
1027 id->eide_dma_min = __le16_to_cpu(id->eide_dma_min);
1028 id->eide_dma_time = __le16_to_cpu(id->eide_dma_time);
1029 id->eide_pio = __le16_to_cpu(id->eide_pio);
1030 id->eide_pio_iordy = __le16_to_cpu(id->eide_pio_iordy);
1031 for (i = 0; i < 2; ++i)
1032 id->words69_70[i] = __le16_to_cpu(id->words69_70[i]);
1033 for (i = 0; i < 4; ++i)
1034 id->words71_74[i] = __le16_to_cpu(id->words71_74[i]);
1035 id->queue_depth = __le16_to_cpu(id->queue_depth);
1036 for (i = 0; i < 4; ++i)
1037 id->words76_79[i] = __le16_to_cpu(id->words76_79[i]);
1038 id->major_rev_num = __le16_to_cpu(id->major_rev_num);
1039 id->minor_rev_num = __le16_to_cpu(id->minor_rev_num);
1040 id->command_set_1 = __le16_to_cpu(id->command_set_1);
1041 id->command_set_2 = __le16_to_cpu(id->command_set_2);
1042 id->cfsse = __le16_to_cpu(id->cfsse);
1043 id->cfs_enable_1 = __le16_to_cpu(id->cfs_enable_1);
1044 id->cfs_enable_2 = __le16_to_cpu(id->cfs_enable_2);
1045 id->csf_default = __le16_to_cpu(id->csf_default);
1046 id->dma_ultra = __le16_to_cpu(id->dma_ultra);
1047 id->trseuc = __le16_to_cpu(id->trseuc);
1048 id->trsEuc = __le16_to_cpu(id->trsEuc);
1049 id->CurAPMvalues = __le16_to_cpu(id->CurAPMvalues);
1050 id->mprc = __le16_to_cpu(id->mprc);
1051 id->hw_config = __le16_to_cpu(id->hw_config);
1052 id->acoustic = __le16_to_cpu(id->acoustic);
1053 id->msrqs = __le16_to_cpu(id->msrqs);
1054 id->sxfert = __le16_to_cpu(id->sxfert);
1055 id->sal = __le16_to_cpu(id->sal);
1056 id->spg = __le32_to_cpu(id->spg);
1057 id->lba_capacity_2 = __le64_to_cpu(id->lba_capacity_2);
1058 for (i = 0; i < 22; i++)
1059 id->words104_125[i] = __le16_to_cpu(id->words104_125[i]);
1060 id->last_lun = __le16_to_cpu(id->last_lun);
1061 id->word127 = __le16_to_cpu(id->word127);
1062 id->dlf = __le16_to_cpu(id->dlf);
1063 id->csfo = __le16_to_cpu(id->csfo);
1064 for (i = 0; i < 26; i++)
1065 id->words130_155[i] = __le16_to_cpu(id->words130_155[i]);
1066 id->word156 = __le16_to_cpu(id->word156);
1067 for (i = 0; i < 3; i++)
1068 id->words157_159[i] = __le16_to_cpu(id->words157_159[i]);
1069 id->cfa_power = __le16_to_cpu(id->cfa_power);
1070 for (i = 0; i < 14; i++)
1071 id->words161_175[i] = __le16_to_cpu(id->words161_175[i]);
1072 for (i = 0; i < 31; i++)
1073 id->words176_205[i] = __le16_to_cpu(id->words176_205[i]);
1074 for (i = 0; i < 48; i++)
1075 id->words206_254[i] = __le16_to_cpu(id->words206_254[i]);
1076 id->integrity_word = __le16_to_cpu(id->integrity_word);
1077# else
1078# error "Please fix <asm/byteorder.h>"
1079# endif
1080#endif
1081}
1082
980 1083
981/************************************************************************** 1084/**************************************************************************
982 * isd200_get_inquiry_data 1085 * isd200_get_inquiry_data
@@ -1018,7 +1121,7 @@ static int isd200_get_inquiry_data( struct us_data *us )
1018 int i; 1121 int i;
1019 __be16 *src; 1122 __be16 *src;
1020 __u16 *dest; 1123 __u16 *dest;
1021 ide_fix_driveid(id); 1124 isd200_fix_driveid(id);
1022 1125
1023 US_DEBUGP(" Identify Data Structure:\n"); 1126 US_DEBUGP(" Identify Data Structure:\n");
1024 US_DEBUGP(" config = 0x%x\n", id->config); 1127 US_DEBUGP(" config = 0x%x\n", id->config);
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index fb9d8d0b2c04..cc4b60f899ca 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1509,7 +1509,7 @@ config FB_VOODOO1
1509 1509
1510 WARNING: Do not use any application that uses the 3D engine 1510 WARNING: Do not use any application that uses the 3D engine
1511 (namely glide) while using this driver. 1511 (namely glide) while using this driver.
1512 Please read the <file:Documentation/fb/README-sstfb.txt> for supported 1512 Please read the <file:Documentation/fb/sstfb.txt> for supported
1513 options and other important info support. 1513 options and other important info support.
1514 1514
1515config FB_VT8623 1515config FB_VT8623
@@ -1807,7 +1807,7 @@ config FB_SM501
1807 This driver is also available as a module ( = code which can be 1807 This driver is also available as a module ( = code which can be
1808 inserted and removed from the running kernel whenever you want). The 1808 inserted and removed from the running kernel whenever you want). The
1809 module will be called sm501fb. If you want to compile it as a module, 1809 module will be called sm501fb. If you want to compile it as a module,
1810 say M here and read <file:Documentation/modules.txt>. 1810 say M here and read <file:Documentation/kbuild/modules.txt>.
1811 1811
1812 If unsure, say N. 1812 If unsure, say N.
1813 1813
@@ -1892,9 +1892,7 @@ config FB_VIRTUAL
1892 1892
1893 If unsure, say N. 1893 If unsure, say N.
1894 1894
1895if ARCH_OMAP 1895source "drivers/video/omap/Kconfig"
1896 source "drivers/video/omap/Kconfig"
1897endif
1898 1896
1899source "drivers/video/backlight/Kconfig" 1897source "drivers/video/backlight/Kconfig"
1900source "drivers/video/display/Kconfig" 1898source "drivers/video/display/Kconfig"
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
index be1d57bf9dc8..83ee3e75386c 100644
--- a/drivers/video/aty/radeon_pm.c
+++ b/drivers/video/aty/radeon_pm.c
@@ -27,8 +27,6 @@
27 27
28#include "ati_ids.h" 28#include "ati_ids.h"
29 29
30static void radeon_reinitialize_M10(struct radeonfb_info *rinfo);
31
32/* 30/*
33 * Workarounds for bugs in PC laptops: 31 * Workarounds for bugs in PC laptops:
34 * - enable D2 sleep in some IBM Thinkpads 32 * - enable D2 sleep in some IBM Thinkpads
@@ -39,6 +37,8 @@ static void radeon_reinitialize_M10(struct radeonfb_info *rinfo);
39 */ 37 */
40 38
41#if defined(CONFIG_PM) && defined(CONFIG_X86) 39#if defined(CONFIG_PM) && defined(CONFIG_X86)
40static void radeon_reinitialize_M10(struct radeonfb_info *rinfo);
41
42struct radeon_device_id { 42struct radeon_device_id {
43 const char *ident; /* (arbitrary) Name */ 43 const char *ident; /* (arbitrary) Name */
44 const unsigned short subsystem_vendor; /* Subsystem Vendor ID */ 44 const unsigned short subsystem_vendor; /* Subsystem Vendor ID */
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index f99cb77e7b42..f7e2d5add831 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -2509,8 +2509,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z,
2509 cinfo = info->par; 2509 cinfo = info->par;
2510 cinfo->btype = btype; 2510 cinfo->btype = btype;
2511 2511
2512 assert(z > 0); 2512 assert(z);
2513 assert(z2 >= 0);
2514 assert(btype != BT_NONE); 2513 assert(btype != BT_NONE);
2515 2514
2516 cinfo->zdev = z; 2515 cinfo->zdev = z;
diff --git a/drivers/video/omap/Kconfig b/drivers/video/omap/Kconfig
index f4fcf11b290d..44408850e2eb 100644
--- a/drivers/video/omap/Kconfig
+++ b/drivers/video/omap/Kconfig
@@ -1,6 +1,6 @@
1config FB_OMAP 1config FB_OMAP
2 tristate "OMAP frame buffer support (EXPERIMENTAL)" 2 tristate "OMAP frame buffer support (EXPERIMENTAL)"
3 depends on FB 3 depends on FB && ARCH_OMAP
4 select FB_CFB_FILLRECT 4 select FB_CFB_FILLRECT
5 select FB_CFB_COPYAREA 5 select FB_CFB_COPYAREA
6 select FB_CFB_IMAGEBLIT 6 select FB_CFB_IMAGEBLIT
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig
index 6854fd6b9714..9adbb4f90479 100644
--- a/drivers/w1/Kconfig
+++ b/drivers/w1/Kconfig
@@ -17,7 +17,8 @@ config W1_CON
17 bool "Userspace communication over connector" 17 bool "Userspace communication over connector"
18 default y 18 default y
19 --- help --- 19 --- help ---
20 This allows to communicate with userspace using connector [Documentation/connector]. 20 This allows to communicate with userspace using connector. For more
21 information see <file:Documentation/connector/connector.txt>.
21 There are three types of messages between w1 core and userspace: 22 There are three types of messages between w1 core and userspace:
22 1. Events. They are generated each time new master or slave device found 23 1. Events. They are generated each time new master or slave device found
23 either due to automatic or requested search. 24 either due to automatic or requested search.
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 81db48f07ca1..2792bc1a7269 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -15,8 +15,8 @@ menuconfig WATCHDOG
15 implementation entirely in software (which can sometimes fail to 15 implementation entirely in software (which can sometimes fail to
16 reboot the machine) and a driver for hardware watchdog boards, which 16 reboot the machine) and a driver for hardware watchdog boards, which
17 are more robust and can also keep track of the temperature inside 17 are more robust and can also keep track of the temperature inside
18 your computer. For details, read <file:Documentation/watchdog/watchdog.txt> 18 your computer. For details, read
19 in the kernel source. 19 <file:Documentation/watchdog/watchdog-api.txt> in the kernel source.
20 20
21 The watchdog is usually used together with the watchdog daemon 21 The watchdog is usually used together with the watchdog daemon
22 which is available from 22 which is available from
diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c
index c404fc69e7e6..b481cc0e32e4 100644
--- a/drivers/watchdog/alim1535_wdt.c
+++ b/drivers/watchdog/alim1535_wdt.c
@@ -31,7 +31,7 @@ static unsigned long ali_is_open;
31static char ali_expect_release; 31static char ali_expect_release;
32static struct pci_dev *ali_pci; 32static struct pci_dev *ali_pci;
33static u32 ali_timeout_bits; /* stores the computed timeout */ 33static u32 ali_timeout_bits; /* stores the computed timeout */
34static spinlock_t ali_lock; /* Guards the hardware */ 34static DEFINE_SPINLOCK(ali_lock); /* Guards the hardware */
35 35
36/* module parameters */ 36/* module parameters */
37static int timeout = WATCHDOG_TIMEOUT; 37static int timeout = WATCHDOG_TIMEOUT;
@@ -398,8 +398,6 @@ static int __init watchdog_init(void)
398{ 398{
399 int ret; 399 int ret;
400 400
401 spin_lock_init(&ali_lock);
402
403 /* Check whether or not the hardware watchdog is there */ 401 /* Check whether or not the hardware watchdog is there */
404 if (ali_find_watchdog() != 0) { 402 if (ali_find_watchdog() != 0) {
405 return -ENODEV; 403 return -ENODEV;
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index 19db5302ba6e..a61cbd48dc07 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -61,7 +61,7 @@
61 61
62static int heartbeat = DEFAULT_HEARTBEAT; 62static int heartbeat = DEFAULT_HEARTBEAT;
63 63
64static spinlock_t io_lock; 64static DEFINE_SPINLOCK(io_lock);
65static unsigned long wdt_status; 65static unsigned long wdt_status;
66#define WDT_IN_USE 0 66#define WDT_IN_USE 0
67#define WDT_OK_TO_CLOSE 1 67#define WDT_OK_TO_CLOSE 1
@@ -200,8 +200,6 @@ static int davinci_wdt_probe(struct platform_device *pdev)
200 int ret = 0, size; 200 int ret = 0, size;
201 struct resource *res; 201 struct resource *res;
202 202
203 spin_lock_init(&io_lock);
204
205 if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) 203 if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
206 heartbeat = DEFAULT_HEARTBEAT; 204 heartbeat = DEFAULT_HEARTBEAT;
207 205
@@ -262,7 +260,7 @@ static int __init davinci_wdt_init(void)
262 260
263static void __exit davinci_wdt_exit(void) 261static void __exit davinci_wdt_exit(void)
264{ 262{
265 return platform_driver_unregister(&platform_wdt_driver); 263 platform_driver_unregister(&platform_wdt_driver);
266} 264}
267 265
268module_init(davinci_wdt_init); 266module_init(davinci_wdt_init);
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c
index f236954d2536..ca44fd9b19bb 100644
--- a/drivers/watchdog/i6300esb.c
+++ b/drivers/watchdog/i6300esb.c
@@ -77,7 +77,7 @@
77 77
78/* internal variables */ 78/* internal variables */
79static void __iomem *BASEADDR; 79static void __iomem *BASEADDR;
80static spinlock_t esb_lock; /* Guards the hardware */ 80static DEFINE_SPINLOCK(esb_lock); /* Guards the hardware */
81static unsigned long timer_alive; 81static unsigned long timer_alive;
82static struct pci_dev *esb_pci; 82static struct pci_dev *esb_pci;
83static unsigned short triggered; /* The status of the watchdog upon boot */ 83static unsigned short triggered; /* The status of the watchdog upon boot */
@@ -456,8 +456,6 @@ static int __init watchdog_init (void)
456{ 456{
457 int ret; 457 int ret;
458 458
459 spin_lock_init(&esb_lock);
460
461 /* Check whether or not the hardware watchdog is there */ 459 /* Check whether or not the hardware watchdog is there */
462 if (!esb_getdevice () || esb_pci == NULL) 460 if (!esb_getdevice () || esb_pci == NULL)
463 return -ENODEV; 461 return -ENODEV;
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index cd5a565bc3a0..a0e6809e369f 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -35,10 +35,12 @@
35 * 82801GDH (ICH7DH) : document number 307013-002, 307014-009, 35 * 82801GDH (ICH7DH) : document number 307013-002, 307014-009,
36 * 82801GBM (ICH7-M) : document number 307013-002, 307014-009, 36 * 82801GBM (ICH7-M) : document number 307013-002, 307014-009,
37 * 82801GHM (ICH7-M DH) : document number 307013-002, 307014-009, 37 * 82801GHM (ICH7-M DH) : document number 307013-002, 307014-009,
38 * 82801HB (ICH8) : document number 313056-002, 313057-004, 38 * 82801HB (ICH8) : document number 313056-003, 313057-009,
39 * 82801HR (ICH8R) : document number 313056-002, 313057-004, 39 * 82801HR (ICH8R) : document number 313056-003, 313057-009,
40 * 82801HH (ICH8DH) : document number 313056-002, 313057-004, 40 * 82801HBM (ICH8M) : document number 313056-003, 313057-009,
41 * 82801HO (ICH8DO) : document number 313056-002, 313057-004, 41 * 82801HH (ICH8DH) : document number 313056-003, 313057-009,
42 * 82801HO (ICH8DO) : document number 313056-003, 313057-009,
43 * 82801HEM (ICH8M-E) : document number 313056-003, 313057-009,
42 * 82801IB (ICH9) : document number 316972-001, 316973-001, 44 * 82801IB (ICH9) : document number 316972-001, 316973-001,
43 * 82801IR (ICH9R) : document number 316972-001, 316973-001, 45 * 82801IR (ICH9R) : document number 316972-001, 316973-001,
44 * 82801IH (ICH9DH) : document number 316972-001, 316973-001, 46 * 82801IH (ICH9DH) : document number 316972-001, 316973-001,
@@ -95,8 +97,10 @@ enum iTCO_chipsets {
95 TCO_ICH7M, /* ICH7-M */ 97 TCO_ICH7M, /* ICH7-M */
96 TCO_ICH7MDH, /* ICH7-M DH */ 98 TCO_ICH7MDH, /* ICH7-M DH */
97 TCO_ICH8, /* ICH8 & ICH8R */ 99 TCO_ICH8, /* ICH8 & ICH8R */
100 TCO_ICH8ME, /* ICH8M-E */
98 TCO_ICH8DH, /* ICH8DH */ 101 TCO_ICH8DH, /* ICH8DH */
99 TCO_ICH8DO, /* ICH8DO */ 102 TCO_ICH8DO, /* ICH8DO */
103 TCO_ICH8M, /* ICH8M */
100 TCO_ICH9, /* ICH9 */ 104 TCO_ICH9, /* ICH9 */
101 TCO_ICH9R, /* ICH9R */ 105 TCO_ICH9R, /* ICH9R */
102 TCO_ICH9DH, /* ICH9DH */ 106 TCO_ICH9DH, /* ICH9DH */
@@ -125,8 +129,10 @@ static struct {
125 {"ICH7-M", 2}, 129 {"ICH7-M", 2},
126 {"ICH7-M DH", 2}, 130 {"ICH7-M DH", 2},
127 {"ICH8 or ICH8R", 2}, 131 {"ICH8 or ICH8R", 2},
132 {"ICH8M-E", 2},
128 {"ICH8DH", 2}, 133 {"ICH8DH", 2},
129 {"ICH8DO", 2}, 134 {"ICH8DO", 2},
135 {"ICH8M", 2},
130 {"ICH9", 2}, 136 {"ICH9", 2},
131 {"ICH9R", 2}, 137 {"ICH9R", 2},
132 {"ICH9DH", 2}, 138 {"ICH9DH", 2},
@@ -134,6 +140,15 @@ static struct {
134 {NULL,0} 140 {NULL,0}
135}; 141};
136 142
143#define ITCO_PCI_DEVICE(dev, data) \
144 .vendor = PCI_VENDOR_ID_INTEL, \
145 .device = dev, \
146 .subvendor = PCI_ANY_ID, \
147 .subdevice = PCI_ANY_ID, \
148 .class = 0, \
149 .class_mask = 0, \
150 .driver_data = data
151
137/* 152/*
138 * This data only exists for exporting the supported PCI ids 153 * This data only exists for exporting the supported PCI ids
139 * via MODULE_DEVICE_TABLE. We do not actually register a 154 * via MODULE_DEVICE_TABLE. We do not actually register a
@@ -141,45 +156,47 @@ static struct {
141 * functions that probably will be registered by other drivers. 156 * functions that probably will be registered by other drivers.
142 */ 157 */
143static struct pci_device_id iTCO_wdt_pci_tbl[] = { 158static struct pci_device_id iTCO_wdt_pci_tbl[] = {
144 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH }, 159 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AA_0, TCO_ICH )},
145 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH0 }, 160 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AB_0, TCO_ICH0 )},
146 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH2 }, 161 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_0, TCO_ICH2 )},
147 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH2M }, 162 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_10, TCO_ICH2M )},
148 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH3 }, 163 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_0, TCO_ICH3 )},
149 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH3M }, 164 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_12, TCO_ICH3M )},
150 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH4 }, 165 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_0, TCO_ICH4 )},
151 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH4M }, 166 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_12, TCO_ICH4M )},
152 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_CICH }, 167 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801E_0, TCO_CICH )},
153 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH5 }, 168 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801EB_0, TCO_ICH5 )},
154 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_6300ESB }, 169 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB_1, TCO_6300ESB)},
155 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6 }, 170 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_0, TCO_ICH6 )},
156 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6M }, 171 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_1, TCO_ICH6M )},
157 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6W }, 172 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_2, TCO_ICH6W )},
158 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7 }, 173 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_0, TCO_ICH7 )},
159 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7M }, 174 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_1, TCO_ICH7M )},
160 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7MDH }, 175 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_31, TCO_ICH7MDH)},
161 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8 }, 176 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_0, TCO_ICH8 )},
162 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DH }, 177 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_1, TCO_ICH8ME )},
163 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DO }, 178 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_2, TCO_ICH8DH )},
164 { PCI_VENDOR_ID_INTEL, 0x2918, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9 }, 179 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_3, TCO_ICH8DO )},
165 { PCI_VENDOR_ID_INTEL, 0x2916, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9R }, 180 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_4, TCO_ICH8M )},
166 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9DH }, 181 { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )},
167 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 182 { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )},
168 { PCI_VENDOR_ID_INTEL, 0x2671, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 183 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )},
169 { PCI_VENDOR_ID_INTEL, 0x2672, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 184 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)},
170 { PCI_VENDOR_ID_INTEL, 0x2673, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 185 { ITCO_PCI_DEVICE(0x2671, TCO_631XESB)},
171 { PCI_VENDOR_ID_INTEL, 0x2674, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 186 { ITCO_PCI_DEVICE(0x2672, TCO_631XESB)},
172 { PCI_VENDOR_ID_INTEL, 0x2675, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 187 { ITCO_PCI_DEVICE(0x2673, TCO_631XESB)},
173 { PCI_VENDOR_ID_INTEL, 0x2676, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 188 { ITCO_PCI_DEVICE(0x2674, TCO_631XESB)},
174 { PCI_VENDOR_ID_INTEL, 0x2677, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 189 { ITCO_PCI_DEVICE(0x2675, TCO_631XESB)},
175 { PCI_VENDOR_ID_INTEL, 0x2678, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 190 { ITCO_PCI_DEVICE(0x2676, TCO_631XESB)},
176 { PCI_VENDOR_ID_INTEL, 0x2679, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 191 { ITCO_PCI_DEVICE(0x2677, TCO_631XESB)},
177 { PCI_VENDOR_ID_INTEL, 0x267a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 192 { ITCO_PCI_DEVICE(0x2678, TCO_631XESB)},
178 { PCI_VENDOR_ID_INTEL, 0x267b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 193 { ITCO_PCI_DEVICE(0x2679, TCO_631XESB)},
179 { PCI_VENDOR_ID_INTEL, 0x267c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 194 { ITCO_PCI_DEVICE(0x267a, TCO_631XESB)},
180 { PCI_VENDOR_ID_INTEL, 0x267d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 195 { ITCO_PCI_DEVICE(0x267b, TCO_631XESB)},
181 { PCI_VENDOR_ID_INTEL, 0x267e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 196 { ITCO_PCI_DEVICE(0x267c, TCO_631XESB)},
182 { PCI_VENDOR_ID_INTEL, 0x267f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 197 { ITCO_PCI_DEVICE(0x267d, TCO_631XESB)},
198 { ITCO_PCI_DEVICE(0x267e, TCO_631XESB)},
199 { ITCO_PCI_DEVICE(0x267f, TCO_631XESB)},
183 { 0, }, /* End of list */ 200 { 0, }, /* End of list */
184}; 201};
185MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl); 202MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl);
@@ -300,6 +317,7 @@ static int iTCO_wdt_start(void)
300 317
301 /* disable chipset's NO_REBOOT bit */ 318 /* disable chipset's NO_REBOOT bit */
302 if (iTCO_wdt_unset_NO_REBOOT_bit()) { 319 if (iTCO_wdt_unset_NO_REBOOT_bit()) {
320 spin_unlock(&iTCO_wdt_private.io_lock);
303 printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); 321 printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n");
304 return -EIO; 322 return -EIO;
305 } 323 }
@@ -590,7 +608,7 @@ static struct miscdevice iTCO_wdt_miscdev = {
590 * Init & exit routines 608 * Init & exit routines
591 */ 609 */
592 610
593static int iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device_id *ent, struct platform_device *dev) 611static int __devinit iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device_id *ent, struct platform_device *dev)
594{ 612{
595 int ret; 613 int ret;
596 u32 base_address; 614 u32 base_address;
@@ -694,7 +712,7 @@ out:
694 return ret; 712 return ret;
695} 713}
696 714
697static void iTCO_wdt_cleanup(void) 715static void __devexit iTCO_wdt_cleanup(void)
698{ 716{
699 /* Stop the timer before we leave */ 717 /* Stop the timer before we leave */
700 if (!nowayout) 718 if (!nowayout)
@@ -709,7 +727,7 @@ static void iTCO_wdt_cleanup(void)
709 iTCO_wdt_private.ACPIBASE = 0; 727 iTCO_wdt_private.ACPIBASE = 0;
710} 728}
711 729
712static int iTCO_wdt_probe(struct platform_device *dev) 730static int __devinit iTCO_wdt_probe(struct platform_device *dev)
713{ 731{
714 int found = 0; 732 int found = 0;
715 struct pci_dev *pdev = NULL; 733 struct pci_dev *pdev = NULL;
@@ -735,7 +753,7 @@ static int iTCO_wdt_probe(struct platform_device *dev)
735 return 0; 753 return 0;
736} 754}
737 755
738static int iTCO_wdt_remove(struct platform_device *dev) 756static int __devexit iTCO_wdt_remove(struct platform_device *dev)
739{ 757{
740 if (iTCO_wdt_private.ACPIBASE) 758 if (iTCO_wdt_private.ACPIBASE)
741 iTCO_wdt_cleanup(); 759 iTCO_wdt_cleanup();
@@ -753,7 +771,7 @@ static void iTCO_wdt_shutdown(struct platform_device *dev)
753 771
754static struct platform_driver iTCO_wdt_driver = { 772static struct platform_driver iTCO_wdt_driver = {
755 .probe = iTCO_wdt_probe, 773 .probe = iTCO_wdt_probe,
756 .remove = iTCO_wdt_remove, 774 .remove = __devexit_p(iTCO_wdt_remove),
757 .shutdown = iTCO_wdt_shutdown, 775 .shutdown = iTCO_wdt_shutdown,
758 .suspend = iTCO_wdt_suspend, 776 .suspend = iTCO_wdt_suspend,
759 .resume = iTCO_wdt_resume, 777 .resume = iTCO_wdt_resume,
diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
index c3a60f52ccb9..4b89f401691a 100644
--- a/drivers/watchdog/ib700wdt.c
+++ b/drivers/watchdog/ib700wdt.c
@@ -48,7 +48,7 @@
48 48
49static struct platform_device *ibwdt_platform_device; 49static struct platform_device *ibwdt_platform_device;
50static unsigned long ibwdt_is_open; 50static unsigned long ibwdt_is_open;
51static spinlock_t ibwdt_lock; 51static DEFINE_SPINLOCK(ibwdt_lock);
52static char expect_close; 52static char expect_close;
53 53
54/* Module information */ 54/* Module information */
@@ -308,8 +308,6 @@ static int __devinit ibwdt_probe(struct platform_device *dev)
308{ 308{
309 int res; 309 int res;
310 310
311 spin_lock_init(&ibwdt_lock);
312
313#if WDT_START != WDT_STOP 311#if WDT_START != WDT_STOP
314 if (!request_region(WDT_STOP, 1, "IB700 WDT")) { 312 if (!request_region(WDT_STOP, 1, "IB700 WDT")) {
315 printk (KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP); 313 printk (KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP);
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c
index 6d35bb112a5f..e6e07b4575eb 100644
--- a/drivers/watchdog/machzwd.c
+++ b/drivers/watchdog/machzwd.c
@@ -123,8 +123,8 @@ static void zf_ping(unsigned long data);
123static int zf_action = GEN_RESET; 123static int zf_action = GEN_RESET;
124static unsigned long zf_is_open; 124static unsigned long zf_is_open;
125static char zf_expect_close; 125static char zf_expect_close;
126static spinlock_t zf_lock; 126static DEFINE_SPINLOCK(zf_lock);
127static spinlock_t zf_port_lock; 127static DEFINE_SPINLOCK(zf_port_lock);
128static DEFINE_TIMER(zf_timer, zf_ping, 0, 0); 128static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
129static unsigned long next_heartbeat = 0; 129static unsigned long next_heartbeat = 0;
130 130
@@ -438,9 +438,6 @@ static int __init zf_init(void)
438 438
439 zf_show_action(action); 439 zf_show_action(action);
440 440
441 spin_lock_init(&zf_lock);
442 spin_lock_init(&zf_port_lock);
443
444 if(!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")){ 441 if(!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")){
445 printk(KERN_ERR "cannot reserve I/O ports at %d\n", 442 printk(KERN_ERR "cannot reserve I/O ports at %d\n",
446 ZF_IOBASE); 443 ZF_IOBASE);
diff --git a/drivers/watchdog/mpc83xx_wdt.c b/drivers/watchdog/mpc83xx_wdt.c
index a0bf95fb9763..6369f569517f 100644
--- a/drivers/watchdog/mpc83xx_wdt.c
+++ b/drivers/watchdog/mpc83xx_wdt.c
@@ -56,7 +56,7 @@ static int prescale = 1;
56static unsigned int timeout_sec; 56static unsigned int timeout_sec;
57 57
58static unsigned long wdt_is_open; 58static unsigned long wdt_is_open;
59static spinlock_t wdt_spinlock; 59static DEFINE_SPINLOCK(wdt_spinlock);
60 60
61static void mpc83xx_wdt_keepalive(void) 61static void mpc83xx_wdt_keepalive(void)
62{ 62{
@@ -185,9 +185,6 @@ static int __devinit mpc83xx_wdt_probe(struct platform_device *dev)
185 printk(KERN_INFO "WDT driver for MPC83xx initialized. " 185 printk(KERN_INFO "WDT driver for MPC83xx initialized. "
186 "mode:%s timeout=%d (%d seconds)\n", 186 "mode:%s timeout=%d (%d seconds)\n",
187 reset ? "reset":"interrupt", timeout, timeout_sec); 187 reset ? "reset":"interrupt", timeout, timeout_sec);
188
189 spin_lock_init(&wdt_spinlock);
190
191 return 0; 188 return 0;
192 189
193err_unmap: 190err_unmap:
diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c
index 3d3deae0d64b..15e4f8887a9e 100644
--- a/drivers/watchdog/pc87413_wdt.c
+++ b/drivers/watchdog/pc87413_wdt.c
@@ -61,7 +61,7 @@ static unsigned long timer_enabled = 0; /* is the timer enabled? */
61 61
62static char expect_close; /* is the close expected? */ 62static char expect_close; /* is the close expected? */
63 63
64static spinlock_t io_lock; /* to guard the watchdog from io races */ 64static DEFINE_SPINLOCK(io_lock);/* to guard the watchdog from io races */
65 65
66static int nowayout = WATCHDOG_NOWAYOUT; 66static int nowayout = WATCHDOG_NOWAYOUT;
67 67
@@ -561,8 +561,6 @@ static int __init pc87413_init(void)
561{ 561{
562 int ret; 562 int ret;
563 563
564 spin_lock_init(&io_lock);
565
566 printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n", WDT_INDEX_IO_PORT); 564 printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n", WDT_INDEX_IO_PORT);
567 565
568 /* request_region(io, 2, "pc87413"); */ 566 /* request_region(io, 2, "pc87413"); */
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 22f8873dd092..b04aa096a10a 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -80,7 +80,7 @@
80static int nowayout = WATCHDOG_NOWAYOUT; 80static int nowayout = WATCHDOG_NOWAYOUT;
81static int heartbeat = DEFAULT_HEARTBEAT; 81static int heartbeat = DEFAULT_HEARTBEAT;
82 82
83static spinlock_t io_lock; 83static DEFINE_SPINLOCK(io_lock);
84static unsigned long wdt_status; 84static unsigned long wdt_status;
85#define WDT_IN_USE 0 85#define WDT_IN_USE 0
86#define WDT_OK_TO_CLOSE 1 86#define WDT_OK_TO_CLOSE 1
@@ -254,8 +254,6 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
254 int ret = 0, size; 254 int ret = 0, size;
255 struct resource *res; 255 struct resource *res;
256 256
257 spin_lock_init(&io_lock);
258
259 if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) 257 if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
260 heartbeat = DEFAULT_HEARTBEAT; 258 heartbeat = DEFAULT_HEARTBEAT;
261 259
@@ -335,7 +333,7 @@ static int __init pnx4008_wdt_init(void)
335 333
336static void __exit pnx4008_wdt_exit(void) 334static void __exit pnx4008_wdt_exit(void)
337{ 335{
338 return platform_driver_unregister(&platform_wdt_driver); 336 platform_driver_unregister(&platform_wdt_driver);
339} 337}
340 338
341module_init(pnx4008_wdt_init); 339module_init(pnx4008_wdt_init);
diff --git a/drivers/watchdog/sbc8360.c b/drivers/watchdog/sbc8360.c
index 285d85289532..2ee2677f3648 100644
--- a/drivers/watchdog/sbc8360.c
+++ b/drivers/watchdog/sbc8360.c
@@ -54,7 +54,7 @@
54#include <asm/system.h> 54#include <asm/system.h>
55 55
56static unsigned long sbc8360_is_open; 56static unsigned long sbc8360_is_open;
57static spinlock_t sbc8360_lock; 57static DEFINE_SPINLOCK(sbc8360_lock);
58static char expect_close; 58static char expect_close;
59 59
60#define PFX "sbc8360: " 60#define PFX "sbc8360: "
@@ -359,7 +359,6 @@ static int __init sbc8360_init(void)
359 goto out_noreboot; 359 goto out_noreboot;
360 } 360 }
361 361
362 spin_lock_init(&sbc8360_lock);
363 res = misc_register(&sbc8360_miscdev); 362 res = misc_register(&sbc8360_miscdev);
364 if (res) { 363 if (res) {
365 printk(KERN_ERR PFX "failed to register misc device\n"); 364 printk(KERN_ERR PFX "failed to register misc device\n");
diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c
index 9670d47190d0..32ccd7c89c7d 100644
--- a/drivers/watchdog/sc1200wdt.c
+++ b/drivers/watchdog/sc1200wdt.c
@@ -74,7 +74,7 @@ static int io = -1;
74static int io_len = 2; /* for non plug and play */ 74static int io_len = 2; /* for non plug and play */
75static struct semaphore open_sem; 75static struct semaphore open_sem;
76static char expect_close; 76static char expect_close;
77static spinlock_t sc1200wdt_lock; /* io port access serialisation */ 77static DEFINE_SPINLOCK(sc1200wdt_lock); /* io port access serialisation */
78 78
79#if defined CONFIG_PNP 79#if defined CONFIG_PNP
80static int isapnp = 1; 80static int isapnp = 1;
@@ -375,7 +375,6 @@ static int __init sc1200wdt_init(void)
375 375
376 printk("%s\n", banner); 376 printk("%s\n", banner);
377 377
378 spin_lock_init(&sc1200wdt_lock);
379 sema_init(&open_sem, 1); 378 sema_init(&open_sem, 1);
380 379
381#if defined CONFIG_PNP 380#if defined CONFIG_PNP
diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
index e8594c64d1e6..2847324a2be2 100644
--- a/drivers/watchdog/sc520_wdt.c
+++ b/drivers/watchdog/sc520_wdt.c
@@ -125,7 +125,7 @@ static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
125static unsigned long next_heartbeat; 125static unsigned long next_heartbeat;
126static unsigned long wdt_is_open; 126static unsigned long wdt_is_open;
127static char wdt_expect_close; 127static char wdt_expect_close;
128static spinlock_t wdt_spinlock; 128static DEFINE_SPINLOCK(wdt_spinlock);
129 129
130/* 130/*
131 * Whack the dog 131 * Whack the dog
@@ -383,8 +383,6 @@ static int __init sc520_wdt_init(void)
383{ 383{
384 int rc = -EBUSY; 384 int rc = -EBUSY;
385 385
386 spin_lock_init(&wdt_spinlock);
387
388 /* Check that the timeout value is within it's range ; if not reset to the default */ 386 /* Check that the timeout value is within it's range ; if not reset to the default */
389 if (wdt_set_heartbeat(timeout)) { 387 if (wdt_set_heartbeat(timeout)) {
390 wdt_set_heartbeat(WATCHDOG_TIMEOUT); 388 wdt_set_heartbeat(WATCHDOG_TIMEOUT);
diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c
index d3cb0a766020..5d2b5ba61414 100644
--- a/drivers/watchdog/smsc37b787_wdt.c
+++ b/drivers/watchdog/smsc37b787_wdt.c
@@ -83,7 +83,7 @@ static unsigned long timer_enabled = 0; /* is the timer enabled? */
83 83
84static char expect_close; /* is the close expected? */ 84static char expect_close; /* is the close expected? */
85 85
86static spinlock_t io_lock; /* to guard the watchdog from io races */ 86static DEFINE_SPINLOCK(io_lock);/* to guard the watchdog from io races */
87 87
88static int nowayout = WATCHDOG_NOWAYOUT; 88static int nowayout = WATCHDOG_NOWAYOUT;
89 89
@@ -540,8 +540,6 @@ static int __init wb_smsc_wdt_init(void)
540{ 540{
541 int ret; 541 int ret;
542 542
543 spin_lock_init(&io_lock);
544
545 printk("SMsC 37B787 watchdog component driver " VERSION " initialising...\n"); 543 printk("SMsC 37B787 watchdog component driver " VERSION " initialising...\n");
546 544
547 if (!request_region(IOPORT, IOPORT_SIZE, "SMsC 37B787 watchdog")) { 545 if (!request_region(IOPORT, IOPORT_SIZE, "SMsC 37B787 watchdog")) {
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c
index df33b3b5a53c..386492821fc2 100644
--- a/drivers/watchdog/w83627hf_wdt.c
+++ b/drivers/watchdog/w83627hf_wdt.c
@@ -48,7 +48,7 @@
48 48
49static unsigned long wdt_is_open; 49static unsigned long wdt_is_open;
50static char expect_close; 50static char expect_close;
51static spinlock_t io_lock; 51static DEFINE_SPINLOCK(io_lock);
52 52
53/* You must set this - there is no sane way to probe for this board. */ 53/* You must set this - there is no sane way to probe for this board. */
54static int wdt_io = 0x2E; 54static int wdt_io = 0x2E;
@@ -328,8 +328,6 @@ wdt_init(void)
328{ 328{
329 int ret; 329 int ret;
330 330
331 spin_lock_init(&io_lock);
332
333 printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.\n"); 331 printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.\n");
334 332
335 if (wdt_set_heartbeat(timeout)) { 333 if (wdt_set_heartbeat(timeout)) {
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index 51826c216d6d..c622a0e6c9ae 100644
--- a/drivers/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -47,7 +47,7 @@
47 47
48static unsigned long wdt_is_open; 48static unsigned long wdt_is_open;
49static char expect_close; 49static char expect_close;
50static spinlock_t io_lock; 50static DEFINE_SPINLOCK(io_lock);
51 51
52/* You must set this - there is no sane way to probe for this board. */ 52/* You must set this - there is no sane way to probe for this board. */
53static int wdt_io = 0x2e; 53static int wdt_io = 0x2e;
@@ -376,8 +376,6 @@ wdt_init(void)
376{ 376{
377 int ret, i, found = 0; 377 int ret, i, found = 0;
378 378
379 spin_lock_init(&io_lock);
380
381 printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n"); 379 printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n");
382 380
383 if (wdt_io == 0) { 381 if (wdt_io == 0) {
diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
index 3c88fe18f4f4..bcc9d48955de 100644
--- a/drivers/watchdog/w83877f_wdt.c
+++ b/drivers/watchdog/w83877f_wdt.c
@@ -94,7 +94,7 @@ static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
94static unsigned long next_heartbeat; 94static unsigned long next_heartbeat;
95static unsigned long wdt_is_open; 95static unsigned long wdt_is_open;
96static char wdt_expect_close; 96static char wdt_expect_close;
97static spinlock_t wdt_spinlock; 97static DEFINE_SPINLOCK(wdt_spinlock);
98 98
99/* 99/*
100 * Whack the dog 100 * Whack the dog
@@ -350,8 +350,6 @@ static int __init w83877f_wdt_init(void)
350{ 350{
351 int rc = -EBUSY; 351 int rc = -EBUSY;
352 352
353 spin_lock_init(&wdt_spinlock);
354
355 if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */ 353 if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */
356 { 354 {
357 timeout = WATCHDOG_TIMEOUT; 355 timeout = WATCHDOG_TIMEOUT;
diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c
index 157968442891..b475529d2475 100644
--- a/drivers/watchdog/w83977f_wdt.c
+++ b/drivers/watchdog/w83977f_wdt.c
@@ -50,7 +50,7 @@ static int timeoutW; /* timeout in watchdog counter units */
50static unsigned long timer_alive; 50static unsigned long timer_alive;
51static int testmode; 51static int testmode;
52static char expect_close; 52static char expect_close;
53static spinlock_t spinlock; 53static DEFINE_SPINLOCK(spinlock);
54 54
55module_param(timeout, int, 0); 55module_param(timeout, int, 0);
56MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (15..7635), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")"); 56MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (15..7635), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")");
@@ -476,8 +476,6 @@ static int __init w83977f_wdt_init(void)
476 476
477 printk(KERN_INFO PFX DRIVER_VERSION); 477 printk(KERN_INFO PFX DRIVER_VERSION);
478 478
479 spin_lock_init(&spinlock);
480
481 /* 479 /*
482 * Check that the timeout value is within it's range ; 480 * Check that the timeout value is within it's range ;
483 * if not reset to the default 481 * if not reset to the default
diff --git a/drivers/watchdog/wafer5823wdt.c b/drivers/watchdog/wafer5823wdt.c
index 950905d3c39f..9e368091f799 100644
--- a/drivers/watchdog/wafer5823wdt.c
+++ b/drivers/watchdog/wafer5823wdt.c
@@ -45,7 +45,7 @@
45 45
46static unsigned long wafwdt_is_open; 46static unsigned long wafwdt_is_open;
47static char expect_close; 47static char expect_close;
48static spinlock_t wafwdt_lock; 48static DEFINE_SPINLOCK(wafwdt_lock);
49 49
50/* 50/*
51 * You must set these - there is no sane way to probe for this board. 51 * You must set these - there is no sane way to probe for this board.
@@ -252,8 +252,6 @@ static int __init wafwdt_init(void)
252 252
253 printk(KERN_INFO "WDT driver for Wafer 5823 single board computer initialising.\n"); 253 printk(KERN_INFO "WDT driver for Wafer 5823 single board computer initialising.\n");
254 254
255 spin_lock_init(&wafwdt_lock);
256
257 if (timeout < 1 || timeout > 255) { 255 if (timeout < 1 || timeout > 255) {
258 timeout = WD_TIMO; 256 timeout = WD_TIMO;
259 printk (KERN_INFO PFX "timeout value must be 1<=x<=255, using %d\n", 257 printk (KERN_INFO PFX "timeout value must be 1<=x<=255, using %d\n",
diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c
index 0a3de6a02442..53d0bb410df8 100644
--- a/drivers/watchdog/wdt.c
+++ b/drivers/watchdog/wdt.c
@@ -253,7 +253,7 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id)
253 printk(KERN_CRIT "Possible fan fault.\n"); 253 printk(KERN_CRIT "Possible fan fault.\n");
254 } 254 }
255#endif /* CONFIG_WDT_501 */ 255#endif /* CONFIG_WDT_501 */
256 if (!(status & WDC_SR_WCCR)) 256 if (!(status & WDC_SR_WCCR)) {
257#ifdef SOFTWARE_REBOOT 257#ifdef SOFTWARE_REBOOT
258#ifdef ONLY_TESTING 258#ifdef ONLY_TESTING
259 printk(KERN_CRIT "Would Reboot.\n"); 259 printk(KERN_CRIT "Would Reboot.\n");
@@ -264,6 +264,7 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id)
264#else 264#else
265 printk(KERN_CRIT "Reset in 5ms.\n"); 265 printk(KERN_CRIT "Reset in 5ms.\n");
266#endif 266#endif
267 }
267 return IRQ_HANDLED; 268 return IRQ_HANDLED;
268} 269}
269 270
diff --git a/drivers/watchdog/wdt977.c b/drivers/watchdog/wdt977.c
index 7d300ff7ab07..9b7f6b6edef6 100644
--- a/drivers/watchdog/wdt977.c
+++ b/drivers/watchdog/wdt977.c
@@ -59,7 +59,7 @@ static int timeoutM; /* timeout in minutes */
59static unsigned long timer_alive; 59static unsigned long timer_alive;
60static int testmode; 60static int testmode;
61static char expect_close; 61static char expect_close;
62static spinlock_t spinlock; 62static DEFINE_SPINLOCK(spinlock);
63 63
64module_param(timeout, int, 0); 64module_param(timeout, int, 0);
65MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (60..15300), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")"); 65MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (60..15300), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")");
@@ -448,8 +448,6 @@ static int __init wd977_init(void)
448 448
449 printk(KERN_INFO PFX DRIVER_VERSION); 449 printk(KERN_INFO PFX DRIVER_VERSION);
450 450
451 spin_lock_init(&spinlock);
452
453 /* Check that the timeout value is within it's range ; if not reset to the default */ 451 /* Check that the timeout value is within it's range ; if not reset to the default */
454 if (wdt977_set_timeout(timeout)) 452 if (wdt977_set_timeout(timeout))
455 { 453 {
diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c
index 6baf4ae42c9d..1355608683e4 100644
--- a/drivers/watchdog/wdt_pci.c
+++ b/drivers/watchdog/wdt_pci.c
@@ -74,7 +74,7 @@
74static int dev_count; 74static int dev_count;
75 75
76static struct semaphore open_sem; 76static struct semaphore open_sem;
77static spinlock_t wdtpci_lock; 77static DEFINE_SPINLOCK(wdtpci_lock);
78static char expect_close; 78static char expect_close;
79 79
80static int io; 80static int io;
@@ -298,7 +298,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id)
298 printk(KERN_CRIT PFX "Possible fan fault.\n"); 298 printk(KERN_CRIT PFX "Possible fan fault.\n");
299 } 299 }
300#endif /* CONFIG_WDT_501_PCI */ 300#endif /* CONFIG_WDT_501_PCI */
301 if (!(status&WDC_SR_WCCR)) 301 if (!(status&WDC_SR_WCCR)) {
302#ifdef SOFTWARE_REBOOT 302#ifdef SOFTWARE_REBOOT
303#ifdef ONLY_TESTING 303#ifdef ONLY_TESTING
304 printk(KERN_CRIT PFX "Would Reboot.\n"); 304 printk(KERN_CRIT PFX "Would Reboot.\n");
@@ -309,6 +309,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id)
309#else 309#else
310 printk(KERN_CRIT PFX "Reset in 5ms.\n"); 310 printk(KERN_CRIT PFX "Reset in 5ms.\n");
311#endif 311#endif
312 }
312 return IRQ_HANDLED; 313 return IRQ_HANDLED;
313} 314}
314 315
@@ -606,7 +607,6 @@ static int __devinit wdtpci_init_one (struct pci_dev *dev,
606 } 607 }
607 608
608 sema_init(&open_sem, 1); 609 sema_init(&open_sem, 1);
609 spin_lock_init(&wdtpci_lock);
610 610
611 irq = dev->irq; 611 irq = dev->irq;
612 io = pci_resource_start (dev, 2); 612 io = pci_resource_start (dev, 2);
diff --git a/fs/Kconfig b/fs/Kconfig
index cc28a69246a7..c75c95406497 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -504,7 +504,7 @@ config INOTIFY
504 including multiple file events, one-shot support, and unmount 504 including multiple file events, one-shot support, and unmount
505 notification. 505 notification.
506 506
507 For more information, see Documentation/filesystems/inotify.txt 507 For more information, see <file:Documentation/filesystems/inotify.txt>
508 508
509 If unsure, say Y. 509 If unsure, say Y.
510 510
@@ -518,7 +518,7 @@ config INOTIFY_USER
518 directories via a single open fd. Events are read from the file 518 directories via a single open fd. Events are read from the file
519 descriptor, which is also select()- and poll()-able. 519 descriptor, which is also select()- and poll()-able.
520 520
521 For more information, see Documentation/filesystems/inotify.txt 521 For more information, see <file:Documentation/filesystems/inotify.txt>
522 522
523 If unsure, say Y. 523 If unsure, say Y.
524 524
@@ -1089,7 +1089,7 @@ config ECRYPT_FS
1089 depends on EXPERIMENTAL && KEYS && CRYPTO && NET 1089 depends on EXPERIMENTAL && KEYS && CRYPTO && NET
1090 help 1090 help
1091 Encrypted filesystem that operates on the VFS layer. See 1091 Encrypted filesystem that operates on the VFS layer. See
1092 <file:Documentation/ecryptfs.txt> to learn more about 1092 <file:Documentation/filesystems/ecryptfs.txt> to learn more about
1093 eCryptfs. Userspace components are required and can be 1093 eCryptfs. Userspace components are required and can be
1094 obtained from <http://ecryptfs.sf.net>. 1094 obtained from <http://ecryptfs.sf.net>.
1095 1095
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index a4284ccac1f9..bd26e4cbb994 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -322,7 +322,7 @@ static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg)
322 int err; 322 int err;
323 323
324 uifr = compat_alloc_user_space(sizeof(struct ifreq)); 324 uifr = compat_alloc_user_space(sizeof(struct ifreq));
325 if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32))); 325 if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32)))
326 return -EFAULT; 326 return -EFAULT;
327 327
328 err = sys_ioctl(fd, SIOCGIFNAME, (unsigned long)uifr); 328 err = sys_ioctl(fd, SIOCGIFNAME, (unsigned long)uifr);
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 0a9882edf562..9d70289f7df3 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -279,13 +279,13 @@ int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg,
279 int offset; 279 int offset;
280 int remainder_of_page; 280 int remainder_of_page;
281 281
282 sg_init_table(sg, sg_size);
283
282 while (size > 0 && i < sg_size) { 284 while (size > 0 && i < sg_size) {
283 pg = virt_to_page(addr); 285 pg = virt_to_page(addr);
284 offset = offset_in_page(addr); 286 offset = offset_in_page(addr);
285 if (sg) { 287 if (sg)
286 sg_set_page(&sg[i], pg); 288 sg_set_page(&sg[i], pg, 0, offset);
287 sg[i].offset = offset;
288 }
289 remainder_of_page = PAGE_CACHE_SIZE - offset; 289 remainder_of_page = PAGE_CACHE_SIZE - offset;
290 if (size >= remainder_of_page) { 290 if (size >= remainder_of_page) {
291 if (sg) 291 if (sg)
@@ -716,12 +716,8 @@ ecryptfs_encrypt_page_offset(struct ecryptfs_crypt_stat *crypt_stat,
716 sg_init_table(&src_sg, 1); 716 sg_init_table(&src_sg, 1);
717 sg_init_table(&dst_sg, 1); 717 sg_init_table(&dst_sg, 1);
718 718
719 sg_set_page(&src_sg, src_page); 719 sg_set_page(&src_sg, src_page, size, src_offset);
720 src_sg.offset = src_offset; 720 sg_set_page(&dst_sg, dst_page, size, dst_offset);
721 src_sg.length = size;
722 sg_set_page(&dst_sg, dst_page);
723 dst_sg.offset = dst_offset;
724 dst_sg.length = size;
725 return encrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv); 721 return encrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv);
726} 722}
727 723
@@ -746,14 +742,11 @@ ecryptfs_decrypt_page_offset(struct ecryptfs_crypt_stat *crypt_stat,
746 struct scatterlist src_sg, dst_sg; 742 struct scatterlist src_sg, dst_sg;
747 743
748 sg_init_table(&src_sg, 1); 744 sg_init_table(&src_sg, 1);
745 sg_set_page(&src_sg, src_page, size, src_offset);
746
749 sg_init_table(&dst_sg, 1); 747 sg_init_table(&dst_sg, 1);
748 sg_set_page(&dst_sg, dst_page, size, dst_offset);
750 749
751 sg_set_page(&src_sg, src_page);
752 src_sg.offset = src_offset;
753 src_sg.length = size;
754 sg_set_page(&dst_sg, dst_page);
755 dst_sg.offset = dst_offset;
756 dst_sg.length = size;
757 return decrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv); 750 return decrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv);
758} 751}
759 752
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 9728614b8958..77fc5838609c 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -372,7 +372,7 @@ int jffs2_init_acl_post(struct inode *inode)
372 return rc; 372 return rc;
373 } 373 }
374 374
375 return rc; 375 return 0;
376} 376}
377 377
378void jffs2_clear_acl(struct jffs2_inode_info *f) 378void jffs2_clear_acl(struct jffs2_inode_info *f)
diff --git a/fs/locks.c b/fs/locks.c
index 0127a2846819..8b8388eca05e 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -696,17 +696,28 @@ EXPORT_SYMBOL(posix_test_lock);
696 * Note: the above assumption may not be true when handling lock requests 696 * Note: the above assumption may not be true when handling lock requests
697 * from a broken NFS client. But broken NFS clients have a lot more to 697 * from a broken NFS client. But broken NFS clients have a lot more to
698 * worry about than proper deadlock detection anyway... --okir 698 * worry about than proper deadlock detection anyway... --okir
699 *
700 * However, the failure of this assumption (also possible in the case of
701 * multiple tasks sharing the same open file table) also means there's no
702 * guarantee that the loop below will terminate. As a hack, we give up
703 * after a few iterations.
699 */ 704 */
705
706#define MAX_DEADLK_ITERATIONS 10
707
700static int posix_locks_deadlock(struct file_lock *caller_fl, 708static int posix_locks_deadlock(struct file_lock *caller_fl,
701 struct file_lock *block_fl) 709 struct file_lock *block_fl)
702{ 710{
703 struct file_lock *fl; 711 struct file_lock *fl;
712 int i = 0;
704 713
705next_task: 714next_task:
706 if (posix_same_owner(caller_fl, block_fl)) 715 if (posix_same_owner(caller_fl, block_fl))
707 return 1; 716 return 1;
708 list_for_each_entry(fl, &blocked_list, fl_link) { 717 list_for_each_entry(fl, &blocked_list, fl_link) {
709 if (posix_same_owner(fl, block_fl)) { 718 if (posix_same_owner(fl, block_fl)) {
719 if (i++ > MAX_DEADLK_ITERATIONS)
720 return 0;
710 fl = fl->fl_next; 721 fl = fl->fl_next;
711 block_fl = fl; 722 block_fl = fl;
712 goto next_task; 723 goto next_task;
diff --git a/fs/mbcache.c b/fs/mbcache.c
index 1046cbefbfbf..eb31b73e7d69 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -403,9 +403,9 @@ mb_cache_entry_alloc(struct mb_cache *cache)
403{ 403{
404 struct mb_cache_entry *ce; 404 struct mb_cache_entry *ce;
405 405
406 atomic_inc(&cache->c_entry_count);
407 ce = kmem_cache_alloc(cache->c_entry_cache, GFP_KERNEL); 406 ce = kmem_cache_alloc(cache->c_entry_cache, GFP_KERNEL);
408 if (ce) { 407 if (ce) {
408 atomic_inc(&cache->c_entry_count);
409 INIT_LIST_HEAD(&ce->e_lru_list); 409 INIT_LIST_HEAD(&ce->e_lru_list);
410 INIT_LIST_HEAD(&ce->e_block_list); 410 INIT_LIST_HEAD(&ce->e_block_list);
411 ce->e_cache = cache; 411 ce->e_cache = cache;
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index cfdc7900d271..ad87cb01299b 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -405,6 +405,15 @@ static int ntfs_readpage(struct file *file, struct page *page)
405 405
406retry_readpage: 406retry_readpage:
407 BUG_ON(!PageLocked(page)); 407 BUG_ON(!PageLocked(page));
408 vi = page->mapping->host;
409 i_size = i_size_read(vi);
410 /* Is the page fully outside i_size? (truncate in progress) */
411 if (unlikely(page->index >= (i_size + PAGE_CACHE_SIZE - 1) >>
412 PAGE_CACHE_SHIFT)) {
413 zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
414 ntfs_debug("Read outside i_size - truncated?");
415 goto done;
416 }
408 /* 417 /*
409 * This can potentially happen because we clear PageUptodate() during 418 * This can potentially happen because we clear PageUptodate() during
410 * ntfs_writepage() of MstProtected() attributes. 419 * ntfs_writepage() of MstProtected() attributes.
@@ -413,7 +422,6 @@ retry_readpage:
413 unlock_page(page); 422 unlock_page(page);
414 return 0; 423 return 0;
415 } 424 }
416 vi = page->mapping->host;
417 ni = NTFS_I(vi); 425 ni = NTFS_I(vi);
418 /* 426 /*
419 * Only $DATA attributes can be encrypted and only unnamed $DATA 427 * Only $DATA attributes can be encrypted and only unnamed $DATA
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index 92dabdcf2b80..50d3b0c258e3 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -179,10 +179,7 @@ int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn, ntfs_attr_search_ctx *ctx)
179 * ntfs_mapping_pairs_decompress() fails. 179 * ntfs_mapping_pairs_decompress() fails.
180 */ 180 */
181 end_vcn = sle64_to_cpu(a->data.non_resident.highest_vcn) + 1; 181 end_vcn = sle64_to_cpu(a->data.non_resident.highest_vcn) + 1;
182 if (!a->data.non_resident.lowest_vcn && end_vcn == 1) 182 if (unlikely(vcn && vcn >= end_vcn)) {
183 end_vcn = sle64_to_cpu(a->data.non_resident.allocated_size) >>
184 ni->vol->cluster_size_bits;
185 if (unlikely(vcn >= end_vcn)) {
186 err = -ENOENT; 183 err = -ENOENT;
187 goto err_out; 184 goto err_out;
188 } 185 }
diff --git a/fs/ntfs/compress.c b/fs/ntfs/compress.c
index d98daf59e0b6..d1619d05eb23 100644
--- a/fs/ntfs/compress.c
+++ b/fs/ntfs/compress.c
@@ -561,6 +561,16 @@ int ntfs_read_compressed_block(struct page *page)
561 read_unlock_irqrestore(&ni->size_lock, flags); 561 read_unlock_irqrestore(&ni->size_lock, flags);
562 max_page = ((i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) - 562 max_page = ((i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) -
563 offset; 563 offset;
564 /* Is the page fully outside i_size? (truncate in progress) */
565 if (xpage >= max_page) {
566 kfree(bhs);
567 kfree(pages);
568 zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
569 ntfs_debug("Compressed read outside i_size - truncated?");
570 SetPageUptodate(page);
571 unlock_page(page);
572 return 0;
573 }
564 if (nr_pages < max_page) 574 if (nr_pages < max_page)
565 max_page = nr_pages; 575 max_page = nr_pages;
566 for (i = 0; i < max_page; i++, offset++) { 576 for (i = 0; i < max_page; i++, offset++) {
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 63c95afb561f..eba339ecba27 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -358,7 +358,8 @@ static cputime_t task_utime(struct task_struct *p)
358 } 358 }
359 utime = (clock_t)temp; 359 utime = (clock_t)temp;
360 360
361 return clock_t_to_cputime(utime); 361 p->prev_utime = max(p->prev_utime, clock_t_to_cputime(utime));
362 return p->prev_utime;
362} 363}
363 364
364static cputime_t task_stime(struct task_struct *p) 365static cputime_t task_stime(struct task_struct *p)
@@ -373,7 +374,8 @@ static cputime_t task_stime(struct task_struct *p)
373 stime = nsec_to_clock_t(p->se.sum_exec_runtime) - 374 stime = nsec_to_clock_t(p->se.sum_exec_runtime) -
374 cputime_to_clock_t(task_utime(p)); 375 cputime_to_clock_t(task_utime(p));
375 376
376 return clock_t_to_cputime(stime); 377 p->prev_stime = max(p->prev_stime, clock_t_to_cputime(stime));
378 return p->prev_stime;
377} 379}
378#endif 380#endif
379 381
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index 2e91fb756e9a..749def054a34 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -185,7 +185,7 @@ static __net_exit void proc_net_ns_exit(struct net *net)
185 kfree(net->proc_net_root); 185 kfree(net->proc_net_root);
186} 186}
187 187
188struct pernet_operations __net_initdata proc_net_ns_ops = { 188static struct pernet_operations proc_net_ns_ops = {
189 .init = proc_net_ns_init, 189 .init = proc_net_ns_init,
190 .exit = proc_net_ns_exit, 190 .exit = proc_net_ns_exit,
191}; 191};
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 680c429bfa22..4e57fcf85982 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -171,7 +171,8 @@ static ssize_t proc_sys_read(struct file *filp, char __user *buf,
171 struct dentry *dentry = filp->f_dentry; 171 struct dentry *dentry = filp->f_dentry;
172 struct ctl_table_header *head; 172 struct ctl_table_header *head;
173 struct ctl_table *table; 173 struct ctl_table *table;
174 ssize_t error, res; 174 ssize_t error;
175 size_t res;
175 176
176 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head); 177 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head);
177 /* Has the sysctl entry disappeared on us? */ 178 /* Has the sysctl entry disappeared on us? */
@@ -209,7 +210,8 @@ static ssize_t proc_sys_write(struct file *filp, const char __user *buf,
209 struct dentry *dentry = filp->f_dentry; 210 struct dentry *dentry = filp->f_dentry;
210 struct ctl_table_header *head; 211 struct ctl_table_header *head;
211 struct ctl_table *table; 212 struct ctl_table *table;
212 ssize_t error, res; 213 ssize_t error;
214 size_t res;
213 215
214 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head); 216 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head);
215 /* Has the sysctl entry disappeared on us? */ 217 /* Has the sysctl entry disappeared on us? */
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 7a8ce9e98b32..337162935d21 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -132,7 +132,7 @@ struct dentry *sysfs_get_dentry(struct sysfs_dirent *sd)
132 * RETURNS: 132 * RETURNS:
133 * Pointer to @sd on success, NULL on failure. 133 * Pointer to @sd on success, NULL on failure.
134 */ 134 */
135struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd) 135static struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd)
136{ 136{
137 if (unlikely(!sd)) 137 if (unlikely(!sd))
138 return NULL; 138 return NULL;
@@ -161,7 +161,7 @@ struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd)
161 * Put an active reference to @sd. This function is noop if @sd 161 * Put an active reference to @sd. This function is noop if @sd
162 * is NULL. 162 * is NULL.
163 */ 163 */
164void sysfs_put_active(struct sysfs_dirent *sd) 164static void sysfs_put_active(struct sysfs_dirent *sd)
165{ 165{
166 struct completion *cmpl; 166 struct completion *cmpl;
167 int v; 167 int v;
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index f8417988f6b0..ff17f8da9b43 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -103,8 +103,6 @@ extern const struct file_operations sysfs_dir_operations;
103extern const struct inode_operations sysfs_dir_inode_operations; 103extern const struct inode_operations sysfs_dir_inode_operations;
104 104
105struct dentry *sysfs_get_dentry(struct sysfs_dirent *sd); 105struct dentry *sysfs_get_dentry(struct sysfs_dirent *sd);
106struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd);
107void sysfs_put_active(struct sysfs_dirent *sd);
108struct sysfs_dirent *sysfs_get_active_two(struct sysfs_dirent *sd); 106struct sysfs_dirent *sysfs_get_active_two(struct sysfs_dirent *sd);
109void sysfs_put_active_two(struct sysfs_dirent *sd); 107void sysfs_put_active_two(struct sysfs_dirent *sd);
110void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, 108void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt,
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 584cf12cc40f..c78c04fd993f 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -933,20 +933,19 @@ magic_found:
933 goto again; 933 goto again;
934 } 934 }
935 935
936 /* Set sbi->s_flags here, used by ufs_get_fs_state() below */ 936 sbi->s_flags = flags;/*after that line some functions use s_flags*/
937 sbi->s_flags = flags;
938 ufs_print_super_stuff(sb, usb1, usb2, usb3); 937 ufs_print_super_stuff(sb, usb1, usb2, usb3);
939 938
940 /* 939 /*
941 * Check, if file system was correctly unmounted. 940 * Check, if file system was correctly unmounted.
942 * If not, make it read only. 941 * If not, make it read only.
943 */ 942 */
944 if ((((flags & UFS_ST_MASK) == UFS_ST_44BSD) || 943 if (((flags & UFS_ST_MASK) == UFS_ST_44BSD) ||
945 ((flags & UFS_ST_MASK) == UFS_ST_OLD) || 944 ((flags & UFS_ST_MASK) == UFS_ST_OLD) ||
946 ((flags & UFS_ST_MASK) == UFS_ST_SUN) || 945 (((flags & UFS_ST_MASK) == UFS_ST_SUN ||
947 ((flags & UFS_ST_MASK) == UFS_ST_SUNOS) || 946 (flags & UFS_ST_MASK) == UFS_ST_SUNOS ||
948 ((flags & UFS_ST_MASK) == UFS_ST_SUNx86)) && 947 (flags & UFS_ST_MASK) == UFS_ST_SUNx86) &&
949 (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)))) { 948 (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) {
950 switch(usb1->fs_clean) { 949 switch(usb1->fs_clean) {
951 case UFS_FSCLEAN: 950 case UFS_FSCLEAN:
952 UFSD("fs is clean\n"); 951 UFSD("fs is clean\n");
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 7b74b60a68a4..19c3ead2a90b 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -168,8 +168,7 @@ struct acpi_device_flags {
168 u32 power_manageable:1; 168 u32 power_manageable:1;
169 u32 performance_manageable:1; 169 u32 performance_manageable:1;
170 u32 wake_capable:1; /* Wakeup(_PRW) supported? */ 170 u32 wake_capable:1; /* Wakeup(_PRW) supported? */
171 u32 force_power_state:1; 171 u32 reserved:20;
172 u32 reserved:19;
173}; 172};
174 173
175/* File System */ 174/* File System */
diff --git a/include/asm-arm/arch-at91/board.h b/include/asm-arm/arch-at91/board.h
index d96b10fd449f..c0d7075982c1 100644
--- a/include/asm-arm/arch-at91/board.h
+++ b/include/asm-arm/arch-at91/board.h
@@ -130,4 +130,7 @@ extern u8 at91_leds_cpu;
130extern u8 at91_leds_timer; 130extern u8 at91_leds_timer;
131extern void __init at91_init_leds(u8 cpu_led, u8 timer_led); 131extern void __init at91_init_leds(u8 cpu_led, u8 timer_led);
132 132
133/* FIXME: this needs a better location, but gets stuff building again */
134extern int at91_suspend_entering_slow_clock(void);
135
133#endif 136#endif
diff --git a/include/asm-arm/arch-davinci/gpio.h b/include/asm-arm/arch-davinci/gpio.h
index ea24a0e0bfd6..ff8de30b2fb3 100644
--- a/include/asm-arm/arch-davinci/gpio.h
+++ b/include/asm-arm/arch-davinci/gpio.h
@@ -13,6 +13,9 @@
13#ifndef __DAVINCI_GPIO_H 13#ifndef __DAVINCI_GPIO_H
14#define __DAVINCI_GPIO_H 14#define __DAVINCI_GPIO_H
15 15
16#include <linux/io.h>
17#include <asm/hardware.h>
18
16/* 19/*
17 * basic gpio routines 20 * basic gpio routines
18 * 21 *
diff --git a/include/asm-arm/arch-pxa/mfp-pxa300.h b/include/asm-arm/arch-pxa/mfp-pxa300.h
index 7513c7a3402d..822a27cd7864 100644
--- a/include/asm-arm/arch-pxa/mfp-pxa300.h
+++ b/include/asm-arm/arch-pxa/mfp-pxa300.h
@@ -4,7 +4,7 @@
4 * PXA300/PXA310 specific MFP configuration definitions 4 * PXA300/PXA310 specific MFP configuration definitions
5 * 5 *
6 * Copyright (C) 2007 Marvell International Ltd. 6 * Copyright (C) 2007 Marvell International Ltd.
7 * 2007-08-21: eric miao <eric.y.miao@gmail.com> 7 * 2007-08-21: eric miao <eric.miao@marvell.com>
8 * initial version 8 * initial version
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
diff --git a/include/asm-arm/arch-pxa/mfp-pxa320.h b/include/asm-arm/arch-pxa/mfp-pxa320.h
index ae8ba34194cf..488a5bbc49e9 100644
--- a/include/asm-arm/arch-pxa/mfp-pxa320.h
+++ b/include/asm-arm/arch-pxa/mfp-pxa320.h
@@ -4,7 +4,7 @@
4 * PXA320 specific MFP configuration definitions 4 * PXA320 specific MFP configuration definitions
5 * 5 *
6 * Copyright (C) 2007 Marvell International Ltd. 6 * Copyright (C) 2007 Marvell International Ltd.
7 * 2007-08-21: eric miao <eric.y.miao@gmail.com> 7 * 2007-08-21: eric miao <eric.miao@marvell.com>
8 * initial version 8 * initial version
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
diff --git a/include/asm-arm/arch-pxa/mfp.h b/include/asm-arm/arch-pxa/mfp.h
index 60291742ffdd..ac4157af5a8e 100644
--- a/include/asm-arm/arch-pxa/mfp.h
+++ b/include/asm-arm/arch-pxa/mfp.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2007 Marvell International Ltd. 6 * Copyright (C) 2007 Marvell International Ltd.
7 * 7 *
8 * 2007-8-21: eric miao <eric.y.miao@gmail.com> 8 * 2007-8-21: eric miao <eric.miao@marvell.com>
9 * initial version 9 * initial version
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
diff --git a/include/asm-arm/flat.h b/include/asm-arm/flat.h
index 16f5375e57b8..9918aa46d9e5 100644
--- a/include/asm-arm/flat.h
+++ b/include/asm-arm/flat.h
@@ -11,8 +11,9 @@
11#define flat_argvp_envp_on_stack() 1 11#define flat_argvp_envp_on_stack() 1
12#define flat_old_ram_flag(flags) (flags) 12#define flat_old_ram_flag(flags) (flags)
13#define flat_reloc_valid(reloc, size) ((reloc) <= (size)) 13#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
14#define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp) 14#define flat_get_addr_from_rp(rp, relval, flags, persistent) get_unaligned(rp)
15#define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp) 15#define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp)
16#define flat_get_relocate_addr(rel) (rel) 16#define flat_get_relocate_addr(rel) (rel)
17#define flat_set_persistent(relval, p) 0
17 18
18#endif /* __ARM_FLAT_H__ */ 19#endif /* __ARM_FLAT_H__ */
diff --git a/include/asm-arm/plat-s3c/regs-nand.h b/include/asm-arm/plat-s3c/regs-nand.h
index b824d371ae0b..d742205ac172 100644
--- a/include/asm-arm/plat-s3c/regs-nand.h
+++ b/include/asm-arm/plat-s3c/regs-nand.h
@@ -35,7 +35,7 @@
35#define S3C2440_NFESTAT1 S3C2410_NFREG(0x28) 35#define S3C2440_NFESTAT1 S3C2410_NFREG(0x28)
36#define S3C2440_NFMECC0 S3C2410_NFREG(0x2C) 36#define S3C2440_NFMECC0 S3C2410_NFREG(0x2C)
37#define S3C2440_NFMECC1 S3C2410_NFREG(0x30) 37#define S3C2440_NFMECC1 S3C2410_NFREG(0x30)
38#define S3C2440_NFSECC S3C24E10_NFREG(0x34) 38#define S3C2440_NFSECC S3C2410_NFREG(0x34)
39#define S3C2440_NFSBLK S3C2410_NFREG(0x38) 39#define S3C2440_NFSBLK S3C2410_NFREG(0x38)
40#define S3C2440_NFEBLK S3C2410_NFREG(0x3C) 40#define S3C2440_NFEBLK S3C2410_NFREG(0x3C)
41 41
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h
index a7131630c057..57dc672bab8e 100644
--- a/include/asm-avr32/dma-mapping.h
+++ b/include/asm-avr32/dma-mapping.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <linux/device.h> 5#include <linux/device.h>
6#include <asm/scatterlist.h> 6#include <linux/scatterlist.h>
7#include <asm/processor.h> 7#include <asm/processor.h>
8#include <asm/cacheflush.h> 8#include <asm/cacheflush.h>
9#include <asm/io.h> 9#include <asm/io.h>
diff --git a/include/asm-blackfin/bfin-global.h b/include/asm-blackfin/bfin-global.h
index 14cb8d35924e..0212e180b90e 100644
--- a/include/asm-blackfin/bfin-global.h
+++ b/include/asm-blackfin/bfin-global.h
@@ -80,6 +80,7 @@ extern int atomic_sub32(void);
80extern int atomic_ior32(void); 80extern int atomic_ior32(void);
81extern int atomic_and32(void); 81extern int atomic_and32(void);
82extern int atomic_xor32(void); 82extern int atomic_xor32(void);
83extern void safe_user_instruction(void);
83extern void sigreturn_stub(void); 84extern void sigreturn_stub(void);
84 85
85extern void *l1_data_A_sram_alloc(size_t); 86extern void *l1_data_A_sram_alloc(size_t);
diff --git a/include/asm-blackfin/fixed_code.h b/include/asm-blackfin/fixed_code.h
index e6df84ee1557..37db66c7030d 100644
--- a/include/asm-blackfin/fixed_code.h
+++ b/include/asm-blackfin/fixed_code.h
@@ -17,4 +17,6 @@
17 17
18#define ATOMIC_SEQS_END 0x480 18#define ATOMIC_SEQS_END 0x480
19 19
20#define FIXED_CODE_END 0x480 20#define SAFE_USER_INSTRUCTION 0x480
21
22#define FIXED_CODE_END 0x490
diff --git a/include/asm-blackfin/gptimers.h b/include/asm-blackfin/gptimers.h
index c97ab03e43a6..8265ea473d5b 100644
--- a/include/asm-blackfin/gptimers.h
+++ b/include/asm-blackfin/gptimers.h
@@ -197,6 +197,8 @@ uint32_t get_gptimer_period (int timer_id);
197uint32_t get_gptimer_count (int timer_id); 197uint32_t get_gptimer_count (int timer_id);
198uint16_t get_gptimer_intr (int timer_id); 198uint16_t get_gptimer_intr (int timer_id);
199void clear_gptimer_intr (int timer_id); 199void clear_gptimer_intr (int timer_id);
200uint16_t get_gptimer_over (int timer_id);
201void clear_gptimer_over (int timer_id);
200void set_gptimer_config (int timer_id, uint16_t config); 202void set_gptimer_config (int timer_id, uint16_t config);
201uint16_t get_gptimer_config (int timer_id); 203uint16_t get_gptimer_config (int timer_id);
202void set_gptimer_pulse_hi (int timer_id); 204void set_gptimer_pulse_hi (int timer_id);
diff --git a/include/asm-blackfin/mach-bf527/defBF52x_base.h b/include/asm-blackfin/mach-bf527/defBF52x_base.h
index d6c24c54699d..fc69cf93f149 100644
--- a/include/asm-blackfin/mach-bf527/defBF52x_base.h
+++ b/include/asm-blackfin/mach-bf527/defBF52x_base.h
@@ -1718,55 +1718,55 @@
1718 1718
1719/* Bit masks for HOST_CONTROL */ 1719/* Bit masks for HOST_CONTROL */
1720 1720
1721#define HOST_EN 0x1 /* Host Enable */ 1721#define HOST_CNTR_HOST_EN 0x1 /* Host Enable */
1722#define nHOST_EN 0x0 1722#define HOST_CNTR_nHOST_EN 0x0
1723#define HOST_END 0x2 /* Host Endianess */ 1723#define HOST_CNTR_HOST_END 0x2 /* Host Endianess */
1724#define nHOST_END 0x0 1724#define HOST_CNTR_nHOST_END 0x0
1725#define DATA_SIZE 0x4 /* Data Size */ 1725#define HOST_CNTR_DATA_SIZE 0x4 /* Data Size */
1726#define nDATA_SIZE 0x0 1726#define HOST_CNTR_nDATA_SIZE 0x0
1727#define HOST_RST 0x8 /* Host Reset */ 1727#define HOST_CNTR_HOST_RST 0x8 /* Host Reset */
1728#define nHOST_RST 0x0 1728#define HOST_CNTR_nHOST_RST 0x0
1729#define HRDY_OVR 0x20 /* Host Ready Override */ 1729#define HOST_CNTR_HRDY_OVR 0x20 /* Host Ready Override */
1730#define nHRDY_OVR 0x0 1730#define HOST_CNTR_nHRDY_OVR 0x0
1731#define INT_MODE 0x40 /* Interrupt Mode */ 1731#define HOST_CNTR_INT_MODE 0x40 /* Interrupt Mode */
1732#define nINT_MODE 0x0 1732#define HOST_CNTR_nINT_MODE 0x0
1733#define BT_EN 0x80 /* Bus Timeout Enable */ 1733#define HOST_CNTR_BT_EN 0x80 /* Bus Timeout Enable */
1734#define nBT_EN 0x0 1734#define HOST_CNTR_ nBT_EN 0x0
1735#define EHW 0x100 /* Enable Host Write */ 1735#define HOST_CNTR_EHW 0x100 /* Enable Host Write */
1736#define nEHW 0x0 1736#define HOST_CNTR_nEHW 0x0
1737#define EHR 0x200 /* Enable Host Read */ 1737#define HOST_CNTR_EHR 0x200 /* Enable Host Read */
1738#define nEHR 0x0 1738#define HOST_CNTR_nEHR 0x0
1739#define BDR 0x400 /* Burst DMA Requests */ 1739#define HOST_CNTR_BDR 0x400 /* Burst DMA Requests */
1740#define nBDR 0x0 1740#define HOST_CNTR_nBDR 0x0
1741 1741
1742/* Bit masks for HOST_STATUS */ 1742/* Bit masks for HOST_STATUS */
1743 1743
1744#define READY 0x1 /* DMA Ready */ 1744#define HOST_STAT_READY 0x1 /* DMA Ready */
1745#define nREADY 0x0 1745#define HOST_STAT_nREADY 0x0
1746#define FIFOFULL 0x2 /* FIFO Full */ 1746#define HOST_STAT_FIFOFULL 0x2 /* FIFO Full */
1747#define nFIFOFULL 0x0 1747#define HOST_STAT_nFIFOFULL 0x0
1748#define FIFOEMPTY 0x4 /* FIFO Empty */ 1748#define HOST_STAT_FIFOEMPTY 0x4 /* FIFO Empty */
1749#define nFIFOEMPTY 0x0 1749#define HOST_STAT_nFIFOEMPTY 0x0
1750#define COMPLETE 0x8 /* DMA Complete */ 1750#define HOST_STAT_COMPLETE 0x8 /* DMA Complete */
1751#define nCOMPLETE 0x0 1751#define HOST_STAT_nCOMPLETE 0x0
1752#define HSHK 0x10 /* Host Handshake */ 1752#define HOST_STAT_HSHK 0x10 /* Host Handshake */
1753#define nHSHK 0x0 1753#define HOST_STAT_nHSHK 0x0
1754#define TIMEOUT 0x20 /* Host Timeout */ 1754#define HOST_STAT_TIMEOUT 0x20 /* Host Timeout */
1755#define nTIMEOUT 0x0 1755#define HOST_STAT_nTIMEOUT 0x0
1756#define HIRQ 0x40 /* Host Interrupt Request */ 1756#define HOST_STAT_HIRQ 0x40 /* Host Interrupt Request */
1757#define nHIRQ 0x0 1757#define HOST_STAT_nHIRQ 0x0
1758#define ALLOW_CNFG 0x80 /* Allow New Configuration */ 1758#define HOST_STAT_ALLOW_CNFG 0x80 /* Allow New Configuration */
1759#define nALLOW_CNFG 0x0 1759#define HOST_STAT_nALLOW_CNFG 0x0
1760#define DMA_DIR 0x100 /* DMA Direction */ 1760#define HOST_STAT_DMA_DIR 0x100 /* DMA Direction */
1761#define nDMA_DIR 0x0 1761#define HOST_STAT_nDMA_DIR 0x0
1762#define BTE 0x200 /* Bus Timeout Enabled */ 1762#define HOST_STAT_BTE 0x200 /* Bus Timeout Enabled */
1763#define nBTE 0x0 1763#define HOST_STAT_nBTE 0x0
1764#define HOSTRD_DONE 0x8000 /* Host Read Completion Interrupt */ 1764#define HOST_STAT_HOSTRD_DONE 0x8000 /* Host Read Completion Interrupt */
1765#define nHOSTRD_DONE 0x0 1765#define HOST_STAT_nHOSTRD_DONE 0x0
1766 1766
1767/* Bit masks for HOST_TIMEOUT */ 1767/* Bit masks for HOST_TIMEOUT */
1768 1768
1769#define COUNT_TIMEOUT 0x7ff /* Host Timeout count */ 1769#define HOST_COUNT_TIMEOUT 0x7ff /* Host Timeout count */
1770 1770
1771/* Bit masks for CNT_CONFIG */ 1771/* Bit masks for CNT_CONFIG */
1772 1772
diff --git a/include/asm-blackfin/mach-bf527/dma.h b/include/asm-blackfin/mach-bf527/dma.h
index a41627ae9134..2dfee12864f6 100644
--- a/include/asm-blackfin/mach-bf527/dma.h
+++ b/include/asm-blackfin/mach-bf527/dma.h
@@ -35,7 +35,6 @@
35#define MAX_BLACKFIN_DMA_CHANNEL 16 35#define MAX_BLACKFIN_DMA_CHANNEL 16
36 36
37#define CH_PPI 0 /* PPI receive/transmit or NFC */ 37#define CH_PPI 0 /* PPI receive/transmit or NFC */
38#define CH_NFC 0 /* PPI receive/transmit or NFC */
39#define CH_EMAC_RX 1 /* Ethernet MAC receive or HOSTDP */ 38#define CH_EMAC_RX 1 /* Ethernet MAC receive or HOSTDP */
40#define CH_EMAC_HOSTDP 1 /* Ethernet MAC receive or HOSTDP */ 39#define CH_EMAC_HOSTDP 1 /* Ethernet MAC receive or HOSTDP */
41#define CH_EMAC_TX 2 /* Ethernet MAC transmit or NFC */ 40#define CH_EMAC_TX 2 /* Ethernet MAC transmit or NFC */
@@ -54,6 +53,12 @@
54#define CH_MEM_STREAM1_DEST 14 /* TX */ 53#define CH_MEM_STREAM1_DEST 14 /* TX */
55#define CH_MEM_STREAM1_SRC 15 /* RX */ 54#define CH_MEM_STREAM1_SRC 15 /* RX */
56 55
56#if defined(CONFIG_BF527_NAND_D_PORTF)
57#define CH_NFC CH_PPI /* PPI receive/transmit or NFC */
58#elif defined(CONFIG_BF527_NAND_D_PORTH)
59#define CH_NFC CH_EMAC_TX /* PPI receive/transmit or NFC */
60#endif
61
57extern int channel2irq(unsigned int channel); 62extern int channel2irq(unsigned int channel);
58extern struct dma_register *base_addr[]; 63extern struct dma_register *base_addr[];
59 64
diff --git a/include/asm-blackfin/mach-bf548/defBF549.h b/include/asm-blackfin/mach-bf548/defBF549.h
index 4e46d657e50e..fcb72b41e007 100644
--- a/include/asm-blackfin/mach-bf548/defBF549.h
+++ b/include/asm-blackfin/mach-bf548/defBF549.h
@@ -1671,7 +1671,7 @@
1671/* Bit masks for MXVR_DMAx_CONFIG */ 1671/* Bit masks for MXVR_DMAx_CONFIG */
1672 1672
1673#define MDMAEN 0x1 /* DMA Channel Enable */ 1673#define MDMAEN 0x1 /* DMA Channel Enable */
1674#define DD 0x2 /* DMA Channel Direction */ 1674#define DMADD 0x2 /* DMA Channel Direction */
1675#define BY4SWAPEN 0x20 /* DMA Channel Four Byte Swap Enable */ 1675#define BY4SWAPEN 0x20 /* DMA Channel Four Byte Swap Enable */
1676#define LCHAN 0x3c0 /* DMA Channel Logical Channel */ 1676#define LCHAN 0x3c0 /* DMA Channel Logical Channel */
1677#define BITSWAPEN 0x400 /* DMA Channel Bit Swap Enable */ 1677#define BITSWAPEN 0x400 /* DMA Channel Bit Swap Enable */
diff --git a/include/asm-blackfin/mach-bf548/defBF54x_base.h b/include/asm-blackfin/mach-bf548/defBF54x_base.h
index 1d365c844ffe..da979cb62f7d 100644
--- a/include/asm-blackfin/mach-bf548/defBF54x_base.h
+++ b/include/asm-blackfin/mach-bf548/defBF54x_base.h
@@ -2252,6 +2252,13 @@
2252#define PLL_OFF 0x2 /* Disable PLL */ 2252#define PLL_OFF 0x2 /* Disable PLL */
2253#define DF 0x1 /* Divide Frequency */ 2253#define DF 0x1 /* Divide Frequency */
2254 2254
2255/* SWRST Masks */
2256#define SYSTEM_RESET 0x0007 /* Initiates A System Software Reset */
2257#define DOUBLE_FAULT 0x0008 /* Core Double Fault Causes Reset */
2258#define RESET_DOUBLE 0x2000 /* SW Reset Generated By Core Double-Fault */
2259#define RESET_WDOG 0x4000 /* SW Reset Generated By Watchdog Timer */
2260#define RESET_SOFTWARE 0x8000 /* SW Reset Occurred Since Last Read Of SWRST */
2261
2255/* Bit masks for PLL_STAT */ 2262/* Bit masks for PLL_STAT */
2256 2263
2257#define PLL_LOCKED 0x20 /* PLL Locked Status */ 2264#define PLL_LOCKED 0x20 /* PLL Locked Status */
diff --git a/include/asm-blackfin/mach-bf548/portmux.h b/include/asm-blackfin/mach-bf548/portmux.h
index b382deb501a7..6b485120015f 100644
--- a/include/asm-blackfin/mach-bf548/portmux.h
+++ b/include/asm-blackfin/mach-bf548/portmux.h
@@ -267,4 +267,18 @@
267#define P_AMC_BG (P_DEFINED | P_IDENT(GPIO_PJ12) | P_FUNCT(0)) 267#define P_AMC_BG (P_DEFINED | P_IDENT(GPIO_PJ12) | P_FUNCT(0))
268#define P_AMC_BGH (P_DEFINED | P_IDENT(GPIO_PJ13) | P_FUNCT(0)) 268#define P_AMC_BGH (P_DEFINED | P_IDENT(GPIO_PJ13) | P_FUNCT(0))
269 269
270
271#define P_NAND_D0 (P_DONTCARE)
272#define P_NAND_D1 (P_DONTCARE)
273#define P_NAND_D2 (P_DONTCARE)
274#define P_NAND_D3 (P_DONTCARE)
275#define P_NAND_D4 (P_DONTCARE)
276#define P_NAND_D5 (P_DONTCARE)
277#define P_NAND_D6 (P_DONTCARE)
278#define P_NAND_D7 (P_DONTCARE)
279#define P_NAND_WE (P_DONTCARE)
280#define P_NAND_RE (P_DONTCARE)
281#define P_NAND_CLE (P_DONTCARE)
282#define P_NAND_ALE (P_DONTCARE)
283
270#endif /* _MACH_PORTMUX_H_ */ 284#endif /* _MACH_PORTMUX_H_ */
diff --git a/include/asm-blackfin/mach-bf561/defBF561.h b/include/asm-blackfin/mach-bf561/defBF561.h
index bf7dc4e00065..7945e8a3a841 100644
--- a/include/asm-blackfin/mach-bf561/defBF561.h
+++ b/include/asm-blackfin/mach-bf561/defBF561.h
@@ -55,6 +55,9 @@
55/* For MMR's that are reserved on Core B, set up defines to better integrate with other ports */ 55/* For MMR's that are reserved on Core B, set up defines to better integrate with other ports */
56#define SWRST SICA_SWRST 56#define SWRST SICA_SWRST
57#define SYSCR SICA_SYSCR 57#define SYSCR SICA_SYSCR
58#define RESET_DOUBLE (SWRST_DBL_FAULT_B|SWRST_DBL_FAULT_A)
59#define RESET_WDOG (SWRST_WDT_B|SWRST_WDT_A)
60#define RESET_SOFTWARE (SWRST_OCCURRED)
58 61
59/* System Reset and Interrupt Controller registers for core A (0xFFC0 0100-0xFFC0 01FF) */ 62/* System Reset and Interrupt Controller registers for core A (0xFFC0 0100-0xFFC0 01FF) */
60#define SICA_SWRST 0xFFC00100 /* Software Reset register */ 63#define SICA_SWRST 0xFFC00100 /* Software Reset register */
diff --git a/include/asm-frv/scatterlist.h b/include/asm-frv/scatterlist.h
index 99ba76edc42a..2e7143b5a7ad 100644
--- a/include/asm-frv/scatterlist.h
+++ b/include/asm-frv/scatterlist.h
@@ -16,8 +16,7 @@
16 * 16 *
17 * can be rewritten as 17 * can be rewritten as
18 * 18 *
19 * sg_set_page(virt_to_page(some_ptr)); 19 * sg_set_buf(sg, some_ptr, length);
20 * sg->offset = (unsigned long) some_ptr & ~PAGE_MASK;
21 * 20 *
22 * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens 21 * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens
23 */ 22 */
diff --git a/include/asm-ia64/percpu.h b/include/asm-ia64/percpu.h
index 43a7aac414e0..c4f1e328a5ba 100644
--- a/include/asm-ia64/percpu.h
+++ b/include/asm-ia64/percpu.h
@@ -46,7 +46,7 @@
46#ifdef CONFIG_SMP 46#ifdef CONFIG_SMP
47 47
48extern unsigned long __per_cpu_offset[NR_CPUS]; 48extern unsigned long __per_cpu_offset[NR_CPUS];
49#define per_cpu_offset(x) (__per_cpu_offset(x)) 49#define per_cpu_offset(x) (__per_cpu_offset[x])
50 50
51/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */ 51/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
52DECLARE_PER_CPU(unsigned long, local_per_cpu_offset); 52DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
index 471cc2ee9ac4..4fa733dd417a 100644
--- a/include/asm-ia64/smp.h
+++ b/include/asm-ia64/smp.h
@@ -60,7 +60,6 @@ extern cpumask_t cpu_online_map;
60extern cpumask_t cpu_core_map[NR_CPUS]; 60extern cpumask_t cpu_core_map[NR_CPUS];
61DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 61DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
62extern int smp_num_siblings; 62extern int smp_num_siblings;
63extern int smp_num_cpucores;
64extern void __iomem *ipi_base_addr; 63extern void __iomem *ipi_base_addr;
65extern unsigned char smp_int_redirect; 64extern unsigned char smp_int_redirect;
66 65
diff --git a/include/asm-mips/i8253.h b/include/asm-mips/i8253.h
index affb32ce4af9..032ca73f181b 100644
--- a/include/asm-mips/i8253.h
+++ b/include/asm-mips/i8253.h
@@ -5,25 +5,14 @@
5#ifndef __ASM_I8253_H 5#ifndef __ASM_I8253_H
6#define __ASM_I8253_H 6#define __ASM_I8253_H
7 7
8#include <linux/spinlock.h>
9
8/* i8253A PIT registers */ 10/* i8253A PIT registers */
9#define PIT_MODE 0x43 11#define PIT_MODE 0x43
10#define PIT_CH0 0x40 12#define PIT_CH0 0x40
11#define PIT_CH2 0x42 13#define PIT_CH2 0x42
12 14
13/* i8259A PIC registers */ 15extern spinlock_t i8253_lock;
14#define PIC_MASTER_CMD 0x20
15#define PIC_MASTER_IMR 0x21
16#define PIC_MASTER_ISR PIC_MASTER_CMD
17#define PIC_MASTER_POLL PIC_MASTER_ISR
18#define PIC_MASTER_OCW3 PIC_MASTER_ISR
19#define PIC_SLAVE_CMD 0xa0
20#define PIC_SLAVE_IMR 0xa1
21
22/* i8259A PIC related value */
23#define PIC_CASCADE_IR 2
24#define MASTER_ICW4_DEFAULT 0x01
25#define SLAVE_ICW4_DEFAULT 0x01
26#define PIC_ICW4_AEOI 2
27 16
28extern void setup_pit_timer(void); 17extern void setup_pit_timer(void);
29 18
diff --git a/include/asm-mips/ip32/ip32_ints.h b/include/asm-mips/ip32/ip32_ints.h
index 042f821899a8..ab5612f90f6f 100644
--- a/include/asm-mips/ip32/ip32_ints.h
+++ b/include/asm-mips/ip32/ip32_ints.h
@@ -22,10 +22,12 @@ enum ip32_irq_no {
22 * CPU interrupts are 0 ... 7 22 * CPU interrupts are 0 ... 7
23 */ 23 */
24 24
25 CRIME_IRQ_BASE = MIPS_CPU_IRQ_BASE,
26
25 /* 27 /*
26 * MACE 28 * MACE
27 */ 29 */
28 MACE_VID_IN1_IRQ = MIPS_CPU_IRQ_BASE + 8, 30 MACE_VID_IN1_IRQ = CRIME_IRQ_BASE,
29 MACE_VID_IN2_IRQ, 31 MACE_VID_IN2_IRQ,
30 MACE_VID_OUT_IRQ, 32 MACE_VID_OUT_IRQ,
31 MACE_ETHERNET_IRQ, 33 MACE_ETHERNET_IRQ,
diff --git a/include/asm-mips/jmr3927/jmr3927.h b/include/asm-mips/jmr3927/jmr3927.h
index b2dc35f56181..81602c8047eb 100644
--- a/include/asm-mips/jmr3927/jmr3927.h
+++ b/include/asm-mips/jmr3927/jmr3927.h
@@ -132,9 +132,7 @@
132#define JMR3927_IRQ_IRC_DMA (JMR3927_IRQ_IRC + TX3927_IR_DMA) 132#define JMR3927_IRQ_IRC_DMA (JMR3927_IRQ_IRC + TX3927_IR_DMA)
133#define JMR3927_IRQ_IRC_PIO (JMR3927_IRQ_IRC + TX3927_IR_PIO) 133#define JMR3927_IRQ_IRC_PIO (JMR3927_IRQ_IRC + TX3927_IR_PIO)
134#define JMR3927_IRQ_IRC_PCI (JMR3927_IRQ_IRC + TX3927_IR_PCI) 134#define JMR3927_IRQ_IRC_PCI (JMR3927_IRQ_IRC + TX3927_IR_PCI)
135#define JMR3927_IRQ_IRC_TMR0 (JMR3927_IRQ_IRC + TX3927_IR_TMR0) 135#define JMR3927_IRQ_IRC_TMR(ch) (JMR3927_IRQ_IRC + TX3927_IR_TMR(ch))
136#define JMR3927_IRQ_IRC_TMR1 (JMR3927_IRQ_IRC + TX3927_IR_TMR1)
137#define JMR3927_IRQ_IRC_TMR2 (JMR3927_IRQ_IRC + TX3927_IR_TMR2)
138#define JMR3927_IRQ_IOC_PCIA (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIA) 136#define JMR3927_IRQ_IOC_PCIA (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIA)
139#define JMR3927_IRQ_IOC_PCIB (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIB) 137#define JMR3927_IRQ_IOC_PCIB (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIB)
140#define JMR3927_IRQ_IOC_PCIC (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIC) 138#define JMR3927_IRQ_IOC_PCIC (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIC)
@@ -148,17 +146,12 @@
148#define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1 146#define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1
149/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */ 147/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */
150#define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3 148#define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3
151/* Clock Tick (10ms) */
152#define JMR3927_IRQ_TICK JMR3927_IRQ_IRC_TMR0
153 149
154/* Clocks */ 150/* Clocks */
155#define JMR3927_CORECLK 132710400 /* 132.7MHz */ 151#define JMR3927_CORECLK 132710400 /* 132.7MHz */
156#define JMR3927_GBUSCLK (JMR3927_CORECLK / 2) /* 66.35MHz */ 152#define JMR3927_GBUSCLK (JMR3927_CORECLK / 2) /* 66.35MHz */
157#define JMR3927_IMCLK (JMR3927_CORECLK / 4) /* 33.17MHz */ 153#define JMR3927_IMCLK (JMR3927_CORECLK / 4) /* 33.17MHz */
158 154
159#define jmr3927_tmrptr tx3927_tmrptr(0) /* TMR0 */
160
161
162/* 155/*
163 * TX3927 Pin Configuration: 156 * TX3927 Pin Configuration:
164 * 157 *
diff --git a/include/asm-mips/jmr3927/tx3927.h b/include/asm-mips/jmr3927/tx3927.h
index 211bcf47fffb..338f99882a39 100644
--- a/include/asm-mips/jmr3927/tx3927.h
+++ b/include/asm-mips/jmr3927/tx3927.h
@@ -222,9 +222,7 @@ struct tx3927_ccfg_reg {
222#define TX3927_IR_DMA 8 222#define TX3927_IR_DMA 8
223#define TX3927_IR_PIO 9 223#define TX3927_IR_PIO 9
224#define TX3927_IR_PCI 10 224#define TX3927_IR_PCI 10
225#define TX3927_IR_TMR0 13 225#define TX3927_IR_TMR(ch) (13 + (ch))
226#define TX3927_IR_TMR1 14
227#define TX3927_IR_TMR2 15
228#define TX3927_NUM_IR 16 226#define TX3927_NUM_IR 16
229 227
230/* 228/*
diff --git a/include/asm-mips/jmr3927/txx927.h b/include/asm-mips/jmr3927/txx927.h
index 58a8ff6be815..0474fe8dac3f 100644
--- a/include/asm-mips/jmr3927/txx927.h
+++ b/include/asm-mips/jmr3927/txx927.h
@@ -10,22 +10,6 @@
10#ifndef __ASM_TXX927_H 10#ifndef __ASM_TXX927_H
11#define __ASM_TXX927_H 11#define __ASM_TXX927_H
12 12
13struct txx927_tmr_reg {
14 volatile unsigned long tcr;
15 volatile unsigned long tisr;
16 volatile unsigned long cpra;
17 volatile unsigned long cprb;
18 volatile unsigned long itmr;
19 volatile unsigned long unused0[3];
20 volatile unsigned long ccdr;
21 volatile unsigned long unused1[3];
22 volatile unsigned long pgmr;
23 volatile unsigned long unused2[3];
24 volatile unsigned long wtmr;
25 volatile unsigned long unused3[43];
26 volatile unsigned long trr;
27};
28
29struct txx927_sio_reg { 13struct txx927_sio_reg {
30 volatile unsigned long lcr; 14 volatile unsigned long lcr;
31 volatile unsigned long dicr; 15 volatile unsigned long dicr;
@@ -51,27 +35,6 @@ struct txx927_pio_reg {
51}; 35};
52 36
53/* 37/*
54 * TMR
55 */
56/* TMTCR : Timer Control */
57#define TXx927_TMTCR_TCE 0x00000080
58#define TXx927_TMTCR_CCDE 0x00000040
59#define TXx927_TMTCR_CRE 0x00000020
60#define TXx927_TMTCR_ECES 0x00000008
61#define TXx927_TMTCR_CCS 0x00000004
62#define TXx927_TMTCR_TMODE_MASK 0x00000003
63#define TXx927_TMTCR_TMODE_ITVL 0x00000000
64
65/* TMTISR : Timer Int. Status */
66#define TXx927_TMTISR_TPIBS 0x00000004
67#define TXx927_TMTISR_TPIAS 0x00000002
68#define TXx927_TMTISR_TIIS 0x00000001
69
70/* TMTITMR : Interval Timer Mode */
71#define TXx927_TMTITMR_TIIE 0x00008000
72#define TXx927_TMTITMR_TZCE 0x00000001
73
74/*
75 * SIO 38 * SIO
76 */ 39 */
77/* SILCR : Line Control */ 40/* SILCR : Line Control */
diff --git a/include/asm-mips/mach-au1x00/timex.h b/include/asm-mips/mach-au1x00/timex.h
deleted file mode 100644
index e3ada66cb636..000000000000
--- a/include/asm-mips/mach-au1x00/timex.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_AU1X00_TIMEX_H
9#define __ASM_MACH_AU1X00_TIMEX_H
10
11#define CLOCK_TICK_RATE ((HZ * 100000UL) / 2)
12
13#endif /* __ASM_MACH_AU1X00_TIMEX_H */
diff --git a/include/asm-mips/mach-cobalt/irq.h b/include/asm-mips/mach-cobalt/irq.h
index 179d0e850b59..57c8c9ac5851 100644
--- a/include/asm-mips/mach-cobalt/irq.h
+++ b/include/asm-mips/mach-cobalt/irq.h
@@ -35,7 +35,7 @@
35 * 4 - ethernet 35 * 4 - ethernet
36 * 5 - 16550 UART 36 * 5 - 16550 UART
37 * 6 - cascade i8259 37 * 6 - cascade i8259
38 * 7 - CP0 counter (unused) 38 * 7 - CP0 counter
39 */ 39 */
40#define MIPS_CPU_IRQ_BASE 16 40#define MIPS_CPU_IRQ_BASE 16
41 41
@@ -48,7 +48,6 @@
48#define SCSI_IRQ (MIPS_CPU_IRQ_BASE + 5) 48#define SCSI_IRQ (MIPS_CPU_IRQ_BASE + 5)
49#define I8259_CASCADE_IRQ (MIPS_CPU_IRQ_BASE + 6) 49#define I8259_CASCADE_IRQ (MIPS_CPU_IRQ_BASE + 6)
50 50
51
52#define GT641XX_IRQ_BASE 24 51#define GT641XX_IRQ_BASE 24
53 52
54#include <asm/irq_gt641xx.h> 53#include <asm/irq_gt641xx.h>
diff --git a/include/asm-mips/mach-generic/timex.h b/include/asm-mips/mach-generic/timex.h
deleted file mode 100644
index 48b4cfaa0d50..000000000000
--- a/include/asm-mips/mach-generic/timex.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2005 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_TIMEX_H
9#define __ASM_MACH_GENERIC_TIMEX_H
10
11#define CLOCK_TICK_RATE 500000
12
13#endif /* __ASM_MACH_GENERIC_TIMEX_H */
diff --git a/include/asm-mips/mach-jazz/timex.h b/include/asm-mips/mach-jazz/timex.h
deleted file mode 100644
index 93affa33dfa8..000000000000
--- a/include/asm-mips/mach-jazz/timex.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_JAZZ_TIMEX_H
9#define __ASM_MACH_JAZZ_TIMEX_H
10
11/*
12 * Jazz is still using the R4030 100Hz counter
13 */
14#define CLOCK_TICK_RATE 100
15
16#endif /* __ASM_MACH_JAZZ_TIMEX_H */
diff --git a/include/asm-mips/mach-qemu/timex.h b/include/asm-mips/mach-qemu/timex.h
deleted file mode 100644
index cd543693fb0a..000000000000
--- a/include/asm-mips/mach-qemu/timex.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 Daniel Jacobowitz
7 */
8#ifndef __ASM_MACH_QEMU_TIMEX_H
9#define __ASM_MACH_QEMU_TIMEX_H
10
11/*
12 * We use a simulated i8254 PIC...
13 */
14#define CLOCK_TICK_RATE 1193182
15
16#endif /* __ASM_MACH_QEMU_TIMEX_H */
diff --git a/include/asm-mips/mach-rm/timex.h b/include/asm-mips/mach-rm/timex.h
deleted file mode 100644
index 11ff6cb0f214..000000000000
--- a/include/asm-mips/mach-rm/timex.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2005 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_RM200_TIMEX_H
9#define __ASM_MACH_RM200_TIMEX_H
10
11#define CLOCK_TICK_RATE 1193182
12
13#endif /* __ASM_MACH_RM200_TIMEX_H */
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index bc47af313bcd..ee1663e64da1 100644
--- a/include/asm-mips/time.h
+++ b/include/asm-mips/time.h
@@ -10,15 +10,10 @@
10 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version. 12 * option) any later version.
13 *
14 * Please refer to Documentation/mips/time.README.
15 */ 13 */
16#ifndef _ASM_TIME_H 14#ifndef _ASM_TIME_H
17#define _ASM_TIME_H 15#define _ASM_TIME_H
18 16
19#include <linux/interrupt.h>
20#include <linux/linkage.h>
21#include <linux/ptrace.h>
22#include <linux/rtc.h> 17#include <linux/rtc.h>
23#include <linux/spinlock.h> 18#include <linux/spinlock.h>
24#include <linux/clockchips.h> 19#include <linux/clockchips.h>
@@ -38,27 +33,13 @@ extern int rtc_mips_set_mmss(unsigned long);
38/* 33/*
39 * Timer interrupt functions. 34 * Timer interrupt functions.
40 * mips_timer_state is needed for high precision timer calibration. 35 * mips_timer_state is needed for high precision timer calibration.
41 * mips_timer_ack may be NULL if the interrupt is self-recoverable.
42 */ 36 */
43extern int (*mips_timer_state)(void); 37extern int (*mips_timer_state)(void);
44 38
45/* 39/*
46 * High precision timer clocksource.
47 * If .read is NULL, an R4k-compatible timer setup is attempted.
48 */
49extern struct clocksource clocksource_mips;
50
51/*
52 * profiling and process accouting is done separately in local_timer_interrupt
53 */
54extern void local_timer_interrupt(int irq, void *dev_id);
55
56/*
57 * board specific routines required by time_init(). 40 * board specific routines required by time_init().
58 */ 41 */
59struct irqaction;
60extern void plat_time_init(void); 42extern void plat_time_init(void);
61extern void plat_timer_setup(struct irqaction *irq);
62 43
63/* 44/*
64 * mips_hpt_frequency - must be set if you intend to use an R4k-compatible 45 * mips_hpt_frequency - must be set if you intend to use an R4k-compatible
@@ -78,6 +59,7 @@ extern int (*perf_irq)(void);
78 */ 59 */
79#ifdef CONFIG_CEVT_R4K 60#ifdef CONFIG_CEVT_R4K
80extern void mips_clockevent_init(void); 61extern void mips_clockevent_init(void);
62extern unsigned int __weak get_c0_compare_int(void);
81#else 63#else
82static inline void mips_clockevent_init(void) 64static inline void mips_clockevent_init(void)
83{ 65{
diff --git a/include/asm-mips/timex.h b/include/asm-mips/timex.h
index 87c68ae76ff8..5816ad1569d6 100644
--- a/include/asm-mips/timex.h
+++ b/include/asm-mips/timex.h
@@ -13,27 +13,12 @@
13#include <asm/mipsregs.h> 13#include <asm/mipsregs.h>
14 14
15/* 15/*
16 * This is the frequency of the timer used for Linux's timer interrupt. 16 * This is the clock rate of the i8253 PIT. A MIPS system may not have
17 * The value should be defined as accurate as possible or under certain 17 * a PIT by the symbol is used all over the kernel including some APIs.
18 * circumstances Linux timekeeping might become inaccurate or fail. 18 * So keeping it defined to the number for the PIT is the only sane thing
19 * 19 * for now.
20 * For many system the exact clockrate of the timer isn't known but due to
21 * the way this value is used we can get away with a wrong value as long
22 * as this value is:
23 *
24 * - a multiple of HZ
25 * - a divisor of the actual rate
26 *
27 * 500000 is a good such cheat value.
28 *
29 * The obscure number 1193182 is the same as used by the original i8254
30 * time in legacy PC hardware; the chip unfortunately also found in a
31 * bunch of MIPS systems. The last remaining user of the i8254 for the
32 * timer interrupt is the RM200; it's a very standard system so there is
33 * no reason to make this a separate architecture.
34 */ 20 */
35 21#define CLOCK_TICK_RATE 1193182
36#include <timex.h>
37 22
38/* 23/*
39 * Standard way to access the cycle counter. 24 * Standard way to access the cycle counter.
diff --git a/include/asm-mips/tx4927/tx4927_pci.h b/include/asm-mips/tx4927/tx4927_pci.h
index f98b2bb719d5..3f1e470192e3 100644
--- a/include/asm-mips/tx4927/tx4927_pci.h
+++ b/include/asm-mips/tx4927/tx4927_pci.h
@@ -9,6 +9,7 @@
9#define __ASM_TX4927_TX4927_PCI_H 9#define __ASM_TX4927_TX4927_PCI_H
10 10
11#define TX4927_CCFG_TOE 0x00004000 11#define TX4927_CCFG_TOE 0x00004000
12#define TX4927_CCFG_TINTDIS 0x01000000
12 13
13#define TX4927_PCIMEM 0x08000000 14#define TX4927_PCIMEM 0x08000000
14#define TX4927_PCIMEM_SIZE 0x08000000 15#define TX4927_PCIMEM_SIZE 0x08000000
@@ -20,6 +21,8 @@
20#define TX4927_PCIC_REG 0xff1fd000 21#define TX4927_PCIC_REG 0xff1fd000
21#define TX4927_CCFG_REG 0xff1fe000 22#define TX4927_CCFG_REG 0xff1fe000
22#define TX4927_IRC_REG 0xff1ff600 23#define TX4927_IRC_REG 0xff1ff600
24#define TX4927_NR_TMR 3
25#define TX4927_TMR_REG(ch) (0xff1ff000 + (ch) * 0x100)
23#define TX4927_CE3 0x17f00000 /* 1M */ 26#define TX4927_CE3 0x17f00000 /* 1M */
24#define TX4927_PCIRESET_ADDR 0xbc00f006 27#define TX4927_PCIRESET_ADDR 0xbc00f006
25#define TX4927_PCI_CLK_ADDR (KSEG1 + TX4927_CE3 + 0x00040020) 28#define TX4927_PCI_CLK_ADDR (KSEG1 + TX4927_CE3 + 0x00040020)
diff --git a/include/asm-mips/tx4938/tx4938.h b/include/asm-mips/tx4938/tx4938.h
index 650b010761f9..f7c448b90578 100644
--- a/include/asm-mips/tx4938/tx4938.h
+++ b/include/asm-mips/tx4938/tx4938.h
@@ -641,7 +641,6 @@ struct tx4938_ccfg_reg {
641#define tx4938_pcicptr ((struct tx4938_pcic_reg *)TX4938_PCIC_REG) 641#define tx4938_pcicptr ((struct tx4938_pcic_reg *)TX4938_PCIC_REG)
642#define tx4938_pcic1ptr ((struct tx4938_pcic_reg *)TX4938_PCIC1_REG) 642#define tx4938_pcic1ptr ((struct tx4938_pcic_reg *)TX4938_PCIC1_REG)
643#define tx4938_ccfgptr ((struct tx4938_ccfg_reg *)TX4938_CCFG_REG) 643#define tx4938_ccfgptr ((struct tx4938_ccfg_reg *)TX4938_CCFG_REG)
644#define tx4938_tmrptr(ch) ((struct tx4938_tmr_reg *)TX4938_TMR_REG(ch))
645#define tx4938_sioptr(ch) ((struct tx4938_sio_reg *)TX4938_SIO_REG(ch)) 644#define tx4938_sioptr(ch) ((struct tx4938_sio_reg *)TX4938_SIO_REG(ch))
646#define tx4938_pioptr ((struct tx4938_pio_reg *)TX4938_PIO_REG) 645#define tx4938_pioptr ((struct tx4938_pio_reg *)TX4938_PIO_REG)
647#define tx4938_aclcptr ((struct tx4938_aclc_reg *)TX4938_ACLC_REG) 646#define tx4938_aclcptr ((struct tx4938_aclc_reg *)TX4938_ACLC_REG)
diff --git a/include/asm-mips/txx9tmr.h b/include/asm-mips/txx9tmr.h
new file mode 100644
index 000000000000..67f70a8f09bd
--- /dev/null
+++ b/include/asm-mips/txx9tmr.h
@@ -0,0 +1,67 @@
1/*
2 * include/asm-mips/txx9tmr.h
3 * TX39/TX49 timer controller definitions.
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9#ifndef __ASM_TXX9TMR_H
10#define __ASM_TXX9TMR_H
11
12#include <linux/types.h>
13
14struct txx9_tmr_reg {
15 u32 tcr;
16 u32 tisr;
17 u32 cpra;
18 u32 cprb;
19 u32 itmr;
20 u32 unused0[3];
21 u32 ccdr;
22 u32 unused1[3];
23 u32 pgmr;
24 u32 unused2[3];
25 u32 wtmr;
26 u32 unused3[43];
27 u32 trr;
28};
29
30/* TMTCR : Timer Control */
31#define TXx9_TMTCR_TCE 0x00000080
32#define TXx9_TMTCR_CCDE 0x00000040
33#define TXx9_TMTCR_CRE 0x00000020
34#define TXx9_TMTCR_ECES 0x00000008
35#define TXx9_TMTCR_CCS 0x00000004
36#define TXx9_TMTCR_TMODE_MASK 0x00000003
37#define TXx9_TMTCR_TMODE_ITVL 0x00000000
38#define TXx9_TMTCR_TMODE_PGEN 0x00000001
39#define TXx9_TMTCR_TMODE_WDOG 0x00000002
40
41/* TMTISR : Timer Int. Status */
42#define TXx9_TMTISR_TPIBS 0x00000004
43#define TXx9_TMTISR_TPIAS 0x00000002
44#define TXx9_TMTISR_TIIS 0x00000001
45
46/* TMITMR : Interval Timer Mode */
47#define TXx9_TMITMR_TIIE 0x00008000
48#define TXx9_TMITMR_TZCE 0x00000001
49
50/* TMWTMR : Watchdog Timer Mode */
51#define TXx9_TMWTMR_TWIE 0x00008000
52#define TXx9_TMWTMR_WDIS 0x00000080
53#define TXx9_TMWTMR_TWC 0x00000001
54
55void txx9_clocksource_init(unsigned long baseaddr,
56 unsigned int imbusclk);
57void txx9_clockevent_init(unsigned long baseaddr, int irq,
58 unsigned int imbusclk);
59void txx9_tmr_init(unsigned long baseaddr);
60
61#ifdef CONFIG_CPU_TX39XX
62#define TXX9_TIMER_BITS 24
63#else
64#define TXX9_TIMER_BITS 32
65#endif
66
67#endif /* __ASM_TXX9TMR_H */
diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h
index 7a18649d1ccb..01e5cf51ba9b 100644
--- a/include/asm-sh/cache.h
+++ b/include/asm-sh/cache.h
@@ -18,9 +18,8 @@
18#define SH_CACHE_ASSOC 8 18#define SH_CACHE_ASSOC 8
19 19
20#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 20#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
21#define SMP_CACHE_BYTES L1_CACHE_BYTES
22 21
23#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) 22#define __read_mostly __attribute__((__section__(".data.read_mostly")))
24 23
25#ifndef __ASSEMBLY__ 24#ifndef __ASSEMBLY__
26struct cache_info { 25struct cache_info {
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
index c61d902b8bff..11850f65c922 100644
--- a/include/asm-sh/irq.h
+++ b/include/asm-sh/irq.h
@@ -41,7 +41,7 @@ static inline int generic_irq_demux(int irq)
41#define irq_canonicalize(irq) (irq) 41#define irq_canonicalize(irq) (irq)
42#define irq_demux(irq) sh_mv.mv_irq_demux(irq) 42#define irq_demux(irq) sh_mv.mv_irq_demux(irq)
43 43
44#ifdef CONFIG_4KSTACKS 44#ifdef CONFIG_IRQSTACKS
45extern void irq_ctx_init(int cpu); 45extern void irq_ctx_init(int cpu);
46extern void irq_ctx_exit(int cpu); 46extern void irq_ctx_exit(int cpu);
47# define __ARCH_HAS_DO_SOFTIRQ 47# define __ARCH_HAS_DO_SOFTIRQ
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index cb3d46c59eab..3aa8b07da47d 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -128,7 +128,6 @@ typedef struct { unsigned long pgd; } pgd_t;
128#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 128#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
129#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 129#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
130 130
131#define phys_to_page(phys) (pfn_to_page(phys >> PAGE_SHIFT))
132#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 131#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
133 132
134/* PFN start number, because of __MEMORY_START */ 133/* PFN start number, because of __MEMORY_START */
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index cf0dd2b648c2..0b1d7c665659 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -399,7 +399,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
399#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK) 399#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
400 400
401#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) 401#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
402#define pte_page(x) phys_to_page(pte_val(x)&PTE_PHYS_MASK) 402#define pte_page(x) pfn_to_page(pte_pfn(x))
403 403
404/* 404/*
405 * The following only work if pte_present() is true. 405 * The following only work if pte_present() is true.
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
index 4f2922a1979c..ab0028db645a 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -71,7 +71,7 @@ struct sh_cpuinfo {
71 struct cache_info scache; /* Secondary cache */ 71 struct cache_info scache; /* Secondary cache */
72 72
73 unsigned long flags; 73 unsigned long flags;
74} __attribute__ ((aligned(SMP_CACHE_BYTES))); 74} __attribute__ ((aligned(L1_CACHE_BYTES)));
75 75
76extern struct sh_cpuinfo cpu_data[]; 76extern struct sh_cpuinfo cpu_data[];
77#define boot_cpu_data cpu_data[0] 77#define boot_cpu_data cpu_data[0]
diff --git a/include/asm-sh/setup.h b/include/asm-sh/setup.h
index 586a9711a75d..55a2bd328d99 100644
--- a/include/asm-sh/setup.h
+++ b/include/asm-sh/setup.h
@@ -5,6 +5,20 @@
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7 7
8/*
9 * This is set up by the setup-routine at boot-time
10 */
11#define PARAM ((unsigned char *)empty_zero_page)
12
13#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000))
14#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004))
15#define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008))
16#define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c))
17#define INITRD_START (*(unsigned long *) (PARAM+0x010))
18#define INITRD_SIZE (*(unsigned long *) (PARAM+0x014))
19/* ... */
20#define COMMAND_LINE ((char *) (PARAM+0x100))
21
8int setup_early_printk(char *); 22int setup_early_printk(char *);
9void sh_mv_setup(void); 23void sh_mv_setup(void);
10 24
diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h
index 1438b763a5ea..18f8dd642ac5 100644
--- a/include/asm-sh64/dma-mapping.h
+++ b/include/asm-sh64/dma-mapping.h
@@ -42,8 +42,9 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
42static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 42static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
43 enum dma_data_direction dir) 43 enum dma_data_direction dir)
44{ 44{
45 unsigned long s = (unsigned long) vaddr & L1_CACHE_ALIGN_MASK; 45 unsigned long start = (unsigned long) vaddr;
46 unsigned long e = (vaddr + size) & L1_CACHE_ALIGN_MASK; 46 unsigned long s = start & L1_CACHE_ALIGN_MASK;
47 unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
47 48
48 for (; s <= e; s += L1_CACHE_BYTES) 49 for (; s <= e; s += L1_CACHE_BYTES)
49 asm volatile ("ocbp %0, 0" : : "r" (s)); 50 asm volatile ("ocbp %0, 0" : : "r" (s));
diff --git a/include/asm-sh64/pci.h b/include/asm-sh64/pci.h
index 57a67cf7a5c4..18055dbbb4b5 100644
--- a/include/asm-sh64/pci.h
+++ b/include/asm-sh64/pci.h
@@ -72,15 +72,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
72#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 72#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
73#endif 73#endif
74 74
75/* These macros should be used after a pci_map_sg call has been done
76 * to get bus addresses of each of the SG entries and their lengths.
77 * You should only work with the number of sg entries pci_map_sg
78 * returns, or alternatively stop on the first sg_dma_len(sg) which
79 * is 0.
80 */
81#define sg_dma_address(sg) ((sg)->dma_address)
82#define sg_dma_len(sg) ((sg)->length)
83
84#ifdef CONFIG_PCI 75#ifdef CONFIG_PCI
85static inline void pci_dma_burst_advice(struct pci_dev *pdev, 76static inline void pci_dma_burst_advice(struct pci_dev *pdev,
86 enum pci_dma_burst_strategy *strat, 77 enum pci_dma_burst_strategy *strat,
diff --git a/include/asm-sh64/scatterlist.h b/include/asm-sh64/scatterlist.h
index 5109251970e7..7f729bbfce43 100644
--- a/include/asm-sh64/scatterlist.h
+++ b/include/asm-sh64/scatterlist.h
@@ -23,6 +23,15 @@ struct scatterlist {
23 unsigned int length; 23 unsigned int length;
24}; 24};
25 25
26/* These macros should be used after a pci_map_sg call has been done
27 * to get bus addresses of each of the SG entries and their lengths.
28 * You should only work with the number of sg entries pci_map_sg
29 * returns, or alternatively stop on the first sg_dma_len(sg) which
30 * is 0.
31 */
32#define sg_dma_address(sg) ((sg)->dma_address)
33#define sg_dma_len(sg) ((sg)->length)
34
26#define ISA_DMA_THRESHOLD (0xffffffff) 35#define ISA_DMA_THRESHOLD (0xffffffff)
27 36
28#endif /* !__ASM_SH64_SCATTERLIST_H */ 37#endif /* !__ASM_SH64_SCATTERLIST_H */
diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h
index bdca5416d8b0..3328950dbfe6 100644
--- a/include/asm-sparc/atomic.h
+++ b/include/asm-sparc/atomic.h
@@ -1,6 +1,6 @@
1/* atomic.h: These still suck, but the I-cache hit rate is higher. 1/* atomic.h: These still suck, but the I-cache hit rate is higher.
2 * 2 *
3 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
4 * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com.au) 4 * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com.au)
5 * Copyright (C) 2007 Kyle McMartin (kyle@parisc-linux.org) 5 * Copyright (C) 2007 Kyle McMartin (kyle@parisc-linux.org)
6 * 6 *
@@ -33,7 +33,7 @@ extern void __cmpxchg_called_with_bad_pointer(void);
33extern unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); 33extern unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_);
34 34
35/* don't worry...optimizer will get rid of most of this */ 35/* don't worry...optimizer will get rid of most of this */
36static __inline__ unsigned long 36static inline unsigned long
37__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) 37__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
38{ 38{
39 switch(size) { 39 switch(size) {
diff --git a/include/asm-sparc/dma.h b/include/asm-sparc/dma.h
index 407b3614468a..959d6c8a71ae 100644
--- a/include/asm-sparc/dma.h
+++ b/include/asm-sparc/dma.h
@@ -1,7 +1,6 @@
1/* $Id: dma.h,v 1.35 1999/12/27 06:37:09 anton Exp $ 1/* include/asm-sparc/dma.h
2 * include/asm-sparc/dma.h
3 * 2 *
4 * Copyright 1995 (C) David S. Miller (davem@caip.rutgers.edu) 3 * Copyright 1995 (C) David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#ifndef _ASM_SPARC_DMA_H 6#ifndef _ASM_SPARC_DMA_H
@@ -21,14 +20,14 @@
21struct page; 20struct page;
22extern spinlock_t dma_spin_lock; 21extern spinlock_t dma_spin_lock;
23 22
24static __inline__ unsigned long claim_dma_lock(void) 23static inline unsigned long claim_dma_lock(void)
25{ 24{
26 unsigned long flags; 25 unsigned long flags;
27 spin_lock_irqsave(&dma_spin_lock, flags); 26 spin_lock_irqsave(&dma_spin_lock, flags);
28 return flags; 27 return flags;
29} 28}
30 29
31static __inline__ void release_dma_lock(unsigned long flags) 30static inline void release_dma_lock(unsigned long flags)
32{ 31{
33 spin_unlock_irqrestore(&dma_spin_lock, flags); 32 spin_unlock_irqrestore(&dma_spin_lock, flags);
34} 33}
diff --git a/include/asm-sparc/floppy.h b/include/asm-sparc/floppy.h
index 5da1eef0f706..dbe7a586be5b 100644
--- a/include/asm-sparc/floppy.h
+++ b/include/asm-sparc/floppy.h
@@ -1,6 +1,6 @@
1/* asm-sparc/floppy.h: Sparc specific parts of the Floppy driver. 1/* asm-sparc/floppy.h: Sparc specific parts of the Floppy driver.
2 * 2 *
3 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
4 */ 4 */
5 5
6#ifndef __ASM_SPARC_FLOPPY_H 6#ifndef __ASM_SPARC_FLOPPY_H
@@ -232,12 +232,12 @@ extern char *pdma_base;
232extern unsigned long pdma_areasize; 232extern unsigned long pdma_areasize;
233 233
234/* Common routines to all controller types on the Sparc. */ 234/* Common routines to all controller types on the Sparc. */
235static __inline__ void virtual_dma_init(void) 235static inline void virtual_dma_init(void)
236{ 236{
237 /* nothing... */ 237 /* nothing... */
238} 238}
239 239
240static __inline__ void sun_fd_disable_dma(void) 240static inline void sun_fd_disable_dma(void)
241{ 241{
242 doing_pdma = 0; 242 doing_pdma = 0;
243 if (pdma_base) { 243 if (pdma_base) {
@@ -246,7 +246,7 @@ static __inline__ void sun_fd_disable_dma(void)
246 } 246 }
247} 247}
248 248
249static __inline__ void sun_fd_set_dma_mode(int mode) 249static inline void sun_fd_set_dma_mode(int mode)
250{ 250{
251 switch(mode) { 251 switch(mode) {
252 case DMA_MODE_READ: 252 case DMA_MODE_READ:
@@ -261,17 +261,17 @@ static __inline__ void sun_fd_set_dma_mode(int mode)
261 } 261 }
262} 262}
263 263
264static __inline__ void sun_fd_set_dma_addr(char *buffer) 264static inline void sun_fd_set_dma_addr(char *buffer)
265{ 265{
266 pdma_vaddr = buffer; 266 pdma_vaddr = buffer;
267} 267}
268 268
269static __inline__ void sun_fd_set_dma_count(int length) 269static inline void sun_fd_set_dma_count(int length)
270{ 270{
271 pdma_size = length; 271 pdma_size = length;
272} 272}
273 273
274static __inline__ void sun_fd_enable_dma(void) 274static inline void sun_fd_enable_dma(void)
275{ 275{
276 pdma_vaddr = mmu_lockarea(pdma_vaddr, pdma_size); 276 pdma_vaddr = mmu_lockarea(pdma_vaddr, pdma_size);
277 pdma_base = pdma_vaddr; 277 pdma_base = pdma_vaddr;
diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h
index 404022765fc7..4076cb5d1581 100644
--- a/include/asm-sparc/ide.h
+++ b/include/asm-sparc/ide.h
@@ -1,7 +1,6 @@
1/* $Id: ide.h,v 1.7 2002/01/16 20:58:40 davem Exp $ 1/* ide.h: SPARC PCI specific IDE glue.
2 * ide.h: SPARC PCI specific IDE glue.
3 * 2 *
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1997 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
6 * Adaptation from sparc64 version to sparc by Pete Zaitcev. 5 * Adaptation from sparc64 version to sparc by Pete Zaitcev.
7 */ 6 */
@@ -31,7 +30,7 @@
31#define __ide_mm_outsw __ide_outsw 30#define __ide_mm_outsw __ide_outsw
32#define __ide_mm_outsl __ide_outsl 31#define __ide_mm_outsl __ide_outsl
33 32
34static __inline__ void __ide_insw(unsigned long port, 33static inline void __ide_insw(unsigned long port,
35 void *dst, 34 void *dst,
36 unsigned long count) 35 unsigned long count)
37{ 36{
@@ -62,7 +61,7 @@ static __inline__ void __ide_insw(unsigned long port,
62 /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */ 61 /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */
63} 62}
64 63
65static __inline__ void __ide_outsw(unsigned long port, 64static inline void __ide_outsw(unsigned long port,
66 const void *src, 65 const void *src,
67 unsigned long count) 66 unsigned long count)
68{ 67{
diff --git a/include/asm-sparc/posix_types.h b/include/asm-sparc/posix_types.h
index 9ef1b3db4cbf..62c8fa7b36d4 100644
--- a/include/asm-sparc/posix_types.h
+++ b/include/asm-sparc/posix_types.h
@@ -49,7 +49,7 @@ typedef struct {
49#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) 49#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
50 50
51#undef __FD_SET 51#undef __FD_SET
52static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) 52static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
53{ 53{
54 unsigned long _tmp = fd / __NFDBITS; 54 unsigned long _tmp = fd / __NFDBITS;
55 unsigned long _rem = fd % __NFDBITS; 55 unsigned long _rem = fd % __NFDBITS;
@@ -57,7 +57,7 @@ static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
57} 57}
58 58
59#undef __FD_CLR 59#undef __FD_CLR
60static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) 60static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
61{ 61{
62 unsigned long _tmp = fd / __NFDBITS; 62 unsigned long _tmp = fd / __NFDBITS;
63 unsigned long _rem = fd % __NFDBITS; 63 unsigned long _rem = fd % __NFDBITS;
@@ -65,7 +65,7 @@ static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
65} 65}
66 66
67#undef __FD_ISSET 67#undef __FD_ISSET
68static __inline__ int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p) 68static inline int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
69{ 69{
70 unsigned long _tmp = fd / __NFDBITS; 70 unsigned long _tmp = fd / __NFDBITS;
71 unsigned long _rem = fd % __NFDBITS; 71 unsigned long _rem = fd % __NFDBITS;
@@ -77,7 +77,7 @@ static __inline__ int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
77 * for 256 and 1024-bit fd_sets respectively) 77 * for 256 and 1024-bit fd_sets respectively)
78 */ 78 */
79#undef __FD_ZERO 79#undef __FD_ZERO
80static __inline__ void __FD_ZERO(__kernel_fd_set *p) 80static inline void __FD_ZERO(__kernel_fd_set *p)
81{ 81{
82 unsigned long *tmp = p->fds_bits; 82 unsigned long *tmp = p->fds_bits;
83 int i; 83 int i;
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index 8c259de02614..2655d142b22d 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -1,5 +1,3 @@
1/* $Id: system.h,v 1.86 2001/10/30 04:57:10 davem Exp $ */
2
3#ifndef __SPARC_SYSTEM_H 1#ifndef __SPARC_SYSTEM_H
4#define __SPARC_SYSTEM_H 2#define __SPARC_SYSTEM_H
5 3
@@ -56,7 +54,7 @@ extern void sun_do_break(void);
56extern int serial_console; 54extern int serial_console;
57extern int stop_a_enabled; 55extern int stop_a_enabled;
58 56
59static __inline__ int con_is_present(void) 57static inline int con_is_present(void)
60{ 58{
61 return serial_console ? 0 : 1; 59 return serial_console ? 0 : 1;
62} 60}
@@ -217,7 +215,7 @@ static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned lon
217 215
218extern void __xchg_called_with_bad_pointer(void); 216extern void __xchg_called_with_bad_pointer(void);
219 217
220static __inline__ unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) 218static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size)
221{ 219{
222 switch (size) { 220 switch (size) {
223 case 4: 221 case 4:
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
index 3fb4e1f7f186..2c71ec4a3b18 100644
--- a/include/asm-sparc64/atomic.h
+++ b/include/asm-sparc64/atomic.h
@@ -1,5 +1,4 @@
1/* $Id: atomic.h,v 1.22 2001/07/11 23:56:07 davem Exp $ 1/* atomic.h: Thankfully the V9 is at least reasonable for this
2 * atomic.h: Thankfully the V9 is at least reasonable for this
3 * stuff. 2 * stuff.
4 * 3 *
5 * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com)
@@ -74,7 +73,7 @@ extern int atomic64_sub_ret(int, atomic64_t *);
74#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n))) 73#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
75#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 74#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
76 75
77static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 76static inline int atomic_add_unless(atomic_t *v, int a, int u)
78{ 77{
79 int c, old; 78 int c, old;
80 c = atomic_read(v); 79 c = atomic_read(v);
@@ -95,7 +94,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
95 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n))) 94 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
96#define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) 95#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
97 96
98static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) 97static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
99{ 98{
100 long c, old; 99 long c, old;
101 c = atomic64_read(v); 100 c = atomic64_read(v);
diff --git a/include/asm-sparc64/backoff.h b/include/asm-sparc64/backoff.h
index 0e32f8b62fd2..dadd6c385c6c 100644
--- a/include/asm-sparc64/backoff.h
+++ b/include/asm-sparc64/backoff.h
@@ -21,7 +21,9 @@
21#else 21#else
22 22
23#define BACKOFF_SETUP(reg) 23#define BACKOFF_SETUP(reg)
24#define BACKOFF_SPIN(reg, tmp, label) 24#define BACKOFF_SPIN(reg, tmp, label) \
25 ba,pt %xcc, label; \
26 nop;
25 27
26#endif 28#endif
27 29
diff --git a/include/asm-sparc64/byteorder.h b/include/asm-sparc64/byteorder.h
index c69b08af5fe0..3943022906fd 100644
--- a/include/asm-sparc64/byteorder.h
+++ b/include/asm-sparc64/byteorder.h
@@ -1,4 +1,3 @@
1/* $Id: byteorder.h,v 1.8 1997/12/18 02:44:14 ecd Exp $ */
2#ifndef _SPARC64_BYTEORDER_H 1#ifndef _SPARC64_BYTEORDER_H
3#define _SPARC64_BYTEORDER_H 2#define _SPARC64_BYTEORDER_H
4 3
@@ -7,7 +6,7 @@
7 6
8#ifdef __GNUC__ 7#ifdef __GNUC__
9 8
10static __inline__ __u16 ___arch__swab16p(const __u16 *addr) 9static inline __u16 ___arch__swab16p(const __u16 *addr)
11{ 10{
12 __u16 ret; 11 __u16 ret;
13 12
@@ -17,7 +16,7 @@ static __inline__ __u16 ___arch__swab16p(const __u16 *addr)
17 return ret; 16 return ret;
18} 17}
19 18
20static __inline__ __u32 ___arch__swab32p(const __u32 *addr) 19static inline __u32 ___arch__swab32p(const __u32 *addr)
21{ 20{
22 __u32 ret; 21 __u32 ret;
23 22
@@ -27,7 +26,7 @@ static __inline__ __u32 ___arch__swab32p(const __u32 *addr)
27 return ret; 26 return ret;
28} 27}
29 28
30static __inline__ __u64 ___arch__swab64p(const __u64 *addr) 29static inline __u64 ___arch__swab64p(const __u64 *addr)
31{ 30{
32 __u64 ret; 31 __u64 ret;
33 32
diff --git a/include/asm-sparc64/fpumacro.h b/include/asm-sparc64/fpumacro.h
index d583e5efd75d..cc463fec806f 100644
--- a/include/asm-sparc64/fpumacro.h
+++ b/include/asm-sparc64/fpumacro.h
@@ -16,7 +16,7 @@ struct fpustate {
16 16
17#define FPUSTATE (struct fpustate *)(current_thread_info()->fpregs) 17#define FPUSTATE (struct fpustate *)(current_thread_info()->fpregs)
18 18
19static __inline__ unsigned long fprs_read(void) 19static inline unsigned long fprs_read(void)
20{ 20{
21 unsigned long retval; 21 unsigned long retval;
22 22
@@ -25,7 +25,7 @@ static __inline__ unsigned long fprs_read(void)
25 return retval; 25 return retval;
26} 26}
27 27
28static __inline__ void fprs_write(unsigned long val) 28static inline void fprs_write(unsigned long val)
29{ 29{
30 __asm__ __volatile__("wr %0, 0x0, %%fprs" : : "r" (val)); 30 __asm__ __volatile__("wr %0, 0x0, %%fprs" : : "r" (val));
31} 31}
diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h
index 876312fe82cc..df1097d6ffbe 100644
--- a/include/asm-sparc64/futex.h
+++ b/include/asm-sparc64/futex.h
@@ -17,7 +17,8 @@
17 "3:\n" \ 17 "3:\n" \
18 " .section .fixup,#alloc,#execinstr\n" \ 18 " .section .fixup,#alloc,#execinstr\n" \
19 " .align 4\n" \ 19 " .align 4\n" \
20 "4: ba 3b\n" \ 20 "4: sethi %%hi(3b), %0\n" \
21 " jmpl %0 + %%lo(3b), %%g0\n" \
21 " mov %5, %0\n" \ 22 " mov %5, %0\n" \
22 " .previous\n" \ 23 " .previous\n" \
23 " .section __ex_table,\"a\"\n" \ 24 " .section __ex_table,\"a\"\n" \
@@ -91,7 +92,8 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
91 "2:\n" 92 "2:\n"
92 " .section .fixup,#alloc,#execinstr\n" 93 " .section .fixup,#alloc,#execinstr\n"
93 " .align 4\n" 94 " .align 4\n"
94 "3: ba 2b\n" 95 "3: sethi %%hi(2b), %0\n"
96 " jmpl %0 + %%lo(2b), %%g0\n"
95 " mov %4, %0\n" 97 " mov %4, %0\n"
96 " .previous\n" 98 " .previous\n"
97 " .section __ex_table,\"a\"\n" 99 " .section __ex_table,\"a\"\n"
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index cd7ef3097ac2..c299b853b5ba 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -1,4 +1,3 @@
1/* $Id: io.h,v 1.47 2001/12/13 10:36:02 davem Exp $ */
2#ifndef __SPARC64_IO_H 1#ifndef __SPARC64_IO_H
3#define __SPARC64_IO_H 2#define __SPARC64_IO_H
4 3
@@ -19,7 +18,7 @@ extern unsigned long kern_base, kern_size;
19#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 18#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
20#define BIO_VMERGE_BOUNDARY 8192 19#define BIO_VMERGE_BOUNDARY 8192
21 20
22static __inline__ u8 _inb(unsigned long addr) 21static inline u8 _inb(unsigned long addr)
23{ 22{
24 u8 ret; 23 u8 ret;
25 24
@@ -30,7 +29,7 @@ static __inline__ u8 _inb(unsigned long addr)
30 return ret; 29 return ret;
31} 30}
32 31
33static __inline__ u16 _inw(unsigned long addr) 32static inline u16 _inw(unsigned long addr)
34{ 33{
35 u16 ret; 34 u16 ret;
36 35
@@ -41,7 +40,7 @@ static __inline__ u16 _inw(unsigned long addr)
41 return ret; 40 return ret;
42} 41}
43 42
44static __inline__ u32 _inl(unsigned long addr) 43static inline u32 _inl(unsigned long addr)
45{ 44{
46 u32 ret; 45 u32 ret;
47 46
@@ -52,21 +51,21 @@ static __inline__ u32 _inl(unsigned long addr)
52 return ret; 51 return ret;
53} 52}
54 53
55static __inline__ void _outb(u8 b, unsigned long addr) 54static inline void _outb(u8 b, unsigned long addr)
56{ 55{
57 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_outb */" 56 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_outb */"
58 : /* no outputs */ 57 : /* no outputs */
59 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 58 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
60} 59}
61 60
62static __inline__ void _outw(u16 w, unsigned long addr) 61static inline void _outw(u16 w, unsigned long addr)
63{ 62{
64 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_outw */" 63 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_outw */"
65 : /* no outputs */ 64 : /* no outputs */
66 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); 65 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
67} 66}
68 67
69static __inline__ void _outl(u32 l, unsigned long addr) 68static inline void _outl(u32 l, unsigned long addr)
70{ 69{
71 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_outl */" 70 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_outl */"
72 : /* no outputs */ 71 : /* no outputs */
@@ -205,7 +204,7 @@ static inline void _writeq(u64 q, volatile void __iomem *addr)
205#define writeq(__q, __addr) _writeq(__q, __addr) 204#define writeq(__q, __addr) _writeq(__q, __addr)
206 205
207/* Now versions without byte-swapping. */ 206/* Now versions without byte-swapping. */
208static __inline__ u8 _raw_readb(unsigned long addr) 207static inline u8 _raw_readb(unsigned long addr)
209{ 208{
210 u8 ret; 209 u8 ret;
211 210
@@ -216,7 +215,7 @@ static __inline__ u8 _raw_readb(unsigned long addr)
216 return ret; 215 return ret;
217} 216}
218 217
219static __inline__ u16 _raw_readw(unsigned long addr) 218static inline u16 _raw_readw(unsigned long addr)
220{ 219{
221 u16 ret; 220 u16 ret;
222 221
@@ -227,7 +226,7 @@ static __inline__ u16 _raw_readw(unsigned long addr)
227 return ret; 226 return ret;
228} 227}
229 228
230static __inline__ u32 _raw_readl(unsigned long addr) 229static inline u32 _raw_readl(unsigned long addr)
231{ 230{
232 u32 ret; 231 u32 ret;
233 232
@@ -238,7 +237,7 @@ static __inline__ u32 _raw_readl(unsigned long addr)
238 return ret; 237 return ret;
239} 238}
240 239
241static __inline__ u64 _raw_readq(unsigned long addr) 240static inline u64 _raw_readq(unsigned long addr)
242{ 241{
243 u64 ret; 242 u64 ret;
244 243
@@ -249,28 +248,28 @@ static __inline__ u64 _raw_readq(unsigned long addr)
249 return ret; 248 return ret;
250} 249}
251 250
252static __inline__ void _raw_writeb(u8 b, unsigned long addr) 251static inline void _raw_writeb(u8 b, unsigned long addr)
253{ 252{
254 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_raw_writeb */" 253 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_raw_writeb */"
255 : /* no outputs */ 254 : /* no outputs */
256 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 255 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
257} 256}
258 257
259static __inline__ void _raw_writew(u16 w, unsigned long addr) 258static inline void _raw_writew(u16 w, unsigned long addr)
260{ 259{
261 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_raw_writew */" 260 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_raw_writew */"
262 : /* no outputs */ 261 : /* no outputs */
263 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 262 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
264} 263}
265 264
266static __inline__ void _raw_writel(u32 l, unsigned long addr) 265static inline void _raw_writel(u32 l, unsigned long addr)
267{ 266{
268 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_raw_writel */" 267 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_raw_writel */"
269 : /* no outputs */ 268 : /* no outputs */
270 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 269 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
271} 270}
272 271
273static __inline__ void _raw_writeq(u64 q, unsigned long addr) 272static inline void _raw_writeq(u64 q, unsigned long addr)
274{ 273{
275 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_raw_writeq */" 274 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_raw_writeq */"
276 : /* no outputs */ 275 : /* no outputs */
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
index 182dba05c702..30cb76b47be1 100644
--- a/include/asm-sparc64/irq.h
+++ b/include/asm-sparc64/irq.h
@@ -1,7 +1,6 @@
1/* $Id: irq.h,v 1.21 2002/01/23 11:27:36 davem Exp $ 1/* irq.h: IRQ registers on the 64-bit Sparc.
2 * irq.h: IRQ registers on the 64-bit Sparc.
3 * 2 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz) 4 * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
6 */ 5 */
7 6
@@ -67,21 +66,21 @@ extern void virt_irq_free(unsigned int virt_irq);
67 66
68extern void fixup_irqs(void); 67extern void fixup_irqs(void);
69 68
70static __inline__ void set_softint(unsigned long bits) 69static inline void set_softint(unsigned long bits)
71{ 70{
72 __asm__ __volatile__("wr %0, 0x0, %%set_softint" 71 __asm__ __volatile__("wr %0, 0x0, %%set_softint"
73 : /* No outputs */ 72 : /* No outputs */
74 : "r" (bits)); 73 : "r" (bits));
75} 74}
76 75
77static __inline__ void clear_softint(unsigned long bits) 76static inline void clear_softint(unsigned long bits)
78{ 77{
79 __asm__ __volatile__("wr %0, 0x0, %%clear_softint" 78 __asm__ __volatile__("wr %0, 0x0, %%clear_softint"
80 : /* No outputs */ 79 : /* No outputs */
81 : "r" (bits)); 80 : "r" (bits));
82} 81}
83 82
84static __inline__ unsigned long get_softint(void) 83static inline unsigned long get_softint(void)
85{ 84{
86 unsigned long retval; 85 unsigned long retval;
87 86
diff --git a/include/asm-sparc64/mostek.h b/include/asm-sparc64/mostek.h
index d14dd8988161..c5652de2ace2 100644
--- a/include/asm-sparc64/mostek.h
+++ b/include/asm-sparc64/mostek.h
@@ -1,7 +1,6 @@
1/* $Id: mostek.h,v 1.4 2001/01/11 15:07:09 davem Exp $ 1/* mostek.h: Describes the various Mostek time of day clock registers.
2 * mostek.h: Describes the various Mostek time of day clock registers.
3 * 2 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) 4 * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu)
6 */ 5 */
7 6
@@ -38,7 +37,7 @@
38 * 37 *
39 * We now deal with physical addresses for I/O to the chip. -DaveM 38 * We now deal with physical addresses for I/O to the chip. -DaveM
40 */ 39 */
41static __inline__ u8 mostek_read(void __iomem *addr) 40static inline u8 mostek_read(void __iomem *addr)
42{ 41{
43 u8 ret; 42 u8 ret;
44 43
@@ -48,7 +47,7 @@ static __inline__ u8 mostek_read(void __iomem *addr)
48 return ret; 47 return ret;
49} 48}
50 49
51static __inline__ void mostek_write(void __iomem *addr, u8 val) 50static inline void mostek_write(void __iomem *addr, u8 val)
52{ 51{
53 __asm__ __volatile__("stba %0, [%1] %2" 52 __asm__ __volatile__("stba %0, [%1] %2"
54 : /* no outputs */ 53 : /* no outputs */
diff --git a/include/asm-sparc64/ns87303.h b/include/asm-sparc64/ns87303.h
index 6d58fdf349b5..686defe6aaa0 100644
--- a/include/asm-sparc64/ns87303.h
+++ b/include/asm-sparc64/ns87303.h
@@ -1,5 +1,4 @@
1/* $Id: ns87303.h,v 1.3 2000/01/09 15:16:34 ecd Exp $ 1/* ns87303.h: Configuration Register Description for the
2 * ns87303.h: Configuration Register Description for the
3 * National Semiconductor PC87303 (SuperIO). 2 * National Semiconductor PC87303 (SuperIO).
4 * 3 *
5 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
@@ -85,7 +84,7 @@
85 84
86extern spinlock_t ns87303_lock; 85extern spinlock_t ns87303_lock;
87 86
88static __inline__ int ns87303_modify(unsigned long port, unsigned int index, 87static inline int ns87303_modify(unsigned long port, unsigned int index,
89 unsigned char clr, unsigned char set) 88 unsigned char clr, unsigned char set)
90{ 89{
91 static unsigned char reserved[] = { 90 static unsigned char reserved[] = {
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index 8116e8f6062c..e9555b246c8d 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -1,5 +1,4 @@
1/* $Id: parport.h,v 1.11 2001/05/11 07:54:24 davem Exp $ 1/* parport.h: sparc64 specific parport initialization and dma.
2 * parport.h: sparc64 specific parport initialization and dma.
3 * 2 *
4 * Copyright (C) 1999 Eddie C. Dost (ecd@skynet.be) 3 * Copyright (C) 1999 Eddie C. Dost (ecd@skynet.be)
5 */ 4 */
@@ -42,7 +41,7 @@ static struct sparc_ebus_info {
42 41
43static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS); 42static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS);
44 43
45static __inline__ int request_dma(unsigned int dmanr, const char *device_id) 44static inline int request_dma(unsigned int dmanr, const char *device_id)
46{ 45{
47 if (dmanr >= PARPORT_PC_MAX_PORTS) 46 if (dmanr >= PARPORT_PC_MAX_PORTS)
48 return -EINVAL; 47 return -EINVAL;
@@ -51,7 +50,7 @@ static __inline__ int request_dma(unsigned int dmanr, const char *device_id)
51 return 0; 50 return 0;
52} 51}
53 52
54static __inline__ void free_dma(unsigned int dmanr) 53static inline void free_dma(unsigned int dmanr)
55{ 54{
56 if (dmanr >= PARPORT_PC_MAX_PORTS) { 55 if (dmanr >= PARPORT_PC_MAX_PORTS) {
57 printk(KERN_WARNING "Trying to free DMA%d\n", dmanr); 56 printk(KERN_WARNING "Trying to free DMA%d\n", dmanr);
@@ -63,7 +62,7 @@ static __inline__ void free_dma(unsigned int dmanr)
63 } 62 }
64} 63}
65 64
66static __inline__ void enable_dma(unsigned int dmanr) 65static inline void enable_dma(unsigned int dmanr)
67{ 66{
68 ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1); 67 ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1);
69 68
@@ -73,32 +72,32 @@ static __inline__ void enable_dma(unsigned int dmanr)
73 BUG(); 72 BUG();
74} 73}
75 74
76static __inline__ void disable_dma(unsigned int dmanr) 75static inline void disable_dma(unsigned int dmanr)
77{ 76{
78 ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 0); 77 ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 0);
79} 78}
80 79
81static __inline__ void clear_dma_ff(unsigned int dmanr) 80static inline void clear_dma_ff(unsigned int dmanr)
82{ 81{
83 /* nothing */ 82 /* nothing */
84} 83}
85 84
86static __inline__ void set_dma_mode(unsigned int dmanr, char mode) 85static inline void set_dma_mode(unsigned int dmanr, char mode)
87{ 86{
88 ebus_dma_prepare(&sparc_ebus_dmas[dmanr].info, (mode != DMA_MODE_WRITE)); 87 ebus_dma_prepare(&sparc_ebus_dmas[dmanr].info, (mode != DMA_MODE_WRITE));
89} 88}
90 89
91static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int addr) 90static inline void set_dma_addr(unsigned int dmanr, unsigned int addr)
92{ 91{
93 sparc_ebus_dmas[dmanr].addr = addr; 92 sparc_ebus_dmas[dmanr].addr = addr;
94} 93}
95 94
96static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) 95static inline void set_dma_count(unsigned int dmanr, unsigned int count)
97{ 96{
98 sparc_ebus_dmas[dmanr].count = count; 97 sparc_ebus_dmas[dmanr].count = count;
99} 98}
100 99
101static __inline__ unsigned int get_dma_residue(unsigned int dmanr) 100static inline unsigned int get_dma_residue(unsigned int dmanr)
102{ 101{
103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); 102 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
104} 103}
diff --git a/include/asm-sparc64/posix_types.h b/include/asm-sparc64/posix_types.h
index c86b9452c683..3426a65ecd35 100644
--- a/include/asm-sparc64/posix_types.h
+++ b/include/asm-sparc64/posix_types.h
@@ -53,7 +53,7 @@ typedef struct {
53#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) 53#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
54 54
55#undef __FD_SET 55#undef __FD_SET
56static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) 56static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
57{ 57{
58 unsigned long _tmp = fd / __NFDBITS; 58 unsigned long _tmp = fd / __NFDBITS;
59 unsigned long _rem = fd % __NFDBITS; 59 unsigned long _rem = fd % __NFDBITS;
@@ -61,7 +61,7 @@ static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
61} 61}
62 62
63#undef __FD_CLR 63#undef __FD_CLR
64static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) 64static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
65{ 65{
66 unsigned long _tmp = fd / __NFDBITS; 66 unsigned long _tmp = fd / __NFDBITS;
67 unsigned long _rem = fd % __NFDBITS; 67 unsigned long _rem = fd % __NFDBITS;
@@ -69,7 +69,7 @@ static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
69} 69}
70 70
71#undef __FD_ISSET 71#undef __FD_ISSET
72static __inline__ int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p) 72static inline int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
73{ 73{
74 unsigned long _tmp = fd / __NFDBITS; 74 unsigned long _tmp = fd / __NFDBITS;
75 unsigned long _rem = fd % __NFDBITS; 75 unsigned long _rem = fd % __NFDBITS;
@@ -81,7 +81,7 @@ static __inline__ int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
81 * for 256 and 1024-bit fd_sets respectively) 81 * for 256 and 1024-bit fd_sets respectively)
82 */ 82 */
83#undef __FD_ZERO 83#undef __FD_ZERO
84static __inline__ void __FD_ZERO(__kernel_fd_set *p) 84static inline void __FD_ZERO(__kernel_fd_set *p)
85{ 85{
86 unsigned long *tmp = p->fds_bits; 86 unsigned long *tmp = p->fds_bits;
87 int i; 87 int i;
diff --git a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h
index 0151cad486f3..24a04a55cf85 100644
--- a/include/asm-sparc64/sbus.h
+++ b/include/asm-sparc64/sbus.h
@@ -29,12 +29,12 @@
29 * numbers + offsets, and vice versa. 29 * numbers + offsets, and vice versa.
30 */ 30 */
31 31
32static __inline__ unsigned long sbus_devaddr(int slotnum, unsigned long offset) 32static inline unsigned long sbus_devaddr(int slotnum, unsigned long offset)
33{ 33{
34 return (unsigned long) (SUN_SBUS_BVADDR+((slotnum)<<28)+(offset)); 34 return (unsigned long) (SUN_SBUS_BVADDR+((slotnum)<<28)+(offset));
35} 35}
36 36
37static __inline__ int sbus_dev_slot(unsigned long dev_addr) 37static inline int sbus_dev_slot(unsigned long dev_addr)
38{ 38{
39 return (int) (((dev_addr)-SUN_SBUS_BVADDR)>>28); 39 return (int) (((dev_addr)-SUN_SBUS_BVADDR)>>28);
40} 40}
diff --git a/include/asm-sparc64/spitfire.h b/include/asm-sparc64/spitfire.h
index cf7807813e85..63b7040e8134 100644
--- a/include/asm-sparc64/spitfire.h
+++ b/include/asm-sparc64/spitfire.h
@@ -1,7 +1,6 @@
1/* $Id: spitfire.h,v 1.18 2001/11/29 16:42:10 kanoj Exp $ 1/* spitfire.h: SpitFire/BlackBird/Cheetah inline MMU operations.
2 * spitfire.h: SpitFire/BlackBird/Cheetah inline MMU operations.
3 * 2 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#ifndef _SPARC64_SPITFIRE_H 6#ifndef _SPARC64_SPITFIRE_H
@@ -67,7 +66,7 @@ extern void cheetah_enable_pcache(void);
67/* The data cache is write through, so this just invalidates the 66/* The data cache is write through, so this just invalidates the
68 * specified line. 67 * specified line.
69 */ 68 */
70static __inline__ void spitfire_put_dcache_tag(unsigned long addr, unsigned long tag) 69static inline void spitfire_put_dcache_tag(unsigned long addr, unsigned long tag)
71{ 70{
72 __asm__ __volatile__("stxa %0, [%1] %2\n\t" 71 __asm__ __volatile__("stxa %0, [%1] %2\n\t"
73 "membar #Sync" 72 "membar #Sync"
@@ -81,7 +80,7 @@ static __inline__ void spitfire_put_dcache_tag(unsigned long addr, unsigned long
81 * a flush instruction (to any address) is sufficient to handle 80 * a flush instruction (to any address) is sufficient to handle
82 * this issue after the line is invalidated. 81 * this issue after the line is invalidated.
83 */ 82 */
84static __inline__ void spitfire_put_icache_tag(unsigned long addr, unsigned long tag) 83static inline void spitfire_put_icache_tag(unsigned long addr, unsigned long tag)
85{ 84{
86 __asm__ __volatile__("stxa %0, [%1] %2\n\t" 85 __asm__ __volatile__("stxa %0, [%1] %2\n\t"
87 "membar #Sync" 86 "membar #Sync"
@@ -89,7 +88,7 @@ static __inline__ void spitfire_put_icache_tag(unsigned long addr, unsigned long
89 : "r" (tag), "r" (addr), "i" (ASI_IC_TAG)); 88 : "r" (tag), "r" (addr), "i" (ASI_IC_TAG));
90} 89}
91 90
92static __inline__ unsigned long spitfire_get_dtlb_data(int entry) 91static inline unsigned long spitfire_get_dtlb_data(int entry)
93{ 92{
94 unsigned long data; 93 unsigned long data;
95 94
@@ -103,7 +102,7 @@ static __inline__ unsigned long spitfire_get_dtlb_data(int entry)
103 return data; 102 return data;
104} 103}
105 104
106static __inline__ unsigned long spitfire_get_dtlb_tag(int entry) 105static inline unsigned long spitfire_get_dtlb_tag(int entry)
107{ 106{
108 unsigned long tag; 107 unsigned long tag;
109 108
@@ -113,7 +112,7 @@ static __inline__ unsigned long spitfire_get_dtlb_tag(int entry)
113 return tag; 112 return tag;
114} 113}
115 114
116static __inline__ void spitfire_put_dtlb_data(int entry, unsigned long data) 115static inline void spitfire_put_dtlb_data(int entry, unsigned long data)
117{ 116{
118 __asm__ __volatile__("stxa %0, [%1] %2\n\t" 117 __asm__ __volatile__("stxa %0, [%1] %2\n\t"
119 "membar #Sync" 118 "membar #Sync"
@@ -122,7 +121,7 @@ static __inline__ void spitfire_put_dtlb_data(int entry, unsigned long data)
122 "i" (ASI_DTLB_DATA_ACCESS)); 121 "i" (ASI_DTLB_DATA_ACCESS));
123} 122}
124 123
125static __inline__ unsigned long spitfire_get_itlb_data(int entry) 124static inline unsigned long spitfire_get_itlb_data(int entry)
126{ 125{
127 unsigned long data; 126 unsigned long data;
128 127
@@ -136,7 +135,7 @@ static __inline__ unsigned long spitfire_get_itlb_data(int entry)
136 return data; 135 return data;
137} 136}
138 137
139static __inline__ unsigned long spitfire_get_itlb_tag(int entry) 138static inline unsigned long spitfire_get_itlb_tag(int entry)
140{ 139{
141 unsigned long tag; 140 unsigned long tag;
142 141
@@ -146,7 +145,7 @@ static __inline__ unsigned long spitfire_get_itlb_tag(int entry)
146 return tag; 145 return tag;
147} 146}
148 147
149static __inline__ void spitfire_put_itlb_data(int entry, unsigned long data) 148static inline void spitfire_put_itlb_data(int entry, unsigned long data)
150{ 149{
151 __asm__ __volatile__("stxa %0, [%1] %2\n\t" 150 __asm__ __volatile__("stxa %0, [%1] %2\n\t"
152 "membar #Sync" 151 "membar #Sync"
@@ -155,7 +154,7 @@ static __inline__ void spitfire_put_itlb_data(int entry, unsigned long data)
155 "i" (ASI_ITLB_DATA_ACCESS)); 154 "i" (ASI_ITLB_DATA_ACCESS));
156} 155}
157 156
158static __inline__ void spitfire_flush_dtlb_nucleus_page(unsigned long page) 157static inline void spitfire_flush_dtlb_nucleus_page(unsigned long page)
159{ 158{
160 __asm__ __volatile__("stxa %%g0, [%0] %1\n\t" 159 __asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
161 "membar #Sync" 160 "membar #Sync"
@@ -163,7 +162,7 @@ static __inline__ void spitfire_flush_dtlb_nucleus_page(unsigned long page)
163 : "r" (page | 0x20), "i" (ASI_DMMU_DEMAP)); 162 : "r" (page | 0x20), "i" (ASI_DMMU_DEMAP));
164} 163}
165 164
166static __inline__ void spitfire_flush_itlb_nucleus_page(unsigned long page) 165static inline void spitfire_flush_itlb_nucleus_page(unsigned long page)
167{ 166{
168 __asm__ __volatile__("stxa %%g0, [%0] %1\n\t" 167 __asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
169 "membar #Sync" 168 "membar #Sync"
@@ -172,7 +171,7 @@ static __inline__ void spitfire_flush_itlb_nucleus_page(unsigned long page)
172} 171}
173 172
174/* Cheetah has "all non-locked" tlb flushes. */ 173/* Cheetah has "all non-locked" tlb flushes. */
175static __inline__ void cheetah_flush_dtlb_all(void) 174static inline void cheetah_flush_dtlb_all(void)
176{ 175{
177 __asm__ __volatile__("stxa %%g0, [%0] %1\n\t" 176 __asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
178 "membar #Sync" 177 "membar #Sync"
@@ -180,7 +179,7 @@ static __inline__ void cheetah_flush_dtlb_all(void)
180 : "r" (0x80), "i" (ASI_DMMU_DEMAP)); 179 : "r" (0x80), "i" (ASI_DMMU_DEMAP));
181} 180}
182 181
183static __inline__ void cheetah_flush_itlb_all(void) 182static inline void cheetah_flush_itlb_all(void)
184{ 183{
185 __asm__ __volatile__("stxa %%g0, [%0] %1\n\t" 184 __asm__ __volatile__("stxa %%g0, [%0] %1\n\t"
186 "membar #Sync" 185 "membar #Sync"
@@ -202,7 +201,7 @@ static __inline__ void cheetah_flush_itlb_all(void)
202 * ASI_{D,I}TLB_DATA_ACCESS loads, doing the load twice fixes 201 * ASI_{D,I}TLB_DATA_ACCESS loads, doing the load twice fixes
203 * the problem for me. -DaveM 202 * the problem for me. -DaveM
204 */ 203 */
205static __inline__ unsigned long cheetah_get_ldtlb_data(int entry) 204static inline unsigned long cheetah_get_ldtlb_data(int entry)
206{ 205{
207 unsigned long data; 206 unsigned long data;
208 207
@@ -215,7 +214,7 @@ static __inline__ unsigned long cheetah_get_ldtlb_data(int entry)
215 return data; 214 return data;
216} 215}
217 216
218static __inline__ unsigned long cheetah_get_litlb_data(int entry) 217static inline unsigned long cheetah_get_litlb_data(int entry)
219{ 218{
220 unsigned long data; 219 unsigned long data;
221 220
@@ -228,7 +227,7 @@ static __inline__ unsigned long cheetah_get_litlb_data(int entry)
228 return data; 227 return data;
229} 228}
230 229
231static __inline__ unsigned long cheetah_get_ldtlb_tag(int entry) 230static inline unsigned long cheetah_get_ldtlb_tag(int entry)
232{ 231{
233 unsigned long tag; 232 unsigned long tag;
234 233
@@ -240,7 +239,7 @@ static __inline__ unsigned long cheetah_get_ldtlb_tag(int entry)
240 return tag; 239 return tag;
241} 240}
242 241
243static __inline__ unsigned long cheetah_get_litlb_tag(int entry) 242static inline unsigned long cheetah_get_litlb_tag(int entry)
244{ 243{
245 unsigned long tag; 244 unsigned long tag;
246 245
@@ -252,7 +251,7 @@ static __inline__ unsigned long cheetah_get_litlb_tag(int entry)
252 return tag; 251 return tag;
253} 252}
254 253
255static __inline__ void cheetah_put_ldtlb_data(int entry, unsigned long data) 254static inline void cheetah_put_ldtlb_data(int entry, unsigned long data)
256{ 255{
257 __asm__ __volatile__("stxa %0, [%1] %2\n\t" 256 __asm__ __volatile__("stxa %0, [%1] %2\n\t"
258 "membar #Sync" 257 "membar #Sync"
@@ -262,7 +261,7 @@ static __inline__ void cheetah_put_ldtlb_data(int entry, unsigned long data)
262 "i" (ASI_DTLB_DATA_ACCESS)); 261 "i" (ASI_DTLB_DATA_ACCESS));
263} 262}
264 263
265static __inline__ void cheetah_put_litlb_data(int entry, unsigned long data) 264static inline void cheetah_put_litlb_data(int entry, unsigned long data)
266{ 265{
267 __asm__ __volatile__("stxa %0, [%1] %2\n\t" 266 __asm__ __volatile__("stxa %0, [%1] %2\n\t"
268 "membar #Sync" 267 "membar #Sync"
@@ -272,7 +271,7 @@ static __inline__ void cheetah_put_litlb_data(int entry, unsigned long data)
272 "i" (ASI_ITLB_DATA_ACCESS)); 271 "i" (ASI_ITLB_DATA_ACCESS));
273} 272}
274 273
275static __inline__ unsigned long cheetah_get_dtlb_data(int entry, int tlb) 274static inline unsigned long cheetah_get_dtlb_data(int entry, int tlb)
276{ 275{
277 unsigned long data; 276 unsigned long data;
278 277
@@ -284,7 +283,7 @@ static __inline__ unsigned long cheetah_get_dtlb_data(int entry, int tlb)
284 return data; 283 return data;
285} 284}
286 285
287static __inline__ unsigned long cheetah_get_dtlb_tag(int entry, int tlb) 286static inline unsigned long cheetah_get_dtlb_tag(int entry, int tlb)
288{ 287{
289 unsigned long tag; 288 unsigned long tag;
290 289
@@ -294,7 +293,7 @@ static __inline__ unsigned long cheetah_get_dtlb_tag(int entry, int tlb)
294 return tag; 293 return tag;
295} 294}
296 295
297static __inline__ void cheetah_put_dtlb_data(int entry, unsigned long data, int tlb) 296static inline void cheetah_put_dtlb_data(int entry, unsigned long data, int tlb)
298{ 297{
299 __asm__ __volatile__("stxa %0, [%1] %2\n\t" 298 __asm__ __volatile__("stxa %0, [%1] %2\n\t"
300 "membar #Sync" 299 "membar #Sync"
@@ -304,7 +303,7 @@ static __inline__ void cheetah_put_dtlb_data(int entry, unsigned long data, int
304 "i" (ASI_DTLB_DATA_ACCESS)); 303 "i" (ASI_DTLB_DATA_ACCESS));
305} 304}
306 305
307static __inline__ unsigned long cheetah_get_itlb_data(int entry) 306static inline unsigned long cheetah_get_itlb_data(int entry)
308{ 307{
309 unsigned long data; 308 unsigned long data;
310 309
@@ -317,7 +316,7 @@ static __inline__ unsigned long cheetah_get_itlb_data(int entry)
317 return data; 316 return data;
318} 317}
319 318
320static __inline__ unsigned long cheetah_get_itlb_tag(int entry) 319static inline unsigned long cheetah_get_itlb_tag(int entry)
321{ 320{
322 unsigned long tag; 321 unsigned long tag;
323 322
@@ -327,7 +326,7 @@ static __inline__ unsigned long cheetah_get_itlb_tag(int entry)
327 return tag; 326 return tag;
328} 327}
329 328
330static __inline__ void cheetah_put_itlb_data(int entry, unsigned long data) 329static inline void cheetah_put_itlb_data(int entry, unsigned long data)
331{ 330{
332 __asm__ __volatile__("stxa %0, [%1] %2\n\t" 331 __asm__ __volatile__("stxa %0, [%1] %2\n\t"
333 "membar #Sync" 332 "membar #Sync"
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index 3f175fa7e6d2..99a669c190c7 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -1,4 +1,3 @@
1/* $Id: system.h,v 1.69 2002/02/09 19:49:31 davem Exp $ */
2#ifndef __SPARC64_SYSTEM_H 1#ifndef __SPARC64_SYSTEM_H
3#define __SPARC64_SYSTEM_H 2#define __SPARC64_SYSTEM_H
4 3
@@ -179,7 +178,9 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
179 "ldx [%%g6 + %9], %%g4\n\t" \ 178 "ldx [%%g6 + %9], %%g4\n\t" \
180 "brz,pt %%o7, 1f\n\t" \ 179 "brz,pt %%o7, 1f\n\t" \
181 " mov %%g7, %0\n\t" \ 180 " mov %%g7, %0\n\t" \
182 "b,a ret_from_syscall\n\t" \ 181 "sethi %%hi(ret_from_syscall), %%g1\n\t" \
182 "jmpl %%g1 + %%lo(ret_from_syscall), %%g0\n\t" \
183 " nop\n\t" \
183 "1:\n\t" \ 184 "1:\n\t" \
184 : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \ 185 : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \
185 "=r" (__local_per_cpu_offset) \ 186 "=r" (__local_per_cpu_offset) \
@@ -240,7 +241,7 @@ static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long
240 241
241extern void __xchg_called_with_bad_pointer(void); 242extern void __xchg_called_with_bad_pointer(void);
242 243
243static __inline__ unsigned long __xchg(unsigned long x, __volatile__ void * ptr, 244static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr,
244 int size) 245 int size)
245{ 246{
246 switch (size) { 247 switch (size) {
@@ -263,7 +264,7 @@ extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noret
263 264
264#define __HAVE_ARCH_CMPXCHG 1 265#define __HAVE_ARCH_CMPXCHG 1
265 266
266static __inline__ unsigned long 267static inline unsigned long
267__cmpxchg_u32(volatile int *m, int old, int new) 268__cmpxchg_u32(volatile int *m, int old, int new)
268{ 269{
269 __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n" 270 __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n"
@@ -276,7 +277,7 @@ __cmpxchg_u32(volatile int *m, int old, int new)
276 return new; 277 return new;
277} 278}
278 279
279static __inline__ unsigned long 280static inline unsigned long
280__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) 281__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
281{ 282{
282 __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n" 283 __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n"
@@ -293,7 +294,7 @@ __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
293 if something tries to do an invalid cmpxchg(). */ 294 if something tries to do an invalid cmpxchg(). */
294extern void __cmpxchg_called_with_bad_pointer(void); 295extern void __cmpxchg_called_with_bad_pointer(void);
295 296
296static __inline__ unsigned long 297static inline unsigned long
297__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) 298__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
298{ 299{
299 switch (size) { 300 switch (size) {
diff --git a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h
index afe236ba555b..93720e7b0289 100644
--- a/include/asm-sparc64/uaccess.h
+++ b/include/asm-sparc64/uaccess.h
@@ -123,7 +123,8 @@ __asm__ __volatile__( \
123 ".section .fixup,#alloc,#execinstr\n\t" \ 123 ".section .fixup,#alloc,#execinstr\n\t" \
124 ".align 4\n" \ 124 ".align 4\n" \
125"3:\n\t" \ 125"3:\n\t" \
126 "b 2b\n\t" \ 126 "sethi %%hi(2b), %0\n\t" \
127 "jmpl %0 + %%lo(2b), %%g0\n\t" \
127 " mov %3, %0\n\n\t" \ 128 " mov %3, %0\n\n\t" \
128 ".previous\n\t" \ 129 ".previous\n\t" \
129 ".section __ex_table,\"a\"\n\t" \ 130 ".section __ex_table,\"a\"\n\t" \
@@ -165,8 +166,9 @@ __asm__ __volatile__( \
165 ".section .fixup,#alloc,#execinstr\n\t" \ 166 ".section .fixup,#alloc,#execinstr\n\t" \
166 ".align 4\n" \ 167 ".align 4\n" \
167"3:\n\t" \ 168"3:\n\t" \
169 "sethi %%hi(2b), %0\n\t" \
168 "clr %1\n\t" \ 170 "clr %1\n\t" \
169 "b 2b\n\t" \ 171 "jmpl %0 + %%lo(2b), %%g0\n\t" \
170 " mov %3, %0\n\n\t" \ 172 " mov %3, %0\n\n\t" \
171 ".previous\n\t" \ 173 ".previous\n\t" \
172 ".section __ex_table,\"a\"\n\t" \ 174 ".section __ex_table,\"a\"\n\t" \
diff --git a/include/asm-sparc64/upa.h b/include/asm-sparc64/upa.h
index 7ae09a22e408..5b1633223f92 100644
--- a/include/asm-sparc64/upa.h
+++ b/include/asm-sparc64/upa.h
@@ -1,4 +1,3 @@
1/* $Id: upa.h,v 1.3 1999/09/21 14:39:47 davem Exp $ */
2#ifndef _SPARC64_UPA_H 1#ifndef _SPARC64_UPA_H
3#define _SPARC64_UPA_H 2#define _SPARC64_UPA_H
4 3
@@ -25,7 +24,7 @@
25 24
26/* UPA I/O space accessors */ 25/* UPA I/O space accessors */
27#if defined(__KERNEL__) && !defined(__ASSEMBLY__) 26#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
28static __inline__ unsigned char _upa_readb(unsigned long addr) 27static inline unsigned char _upa_readb(unsigned long addr)
29{ 28{
30 unsigned char ret; 29 unsigned char ret;
31 30
@@ -36,7 +35,7 @@ static __inline__ unsigned char _upa_readb(unsigned long addr)
36 return ret; 35 return ret;
37} 36}
38 37
39static __inline__ unsigned short _upa_readw(unsigned long addr) 38static inline unsigned short _upa_readw(unsigned long addr)
40{ 39{
41 unsigned short ret; 40 unsigned short ret;
42 41
@@ -47,7 +46,7 @@ static __inline__ unsigned short _upa_readw(unsigned long addr)
47 return ret; 46 return ret;
48} 47}
49 48
50static __inline__ unsigned int _upa_readl(unsigned long addr) 49static inline unsigned int _upa_readl(unsigned long addr)
51{ 50{
52 unsigned int ret; 51 unsigned int ret;
53 52
@@ -58,7 +57,7 @@ static __inline__ unsigned int _upa_readl(unsigned long addr)
58 return ret; 57 return ret;
59} 58}
60 59
61static __inline__ unsigned long _upa_readq(unsigned long addr) 60static inline unsigned long _upa_readq(unsigned long addr)
62{ 61{
63 unsigned long ret; 62 unsigned long ret;
64 63
@@ -69,28 +68,28 @@ static __inline__ unsigned long _upa_readq(unsigned long addr)
69 return ret; 68 return ret;
70} 69}
71 70
72static __inline__ void _upa_writeb(unsigned char b, unsigned long addr) 71static inline void _upa_writeb(unsigned char b, unsigned long addr)
73{ 72{
74 __asm__ __volatile__("stba\t%0, [%1] %2\t/* upa_writeb */" 73 __asm__ __volatile__("stba\t%0, [%1] %2\t/* upa_writeb */"
75 : /* no outputs */ 74 : /* no outputs */
76 : "r" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 75 : "r" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
77} 76}
78 77
79static __inline__ void _upa_writew(unsigned short w, unsigned long addr) 78static inline void _upa_writew(unsigned short w, unsigned long addr)
80{ 79{
81 __asm__ __volatile__("stha\t%0, [%1] %2\t/* upa_writew */" 80 __asm__ __volatile__("stha\t%0, [%1] %2\t/* upa_writew */"
82 : /* no outputs */ 81 : /* no outputs */
83 : "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 82 : "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
84} 83}
85 84
86static __inline__ void _upa_writel(unsigned int l, unsigned long addr) 85static inline void _upa_writel(unsigned int l, unsigned long addr)
87{ 86{
88 __asm__ __volatile__("stwa\t%0, [%1] %2\t/* upa_writel */" 87 __asm__ __volatile__("stwa\t%0, [%1] %2\t/* upa_writel */"
89 : /* no outputs */ 88 : /* no outputs */
90 : "r" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 89 : "r" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
91} 90}
92 91
93static __inline__ void _upa_writeq(unsigned long q, unsigned long addr) 92static inline void _upa_writeq(unsigned long q, unsigned long addr)
94{ 93{
95 __asm__ __volatile__("stxa\t%0, [%1] %2\t/* upa_writeq */" 94 __asm__ __volatile__("stxa\t%0, [%1] %2\t/* upa_writeq */"
96 : /* no outputs */ 95 : /* no outputs */
diff --git a/include/asm-sparc64/visasm.h b/include/asm-sparc64/visasm.h
index a74078551e0f..34f2ec64933b 100644
--- a/include/asm-sparc64/visasm.h
+++ b/include/asm-sparc64/visasm.h
@@ -1,4 +1,3 @@
1/* $Id: visasm.h,v 1.5 2001/04/24 01:09:12 davem Exp $ */
2#ifndef _SPARC64_VISASM_H 1#ifndef _SPARC64_VISASM_H
3#define _SPARC64_VISASM_H 2#define _SPARC64_VISASM_H
4 3
@@ -44,7 +43,7 @@
44 wr %o5, 0, %fprs; 43 wr %o5, 0, %fprs;
45 44
46#ifndef __ASSEMBLY__ 45#ifndef __ASSEMBLY__
47static __inline__ void save_and_clear_fpu(void) { 46static inline void save_and_clear_fpu(void) {
48 __asm__ __volatile__ ( 47 __asm__ __volatile__ (
49" rd %%fprs, %%o5\n" 48" rd %%fprs, %%o5\n"
50" andcc %%o5, %0, %%g0\n" 49" andcc %%o5, %0, %%g0\n"
diff --git a/include/asm-um/unistd.h b/include/asm-um/unistd.h
index 732c83f04c3d..38bd9d94ee46 100644
--- a/include/asm-um/unistd.h
+++ b/include/asm-um/unistd.h
@@ -14,7 +14,6 @@ extern int um_execve(const char *file, char *const argv[], char *const env[]);
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16/* We get __ARCH_WANT_OLD_STAT and __ARCH_WANT_STAT64 from the base arch */ 16/* We get __ARCH_WANT_OLD_STAT and __ARCH_WANT_STAT64 from the base arch */
17#define __ARCH_WANT_IPC_PARSE_VERSION
18#define __ARCH_WANT_OLD_READDIR 17#define __ARCH_WANT_OLD_READDIR
19#define __ARCH_WANT_SYS_ALARM 18#define __ARCH_WANT_SYS_ALARM
20#define __ARCH_WANT_SYS_GETHOSTNAME 19#define __ARCH_WANT_SYS_GETHOSTNAME
diff --git a/include/asm-x86/bitops_32.h b/include/asm-x86/bitops_32.h
index 36ebb5b02b4f..0b40f6d20bea 100644
--- a/include/asm-x86/bitops_32.h
+++ b/include/asm-x86/bitops_32.h
@@ -183,9 +183,12 @@ static inline int test_and_set_bit(int nr, volatile unsigned long * addr)
183 * @nr: Bit to set 183 * @nr: Bit to set
184 * @addr: Address to count from 184 * @addr: Address to count from
185 * 185 *
186 * This is the same as test_and_set_bit on x86 186 * This is the same as test_and_set_bit on x86.
187 */ 187 */
188#define test_and_set_bit_lock test_and_set_bit 188static inline int test_and_set_bit_lock(int nr, volatile unsigned long *addr)
189{
190 return test_and_set_bit(nr, addr);
191}
189 192
190/** 193/**
191 * __test_and_set_bit - Set a bit and return its old value 194 * __test_and_set_bit - Set a bit and return its old value
diff --git a/include/asm-x86/bitops_64.h b/include/asm-x86/bitops_64.h
index b4d47940b959..766bcc0470a6 100644
--- a/include/asm-x86/bitops_64.h
+++ b/include/asm-x86/bitops_64.h
@@ -29,7 +29,7 @@
29 * Note that @nr may be almost arbitrarily large; this function is not 29 * Note that @nr may be almost arbitrarily large; this function is not
30 * restricted to acting on a single-word quantity. 30 * restricted to acting on a single-word quantity.
31 */ 31 */
32static __inline__ void set_bit(int nr, volatile void * addr) 32static inline void set_bit(int nr, volatile void *addr)
33{ 33{
34 __asm__ __volatile__( LOCK_PREFIX 34 __asm__ __volatile__( LOCK_PREFIX
35 "btsl %1,%0" 35 "btsl %1,%0"
@@ -46,7 +46,7 @@ static __inline__ void set_bit(int nr, volatile void * addr)
46 * If it's called on the same region of memory simultaneously, the effect 46 * If it's called on the same region of memory simultaneously, the effect
47 * may be that only one operation succeeds. 47 * may be that only one operation succeeds.
48 */ 48 */
49static __inline__ void __set_bit(int nr, volatile void * addr) 49static inline void __set_bit(int nr, volatile void *addr)
50{ 50{
51 __asm__ volatile( 51 __asm__ volatile(
52 "btsl %1,%0" 52 "btsl %1,%0"
@@ -64,7 +64,7 @@ static __inline__ void __set_bit(int nr, volatile void * addr)
64 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() 64 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
65 * in order to ensure changes are visible on other processors. 65 * in order to ensure changes are visible on other processors.
66 */ 66 */
67static __inline__ void clear_bit(int nr, volatile void * addr) 67static inline void clear_bit(int nr, volatile void *addr)
68{ 68{
69 __asm__ __volatile__( LOCK_PREFIX 69 __asm__ __volatile__( LOCK_PREFIX
70 "btrl %1,%0" 70 "btrl %1,%0"
@@ -86,7 +86,7 @@ static inline void clear_bit_unlock(unsigned long nr, volatile unsigned long *ad
86 clear_bit(nr, addr); 86 clear_bit(nr, addr);
87} 87}
88 88
89static __inline__ void __clear_bit(int nr, volatile void * addr) 89static inline void __clear_bit(int nr, volatile void *addr)
90{ 90{
91 __asm__ __volatile__( 91 __asm__ __volatile__(
92 "btrl %1,%0" 92 "btrl %1,%0"
@@ -124,7 +124,7 @@ static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *
124 * If it's called on the same region of memory simultaneously, the effect 124 * If it's called on the same region of memory simultaneously, the effect
125 * may be that only one operation succeeds. 125 * may be that only one operation succeeds.
126 */ 126 */
127static __inline__ void __change_bit(int nr, volatile void * addr) 127static inline void __change_bit(int nr, volatile void *addr)
128{ 128{
129 __asm__ __volatile__( 129 __asm__ __volatile__(
130 "btcl %1,%0" 130 "btcl %1,%0"
@@ -141,7 +141,7 @@ static __inline__ void __change_bit(int nr, volatile void * addr)
141 * Note that @nr may be almost arbitrarily large; this function is not 141 * Note that @nr may be almost arbitrarily large; this function is not
142 * restricted to acting on a single-word quantity. 142 * restricted to acting on a single-word quantity.
143 */ 143 */
144static __inline__ void change_bit(int nr, volatile void * addr) 144static inline void change_bit(int nr, volatile void *addr)
145{ 145{
146 __asm__ __volatile__( LOCK_PREFIX 146 __asm__ __volatile__( LOCK_PREFIX
147 "btcl %1,%0" 147 "btcl %1,%0"
@@ -157,7 +157,7 @@ static __inline__ void change_bit(int nr, volatile void * addr)
157 * This operation is atomic and cannot be reordered. 157 * This operation is atomic and cannot be reordered.
158 * It also implies a memory barrier. 158 * It also implies a memory barrier.
159 */ 159 */
160static __inline__ int test_and_set_bit(int nr, volatile void * addr) 160static inline int test_and_set_bit(int nr, volatile void *addr)
161{ 161{
162 int oldbit; 162 int oldbit;
163 163
@@ -173,9 +173,12 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr)
173 * @nr: Bit to set 173 * @nr: Bit to set
174 * @addr: Address to count from 174 * @addr: Address to count from
175 * 175 *
176 * This is the same as test_and_set_bit on x86 176 * This is the same as test_and_set_bit on x86.
177 */ 177 */
178#define test_and_set_bit_lock test_and_set_bit 178static inline int test_and_set_bit_lock(int nr, volatile void *addr)
179{
180 return test_and_set_bit(nr, addr);
181}
179 182
180/** 183/**
181 * __test_and_set_bit - Set a bit and return its old value 184 * __test_and_set_bit - Set a bit and return its old value
@@ -186,7 +189,7 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr)
186 * If two examples of this operation race, one can appear to succeed 189 * If two examples of this operation race, one can appear to succeed
187 * but actually fail. You must protect multiple accesses with a lock. 190 * but actually fail. You must protect multiple accesses with a lock.
188 */ 191 */
189static __inline__ int __test_and_set_bit(int nr, volatile void * addr) 192static inline int __test_and_set_bit(int nr, volatile void *addr)
190{ 193{
191 int oldbit; 194 int oldbit;
192 195
@@ -205,7 +208,7 @@ static __inline__ int __test_and_set_bit(int nr, volatile void * addr)
205 * This operation is atomic and cannot be reordered. 208 * This operation is atomic and cannot be reordered.
206 * It also implies a memory barrier. 209 * It also implies a memory barrier.
207 */ 210 */
208static __inline__ int test_and_clear_bit(int nr, volatile void * addr) 211static inline int test_and_clear_bit(int nr, volatile void *addr)
209{ 212{
210 int oldbit; 213 int oldbit;
211 214
@@ -225,7 +228,7 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
225 * If two examples of this operation race, one can appear to succeed 228 * If two examples of this operation race, one can appear to succeed
226 * but actually fail. You must protect multiple accesses with a lock. 229 * but actually fail. You must protect multiple accesses with a lock.
227 */ 230 */
228static __inline__ int __test_and_clear_bit(int nr, volatile void * addr) 231static inline int __test_and_clear_bit(int nr, volatile void *addr)
229{ 232{
230 int oldbit; 233 int oldbit;
231 234
@@ -237,7 +240,7 @@ static __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
237} 240}
238 241
239/* WARNING: non atomic and it can be reordered! */ 242/* WARNING: non atomic and it can be reordered! */
240static __inline__ int __test_and_change_bit(int nr, volatile void * addr) 243static inline int __test_and_change_bit(int nr, volatile void *addr)
241{ 244{
242 int oldbit; 245 int oldbit;
243 246
@@ -256,7 +259,7 @@ static __inline__ int __test_and_change_bit(int nr, volatile void * addr)
256 * This operation is atomic and cannot be reordered. 259 * This operation is atomic and cannot be reordered.
257 * It also implies a memory barrier. 260 * It also implies a memory barrier.
258 */ 261 */
259static __inline__ int test_and_change_bit(int nr, volatile void * addr) 262static inline int test_and_change_bit(int nr, volatile void *addr)
260{ 263{
261 int oldbit; 264 int oldbit;
262 265
@@ -273,15 +276,15 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
273 * @nr: bit number to test 276 * @nr: bit number to test
274 * @addr: Address to start counting from 277 * @addr: Address to start counting from
275 */ 278 */
276static int test_bit(int nr, const volatile void * addr); 279static int test_bit(int nr, const volatile void *addr);
277#endif 280#endif
278 281
279static __inline__ int constant_test_bit(int nr, const volatile void * addr) 282static inline int constant_test_bit(int nr, const volatile void *addr)
280{ 283{
281 return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0; 284 return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
282} 285}
283 286
284static __inline__ int variable_test_bit(int nr, volatile const void * addr) 287static inline int variable_test_bit(int nr, volatile const void *addr)
285{ 288{
286 int oldbit; 289 int oldbit;
287 290
@@ -299,10 +302,10 @@ static __inline__ int variable_test_bit(int nr, volatile const void * addr)
299 302
300#undef ADDR 303#undef ADDR
301 304
302extern long find_first_zero_bit(const unsigned long * addr, unsigned long size); 305extern long find_first_zero_bit(const unsigned long *addr, unsigned long size);
303extern long find_next_zero_bit (const unsigned long * addr, long size, long offset); 306extern long find_next_zero_bit(const unsigned long *addr, long size, long offset);
304extern long find_first_bit(const unsigned long * addr, unsigned long size); 307extern long find_first_bit(const unsigned long *addr, unsigned long size);
305extern long find_next_bit(const unsigned long * addr, long size, long offset); 308extern long find_next_bit(const unsigned long *addr, long size, long offset);
306 309
307/* return index of first bet set in val or max when no bit is set */ 310/* return index of first bet set in val or max when no bit is set */
308static inline long __scanbit(unsigned long val, unsigned long max) 311static inline long __scanbit(unsigned long val, unsigned long max)
@@ -363,7 +366,7 @@ static inline void __clear_bit_string(unsigned long *bitmap, unsigned long i,
363 * 366 *
364 * Undefined if no zero exists, so code should check against ~0UL first. 367 * Undefined if no zero exists, so code should check against ~0UL first.
365 */ 368 */
366static __inline__ unsigned long ffz(unsigned long word) 369static inline unsigned long ffz(unsigned long word)
367{ 370{
368 __asm__("bsfq %1,%0" 371 __asm__("bsfq %1,%0"
369 :"=r" (word) 372 :"=r" (word)
@@ -377,7 +380,7 @@ static __inline__ unsigned long ffz(unsigned long word)
377 * 380 *
378 * Undefined if no bit exists, so code should check against 0 first. 381 * Undefined if no bit exists, so code should check against 0 first.
379 */ 382 */
380static __inline__ unsigned long __ffs(unsigned long word) 383static inline unsigned long __ffs(unsigned long word)
381{ 384{
382 __asm__("bsfq %1,%0" 385 __asm__("bsfq %1,%0"
383 :"=r" (word) 386 :"=r" (word)
@@ -391,7 +394,7 @@ static __inline__ unsigned long __ffs(unsigned long word)
391 * 394 *
392 * Undefined if no zero exists, so code should check against ~0UL first. 395 * Undefined if no zero exists, so code should check against ~0UL first.
393 */ 396 */
394static __inline__ unsigned long __fls(unsigned long word) 397static inline unsigned long __fls(unsigned long word)
395{ 398{
396 __asm__("bsrq %1,%0" 399 __asm__("bsrq %1,%0"
397 :"=r" (word) 400 :"=r" (word)
@@ -411,7 +414,7 @@ static __inline__ unsigned long __fls(unsigned long word)
411 * the libc and compiler builtin ffs routines, therefore 414 * the libc and compiler builtin ffs routines, therefore
412 * differs in spirit from the above ffz (man ffs). 415 * differs in spirit from the above ffz (man ffs).
413 */ 416 */
414static __inline__ int ffs(int x) 417static inline int ffs(int x)
415{ 418{
416 int r; 419 int r;
417 420
@@ -427,7 +430,7 @@ static __inline__ int ffs(int x)
427 * 430 *
428 * This is defined the same way as fls. 431 * This is defined the same way as fls.
429 */ 432 */
430static __inline__ int fls64(__u64 x) 433static inline int fls64(__u64 x)
431{ 434{
432 if (x == 0) 435 if (x == 0)
433 return 0; 436 return 0;
@@ -440,7 +443,7 @@ static __inline__ int fls64(__u64 x)
440 * 443 *
441 * This is defined the same way as ffs. 444 * This is defined the same way as ffs.
442 */ 445 */
443static __inline__ int fls(int x) 446static inline int fls(int x)
444{ 447{
445 int r; 448 int r;
446 449
diff --git a/include/asm-x86/gart.h b/include/asm-x86/gart.h
new file mode 100644
index 000000000000..f704c50519b8
--- /dev/null
+++ b/include/asm-x86/gart.h
@@ -0,0 +1,29 @@
1#ifndef _ASM_X8664_IOMMU_H
2#define _ASM_X8664_IOMMU_H 1
3
4extern void pci_iommu_shutdown(void);
5extern void no_iommu_init(void);
6extern int force_iommu, no_iommu;
7extern int iommu_detected;
8#ifdef CONFIG_GART_IOMMU
9extern void gart_iommu_init(void);
10extern void gart_iommu_shutdown(void);
11extern void __init gart_parse_options(char *);
12extern void gart_iommu_hole_init(void);
13extern int fallback_aper_order;
14extern int fallback_aper_force;
15extern int gart_iommu_aperture;
16extern int gart_iommu_aperture_allowed;
17extern int gart_iommu_aperture_disabled;
18extern int fix_aperture;
19#else
20#define gart_iommu_aperture 0
21#define gart_iommu_aperture_allowed 0
22
23static inline void gart_iommu_shutdown(void)
24{
25}
26
27#endif
28
29#endif
diff --git a/include/asm-x86/iommu.h b/include/asm-x86/iommu.h
index 5af471f228ee..07862fdd23c0 100644
--- a/include/asm-x86/iommu.h
+++ b/include/asm-x86/iommu.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_X8664_IOMMU_H 1#ifndef _ASM_X8664_GART_H
2#define _ASM_X8664_IOMMU_H 1 2#define _ASM_X8664_GART_H 1
3 3
4extern void pci_iommu_shutdown(void); 4extern void pci_iommu_shutdown(void);
5extern void no_iommu_init(void); 5extern void no_iommu_init(void);
diff --git a/include/asm-x86/lguest_hcall.h b/include/asm-x86/lguest_hcall.h
index f948491eb56a..9c5092b6aa9f 100644
--- a/include/asm-x86/lguest_hcall.h
+++ b/include/asm-x86/lguest_hcall.h
@@ -18,12 +18,17 @@
18#define LHCALL_LOAD_TLS 16 18#define LHCALL_LOAD_TLS 16
19#define LHCALL_NOTIFY 17 19#define LHCALL_NOTIFY 17
20 20
21#define LGUEST_TRAP_ENTRY 0x1F
22
23#ifndef __ASSEMBLY__
24#include <asm/hw_irq.h>
25
21/*G:031 First, how does our Guest contact the Host to ask for privileged 26/*G:031 First, how does our Guest contact the Host to ask for privileged
22 * operations? There are two ways: the direct way is to make a "hypercall", 27 * operations? There are two ways: the direct way is to make a "hypercall",
23 * to make requests of the Host Itself. 28 * to make requests of the Host Itself.
24 * 29 *
25 * Our hypercall mechanism uses the highest unused trap code (traps 32 and 30 * Our hypercall mechanism uses the highest unused trap code (traps 32 and
26 * above are used by real hardware interrupts). Seventeen hypercalls are 31 * above are used by real hardware interrupts). Fifteen hypercalls are
27 * available: the hypercall number is put in the %eax register, and the 32 * available: the hypercall number is put in the %eax register, and the
28 * arguments (when required) are placed in %edx, %ebx and %ecx. If a return 33 * arguments (when required) are placed in %edx, %ebx and %ecx. If a return
29 * value makes sense, it's returned in %eax. 34 * value makes sense, it's returned in %eax.
@@ -31,20 +36,15 @@
31 * Grossly invalid calls result in Sudden Death at the hands of the vengeful 36 * Grossly invalid calls result in Sudden Death at the hands of the vengeful
32 * Host, rather than returning failure. This reflects Winston Churchill's 37 * Host, rather than returning failure. This reflects Winston Churchill's
33 * definition of a gentleman: "someone who is only rude intentionally". */ 38 * definition of a gentleman: "someone who is only rude intentionally". */
34#define LGUEST_TRAP_ENTRY 0x1F
35
36#ifndef __ASSEMBLY__
37#include <asm/hw_irq.h>
38
39static inline unsigned long 39static inline unsigned long
40hcall(unsigned long call, 40hcall(unsigned long call,
41 unsigned long arg1, unsigned long arg2, unsigned long arg3) 41 unsigned long arg1, unsigned long arg2, unsigned long arg3)
42{ 42{
43 /* "int" is the Intel instruction to trigger a trap. */ 43 /* "int" is the Intel instruction to trigger a trap. */
44 asm volatile("int $" __stringify(LGUEST_TRAP_ENTRY) 44 asm volatile("int $" __stringify(LGUEST_TRAP_ENTRY)
45 /* The call is in %eax (aka "a"), and can be replaced */ 45 /* The call in %eax (aka "a") might be overwritten */
46 : "=a"(call) 46 : "=a"(call)
47 /* The other arguments are in %eax, %edx, %ebx & %ecx */ 47 /* The arguments are in %eax, %edx, %ebx & %ecx */
48 : "a"(call), "d"(arg1), "b"(arg2), "c"(arg3) 48 : "a"(call), "d"(arg1), "b"(arg2), "c"(arg3)
49 /* "memory" means this might write somewhere in memory. 49 /* "memory" means this might write somewhere in memory.
50 * This isn't true for all calls, but it's safe to tell 50 * This isn't true for all calls, but it's safe to tell
diff --git a/include/asm-x86/pci_64.h b/include/asm-x86/pci_64.h
index 9baa46d9f594..ef54226a9325 100644
--- a/include/asm-x86/pci_64.h
+++ b/include/asm-x86/pci_64.h
@@ -37,7 +37,7 @@ extern int iommu_setup(char *opt);
37 */ 37 */
38#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) 38#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
39 39
40#if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU) 40#if defined(CONFIG_GART_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
41 41
42#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ 42#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
43 dma_addr_t ADDR_NAME; 43 dma_addr_t ADDR_NAME;
diff --git a/include/asm-x86/smp_32.h b/include/asm-x86/smp_32.h
index 7056d8684522..e10b7affdfe5 100644
--- a/include/asm-x86/smp_32.h
+++ b/include/asm-x86/smp_32.h
@@ -94,9 +94,12 @@ static inline void smp_send_reschedule(int cpu)
94{ 94{
95 smp_ops.smp_send_reschedule(cpu); 95 smp_ops.smp_send_reschedule(cpu);
96} 96}
97extern int smp_call_function_mask(cpumask_t mask, 97static inline int smp_call_function_mask(cpumask_t mask,
98 void (*func) (void *info), void *info, 98 void (*func) (void *info), void *info,
99 int wait); 99 int wait)
100{
101 return smp_ops.smp_call_function_mask(mask, func, info, wait);
102}
100 103
101void native_smp_prepare_boot_cpu(void); 104void native_smp_prepare_boot_cpu(void);
102void native_smp_prepare_cpus(unsigned int max_cpus); 105void native_smp_prepare_cpus(unsigned int max_cpus);
diff --git a/include/asm-xtensa/dma-mapping.h b/include/asm-xtensa/dma-mapping.h
index 8bd9d2c02a24..3c7d537dd15d 100644
--- a/include/asm-xtensa/dma-mapping.h
+++ b/include/asm-xtensa/dma-mapping.h
@@ -11,10 +11,10 @@
11#ifndef _XTENSA_DMA_MAPPING_H 11#ifndef _XTENSA_DMA_MAPPING_H
12#define _XTENSA_DMA_MAPPING_H 12#define _XTENSA_DMA_MAPPING_H
13 13
14#include <asm/scatterlist.h>
15#include <asm/cache.h> 14#include <asm/cache.h>
16#include <asm/io.h> 15#include <asm/io.h>
17#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/scatterlist.h>
18 18
19/* 19/*
20 * DMA-consistent mapping functions. 20 * DMA-consistent mapping functions.
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 6a65231bc785..37bfa19d8064 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -149,6 +149,7 @@ header-y += ticable.h
149header-y += times.h 149header-y += times.h
150header-y += tiocl.h 150header-y += tiocl.h
151header-y += tipc.h 151header-y += tipc.h
152header-y += tipc_config.h
152header-y += toshiba.h 153header-y += toshiba.h
153header-y += ultrasound.h 154header-y += ultrasound.h
154header-y += un.h 155header-y += un.h
@@ -325,6 +326,7 @@ unifdef-y += sonypi.h
325unifdef-y += soundcard.h 326unifdef-y += soundcard.h
326unifdef-y += stat.h 327unifdef-y += stat.h
327unifdef-y += stddef.h 328unifdef-y += stddef.h
329unifdef-y += string.h
328unifdef-y += synclink.h 330unifdef-y += synclink.h
329unifdef-y += sysctl.h 331unifdef-y += sysctl.h
330unifdef-y += tcp.h 332unifdef-y += tcp.h
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 8263a7b74d34..61535e72834d 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -43,6 +43,7 @@ enum {
43 ATA_MAX_SECTORS_128 = 128, 43 ATA_MAX_SECTORS_128 = 128,
44 ATA_MAX_SECTORS = 256, 44 ATA_MAX_SECTORS = 256,
45 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ 45 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */
46 ATA_MAX_SECTORS_TAPE = 65535,
46 47
47 ATA_ID_WORDS = 256, 48 ATA_ID_WORDS = 256,
48 ATA_ID_SERNO = 10, 49 ATA_ID_SERNO = 10,
@@ -180,6 +181,7 @@ enum {
180 ATA_CMD_VERIFY_EXT = 0x42, 181 ATA_CMD_VERIFY_EXT = 0x42,
181 ATA_CMD_STANDBYNOW1 = 0xE0, 182 ATA_CMD_STANDBYNOW1 = 0xE0,
182 ATA_CMD_IDLEIMMEDIATE = 0xE1, 183 ATA_CMD_IDLEIMMEDIATE = 0xE1,
184 ATA_CMD_SLEEP = 0xE6,
183 ATA_CMD_INIT_DEV_PARAMS = 0x91, 185 ATA_CMD_INIT_DEV_PARAMS = 0x91,
184 ATA_CMD_READ_NATIVE_MAX = 0xF8, 186 ATA_CMD_READ_NATIVE_MAX = 0xF8,
185 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, 187 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
@@ -235,6 +237,7 @@ enum {
235 237
236 /* SETFEATURE Sector counts for SATA features */ 238 /* SETFEATURE Sector counts for SATA features */
237 SATA_AN = 0x05, /* Asynchronous Notification */ 239 SATA_AN = 0x05, /* Asynchronous Notification */
240 SATA_DIPM = 0x03, /* Device Initiated Power Management */
238 241
239 /* ATAPI stuff */ 242 /* ATAPI stuff */
240 ATAPI_PKT_DMA = (1 << 0), 243 ATAPI_PKT_DMA = (1 << 0),
@@ -377,6 +380,26 @@ struct ata_taskfile {
377 380
378#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) 381#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
379 382
383static inline bool ata_id_has_hipm(const u16 *id)
384{
385 u16 val = id[76];
386
387 if (val == 0 || val == 0xffff)
388 return false;
389
390 return val & (1 << 9);
391}
392
393static inline bool ata_id_has_dipm(const u16 *id)
394{
395 u16 val = id[78];
396
397 if (val == 0 || val == 0xffff)
398 return false;
399
400 return val & (1 << 3);
401}
402
380static inline int ata_id_has_fua(const u16 *id) 403static inline int ata_id_has_fua(const u16 *id)
381{ 404{
382 if ((id[84] & 0xC000) != 0x4000) 405 if ((id[84] & 0xC000) != 0x4000)
@@ -522,6 +545,11 @@ static inline int atapi_cdb_len(const u16 *dev_id)
522 } 545 }
523} 546}
524 547
548static inline int atapi_command_packet_set(const u16 *dev_id)
549{
550 return (dev_id[0] >> 8) & 0x1f;
551}
552
525static inline int is_atapi_taskfile(const struct ata_taskfile *tf) 553static inline int is_atapi_taskfile(const struct ata_taskfile *tf)
526{ 554{
527 return (tf->protocol == ATA_PROT_ATAPI) || 555 return (tf->protocol == ATA_PROT_ATAPI) ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index bbf906a0b419..8396db24d019 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -341,7 +341,6 @@ enum blk_queue_state {
341struct blk_queue_tag { 341struct blk_queue_tag {
342 struct request **tag_index; /* map of busy tags */ 342 struct request **tag_index; /* map of busy tags */
343 unsigned long *tag_map; /* bit map of free/busy tags */ 343 unsigned long *tag_map; /* bit map of free/busy tags */
344 struct list_head busy_list; /* fifo list of busy tags */
345 int busy; /* current depth */ 344 int busy; /* current depth */
346 int max_depth; /* what we will send to device */ 345 int max_depth; /* what we will send to device */
347 int real_max_depth; /* what the array can hold */ 346 int real_max_depth; /* what the array can hold */
@@ -435,6 +434,7 @@ struct request_queue
435 unsigned int dma_alignment; 434 unsigned int dma_alignment;
436 435
437 struct blk_queue_tag *queue_tags; 436 struct blk_queue_tag *queue_tags;
437 struct list_head tag_busy_list;
438 438
439 unsigned int nr_sorted; 439 unsigned int nr_sorted;
440 unsigned int in_flight; 440 unsigned int in_flight;
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index c83534ee1e79..0365ec9fc0c9 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -59,7 +59,6 @@ extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
59 unsigned long align, 59 unsigned long align,
60 unsigned long goal, 60 unsigned long goal,
61 unsigned long limit); 61 unsigned long limit);
62extern void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size);
63 62
64#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 63#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
65extern void reserve_bootmem(unsigned long addr, unsigned long size); 64extern void reserve_bootmem(unsigned long addr, unsigned long size);
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index c811c8b979ac..c68b67b86ef1 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -101,6 +101,12 @@ extern void __chk_io_ptr(const volatile void __iomem *);
101#undef __must_check 101#undef __must_check
102#define __must_check 102#define __must_check
103#endif 103#endif
104#ifndef CONFIG_ENABLE_WARN_DEPRECATED
105#undef __deprecated
106#undef __deprecated_for_modules
107#define __deprecated
108#define __deprecated_for_modules
109#endif
104 110
105/* 111/*
106 * Allow us to avoid 'defined but not used' warnings on functions and data, 112 * Allow us to avoid 'defined but not used' warnings on functions and data,
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 268c5a4a2bd4..33d6aaf94447 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -42,15 +42,15 @@ static inline void init_completion(struct completion *x)
42 init_waitqueue_head(&x->wait); 42 init_waitqueue_head(&x->wait);
43} 43}
44 44
45extern void FASTCALL(wait_for_completion(struct completion *)); 45extern void wait_for_completion(struct completion *);
46extern int FASTCALL(wait_for_completion_interruptible(struct completion *x)); 46extern int wait_for_completion_interruptible(struct completion *x);
47extern unsigned long FASTCALL(wait_for_completion_timeout(struct completion *x, 47extern unsigned long wait_for_completion_timeout(struct completion *x,
48 unsigned long timeout)); 48 unsigned long timeout);
49extern unsigned long FASTCALL(wait_for_completion_interruptible_timeout( 49extern unsigned long wait_for_completion_interruptible_timeout(
50 struct completion *x, unsigned long timeout)); 50 struct completion *x, unsigned long timeout);
51 51
52extern void FASTCALL(complete(struct completion *)); 52extern void complete(struct completion *);
53extern void FASTCALL(complete_all(struct completion *)); 53extern void complete_all(struct completion *);
54 54
55#define INIT_COMPLETION(x) ((x).done = 0) 55#define INIT_COMPLETION(x) ((x).done = 0)
56 56
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index f3fc4392e93d..333c3ea82a5d 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -144,6 +144,8 @@ enum dccp_reset_codes {
144 DCCP_RESET_CODE_TOO_BUSY, 144 DCCP_RESET_CODE_TOO_BUSY,
145 DCCP_RESET_CODE_BAD_INIT_COOKIE, 145 DCCP_RESET_CODE_BAD_INIT_COOKIE,
146 DCCP_RESET_CODE_AGGRESSION_PENALTY, 146 DCCP_RESET_CODE_AGGRESSION_PENALTY,
147
148 DCCP_MAX_RESET_CODES /* Leave at the end! */
147}; 149};
148 150
149/* DCCP options */ 151/* DCCP options */
@@ -270,10 +272,9 @@ static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
270 return memset(skb_transport_header(skb), 0, headlen); 272 return memset(skb_transport_header(skb), 0, headlen);
271} 273}
272 274
273static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb) 275static inline struct dccp_hdr_ext *dccp_hdrx(const struct dccp_hdr *dh)
274{ 276{
275 return (struct dccp_hdr_ext *)(skb_transport_header(skb) + 277 return (struct dccp_hdr_ext *)((unsigned char *)dh + sizeof(*dh));
276 sizeof(struct dccp_hdr));
277} 278}
278 279
279static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh) 280static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh)
@@ -287,13 +288,12 @@ static inline unsigned int dccp_basic_hdr_len(const struct sk_buff *skb)
287 return __dccp_basic_hdr_len(dh); 288 return __dccp_basic_hdr_len(dh);
288} 289}
289 290
290static inline __u64 dccp_hdr_seq(const struct sk_buff *skb) 291static inline __u64 dccp_hdr_seq(const struct dccp_hdr *dh)
291{ 292{
292 const struct dccp_hdr *dh = dccp_hdr(skb);
293 __u64 seq_nr = ntohs(dh->dccph_seq); 293 __u64 seq_nr = ntohs(dh->dccph_seq);
294 294
295 if (dh->dccph_x != 0) 295 if (dh->dccph_x != 0)
296 seq_nr = (seq_nr << 32) + ntohl(dccp_hdrx(skb)->dccph_seq_low); 296 seq_nr = (seq_nr << 32) + ntohl(dccp_hdrx(dh)->dccph_seq_low);
297 else 297 else
298 seq_nr += (u32)dh->dccph_seq2 << 16; 298 seq_nr += (u32)dh->dccph_seq2 << 16;
299 299
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index d2a96cbf4f0e..cf79853967ff 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -32,18 +32,13 @@
32 * On x86-64 make the 64bit structure have the same alignment as the 32 * On x86-64 make the 64bit structure have the same alignment as the
33 * 32bit structure. This makes 32bit emulation easier. 33 * 32bit structure. This makes 32bit emulation easier.
34 * 34 *
35 * UML/x86_64 needs the same packing as x86_64 - UML + UML_X86 + 35 * UML/x86_64 needs the same packing as x86_64
36 * 64_BIT adds up to UML/x86_64.
37 */ 36 */
38#ifdef __x86_64__ 37#ifdef __x86_64__
39#define EPOLL_PACKED __attribute__((packed)) 38#define EPOLL_PACKED __attribute__((packed))
40#else 39#else
41#if defined(CONFIG_UML) && defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
42#define EPOLL_PACKED __attribute__((packed))
43#else
44#define EPOLL_PACKED 40#define EPOLL_PACKED
45#endif 41#endif
46#endif
47 42
48struct epoll_event { 43struct epoll_event {
49 __u32 events; 44 __u32 events;
diff --git a/include/linux/input.h b/include/linux/input.h
index 62268929856c..b45f240a8c45 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -527,6 +527,9 @@ struct input_absinfo {
527#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */ 527#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
528#define KEY_LOGOFF 0x1b1 /* AL Logoff */ 528#define KEY_LOGOFF 0x1b1 /* AL Logoff */
529 529
530#define KEY_DOLLAR 0x1b2
531#define KEY_EURO 0x1b3
532
530#define KEY_DEL_EOL 0x1c0 533#define KEY_DEL_EOL 0x1c0
531#define KEY_DEL_EOS 0x1c1 534#define KEY_DEL_EOS 0x1c1
532#define KEY_INS_LINE 0x1c2 535#define KEY_INS_LINE 0x1c2
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 56ae438ae510..6e8cec503380 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -173,7 +173,7 @@ static inline int ipmi_demangle_device_id(const unsigned char *data,
173 id->firmware_revision_2 = data[3]; 173 id->firmware_revision_2 = data[3];
174 id->ipmi_version = data[4]; 174 id->ipmi_version = data[4];
175 id->additional_device_support = data[5]; 175 id->additional_device_support = data[5];
176 if (data_len >= 6) { 176 if (data_len >= 11) {
177 id->manufacturer_id = (data[6] | (data[7] << 8) | 177 id->manufacturer_id = (data[6] | (data[7] << 8) |
178 (data[8] << 16)); 178 (data[8] << 16));
179 id->product_id = data[9] | (data[10] << 8); 179 id->product_id = data[9] | (data[10] << 8);
diff --git a/include/linux/lguest.h b/include/linux/lguest.h
index 8beb29134626..175e63f4a8c0 100644
--- a/include/linux/lguest.h
+++ b/include/linux/lguest.h
@@ -12,8 +12,8 @@
12#define LG_CLOCK_MAX_DELTA ULONG_MAX 12#define LG_CLOCK_MAX_DELTA ULONG_MAX
13 13
14/*G:032 The second method of communicating with the Host is to via "struct 14/*G:032 The second method of communicating with the Host is to via "struct
15 * lguest_data". The Guest's very first hypercall is to tell the Host where 15 * lguest_data". Once the Guest's initialization hypercall tells the Host where
16 * this is, and then the Guest and Host both publish information in it. :*/ 16 * this is, the Guest and Host both publish information in it. :*/
17struct lguest_data 17struct lguest_data
18{ 18{
19 /* 512 == enabled (same as eflags in normal hardware). The Guest 19 /* 512 == enabled (same as eflags in normal hardware). The Guest
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
index 61e1e3e6b1cc..697104da91f1 100644
--- a/include/linux/lguest_launcher.h
+++ b/include/linux/lguest_launcher.h
@@ -1,17 +1,7 @@
1#ifndef _ASM_LGUEST_USER 1#ifndef _LINUX_LGUEST_LAUNCHER
2#define _ASM_LGUEST_USER 2#define _LINUX_LGUEST_LAUNCHER
3/* Everything the "lguest" userspace program needs to know. */ 3/* Everything the "lguest" userspace program needs to know. */
4#include <linux/types.h> 4#include <linux/types.h>
5/* They can register up to 32 arrays of lguest_dma. */
6#define LGUEST_MAX_DMA 32
7/* At most we can dma 16 lguest_dma in one op. */
8#define LGUEST_MAX_DMA_SECTIONS 16
9
10/* How many devices? Assume each one wants up to two dma arrays per device. */
11#define LGUEST_MAX_DEVICES (LGUEST_MAX_DMA/2)
12
13/* Where the Host expects the Guest to SEND_DMA console output to. */
14#define LGUEST_CONSOLE_DMA_KEY 0
15 5
16/*D:010 6/*D:010
17 * Drivers 7 * Drivers
@@ -20,7 +10,11 @@
20 * real devices (think of the damage it could do!) we provide virtual devices. 10 * real devices (think of the damage it could do!) we provide virtual devices.
21 * We could emulate a PCI bus with various devices on it, but that is a fairly 11 * We could emulate a PCI bus with various devices on it, but that is a fairly
22 * complex burden for the Host and suboptimal for the Guest, so we have our own 12 * complex burden for the Host and suboptimal for the Guest, so we have our own
23 * "lguest" bus and simple drivers. 13 * simple lguest bus and we use "virtio" drivers. These drivers need a set of
14 * routines from us which will actually do the virtual I/O, but they handle all
15 * the net/block/console stuff themselves. This means that if we want to add
16 * a new device, we simply need to write a new virtio driver and create support
17 * for it in the Launcher: this code won't need to change.
24 * 18 *
25 * Devices are described by a simplified ID, a status byte, and some "config" 19 * Devices are described by a simplified ID, a status byte, and some "config"
26 * bytes which describe this device's configuration. This is placed by the 20 * bytes which describe this device's configuration. This is placed by the
@@ -51,9 +45,9 @@ struct lguest_vqconfig {
51/* Write command first word is a request. */ 45/* Write command first word is a request. */
52enum lguest_req 46enum lguest_req
53{ 47{
54 LHREQ_INITIALIZE, /* + pfnlimit, pgdir, start, pageoffset */ 48 LHREQ_INITIALIZE, /* + base, pfnlimit, pgdir, start */
55 LHREQ_GETDMA, /* No longer used */ 49 LHREQ_GETDMA, /* No longer used */
56 LHREQ_IRQ, /* + irq */ 50 LHREQ_IRQ, /* + irq */
57 LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */ 51 LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */
58}; 52};
59#endif /* _ASM_LGUEST_USER */ 53#endif /* _LINUX_LGUEST_LAUNCHER */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6fd24e03622e..1e277852ba42 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -133,11 +133,14 @@ enum {
133 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */ 133 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */
134 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */ 134 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */
135 ATA_DFLAG_AN = (1 << 7), /* AN configured */ 135 ATA_DFLAG_AN = (1 << 7), /* AN configured */
136 ATA_DFLAG_HIPM = (1 << 8), /* device supports HIPM */
137 ATA_DFLAG_DIPM = (1 << 9), /* device supports DIPM */
136 ATA_DFLAG_CFG_MASK = (1 << 12) - 1, 138 ATA_DFLAG_CFG_MASK = (1 << 12) - 1,
137 139
138 ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */ 140 ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */
139 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */ 141 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */
140 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ 142 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */
143 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
141 ATA_DFLAG_INIT_MASK = (1 << 16) - 1, 144 ATA_DFLAG_INIT_MASK = (1 << 16) - 1,
142 145
143 ATA_DFLAG_DETACH = (1 << 16), 146 ATA_DFLAG_DETACH = (1 << 16),
@@ -185,6 +188,7 @@ enum {
185 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 188 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
186 ATA_FLAG_AN = (1 << 18), /* controller supports AN */ 189 ATA_FLAG_AN = (1 << 18), /* controller supports AN */
187 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ 190 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
191 ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */
188 192
189 /* The following flag belongs to ap->pflags but is kept in 193 /* The following flag belongs to ap->pflags but is kept in
190 * ap->flags because it's referenced in many LLDs and will be 194 * ap->flags because it's referenced in many LLDs and will be
@@ -217,6 +221,7 @@ enum {
217 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */ 221 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */
218 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ 222 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */
219 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */ 223 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */
224 ATA_QCFLAG_QUIET = (1 << 6), /* don't report device error */
220 225
221 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */ 226 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */
222 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */ 227 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */
@@ -234,6 +239,13 @@ enum {
234 ATA_TMOUT_INTERNAL = 30 * HZ, 239 ATA_TMOUT_INTERNAL = 30 * HZ,
235 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ, 240 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ,
236 241
242 /* FIXME: GoVault needs 2s but we can't afford that without
243 * parallel probing. 800ms is enough for iVDR disk
244 * HHD424020F7SV00. Increase to 2secs when parallel probing
245 * is in place.
246 */
247 ATA_TMOUT_FF_WAIT = 4 * HZ / 5,
248
237 /* ATA bus states */ 249 /* ATA bus states */
238 BUS_UNKNOWN = 0, 250 BUS_UNKNOWN = 0,
239 BUS_DMA = 1, 251 BUS_DMA = 1,
@@ -294,6 +306,7 @@ enum {
294 ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */ 306 ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */
295 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ 307 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */
296 ATA_EHI_QUIET = (1 << 3), /* be quiet */ 308 ATA_EHI_QUIET = (1 << 3), /* be quiet */
309 ATA_EHI_LPM = (1 << 4), /* link power management action */
297 310
298 ATA_EHI_DID_SOFTRESET = (1 << 16), /* already soft-reset this port */ 311 ATA_EHI_DID_SOFTRESET = (1 << 16), /* already soft-reset this port */
299 ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */ 312 ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */
@@ -325,6 +338,7 @@ enum {
325 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */ 338 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */
326 ATA_HORKAGE_SKIP_PM = (1 << 5), /* Skip PM operations */ 339 ATA_HORKAGE_SKIP_PM = (1 << 5), /* Skip PM operations */
327 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */ 340 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */
341 ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */
328 342
329 /* DMA mask for user DMA control: User visible values; DO NOT 343 /* DMA mask for user DMA control: User visible values; DO NOT
330 renumber */ 344 renumber */
@@ -370,6 +384,18 @@ typedef int (*ata_reset_fn_t)(struct ata_link *link, unsigned int *classes,
370 unsigned long deadline); 384 unsigned long deadline);
371typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes); 385typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes);
372 386
387/*
388 * host pm policy: If you alter this, you also need to alter libata-scsi.c
389 * (for the ascii descriptions)
390 */
391enum link_pm {
392 NOT_AVAILABLE,
393 MIN_POWER,
394 MAX_PERFORMANCE,
395 MEDIUM_POWER,
396};
397extern struct class_device_attribute class_device_attr_link_power_management_policy;
398
373struct ata_ioports { 399struct ata_ioports {
374 void __iomem *cmd_addr; 400 void __iomem *cmd_addr;
375 void __iomem *data_addr; 401 void __iomem *data_addr;
@@ -616,6 +642,7 @@ struct ata_port {
616 642
617 pm_message_t pm_mesg; 643 pm_message_t pm_mesg;
618 int *pm_result; 644 int *pm_result;
645 enum link_pm pm_policy;
619 646
620 struct timer_list fastdrain_timer; 647 struct timer_list fastdrain_timer;
621 unsigned long fastdrain_cnt; 648 unsigned long fastdrain_cnt;
@@ -683,7 +710,8 @@ struct ata_port_operations {
683 710
684 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg); 711 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg);
685 int (*port_resume) (struct ata_port *ap); 712 int (*port_resume) (struct ata_port *ap);
686 713 int (*enable_pm) (struct ata_port *ap, enum link_pm policy);
714 void (*disable_pm) (struct ata_port *ap);
687 int (*port_start) (struct ata_port *ap); 715 int (*port_start) (struct ata_port *ap);
688 void (*port_stop) (struct ata_port *ap); 716 void (*port_stop) (struct ata_port *ap);
689 717
@@ -799,6 +827,7 @@ extern void ata_host_resume(struct ata_host *host);
799extern int ata_ratelimit(void); 827extern int ata_ratelimit(void);
800extern int ata_busy_sleep(struct ata_port *ap, 828extern int ata_busy_sleep(struct ata_port *ap,
801 unsigned long timeout_pat, unsigned long timeout); 829 unsigned long timeout_pat, unsigned long timeout);
830extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline);
802extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline); 831extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline);
803extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn, 832extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
804 void *data, unsigned long delay); 833 void *data, unsigned long delay);
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 3f272396642b..30e11aa3c1c9 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -8,6 +8,9 @@
8#define MV643XX_ETH_NAME "mv643xx_eth" 8#define MV643XX_ETH_NAME "mv643xx_eth"
9#define MV643XX_ETH_SHARED_REGS 0x2000 9#define MV643XX_ETH_SHARED_REGS 0x2000
10#define MV643XX_ETH_SHARED_REGS_SIZE 0x2000 10#define MV643XX_ETH_SHARED_REGS_SIZE 0x2000
11#define MV643XX_ETH_BAR_4 0x2220
12#define MV643XX_ETH_SIZE_REG_4 0x2224
13#define MV643XX_ETH_BASE_ADDR_ENABLE_REG 0x2290
11 14
12struct mv643xx_eth_platform_data { 15struct mv643xx_eth_platform_data {
13 int port_number; 16 int port_number;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c4de536cefa3..1e6af4f174b6 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -390,7 +390,7 @@ static inline void napi_complete(struct napi_struct *n)
390static inline void napi_disable(struct napi_struct *n) 390static inline void napi_disable(struct napi_struct *n)
391{ 391{
392 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) 392 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
393 msleep_interruptible(1); 393 msleep(1);
394} 394}
395 395
396/** 396/**
@@ -669,6 +669,8 @@ struct net_device
669#define HAVE_SET_MAC_ADDR 669#define HAVE_SET_MAC_ADDR
670 int (*set_mac_address)(struct net_device *dev, 670 int (*set_mac_address)(struct net_device *dev,
671 void *addr); 671 void *addr);
672#define HAVE_VALIDATE_ADDR
673 int (*validate_addr)(struct net_device *dev);
672#define HAVE_PRIVATE_IOCTL 674#define HAVE_PRIVATE_IOCTL
673 int (*do_ioctl)(struct net_device *dev, 675 int (*do_ioctl)(struct net_device *dev,
674 struct ifreq *ifr, int cmd); 676 struct ifreq *ifr, int cmd);
@@ -737,6 +739,16 @@ static inline void *netdev_priv(const struct net_device *dev)
737 */ 739 */
738#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) 740#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
739 741
742/**
743 * netif_napi_add - initialize a napi context
744 * @dev: network device
745 * @napi: napi context
746 * @poll: polling function
747 * @weight: default weight
748 *
749 * netif_napi_add() must be used to initialize a napi context prior to calling
750 * *any* of the other napi related functions.
751 */
740static inline void netif_napi_add(struct net_device *dev, 752static inline void netif_napi_add(struct net_device *dev,
741 struct napi_struct *napi, 753 struct napi_struct *napi,
742 int (*poll)(struct napi_struct *, int), 754 int (*poll)(struct napi_struct *, int),
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 4e10a074ca56..e44aac8cf5ff 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1236,6 +1236,10 @@
1236#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 1236#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560
1237#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C 1237#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C
1238#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 1238#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759
1239#define PCI_DEVICE_ID_NVIDIA_NVENET_32 0x0760
1240#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761
1241#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762
1242#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763
1239 1243
1240#define PCI_VENDOR_ID_IMS 0x10e0 1244#define PCI_VENDOR_ID_IMS 0x10e0
1241#define PCI_DEVICE_ID_IMS_TT128 0x9128 1245#define PCI_DEVICE_ID_IMS_TT128 0x9128
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index df7ddcee7c4b..32326c293d7b 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_SCATTERLIST_H 1#ifndef _LINUX_SCATTERLIST_H
2#define _LINUX_SCATTERLIST_H 2#define _LINUX_SCATTERLIST_H
3 3
4#include <asm/types.h>
4#include <asm/scatterlist.h> 5#include <asm/scatterlist.h>
5#include <linux/mm.h> 6#include <linux/mm.h>
6#include <linux/string.h> 7#include <linux/string.h>
@@ -26,18 +27,16 @@
26#define SG_MAGIC 0x87654321 27#define SG_MAGIC 0x87654321
27 28
28/** 29/**
29 * sg_set_page - Set sg entry to point at given page 30 * sg_assign_page - Assign a given page to an SG entry
30 * @sg: SG entry 31 * @sg: SG entry
31 * @page: The page 32 * @page: The page
32 * 33 *
33 * Description: 34 * Description:
34 * Use this function to set an sg entry pointing at a page, never assign 35 * Assign page to sg entry. Also see sg_set_page(), the most commonly used
35 * the page directly. We encode sg table information in the lower bits 36 * variant.
36 * of the page pointer. See sg_page() for looking up the page belonging
37 * to an sg entry.
38 * 37 *
39 **/ 38 **/
40static inline void sg_set_page(struct scatterlist *sg, struct page *page) 39static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
41{ 40{
42 unsigned long page_link = sg->page_link & 0x3; 41 unsigned long page_link = sg->page_link & 0x3;
43 42
@@ -52,6 +51,28 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page)
52 sg->page_link = page_link | (unsigned long) page; 51 sg->page_link = page_link | (unsigned long) page;
53} 52}
54 53
54/**
55 * sg_set_page - Set sg entry to point at given page
56 * @sg: SG entry
57 * @page: The page
58 * @len: Length of data
59 * @offset: Offset into page
60 *
61 * Description:
62 * Use this function to set an sg entry pointing at a page, never assign
63 * the page directly. We encode sg table information in the lower bits
64 * of the page pointer. See sg_page() for looking up the page belonging
65 * to an sg entry.
66 *
67 **/
68static inline void sg_set_page(struct scatterlist *sg, struct page *page,
69 unsigned int len, unsigned int offset)
70{
71 sg_assign_page(sg, page);
72 sg->offset = offset;
73 sg->length = len;
74}
75
55#define sg_page(sg) ((struct page *) ((sg)->page_link & ~0x3)) 76#define sg_page(sg) ((struct page *) ((sg)->page_link & ~0x3))
56 77
57/** 78/**
@@ -64,9 +85,7 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page)
64static inline void sg_set_buf(struct scatterlist *sg, const void *buf, 85static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
65 unsigned int buflen) 86 unsigned int buflen)
66{ 87{
67 sg_set_page(sg, virt_to_page(buf)); 88 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
68 sg->offset = offset_in_page(buf);
69 sg->length = buflen;
70} 89}
71 90
72/* 91/*
@@ -131,7 +150,7 @@ static inline struct scatterlist *sg_last(struct scatterlist *sgl,
131 struct scatterlist *ret = &sgl[nents - 1]; 150 struct scatterlist *ret = &sgl[nents - 1];
132#else 151#else
133 struct scatterlist *sg, *ret = NULL; 152 struct scatterlist *sg, *ret = NULL;
134 int i; 153 unsigned int i;
135 154
136 for_each_sg(sgl, sg, nents, i) 155 for_each_sg(sgl, sg, nents, i)
137 ret = sg; 156 ret = sg;
@@ -160,7 +179,11 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
160#ifndef ARCH_HAS_SG_CHAIN 179#ifndef ARCH_HAS_SG_CHAIN
161 BUG(); 180 BUG();
162#endif 181#endif
163 prv[prv_nents - 1].page_link = (unsigned long) sgl | 0x01; 182 /*
183 * Set lowest bit to indicate a link pointer, and make sure to clear
184 * the termination bit if it happens to be set.
185 */
186 prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02;
164} 187}
165 188
166/** 189/**
@@ -220,7 +243,7 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
220 sg_mark_end(sgl, nents); 243 sg_mark_end(sgl, nents);
221#ifdef CONFIG_DEBUG_SG 244#ifdef CONFIG_DEBUG_SG
222 { 245 {
223 int i; 246 unsigned int i;
224 for (i = 0; i < nents; i++) 247 for (i = 0; i < nents; i++)
225 sgl[i].sg_magic = SG_MAGIC; 248 sgl[i].sg_magic = SG_MAGIC;
226 } 249 }
@@ -237,7 +260,7 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
237 * on the sg page. 260 * on the sg page.
238 * 261 *
239 **/ 262 **/
240static inline unsigned long sg_phys(struct scatterlist *sg) 263static inline dma_addr_t sg_phys(struct scatterlist *sg)
241{ 264{
242 return page_to_phys(sg_page(sg)) + sg->offset; 265 return page_to_phys(sg_page(sg)) + sg->offset;
243} 266}
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 13df99fb2769..155d7438f7ad 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -828,12 +828,17 @@ struct sched_class {
828 struct task_struct * (*pick_next_task) (struct rq *rq); 828 struct task_struct * (*pick_next_task) (struct rq *rq);
829 void (*put_prev_task) (struct rq *rq, struct task_struct *p); 829 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
830 830
831#ifdef CONFIG_SMP
831 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu, 832 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
832 struct rq *busiest, 833 struct rq *busiest, unsigned long max_load_move,
833 unsigned long max_nr_move, unsigned long max_load_move,
834 struct sched_domain *sd, enum cpu_idle_type idle, 834 struct sched_domain *sd, enum cpu_idle_type idle,
835 int *all_pinned, int *this_best_prio); 835 int *all_pinned, int *this_best_prio);
836 836
837 int (*move_one_task) (struct rq *this_rq, int this_cpu,
838 struct rq *busiest, struct sched_domain *sd,
839 enum cpu_idle_type idle);
840#endif
841
837 void (*set_curr_task) (struct rq *rq); 842 void (*set_curr_task) (struct rq *rq);
838 void (*task_tick) (struct rq *rq, struct task_struct *p); 843 void (*task_tick) (struct rq *rq, struct task_struct *p);
839 void (*task_new) (struct rq *rq, struct task_struct *p); 844 void (*task_new) (struct rq *rq, struct task_struct *p);
@@ -1004,6 +1009,7 @@ struct task_struct {
1004 unsigned int rt_priority; 1009 unsigned int rt_priority;
1005 cputime_t utime, stime, utimescaled, stimescaled; 1010 cputime_t utime, stime, utimescaled, stimescaled;
1006 cputime_t gtime; 1011 cputime_t gtime;
1012 cputime_t prev_utime, prev_stime;
1007 unsigned long nvcsw, nivcsw; /* context switch counts */ 1013 unsigned long nvcsw, nivcsw; /* context switch counts */
1008 struct timespec start_time; /* monotonic time */ 1014 struct timespec start_time; /* monotonic time */
1009 struct timespec real_start_time; /* boot based time */ 1015 struct timespec real_start_time; /* boot based time */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index fd4e12f24270..94e49915a8c0 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -994,7 +994,7 @@ static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
994 * 994 *
995 * Return the number of bytes of free space at the head of an &sk_buff. 995 * Return the number of bytes of free space at the head of an &sk_buff.
996 */ 996 */
997static inline int skb_headroom(const struct sk_buff *skb) 997static inline unsigned int skb_headroom(const struct sk_buff *skb)
998{ 998{
999 return skb->data - skb->head; 999 return skb->data - skb->head;
1000} 1000}
@@ -1347,7 +1347,7 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1347 * Returns true if modifying the header part of the cloned buffer 1347 * Returns true if modifying the header part of the cloned buffer
1348 * does not requires the data to be copied. 1348 * does not requires the data to be copied.
1349 */ 1349 */
1350static inline int skb_clone_writable(struct sk_buff *skb, int len) 1350static inline int skb_clone_writable(struct sk_buff *skb, unsigned int len)
1351{ 1351{
1352 return !skb_header_cloned(skb) && 1352 return !skb_header_cloned(skb) &&
1353 skb_headroom(skb) + len <= skb->hdr_len; 1353 skb_headroom(skb) + len <= skb->hdr_len;
diff --git a/include/linux/string.h b/include/linux/string.h
index 836062b7582a..c5d3fcad7b57 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -3,16 +3,14 @@
3 3
4/* We don't want strings.h stuff being user by user stuff by accident */ 4/* We don't want strings.h stuff being user by user stuff by accident */
5 5
6#ifdef __KERNEL__ 6#ifndef __KERNEL__
7#include <string.h>
8#else
7 9
8#include <linux/compiler.h> /* for inline */ 10#include <linux/compiler.h> /* for inline */
9#include <linux/types.h> /* for size_t */ 11#include <linux/types.h> /* for size_t */
10#include <linux/stddef.h> /* for NULL */ 12#include <linux/stddef.h> /* for NULL */
11 13
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16extern char *strndup_user(const char __user *, long); 14extern char *strndup_user(const char __user *, long);
17 15
18/* 16/*
@@ -111,9 +109,5 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
111extern char **argv_split(gfp_t gfp, const char *str, int *argcp); 109extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
112extern void argv_free(char **argv); 110extern void argv_free(char **argv);
113 111
114#ifdef __cplusplus
115}
116#endif
117
118#endif 112#endif
119#endif /* _LINUX_STRING_H_ */ 113#endif /* _LINUX_STRING_H_ */
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h
index 0013a0d8dc6b..87b895d5c786 100644
--- a/include/linux/sunrpc/rpc_rdma.h
+++ b/include/linux/sunrpc/rpc_rdma.h
@@ -41,17 +41,17 @@
41#define _LINUX_SUNRPC_RPC_RDMA_H 41#define _LINUX_SUNRPC_RPC_RDMA_H
42 42
43struct rpcrdma_segment { 43struct rpcrdma_segment {
44 uint32_t rs_handle; /* Registered memory handle */ 44 __be32 rs_handle; /* Registered memory handle */
45 uint32_t rs_length; /* Length of the chunk in bytes */ 45 __be32 rs_length; /* Length of the chunk in bytes */
46 uint64_t rs_offset; /* Chunk virtual address or offset */ 46 __be64 rs_offset; /* Chunk virtual address or offset */
47}; 47};
48 48
49/* 49/*
50 * read chunk(s), encoded as a linked list. 50 * read chunk(s), encoded as a linked list.
51 */ 51 */
52struct rpcrdma_read_chunk { 52struct rpcrdma_read_chunk {
53 uint32_t rc_discrim; /* 1 indicates presence */ 53 __be32 rc_discrim; /* 1 indicates presence */
54 uint32_t rc_position; /* Position in XDR stream */ 54 __be32 rc_position; /* Position in XDR stream */
55 struct rpcrdma_segment rc_target; 55 struct rpcrdma_segment rc_target;
56}; 56};
57 57
@@ -66,29 +66,29 @@ struct rpcrdma_write_chunk {
66 * write chunk(s), encoded as a counted array. 66 * write chunk(s), encoded as a counted array.
67 */ 67 */
68struct rpcrdma_write_array { 68struct rpcrdma_write_array {
69 uint32_t wc_discrim; /* 1 indicates presence */ 69 __be32 wc_discrim; /* 1 indicates presence */
70 uint32_t wc_nchunks; /* Array count */ 70 __be32 wc_nchunks; /* Array count */
71 struct rpcrdma_write_chunk wc_array[0]; 71 struct rpcrdma_write_chunk wc_array[0];
72}; 72};
73 73
74struct rpcrdma_msg { 74struct rpcrdma_msg {
75 uint32_t rm_xid; /* Mirrors the RPC header xid */ 75 __be32 rm_xid; /* Mirrors the RPC header xid */
76 uint32_t rm_vers; /* Version of this protocol */ 76 __be32 rm_vers; /* Version of this protocol */
77 uint32_t rm_credit; /* Buffers requested/granted */ 77 __be32 rm_credit; /* Buffers requested/granted */
78 uint32_t rm_type; /* Type of message (enum rpcrdma_proc) */ 78 __be32 rm_type; /* Type of message (enum rpcrdma_proc) */
79 union { 79 union {
80 80
81 struct { /* no chunks */ 81 struct { /* no chunks */
82 uint32_t rm_empty[3]; /* 3 empty chunk lists */ 82 __be32 rm_empty[3]; /* 3 empty chunk lists */
83 } rm_nochunks; 83 } rm_nochunks;
84 84
85 struct { /* no chunks and padded */ 85 struct { /* no chunks and padded */
86 uint32_t rm_align; /* Padding alignment */ 86 __be32 rm_align; /* Padding alignment */
87 uint32_t rm_thresh; /* Padding threshold */ 87 __be32 rm_thresh; /* Padding threshold */
88 uint32_t rm_pempty[3]; /* 3 empty chunk lists */ 88 __be32 rm_pempty[3]; /* 3 empty chunk lists */
89 } rm_padded; 89 } rm_padded;
90 90
91 uint32_t rm_chunks[0]; /* read, write and reply chunks */ 91 __be32 rm_chunks[0]; /* read, write and reply chunks */
92 92
93 } rm_body; 93 } rm_body;
94}; 94};
diff --git a/include/linux/types.h b/include/linux/types.h
index 4f0dad21c917..f4f8d19158e4 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -37,6 +37,8 @@ typedef __kernel_gid32_t gid_t;
37typedef __kernel_uid16_t uid16_t; 37typedef __kernel_uid16_t uid16_t;
38typedef __kernel_gid16_t gid16_t; 38typedef __kernel_gid16_t gid16_t;
39 39
40typedef unsigned long uintptr_t;
41
40#ifdef CONFIG_UID16 42#ifdef CONFIG_UID16
41/* This is defined by include/asm-{arch}/posix_types.h */ 43/* This is defined by include/asm-{arch}/posix_types.h */
42typedef __kernel_old_uid_t old_uid_t; 44typedef __kernel_old_uid_t old_uid_t;
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 8228b57eb18f..4427dcd1e53a 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -26,7 +26,6 @@
26 26
27#include <net/inet_connection_sock.h> 27#include <net/inet_connection_sock.h>
28#include <net/inet_sock.h> 28#include <net/inet_sock.h>
29#include <net/route.h>
30#include <net/sock.h> 29#include <net/sock.h>
31#include <net/tcp_states.h> 30#include <net/tcp_states.h>
32 31
@@ -266,11 +265,6 @@ out:
266 wake_up(&hashinfo->lhash_wait); 265 wake_up(&hashinfo->lhash_wait);
267} 266}
268 267
269static inline int inet_iif(const struct sk_buff *skb)
270{
271 return ((struct rtable *)skb->dst)->rt_iif;
272}
273
274extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, 268extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo,
275 const __be32 daddr, 269 const __be32 daddr,
276 const unsigned short hnum, 270 const unsigned short hnum,
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 62daf214931f..70013c5f4e59 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -24,6 +24,7 @@
24#include <net/flow.h> 24#include <net/flow.h>
25#include <net/sock.h> 25#include <net/sock.h>
26#include <net/request_sock.h> 26#include <net/request_sock.h>
27#include <net/route.h>
27 28
28/** struct ip_options - IP Options 29/** struct ip_options - IP Options
29 * 30 *
@@ -190,4 +191,10 @@ static inline int inet_sk_ehashfn(const struct sock *sk)
190 return inet_ehashfn(laddr, lport, faddr, fport); 191 return inet_ehashfn(laddr, lport, faddr, fport);
191} 192}
192 193
194
195static inline int inet_iif(const struct sk_buff *skb)
196{
197 return ((struct rtable *)skb->dst)->rt_iif;
198}
199
193#endif /* _INET_SOCK_H */ 200#endif /* _INET_SOCK_H */
diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h
index 8dabdd603fe1..eea2e6152389 100644
--- a/include/net/irda/ircomm_tty.h
+++ b/include/net/irda/ircomm_tty.h
@@ -127,7 +127,6 @@ extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
127 unsigned int cmd, unsigned long arg); 127 unsigned int cmd, unsigned long arg);
128extern void ircomm_tty_set_termios(struct tty_struct *tty, 128extern void ircomm_tty_set_termios(struct tty_struct *tty,
129 struct ktermios *old_termios); 129 struct ktermios *old_termios);
130extern hashbin_t *ircomm_tty;
131 130
132#endif 131#endif
133 132
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 93aa87d32804..1fd449a6530b 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -51,13 +51,12 @@ static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns)
51} 51}
52#endif 52#endif
53 53
54#ifdef CONFIG_NET_NS
54extern void __put_net(struct net *net); 55extern void __put_net(struct net *net);
55 56
56static inline struct net *get_net(struct net *net) 57static inline struct net *get_net(struct net *net)
57{ 58{
58#ifdef CONFIG_NET
59 atomic_inc(&net->count); 59 atomic_inc(&net->count);
60#endif
61 return net; 60 return net;
62} 61}
63 62
@@ -75,26 +74,44 @@ static inline struct net *maybe_get_net(struct net *net)
75 74
76static inline void put_net(struct net *net) 75static inline void put_net(struct net *net)
77{ 76{
78#ifdef CONFIG_NET
79 if (atomic_dec_and_test(&net->count)) 77 if (atomic_dec_and_test(&net->count))
80 __put_net(net); 78 __put_net(net);
81#endif
82} 79}
83 80
84static inline struct net *hold_net(struct net *net) 81static inline struct net *hold_net(struct net *net)
85{ 82{
86#ifdef CONFIG_NET
87 atomic_inc(&net->use_count); 83 atomic_inc(&net->use_count);
88#endif
89 return net; 84 return net;
90} 85}
91 86
92static inline void release_net(struct net *net) 87static inline void release_net(struct net *net)
93{ 88{
94#ifdef CONFIG_NET
95 atomic_dec(&net->use_count); 89 atomic_dec(&net->use_count);
96#endif
97} 90}
91#else
92static inline struct net *get_net(struct net *net)
93{
94 return net;
95}
96
97static inline void put_net(struct net *net)
98{
99}
100
101static inline struct net *hold_net(struct net *net)
102{
103 return net;
104}
105
106static inline void release_net(struct net *net)
107{
108}
109
110static inline struct net *maybe_get_net(struct net *net)
111{
112 return net;
113}
114#endif
98 115
99#define for_each_net(VAR) \ 116#define for_each_net(VAR) \
100 list_for_each_entry(VAR, &net_namespace_list, list) 117 list_for_each_entry(VAR, &net_namespace_list, list)
@@ -102,11 +119,9 @@ static inline void release_net(struct net *net)
102#ifdef CONFIG_NET_NS 119#ifdef CONFIG_NET_NS
103#define __net_init 120#define __net_init
104#define __net_exit 121#define __net_exit
105#define __net_initdata
106#else 122#else
107#define __net_init __init 123#define __net_init __init
108#define __net_exit __exit_refok 124#define __net_exit __exit_refok
109#define __net_initdata __initdata
110#endif 125#endif
111 126
112struct pernet_operations { 127struct pernet_operations {
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index a02ec9e5fea5..c9265518a378 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -316,4 +316,19 @@ static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen)
316 return rtab->data[slot]; 316 return rtab->data[slot];
317} 317}
318 318
319#ifdef CONFIG_NET_CLS_ACT
320static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask)
321{
322 struct sk_buff *n = skb_clone(skb, gfp_mask);
323
324 if (n) {
325 n->tc_verd = SET_TC_VERD(n->tc_verd, 0);
326 n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd);
327 n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
328 n->iif = skb->iif;
329 }
330 return n;
331}
332#endif
333
319#endif 334#endif
diff --git a/include/net/sctp/auth.h b/include/net/sctp/auth.h
index 4945954a16af..5db261a1e85e 100644
--- a/include/net/sctp/auth.h
+++ b/include/net/sctp/auth.h
@@ -88,7 +88,6 @@ static inline void sctp_auth_key_hold(struct sctp_auth_bytes *key)
88 88
89void sctp_auth_key_put(struct sctp_auth_bytes *key); 89void sctp_auth_key_put(struct sctp_auth_bytes *key);
90struct sctp_shared_key *sctp_auth_shkey_create(__u16 key_id, gfp_t gfp); 90struct sctp_shared_key *sctp_auth_shkey_create(__u16 key_id, gfp_t gfp);
91void sctp_auth_shkey_free(struct sctp_shared_key *sh_key);
92void sctp_auth_destroy_keys(struct list_head *keys); 91void sctp_auth_destroy_keys(struct list_head *keys);
93int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp); 92int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp);
94struct sctp_shared_key *sctp_auth_get_shkey( 93struct sctp_shared_key *sctp_auth_get_shkey(
@@ -104,7 +103,7 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc);
104void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc, 103void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc,
105 struct sctp_hmac_algo_param *hmacs); 104 struct sctp_hmac_algo_param *hmacs);
106int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc, 105int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc,
107 __u16 hmac_id); 106 __be16 hmac_id);
108int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc); 107int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc);
109int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc); 108int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc);
110void sctp_auth_calculate_hmac(const struct sctp_association *asoc, 109void sctp_auth_calculate_hmac(const struct sctp_association *asoc,
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 119f5a1ed499..93eb708609e7 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -156,7 +156,6 @@ int sctp_primitive_ASCONF(struct sctp_association *, void *arg);
156__u32 sctp_start_cksum(__u8 *ptr, __u16 count); 156__u32 sctp_start_cksum(__u8 *ptr, __u16 count);
157__u32 sctp_update_cksum(__u8 *ptr, __u16 count, __u32 cksum); 157__u32 sctp_update_cksum(__u8 *ptr, __u16 count, __u32 cksum);
158__u32 sctp_end_cksum(__u32 cksum); 158__u32 sctp_end_cksum(__u32 cksum);
159__u32 sctp_update_copy_cksum(__u8 *, __u8 *, __u16 count, __u32 cksum);
160 159
161/* 160/*
162 * sctp/input.c 161 * sctp/input.c
diff --git a/include/net/sock.h b/include/net/sock.h
index 43fc3fa50d62..20de3fa7ae40 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -779,7 +779,7 @@ extern void FASTCALL(release_sock(struct sock *sk));
779 779
780extern struct sock *sk_alloc(struct net *net, int family, 780extern struct sock *sk_alloc(struct net *net, int family,
781 gfp_t priority, 781 gfp_t priority,
782 struct proto *prot, int zero_it); 782 struct proto *prot);
783extern void sk_free(struct sock *sk); 783extern void sk_free(struct sock *sk);
784extern struct sock *sk_clone(const struct sock *sk, 784extern struct sock *sk_clone(const struct sock *sk,
785 const gfp_t priority); 785 const gfp_t priority);
@@ -993,20 +993,6 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
993 write_unlock_bh(&sk->sk_callback_lock); 993 write_unlock_bh(&sk->sk_callback_lock);
994} 994}
995 995
996static inline void sock_copy(struct sock *nsk, const struct sock *osk)
997{
998#ifdef CONFIG_SECURITY_NETWORK
999 void *sptr = nsk->sk_security;
1000#endif
1001
1002 memcpy(nsk, osk, osk->sk_prot->obj_size);
1003 get_net(nsk->sk_net);
1004#ifdef CONFIG_SECURITY_NETWORK
1005 nsk->sk_security = sptr;
1006 security_sk_clone(osk, nsk);
1007#endif
1008}
1009
1010extern int sock_i_uid(struct sock *sk); 996extern int sock_i_uid(struct sock *sk);
1011extern unsigned long sock_i_ino(struct sock *sk); 997extern unsigned long sock_i_ino(struct sock *sk);
1012 998
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 92049e681258..d695cea7730d 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -803,7 +803,7 @@ static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight)
803 return left <= tcp_max_burst(tp); 803 return left <= tcp_max_burst(tp);
804} 804}
805 805
806static inline void tcp_minshall_update(struct tcp_sock *tp, int mss, 806static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss,
807 const struct sk_buff *skb) 807 const struct sk_buff *skb)
808{ 808{
809 if (skb->len < mss) 809 if (skb->len < mss)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 688f6f5d3285..58dfa82889aa 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -37,6 +37,8 @@
37extern struct sock *xfrm_nl; 37extern struct sock *xfrm_nl;
38extern u32 sysctl_xfrm_aevent_etime; 38extern u32 sysctl_xfrm_aevent_etime;
39extern u32 sysctl_xfrm_aevent_rseqth; 39extern u32 sysctl_xfrm_aevent_rseqth;
40extern int sysctl_xfrm_larval_drop;
41extern u32 sysctl_xfrm_acq_expires;
40 42
41extern struct mutex xfrm_cfg_mutex; 43extern struct mutex xfrm_cfg_mutex;
42 44
diff --git a/init/Kconfig b/init/Kconfig
index b7dffa837926..8b88d0bedcbd 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -322,7 +322,6 @@ config CPUSETS
322config FAIR_GROUP_SCHED 322config FAIR_GROUP_SCHED
323 bool "Fair group CPU scheduler" 323 bool "Fair group CPU scheduler"
324 default y 324 default y
325 depends on EXPERIMENTAL
326 help 325 help
327 This feature lets CPU scheduler recognize task groups and control CPU 326 This feature lets CPU scheduler recognize task groups and control CPU
328 bandwidth allocation to such task groups. 327 bandwidth allocation to such task groups.
diff --git a/kernel/fork.c b/kernel/fork.c
index ddafdfac9456..28a740151988 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1056,6 +1056,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1056 p->gtime = cputime_zero; 1056 p->gtime = cputime_zero;
1057 p->utimescaled = cputime_zero; 1057 p->utimescaled = cputime_zero;
1058 p->stimescaled = cputime_zero; 1058 p->stimescaled = cputime_zero;
1059 p->prev_utime = cputime_zero;
1060 p->prev_stime = cputime_zero;
1059 1061
1060#ifdef CONFIG_TASK_XACCT 1062#ifdef CONFIG_TASK_XACCT
1061 p->rchar = 0; /* I/O counter: bytes read */ 1063 p->rchar = 0; /* I/O counter: bytes read */
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index b6d2ff7e37ee..22a25142e4cf 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -602,7 +602,7 @@ static int hrtimer_switch_to_hres(void)
602 /* "Retrigger" the interrupt to get things going */ 602 /* "Retrigger" the interrupt to get things going */
603 retrigger_next_event(NULL); 603 retrigger_next_event(NULL);
604 local_irq_restore(flags); 604 local_irq_restore(flags);
605 printk(KERN_INFO "Switched to high resolution mode on CPU %d\n", 605 printk(KERN_DEBUG "Switched to high resolution mode on CPU %d\n",
606 smp_processor_id()); 606 smp_processor_id());
607 return 1; 607 return 1;
608} 608}
diff --git a/kernel/profile.c b/kernel/profile.c
index 631b75c25d7e..5e95330e5120 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -60,6 +60,7 @@ static int __init profile_setup(char * str)
60 int par; 60 int par;
61 61
62 if (!strncmp(str, sleepstr, strlen(sleepstr))) { 62 if (!strncmp(str, sleepstr, strlen(sleepstr))) {
63#ifdef CONFIG_SCHEDSTATS
63 prof_on = SLEEP_PROFILING; 64 prof_on = SLEEP_PROFILING;
64 if (str[strlen(sleepstr)] == ',') 65 if (str[strlen(sleepstr)] == ',')
65 str += strlen(sleepstr) + 1; 66 str += strlen(sleepstr) + 1;
@@ -68,6 +69,10 @@ static int __init profile_setup(char * str)
68 printk(KERN_INFO 69 printk(KERN_INFO
69 "kernel sleep profiling enabled (shift: %ld)\n", 70 "kernel sleep profiling enabled (shift: %ld)\n",
70 prof_shift); 71 prof_shift);
72#else
73 printk(KERN_WARNING
74 "kernel sleep profiling requires CONFIG_SCHEDSTATS\n");
75#endif /* CONFIG_SCHEDSTATS */
71 } else if (!strncmp(str, schedstr, strlen(schedstr))) { 76 } else if (!strncmp(str, schedstr, strlen(schedstr))) {
72 prof_on = SCHED_PROFILING; 77 prof_on = SCHED_PROFILING;
73 if (str[strlen(schedstr)] == ',') 78 if (str[strlen(schedstr)] == ',')
diff --git a/kernel/sched.c b/kernel/sched.c
index 2810e562a991..3f6bd1112900 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -66,6 +66,7 @@
66#include <linux/pagemap.h> 66#include <linux/pagemap.h>
67 67
68#include <asm/tlb.h> 68#include <asm/tlb.h>
69#include <asm/irq_regs.h>
69 70
70/* 71/*
71 * Scheduler clock - returns current time in nanosec units. 72 * Scheduler clock - returns current time in nanosec units.
@@ -171,6 +172,7 @@ struct task_group {
171 unsigned long shares; 172 unsigned long shares;
172 /* spinlock to serialize modification to shares */ 173 /* spinlock to serialize modification to shares */
173 spinlock_t lock; 174 spinlock_t lock;
175 struct rcu_head rcu;
174}; 176};
175 177
176/* Default task group's sched entity on each cpu */ 178/* Default task group's sched entity on each cpu */
@@ -257,7 +259,6 @@ struct cfs_rq {
257 */ 259 */
258 struct list_head leaf_cfs_rq_list; /* Better name : task_cfs_rq_list? */ 260 struct list_head leaf_cfs_rq_list; /* Better name : task_cfs_rq_list? */
259 struct task_group *tg; /* group that "owns" this runqueue */ 261 struct task_group *tg; /* group that "owns" this runqueue */
260 struct rcu_head rcu;
261#endif 262#endif
262}; 263};
263 264
@@ -837,11 +838,18 @@ struct rq_iterator {
837 struct task_struct *(*next)(void *); 838 struct task_struct *(*next)(void *);
838}; 839};
839 840
840static int balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest, 841#ifdef CONFIG_SMP
841 unsigned long max_nr_move, unsigned long max_load_move, 842static unsigned long
842 struct sched_domain *sd, enum cpu_idle_type idle, 843balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
843 int *all_pinned, unsigned long *load_moved, 844 unsigned long max_load_move, struct sched_domain *sd,
844 int *this_best_prio, struct rq_iterator *iterator); 845 enum cpu_idle_type idle, int *all_pinned,
846 int *this_best_prio, struct rq_iterator *iterator);
847
848static int
849iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
850 struct sched_domain *sd, enum cpu_idle_type idle,
851 struct rq_iterator *iterator);
852#endif
845 853
846#include "sched_stats.h" 854#include "sched_stats.h"
847#include "sched_idletask.c" 855#include "sched_idletask.c"
@@ -2223,17 +2231,17 @@ int can_migrate_task(struct task_struct *p, struct rq *rq, int this_cpu,
2223 return 1; 2231 return 1;
2224} 2232}
2225 2233
2226static int balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest, 2234static unsigned long
2227 unsigned long max_nr_move, unsigned long max_load_move, 2235balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
2228 struct sched_domain *sd, enum cpu_idle_type idle, 2236 unsigned long max_load_move, struct sched_domain *sd,
2229 int *all_pinned, unsigned long *load_moved, 2237 enum cpu_idle_type idle, int *all_pinned,
2230 int *this_best_prio, struct rq_iterator *iterator) 2238 int *this_best_prio, struct rq_iterator *iterator)
2231{ 2239{
2232 int pulled = 0, pinned = 0, skip_for_load; 2240 int pulled = 0, pinned = 0, skip_for_load;
2233 struct task_struct *p; 2241 struct task_struct *p;
2234 long rem_load_move = max_load_move; 2242 long rem_load_move = max_load_move;
2235 2243
2236 if (max_nr_move == 0 || max_load_move == 0) 2244 if (max_load_move == 0)
2237 goto out; 2245 goto out;
2238 2246
2239 pinned = 1; 2247 pinned = 1;
@@ -2266,7 +2274,7 @@ next:
2266 * We only want to steal up to the prescribed number of tasks 2274 * We only want to steal up to the prescribed number of tasks
2267 * and the prescribed amount of weighted load. 2275 * and the prescribed amount of weighted load.
2268 */ 2276 */
2269 if (pulled < max_nr_move && rem_load_move > 0) { 2277 if (rem_load_move > 0) {
2270 if (p->prio < *this_best_prio) 2278 if (p->prio < *this_best_prio)
2271 *this_best_prio = p->prio; 2279 *this_best_prio = p->prio;
2272 p = iterator->next(iterator->arg); 2280 p = iterator->next(iterator->arg);
@@ -2274,7 +2282,7 @@ next:
2274 } 2282 }
2275out: 2283out:
2276 /* 2284 /*
2277 * Right now, this is the only place pull_task() is called, 2285 * Right now, this is one of only two places pull_task() is called,
2278 * so we can safely collect pull_task() stats here rather than 2286 * so we can safely collect pull_task() stats here rather than
2279 * inside pull_task(). 2287 * inside pull_task().
2280 */ 2288 */
@@ -2282,8 +2290,8 @@ out:
2282 2290
2283 if (all_pinned) 2291 if (all_pinned)
2284 *all_pinned = pinned; 2292 *all_pinned = pinned;
2285 *load_moved = max_load_move - rem_load_move; 2293
2286 return pulled; 2294 return max_load_move - rem_load_move;
2287} 2295}
2288 2296
2289/* 2297/*
@@ -2305,7 +2313,7 @@ static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
2305 do { 2313 do {
2306 total_load_moved += 2314 total_load_moved +=
2307 class->load_balance(this_rq, this_cpu, busiest, 2315 class->load_balance(this_rq, this_cpu, busiest,
2308 ULONG_MAX, max_load_move - total_load_moved, 2316 max_load_move - total_load_moved,
2309 sd, idle, all_pinned, &this_best_prio); 2317 sd, idle, all_pinned, &this_best_prio);
2310 class = class->next; 2318 class = class->next;
2311 } while (class && max_load_move > total_load_moved); 2319 } while (class && max_load_move > total_load_moved);
@@ -2313,6 +2321,32 @@ static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
2313 return total_load_moved > 0; 2321 return total_load_moved > 0;
2314} 2322}
2315 2323
2324static int
2325iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
2326 struct sched_domain *sd, enum cpu_idle_type idle,
2327 struct rq_iterator *iterator)
2328{
2329 struct task_struct *p = iterator->start(iterator->arg);
2330 int pinned = 0;
2331
2332 while (p) {
2333 if (can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
2334 pull_task(busiest, p, this_rq, this_cpu);
2335 /*
2336 * Right now, this is only the second place pull_task()
2337 * is called, so we can safely collect pull_task()
2338 * stats here rather than inside pull_task().
2339 */
2340 schedstat_inc(sd, lb_gained[idle]);
2341
2342 return 1;
2343 }
2344 p = iterator->next(iterator->arg);
2345 }
2346
2347 return 0;
2348}
2349
2316/* 2350/*
2317 * move_one_task tries to move exactly one task from busiest to this_rq, as 2351 * move_one_task tries to move exactly one task from busiest to this_rq, as
2318 * part of active balancing operations within "domain". 2352 * part of active balancing operations within "domain".
@@ -2324,12 +2358,9 @@ static int move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
2324 struct sched_domain *sd, enum cpu_idle_type idle) 2358 struct sched_domain *sd, enum cpu_idle_type idle)
2325{ 2359{
2326 const struct sched_class *class; 2360 const struct sched_class *class;
2327 int this_best_prio = MAX_PRIO;
2328 2361
2329 for (class = sched_class_highest; class; class = class->next) 2362 for (class = sched_class_highest; class; class = class->next)
2330 if (class->load_balance(this_rq, this_cpu, busiest, 2363 if (class->move_one_task(this_rq, this_cpu, busiest, sd, idle))
2331 1, ULONG_MAX, sd, idle, NULL,
2332 &this_best_prio))
2333 return 1; 2364 return 1;
2334 2365
2335 return 0; 2366 return 0;
@@ -3266,18 +3297,6 @@ static inline void idle_balance(int cpu, struct rq *rq)
3266{ 3297{
3267} 3298}
3268 3299
3269/* Avoid "used but not defined" warning on UP */
3270static int balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
3271 unsigned long max_nr_move, unsigned long max_load_move,
3272 struct sched_domain *sd, enum cpu_idle_type idle,
3273 int *all_pinned, unsigned long *load_moved,
3274 int *this_best_prio, struct rq_iterator *iterator)
3275{
3276 *load_moved = 0;
3277
3278 return 0;
3279}
3280
3281#endif 3300#endif
3282 3301
3283DEFINE_PER_CPU(struct kernel_stat, kstat); 3302DEFINE_PER_CPU(struct kernel_stat, kstat);
@@ -3336,7 +3355,7 @@ void account_user_time(struct task_struct *p, cputime_t cputime)
3336 * @p: the process that the cpu time gets accounted to 3355 * @p: the process that the cpu time gets accounted to
3337 * @cputime: the cpu time spent in virtual machine since the last update 3356 * @cputime: the cpu time spent in virtual machine since the last update
3338 */ 3357 */
3339void account_guest_time(struct task_struct *p, cputime_t cputime) 3358static void account_guest_time(struct task_struct *p, cputime_t cputime)
3340{ 3359{
3341 cputime64_t tmp; 3360 cputime64_t tmp;
3342 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat; 3361 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
@@ -3507,12 +3526,19 @@ EXPORT_SYMBOL(sub_preempt_count);
3507 */ 3526 */
3508static noinline void __schedule_bug(struct task_struct *prev) 3527static noinline void __schedule_bug(struct task_struct *prev)
3509{ 3528{
3510 printk(KERN_ERR "BUG: scheduling while atomic: %s/0x%08x/%d\n", 3529 struct pt_regs *regs = get_irq_regs();
3511 prev->comm, preempt_count(), task_pid_nr(prev)); 3530
3531 printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n",
3532 prev->comm, prev->pid, preempt_count());
3533
3512 debug_show_held_locks(prev); 3534 debug_show_held_locks(prev);
3513 if (irqs_disabled()) 3535 if (irqs_disabled())
3514 print_irqtrace_events(prev); 3536 print_irqtrace_events(prev);
3515 dump_stack(); 3537
3538 if (regs)
3539 show_regs(regs);
3540 else
3541 dump_stack();
3516} 3542}
3517 3543
3518/* 3544/*
@@ -3820,7 +3846,7 @@ __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr_exclusive)
3820} 3846}
3821EXPORT_SYMBOL_GPL(__wake_up_sync); /* For internal use only */ 3847EXPORT_SYMBOL_GPL(__wake_up_sync); /* For internal use only */
3822 3848
3823void fastcall complete(struct completion *x) 3849void complete(struct completion *x)
3824{ 3850{
3825 unsigned long flags; 3851 unsigned long flags;
3826 3852
@@ -3832,7 +3858,7 @@ void fastcall complete(struct completion *x)
3832} 3858}
3833EXPORT_SYMBOL(complete); 3859EXPORT_SYMBOL(complete);
3834 3860
3835void fastcall complete_all(struct completion *x) 3861void complete_all(struct completion *x)
3836{ 3862{
3837 unsigned long flags; 3863 unsigned long flags;
3838 3864
@@ -3884,13 +3910,13 @@ wait_for_common(struct completion *x, long timeout, int state)
3884 return timeout; 3910 return timeout;
3885} 3911}
3886 3912
3887void fastcall __sched wait_for_completion(struct completion *x) 3913void __sched wait_for_completion(struct completion *x)
3888{ 3914{
3889 wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE); 3915 wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE);
3890} 3916}
3891EXPORT_SYMBOL(wait_for_completion); 3917EXPORT_SYMBOL(wait_for_completion);
3892 3918
3893unsigned long fastcall __sched 3919unsigned long __sched
3894wait_for_completion_timeout(struct completion *x, unsigned long timeout) 3920wait_for_completion_timeout(struct completion *x, unsigned long timeout)
3895{ 3921{
3896 return wait_for_common(x, timeout, TASK_UNINTERRUPTIBLE); 3922 return wait_for_common(x, timeout, TASK_UNINTERRUPTIBLE);
@@ -3906,7 +3932,7 @@ int __sched wait_for_completion_interruptible(struct completion *x)
3906} 3932}
3907EXPORT_SYMBOL(wait_for_completion_interruptible); 3933EXPORT_SYMBOL(wait_for_completion_interruptible);
3908 3934
3909unsigned long fastcall __sched 3935unsigned long __sched
3910wait_for_completion_interruptible_timeout(struct completion *x, 3936wait_for_completion_interruptible_timeout(struct completion *x,
3911 unsigned long timeout) 3937 unsigned long timeout)
3912{ 3938{
@@ -5339,7 +5365,7 @@ static struct ctl_table sd_ctl_dir[] = {
5339 .procname = "sched_domain", 5365 .procname = "sched_domain",
5340 .mode = 0555, 5366 .mode = 0555,
5341 }, 5367 },
5342 {0,}, 5368 {0, },
5343}; 5369};
5344 5370
5345static struct ctl_table sd_ctl_root[] = { 5371static struct ctl_table sd_ctl_root[] = {
@@ -5349,7 +5375,7 @@ static struct ctl_table sd_ctl_root[] = {
5349 .mode = 0555, 5375 .mode = 0555,
5350 .child = sd_ctl_dir, 5376 .child = sd_ctl_dir,
5351 }, 5377 },
5352 {0,}, 5378 {0, },
5353}; 5379};
5354 5380
5355static struct ctl_table *sd_alloc_ctl_entry(int n) 5381static struct ctl_table *sd_alloc_ctl_entry(int n)
@@ -5461,11 +5487,12 @@ static void register_sched_domain_sysctl(void)
5461 struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1); 5487 struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1);
5462 char buf[32]; 5488 char buf[32];
5463 5489
5490 WARN_ON(sd_ctl_dir[0].child);
5491 sd_ctl_dir[0].child = entry;
5492
5464 if (entry == NULL) 5493 if (entry == NULL)
5465 return; 5494 return;
5466 5495
5467 sd_ctl_dir[0].child = entry;
5468
5469 for_each_online_cpu(i) { 5496 for_each_online_cpu(i) {
5470 snprintf(buf, 32, "cpu%d", i); 5497 snprintf(buf, 32, "cpu%d", i);
5471 entry->procname = kstrdup(buf, GFP_KERNEL); 5498 entry->procname = kstrdup(buf, GFP_KERNEL);
@@ -5473,14 +5500,19 @@ static void register_sched_domain_sysctl(void)
5473 entry->child = sd_alloc_ctl_cpu_table(i); 5500 entry->child = sd_alloc_ctl_cpu_table(i);
5474 entry++; 5501 entry++;
5475 } 5502 }
5503
5504 WARN_ON(sd_sysctl_header);
5476 sd_sysctl_header = register_sysctl_table(sd_ctl_root); 5505 sd_sysctl_header = register_sysctl_table(sd_ctl_root);
5477} 5506}
5478 5507
5508/* may be called multiple times per register */
5479static void unregister_sched_domain_sysctl(void) 5509static void unregister_sched_domain_sysctl(void)
5480{ 5510{
5481 unregister_sysctl_table(sd_sysctl_header); 5511 if (sd_sysctl_header)
5512 unregister_sysctl_table(sd_sysctl_header);
5482 sd_sysctl_header = NULL; 5513 sd_sysctl_header = NULL;
5483 sd_free_ctl_entry(&sd_ctl_dir[0].child); 5514 if (sd_ctl_dir[0].child)
5515 sd_free_ctl_entry(&sd_ctl_dir[0].child);
5484} 5516}
5485#else 5517#else
5486static void register_sched_domain_sysctl(void) 5518static void register_sched_domain_sysctl(void)
@@ -5611,101 +5643,101 @@ int nr_cpu_ids __read_mostly = NR_CPUS;
5611EXPORT_SYMBOL(nr_cpu_ids); 5643EXPORT_SYMBOL(nr_cpu_ids);
5612 5644
5613#ifdef CONFIG_SCHED_DEBUG 5645#ifdef CONFIG_SCHED_DEBUG
5614static void sched_domain_debug(struct sched_domain *sd, int cpu) 5646
5647static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level)
5615{ 5648{
5616 int level = 0; 5649 struct sched_group *group = sd->groups;
5650 cpumask_t groupmask;
5651 char str[NR_CPUS];
5617 5652
5618 if (!sd) { 5653 cpumask_scnprintf(str, NR_CPUS, sd->span);
5619 printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu); 5654 cpus_clear(groupmask);
5620 return; 5655
5656 printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
5657
5658 if (!(sd->flags & SD_LOAD_BALANCE)) {
5659 printk("does not load-balance\n");
5660 if (sd->parent)
5661 printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain"
5662 " has parent");
5663 return -1;
5621 } 5664 }
5622 5665
5623 printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu); 5666 printk(KERN_CONT "span %s\n", str);
5624 5667
5668 if (!cpu_isset(cpu, sd->span)) {
5669 printk(KERN_ERR "ERROR: domain->span does not contain "
5670 "CPU%d\n", cpu);
5671 }
5672 if (!cpu_isset(cpu, group->cpumask)) {
5673 printk(KERN_ERR "ERROR: domain->groups does not contain"
5674 " CPU%d\n", cpu);
5675 }
5676
5677 printk(KERN_DEBUG "%*s groups:", level + 1, "");
5625 do { 5678 do {
5626 int i; 5679 if (!group) {
5627 char str[NR_CPUS]; 5680 printk("\n");
5628 struct sched_group *group = sd->groups; 5681 printk(KERN_ERR "ERROR: group is NULL\n");
5629 cpumask_t groupmask;
5630
5631 cpumask_scnprintf(str, NR_CPUS, sd->span);
5632 cpus_clear(groupmask);
5633
5634 printk(KERN_DEBUG);
5635 for (i = 0; i < level + 1; i++)
5636 printk(" ");
5637 printk("domain %d: ", level);
5638
5639 if (!(sd->flags & SD_LOAD_BALANCE)) {
5640 printk("does not load-balance\n");
5641 if (sd->parent)
5642 printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain"
5643 " has parent");
5644 break; 5682 break;
5645 } 5683 }
5646 5684
5647 printk("span %s\n", str); 5685 if (!group->__cpu_power) {
5686 printk(KERN_CONT "\n");
5687 printk(KERN_ERR "ERROR: domain->cpu_power not "
5688 "set\n");
5689 break;
5690 }
5691
5692 if (!cpus_weight(group->cpumask)) {
5693 printk(KERN_CONT "\n");
5694 printk(KERN_ERR "ERROR: empty group\n");
5695 break;
5696 }
5648 5697
5649 if (!cpu_isset(cpu, sd->span)) 5698 if (cpus_intersects(groupmask, group->cpumask)) {
5650 printk(KERN_ERR "ERROR: domain->span does not contain " 5699 printk(KERN_CONT "\n");
5651 "CPU%d\n", cpu); 5700 printk(KERN_ERR "ERROR: repeated CPUs\n");
5652 if (!cpu_isset(cpu, group->cpumask)) 5701 break;
5653 printk(KERN_ERR "ERROR: domain->groups does not contain" 5702 }
5654 " CPU%d\n", cpu);
5655 5703
5656 printk(KERN_DEBUG); 5704 cpus_or(groupmask, groupmask, group->cpumask);
5657 for (i = 0; i < level + 2; i++)
5658 printk(" ");
5659 printk("groups:");
5660 do {
5661 if (!group) {
5662 printk("\n");
5663 printk(KERN_ERR "ERROR: group is NULL\n");
5664 break;
5665 }
5666 5705
5667 if (!group->__cpu_power) { 5706 cpumask_scnprintf(str, NR_CPUS, group->cpumask);
5668 printk(KERN_CONT "\n"); 5707 printk(KERN_CONT " %s", str);
5669 printk(KERN_ERR "ERROR: domain->cpu_power not "
5670 "set\n");
5671 break;
5672 }
5673 5708
5674 if (!cpus_weight(group->cpumask)) { 5709 group = group->next;
5675 printk(KERN_CONT "\n"); 5710 } while (group != sd->groups);
5676 printk(KERN_ERR "ERROR: empty group\n"); 5711 printk(KERN_CONT "\n");
5677 break;
5678 }
5679 5712
5680 if (cpus_intersects(groupmask, group->cpumask)) { 5713 if (!cpus_equal(sd->span, groupmask))
5681 printk(KERN_CONT "\n"); 5714 printk(KERN_ERR "ERROR: groups don't span domain->span\n");
5682 printk(KERN_ERR "ERROR: repeated CPUs\n");
5683 break;
5684 }
5685 5715
5686 cpus_or(groupmask, groupmask, group->cpumask); 5716 if (sd->parent && !cpus_subset(groupmask, sd->parent->span))
5717 printk(KERN_ERR "ERROR: parent span is not a superset "
5718 "of domain->span\n");
5719 return 0;
5720}
5687 5721
5688 cpumask_scnprintf(str, NR_CPUS, group->cpumask); 5722static void sched_domain_debug(struct sched_domain *sd, int cpu)
5689 printk(KERN_CONT " %s", str); 5723{
5724 int level = 0;
5690 5725
5691 group = group->next; 5726 if (!sd) {
5692 } while (group != sd->groups); 5727 printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu);
5693 printk(KERN_CONT "\n"); 5728 return;
5729 }
5694 5730
5695 if (!cpus_equal(sd->span, groupmask)) 5731 printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu);
5696 printk(KERN_ERR "ERROR: groups don't span "
5697 "domain->span\n");
5698 5732
5733 for (;;) {
5734 if (sched_domain_debug_one(sd, cpu, level))
5735 break;
5699 level++; 5736 level++;
5700 sd = sd->parent; 5737 sd = sd->parent;
5701 if (!sd) 5738 if (!sd)
5702 continue; 5739 break;
5703 5740 }
5704 if (!cpus_subset(groupmask, sd->span))
5705 printk(KERN_ERR "ERROR: parent span is not a superset "
5706 "of domain->span\n");
5707
5708 } while (sd);
5709} 5741}
5710#else 5742#else
5711# define sched_domain_debug(sd, cpu) do { } while (0) 5743# define sched_domain_debug(sd, cpu) do { } while (0)
@@ -6424,13 +6456,17 @@ static cpumask_t fallback_doms;
6424 */ 6456 */
6425static int arch_init_sched_domains(const cpumask_t *cpu_map) 6457static int arch_init_sched_domains(const cpumask_t *cpu_map)
6426{ 6458{
6459 int err;
6460
6427 ndoms_cur = 1; 6461 ndoms_cur = 1;
6428 doms_cur = kmalloc(sizeof(cpumask_t), GFP_KERNEL); 6462 doms_cur = kmalloc(sizeof(cpumask_t), GFP_KERNEL);
6429 if (!doms_cur) 6463 if (!doms_cur)
6430 doms_cur = &fallback_doms; 6464 doms_cur = &fallback_doms;
6431 cpus_andnot(*doms_cur, *cpu_map, cpu_isolated_map); 6465 cpus_andnot(*doms_cur, *cpu_map, cpu_isolated_map);
6466 err = build_sched_domains(doms_cur);
6432 register_sched_domain_sysctl(); 6467 register_sched_domain_sysctl();
6433 return build_sched_domains(doms_cur); 6468
6469 return err;
6434} 6470}
6435 6471
6436static void arch_destroy_sched_domains(const cpumask_t *cpu_map) 6472static void arch_destroy_sched_domains(const cpumask_t *cpu_map)
@@ -6479,6 +6515,9 @@ void partition_sched_domains(int ndoms_new, cpumask_t *doms_new)
6479{ 6515{
6480 int i, j; 6516 int i, j;
6481 6517
6518 /* always unregister in case we don't destroy any domains */
6519 unregister_sched_domain_sysctl();
6520
6482 if (doms_new == NULL) { 6521 if (doms_new == NULL) {
6483 ndoms_new = 1; 6522 ndoms_new = 1;
6484 doms_new = &fallback_doms; 6523 doms_new = &fallback_doms;
@@ -6514,6 +6553,8 @@ match2:
6514 kfree(doms_cur); 6553 kfree(doms_cur);
6515 doms_cur = doms_new; 6554 doms_cur = doms_new;
6516 ndoms_cur = ndoms_new; 6555 ndoms_cur = ndoms_new;
6556
6557 register_sched_domain_sysctl();
6517} 6558}
6518 6559
6519#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) 6560#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
@@ -6978,8 +7019,8 @@ err:
6978/* rcu callback to free various structures associated with a task group */ 7019/* rcu callback to free various structures associated with a task group */
6979static void free_sched_group(struct rcu_head *rhp) 7020static void free_sched_group(struct rcu_head *rhp)
6980{ 7021{
6981 struct cfs_rq *cfs_rq = container_of(rhp, struct cfs_rq, rcu); 7022 struct task_group *tg = container_of(rhp, struct task_group, rcu);
6982 struct task_group *tg = cfs_rq->tg; 7023 struct cfs_rq *cfs_rq;
6983 struct sched_entity *se; 7024 struct sched_entity *se;
6984 int i; 7025 int i;
6985 7026
@@ -7000,7 +7041,7 @@ static void free_sched_group(struct rcu_head *rhp)
7000/* Destroy runqueue etc associated with a task group */ 7041/* Destroy runqueue etc associated with a task group */
7001void sched_destroy_group(struct task_group *tg) 7042void sched_destroy_group(struct task_group *tg)
7002{ 7043{
7003 struct cfs_rq *cfs_rq; 7044 struct cfs_rq *cfs_rq = NULL;
7004 int i; 7045 int i;
7005 7046
7006 for_each_possible_cpu(i) { 7047 for_each_possible_cpu(i) {
@@ -7008,10 +7049,10 @@ void sched_destroy_group(struct task_group *tg)
7008 list_del_rcu(&cfs_rq->leaf_cfs_rq_list); 7049 list_del_rcu(&cfs_rq->leaf_cfs_rq_list);
7009 } 7050 }
7010 7051
7011 cfs_rq = tg->cfs_rq[0]; 7052 BUG_ON(!cfs_rq);
7012 7053
7013 /* wait for possible concurrent references to cfs_rqs complete */ 7054 /* wait for possible concurrent references to cfs_rqs complete */
7014 call_rcu(&cfs_rq->rcu, free_sched_group); 7055 call_rcu(&tg->rcu, free_sched_group);
7015} 7056}
7016 7057
7017/* change task's runqueue when it moves between groups. 7058/* change task's runqueue when it moves between groups.
@@ -7101,25 +7142,25 @@ unsigned long sched_group_shares(struct task_group *tg)
7101#ifdef CONFIG_FAIR_CGROUP_SCHED 7142#ifdef CONFIG_FAIR_CGROUP_SCHED
7102 7143
7103/* return corresponding task_group object of a cgroup */ 7144/* return corresponding task_group object of a cgroup */
7104static inline struct task_group *cgroup_tg(struct cgroup *cont) 7145static inline struct task_group *cgroup_tg(struct cgroup *cgrp)
7105{ 7146{
7106 return container_of(cgroup_subsys_state(cont, cpu_cgroup_subsys_id), 7147 return container_of(cgroup_subsys_state(cgrp, cpu_cgroup_subsys_id),
7107 struct task_group, css); 7148 struct task_group, css);
7108} 7149}
7109 7150
7110static struct cgroup_subsys_state * 7151static struct cgroup_subsys_state *
7111cpu_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont) 7152cpu_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cgrp)
7112{ 7153{
7113 struct task_group *tg; 7154 struct task_group *tg;
7114 7155
7115 if (!cont->parent) { 7156 if (!cgrp->parent) {
7116 /* This is early initialization for the top cgroup */ 7157 /* This is early initialization for the top cgroup */
7117 init_task_group.css.cgroup = cont; 7158 init_task_group.css.cgroup = cgrp;
7118 return &init_task_group.css; 7159 return &init_task_group.css;
7119 } 7160 }
7120 7161
7121 /* we support only 1-level deep hierarchical scheduler atm */ 7162 /* we support only 1-level deep hierarchical scheduler atm */
7122 if (cont->parent->parent) 7163 if (cgrp->parent->parent)
7123 return ERR_PTR(-EINVAL); 7164 return ERR_PTR(-EINVAL);
7124 7165
7125 tg = sched_create_group(); 7166 tg = sched_create_group();
@@ -7127,21 +7168,21 @@ cpu_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
7127 return ERR_PTR(-ENOMEM); 7168 return ERR_PTR(-ENOMEM);
7128 7169
7129 /* Bind the cgroup to task_group object we just created */ 7170 /* Bind the cgroup to task_group object we just created */
7130 tg->css.cgroup = cont; 7171 tg->css.cgroup = cgrp;
7131 7172
7132 return &tg->css; 7173 return &tg->css;
7133} 7174}
7134 7175
7135static void cpu_cgroup_destroy(struct cgroup_subsys *ss, 7176static void cpu_cgroup_destroy(struct cgroup_subsys *ss,
7136 struct cgroup *cont) 7177 struct cgroup *cgrp)
7137{ 7178{
7138 struct task_group *tg = cgroup_tg(cont); 7179 struct task_group *tg = cgroup_tg(cgrp);
7139 7180
7140 sched_destroy_group(tg); 7181 sched_destroy_group(tg);
7141} 7182}
7142 7183
7143static int cpu_cgroup_can_attach(struct cgroup_subsys *ss, 7184static int cpu_cgroup_can_attach(struct cgroup_subsys *ss,
7144 struct cgroup *cont, struct task_struct *tsk) 7185 struct cgroup *cgrp, struct task_struct *tsk)
7145{ 7186{
7146 /* We don't support RT-tasks being in separate groups */ 7187 /* We don't support RT-tasks being in separate groups */
7147 if (tsk->sched_class != &fair_sched_class) 7188 if (tsk->sched_class != &fair_sched_class)
@@ -7151,61 +7192,72 @@ static int cpu_cgroup_can_attach(struct cgroup_subsys *ss,
7151} 7192}
7152 7193
7153static void 7194static void
7154cpu_cgroup_attach(struct cgroup_subsys *ss, struct cgroup *cont, 7195cpu_cgroup_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
7155 struct cgroup *old_cont, struct task_struct *tsk) 7196 struct cgroup *old_cont, struct task_struct *tsk)
7156{ 7197{
7157 sched_move_task(tsk); 7198 sched_move_task(tsk);
7158} 7199}
7159 7200
7160static ssize_t cpu_shares_write(struct cgroup *cont, struct cftype *cftype, 7201static int cpu_shares_write_uint(struct cgroup *cgrp, struct cftype *cftype,
7161 struct file *file, const char __user *userbuf, 7202 u64 shareval)
7162 size_t nbytes, loff_t *ppos)
7163{ 7203{
7164 unsigned long shareval; 7204 return sched_group_set_shares(cgroup_tg(cgrp), shareval);
7165 struct task_group *tg = cgroup_tg(cont); 7205}
7166 char buffer[2*sizeof(unsigned long) + 1];
7167 int rc;
7168
7169 if (nbytes > 2*sizeof(unsigned long)) /* safety check */
7170 return -E2BIG;
7171
7172 if (copy_from_user(buffer, userbuf, nbytes))
7173 return -EFAULT;
7174
7175 buffer[nbytes] = 0; /* nul-terminate */
7176 shareval = simple_strtoul(buffer, NULL, 10);
7177 7206
7178 rc = sched_group_set_shares(tg, shareval); 7207static u64 cpu_shares_read_uint(struct cgroup *cgrp, struct cftype *cft)
7208{
7209 struct task_group *tg = cgroup_tg(cgrp);
7179 7210
7180 return (rc < 0 ? rc : nbytes); 7211 return (u64) tg->shares;
7181} 7212}
7182 7213
7183static u64 cpu_shares_read_uint(struct cgroup *cont, struct cftype *cft) 7214static u64 cpu_usage_read(struct cgroup *cgrp, struct cftype *cft)
7184{ 7215{
7185 struct task_group *tg = cgroup_tg(cont); 7216 struct task_group *tg = cgroup_tg(cgrp);
7217 unsigned long flags;
7218 u64 res = 0;
7219 int i;
7186 7220
7187 return (u64) tg->shares; 7221 for_each_possible_cpu(i) {
7222 /*
7223 * Lock to prevent races with updating 64-bit counters
7224 * on 32-bit arches.
7225 */
7226 spin_lock_irqsave(&cpu_rq(i)->lock, flags);
7227 res += tg->se[i]->sum_exec_runtime;
7228 spin_unlock_irqrestore(&cpu_rq(i)->lock, flags);
7229 }
7230 /* Convert from ns to ms */
7231 do_div(res, 1000000);
7232
7233 return res;
7188} 7234}
7189 7235
7190static struct cftype cpu_shares = { 7236static struct cftype cpu_files[] = {
7191 .name = "shares", 7237 {
7192 .read_uint = cpu_shares_read_uint, 7238 .name = "shares",
7193 .write = cpu_shares_write, 7239 .read_uint = cpu_shares_read_uint,
7240 .write_uint = cpu_shares_write_uint,
7241 },
7242 {
7243 .name = "usage",
7244 .read_uint = cpu_usage_read,
7245 },
7194}; 7246};
7195 7247
7196static int cpu_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont) 7248static int cpu_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont)
7197{ 7249{
7198 return cgroup_add_file(cont, ss, &cpu_shares); 7250 return cgroup_add_files(cont, ss, cpu_files, ARRAY_SIZE(cpu_files));
7199} 7251}
7200 7252
7201struct cgroup_subsys cpu_cgroup_subsys = { 7253struct cgroup_subsys cpu_cgroup_subsys = {
7202 .name = "cpu", 7254 .name = "cpu",
7203 .create = cpu_cgroup_create, 7255 .create = cpu_cgroup_create,
7204 .destroy = cpu_cgroup_destroy, 7256 .destroy = cpu_cgroup_destroy,
7205 .can_attach = cpu_cgroup_can_attach, 7257 .can_attach = cpu_cgroup_can_attach,
7206 .attach = cpu_cgroup_attach, 7258 .attach = cpu_cgroup_attach,
7207 .populate = cpu_cgroup_populate, 7259 .populate = cpu_cgroup_populate,
7208 .subsys_id = cpu_cgroup_subsys_id, 7260 .subsys_id = cpu_cgroup_subsys_id,
7209 .early_init = 1, 7261 .early_init = 1,
7210}; 7262};
7211 7263
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 166ed6db600b..01859f662ab7 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -876,6 +876,7 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
876 } 876 }
877} 877}
878 878
879#ifdef CONFIG_SMP
879/************************************************** 880/**************************************************
880 * Fair scheduling class load-balancing methods: 881 * Fair scheduling class load-balancing methods:
881 */ 882 */
@@ -936,12 +937,11 @@ static int cfs_rq_best_prio(struct cfs_rq *cfs_rq)
936 937
937static unsigned long 938static unsigned long
938load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest, 939load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
939 unsigned long max_nr_move, unsigned long max_load_move, 940 unsigned long max_load_move,
940 struct sched_domain *sd, enum cpu_idle_type idle, 941 struct sched_domain *sd, enum cpu_idle_type idle,
941 int *all_pinned, int *this_best_prio) 942 int *all_pinned, int *this_best_prio)
942{ 943{
943 struct cfs_rq *busy_cfs_rq; 944 struct cfs_rq *busy_cfs_rq;
944 unsigned long load_moved, total_nr_moved = 0, nr_moved;
945 long rem_load_move = max_load_move; 945 long rem_load_move = max_load_move;
946 struct rq_iterator cfs_rq_iterator; 946 struct rq_iterator cfs_rq_iterator;
947 947
@@ -969,25 +969,48 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
969#else 969#else
970# define maxload rem_load_move 970# define maxload rem_load_move
971#endif 971#endif
972 /* pass busy_cfs_rq argument into 972 /*
973 * pass busy_cfs_rq argument into
973 * load_balance_[start|next]_fair iterators 974 * load_balance_[start|next]_fair iterators
974 */ 975 */
975 cfs_rq_iterator.arg = busy_cfs_rq; 976 cfs_rq_iterator.arg = busy_cfs_rq;
976 nr_moved = balance_tasks(this_rq, this_cpu, busiest, 977 rem_load_move -= balance_tasks(this_rq, this_cpu, busiest,
977 max_nr_move, maxload, sd, idle, all_pinned, 978 maxload, sd, idle, all_pinned,
978 &load_moved, this_best_prio, &cfs_rq_iterator); 979 this_best_prio,
979 980 &cfs_rq_iterator);
980 total_nr_moved += nr_moved;
981 max_nr_move -= nr_moved;
982 rem_load_move -= load_moved;
983 981
984 if (max_nr_move <= 0 || rem_load_move <= 0) 982 if (rem_load_move <= 0)
985 break; 983 break;
986 } 984 }
987 985
988 return max_load_move - rem_load_move; 986 return max_load_move - rem_load_move;
989} 987}
990 988
989static int
990move_one_task_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
991 struct sched_domain *sd, enum cpu_idle_type idle)
992{
993 struct cfs_rq *busy_cfs_rq;
994 struct rq_iterator cfs_rq_iterator;
995
996 cfs_rq_iterator.start = load_balance_start_fair;
997 cfs_rq_iterator.next = load_balance_next_fair;
998
999 for_each_leaf_cfs_rq(busiest, busy_cfs_rq) {
1000 /*
1001 * pass busy_cfs_rq argument into
1002 * load_balance_[start|next]_fair iterators
1003 */
1004 cfs_rq_iterator.arg = busy_cfs_rq;
1005 if (iter_move_one_task(this_rq, this_cpu, busiest, sd, idle,
1006 &cfs_rq_iterator))
1007 return 1;
1008 }
1009
1010 return 0;
1011}
1012#endif
1013
991/* 1014/*
992 * scheduler tick hitting a task of our scheduling class: 1015 * scheduler tick hitting a task of our scheduling class:
993 */ 1016 */
@@ -1002,7 +1025,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr)
1002 } 1025 }
1003} 1026}
1004 1027
1005#define swap(a,b) do { typeof(a) tmp = (a); (a) = (b); (b) = tmp; } while (0) 1028#define swap(a, b) do { typeof(a) tmp = (a); (a) = (b); (b) = tmp; } while (0)
1006 1029
1007/* 1030/*
1008 * Share the fairness runtime between parent and child, thus the 1031 * Share the fairness runtime between parent and child, thus the
@@ -1063,7 +1086,10 @@ static const struct sched_class fair_sched_class = {
1063 .pick_next_task = pick_next_task_fair, 1086 .pick_next_task = pick_next_task_fair,
1064 .put_prev_task = put_prev_task_fair, 1087 .put_prev_task = put_prev_task_fair,
1065 1088
1089#ifdef CONFIG_SMP
1066 .load_balance = load_balance_fair, 1090 .load_balance = load_balance_fair,
1091 .move_one_task = move_one_task_fair,
1092#endif
1067 1093
1068 .set_curr_task = set_curr_task_fair, 1094 .set_curr_task = set_curr_task_fair,
1069 .task_tick = task_tick_fair, 1095 .task_tick = task_tick_fair,
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c
index 6e2ead41516e..bf9c25c15b8b 100644
--- a/kernel/sched_idletask.c
+++ b/kernel/sched_idletask.c
@@ -37,15 +37,24 @@ static void put_prev_task_idle(struct rq *rq, struct task_struct *prev)
37{ 37{
38} 38}
39 39
40#ifdef CONFIG_SMP
40static unsigned long 41static unsigned long
41load_balance_idle(struct rq *this_rq, int this_cpu, struct rq *busiest, 42load_balance_idle(struct rq *this_rq, int this_cpu, struct rq *busiest,
42 unsigned long max_nr_move, unsigned long max_load_move, 43 unsigned long max_load_move,
43 struct sched_domain *sd, enum cpu_idle_type idle, 44 struct sched_domain *sd, enum cpu_idle_type idle,
44 int *all_pinned, int *this_best_prio) 45 int *all_pinned, int *this_best_prio)
45{ 46{
46 return 0; 47 return 0;
47} 48}
48 49
50static int
51move_one_task_idle(struct rq *this_rq, int this_cpu, struct rq *busiest,
52 struct sched_domain *sd, enum cpu_idle_type idle)
53{
54 return 0;
55}
56#endif
57
49static void task_tick_idle(struct rq *rq, struct task_struct *curr) 58static void task_tick_idle(struct rq *rq, struct task_struct *curr)
50{ 59{
51} 60}
@@ -69,7 +78,10 @@ const struct sched_class idle_sched_class = {
69 .pick_next_task = pick_next_task_idle, 78 .pick_next_task = pick_next_task_idle,
70 .put_prev_task = put_prev_task_idle, 79 .put_prev_task = put_prev_task_idle,
71 80
81#ifdef CONFIG_SMP
72 .load_balance = load_balance_idle, 82 .load_balance = load_balance_idle,
83 .move_one_task = move_one_task_idle,
84#endif
73 85
74 .set_curr_task = set_curr_task_idle, 86 .set_curr_task = set_curr_task_idle,
75 .task_tick = task_tick_idle, 87 .task_tick = task_tick_idle,
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index d0097a0634e5..8abd752a0ebd 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -98,6 +98,7 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p)
98 p->se.exec_start = 0; 98 p->se.exec_start = 0;
99} 99}
100 100
101#ifdef CONFIG_SMP
101/* 102/*
102 * Load-balancing iterator. Note: while the runqueue stays locked 103 * Load-balancing iterator. Note: while the runqueue stays locked
103 * during the whole iteration, the current task might be 104 * during the whole iteration, the current task might be
@@ -172,13 +173,11 @@ static struct task_struct *load_balance_next_rt(void *arg)
172 173
173static unsigned long 174static unsigned long
174load_balance_rt(struct rq *this_rq, int this_cpu, struct rq *busiest, 175load_balance_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
175 unsigned long max_nr_move, unsigned long max_load_move, 176 unsigned long max_load_move,
176 struct sched_domain *sd, enum cpu_idle_type idle, 177 struct sched_domain *sd, enum cpu_idle_type idle,
177 int *all_pinned, int *this_best_prio) 178 int *all_pinned, int *this_best_prio)
178{ 179{
179 int nr_moved;
180 struct rq_iterator rt_rq_iterator; 180 struct rq_iterator rt_rq_iterator;
181 unsigned long load_moved;
182 181
183 rt_rq_iterator.start = load_balance_start_rt; 182 rt_rq_iterator.start = load_balance_start_rt;
184 rt_rq_iterator.next = load_balance_next_rt; 183 rt_rq_iterator.next = load_balance_next_rt;
@@ -187,12 +186,24 @@ load_balance_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
187 */ 186 */
188 rt_rq_iterator.arg = busiest; 187 rt_rq_iterator.arg = busiest;
189 188
190 nr_moved = balance_tasks(this_rq, this_cpu, busiest, max_nr_move, 189 return balance_tasks(this_rq, this_cpu, busiest, max_load_move, sd,
191 max_load_move, sd, idle, all_pinned, &load_moved, 190 idle, all_pinned, this_best_prio, &rt_rq_iterator);
192 this_best_prio, &rt_rq_iterator); 191}
192
193static int
194move_one_task_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
195 struct sched_domain *sd, enum cpu_idle_type idle)
196{
197 struct rq_iterator rt_rq_iterator;
198
199 rt_rq_iterator.start = load_balance_start_rt;
200 rt_rq_iterator.next = load_balance_next_rt;
201 rt_rq_iterator.arg = busiest;
193 202
194 return load_moved; 203 return iter_move_one_task(this_rq, this_cpu, busiest, sd, idle,
204 &rt_rq_iterator);
195} 205}
206#endif
196 207
197static void task_tick_rt(struct rq *rq, struct task_struct *p) 208static void task_tick_rt(struct rq *rq, struct task_struct *p)
198{ 209{
@@ -236,7 +247,10 @@ const struct sched_class rt_sched_class = {
236 .pick_next_task = pick_next_task_rt, 247 .pick_next_task = pick_next_task_rt,
237 .put_prev_task = put_prev_task_rt, 248 .put_prev_task = put_prev_task_rt,
238 249
250#ifdef CONFIG_SMP
239 .load_balance = load_balance_rt, 251 .load_balance = load_balance_rt,
252 .move_one_task = move_one_task_rt,
253#endif
240 254
241 .set_curr_task = set_curr_task_rt, 255 .set_curr_task = set_curr_task_rt,
242 .task_tick = task_tick_rt, 256 .task_tick = task_tick_rt,
diff --git a/kernel/signal.c b/kernel/signal.c
index 12006308c7eb..909a0cc6bc70 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -124,7 +124,7 @@ void recalc_sigpending_and_wake(struct task_struct *t)
124 124
125void recalc_sigpending(void) 125void recalc_sigpending(void)
126{ 126{
127 if (!recalc_sigpending_tsk(current)) 127 if (!recalc_sigpending_tsk(current) && !freezing(current))
128 clear_thread_flag(TIF_SIGPENDING); 128 clear_thread_flag(TIF_SIGPENDING);
129 129
130} 130}
@@ -732,7 +732,7 @@ static void print_fatal_signal(struct pt_regs *regs, int signr)
732 printk("%s/%d: potentially unexpected fatal signal %d.\n", 732 printk("%s/%d: potentially unexpected fatal signal %d.\n",
733 current->comm, task_pid_nr(current), signr); 733 current->comm, task_pid_nr(current), signr);
734 734
735#ifdef __i386__ 735#if defined(__i386__) && !defined(__arch_um__)
736 printk("code at %08lx: ", regs->eip); 736 printk("code at %08lx: ", regs->eip);
737 { 737 {
738 int i; 738 int i;
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 52c7a151e298..56cb009a4b35 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -40,10 +40,14 @@ cond_syscall(sys_recvfrom);
40cond_syscall(sys_recv); 40cond_syscall(sys_recv);
41cond_syscall(sys_socket); 41cond_syscall(sys_socket);
42cond_syscall(sys_setsockopt); 42cond_syscall(sys_setsockopt);
43cond_syscall(compat_sys_setsockopt);
43cond_syscall(sys_getsockopt); 44cond_syscall(sys_getsockopt);
45cond_syscall(compat_sys_getsockopt);
44cond_syscall(sys_shutdown); 46cond_syscall(sys_shutdown);
45cond_syscall(sys_sendmsg); 47cond_syscall(sys_sendmsg);
48cond_syscall(compat_sys_sendmsg);
46cond_syscall(sys_recvmsg); 49cond_syscall(sys_recvmsg);
50cond_syscall(compat_sys_recvmsg);
47cond_syscall(sys_socketcall); 51cond_syscall(sys_socketcall);
48cond_syscall(sys_futex); 52cond_syscall(sys_futex);
49cond_syscall(compat_sys_futex); 53cond_syscall(compat_sys_futex);
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 10a1347597fd..5997456ebbc9 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -320,8 +320,6 @@ ktime_t tick_nohz_get_sleep_length(void)
320 return ts->sleep_length; 320 return ts->sleep_length;
321} 321}
322 322
323EXPORT_SYMBOL_GPL(tick_nohz_get_sleep_length);
324
325/** 323/**
326 * nohz_restart_sched_tick - restart the idle tick from the idle task 324 * nohz_restart_sched_tick - restart the idle tick from the idle task
327 * 325 *
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index fdb2e03d4fe0..12c5f4cb6b8c 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -129,7 +129,8 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now)
129 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu); 129 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu);
130 int i; 130 int i;
131 131
132 SEQ_printf(m, "\ncpu: %d\n", cpu); 132 SEQ_printf(m, "\n");
133 SEQ_printf(m, "cpu: %d\n", cpu);
133 for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { 134 for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
134 SEQ_printf(m, " clock %d:\n", i); 135 SEQ_printf(m, " clock %d:\n", i);
135 print_base(m, cpu_base->clock_base + i, now); 136 print_base(m, cpu_base->clock_base + i, now);
@@ -184,7 +185,8 @@ print_tickdevice(struct seq_file *m, struct tick_device *td)
184{ 185{
185 struct clock_event_device *dev = td->evtdev; 186 struct clock_event_device *dev = td->evtdev;
186 187
187 SEQ_printf(m, "\nTick Device: mode: %d\n", td->mode); 188 SEQ_printf(m, "\n");
189 SEQ_printf(m, "Tick Device: mode: %d\n", td->mode);
188 190
189 SEQ_printf(m, "Clock Event Device: "); 191 SEQ_printf(m, "Clock Event Device: ");
190 if (!dev) { 192 if (!dev) {
diff --git a/kernel/user.c b/kernel/user.c
index e91331c457e2..0f3aa0234107 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -129,7 +129,7 @@ static inline void uids_mutex_unlock(void)
129} 129}
130 130
131/* return cpu shares held by the user */ 131/* return cpu shares held by the user */
132ssize_t cpu_shares_show(struct kset *kset, char *buffer) 132static ssize_t cpu_shares_show(struct kset *kset, char *buffer)
133{ 133{
134 struct user_struct *up = container_of(kset, struct user_struct, kset); 134 struct user_struct *up = container_of(kset, struct user_struct, kset);
135 135
@@ -137,7 +137,8 @@ ssize_t cpu_shares_show(struct kset *kset, char *buffer)
137} 137}
138 138
139/* modify cpu shares held by the user */ 139/* modify cpu shares held by the user */
140ssize_t cpu_shares_store(struct kset *kset, const char *buffer, size_t size) 140static ssize_t cpu_shares_store(struct kset *kset, const char *buffer,
141 size_t size)
141{ 142{
142 struct user_struct *up = container_of(kset, struct user_struct, kset); 143 struct user_struct *up = container_of(kset, struct user_struct, kset);
143 unsigned long shares; 144 unsigned long shares;
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 1faa5087dc86..1e5f207b9074 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -9,6 +9,14 @@ config PRINTK_TIME
9 operations. This is useful for identifying long delays 9 operations. This is useful for identifying long delays
10 in kernel startup. 10 in kernel startup.
11 11
12config ENABLE_WARN_DEPRECATED
13 bool "Enable __deprecated logic"
14 default y
15 help
16 Enable the __deprecated logic in the kernel build.
17 Disable this to suppress the "warning: 'foo' is deprecated
18 (declared at kernel/power/somefile.c:1234)" messages.
19
12config ENABLE_MUST_CHECK 20config ENABLE_MUST_CHECK
13 bool "Enable __must_check logic" 21 bool "Enable __must_check logic"
14 default y 22 default y
diff --git a/lib/kobject.c b/lib/kobject.c
index 03d40360ff1b..a7e3bf4d3c70 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -308,6 +308,19 @@ int kobject_rename(struct kobject * kobj, const char *new_name)
308 if (!kobj->parent) 308 if (!kobj->parent)
309 return -EINVAL; 309 return -EINVAL;
310 310
311 /* see if this name is already in use */
312 if (kobj->kset) {
313 struct kobject *temp_kobj;
314 temp_kobj = kset_find_obj(kobj->kset, new_name);
315 if (temp_kobj) {
316 printk(KERN_WARNING "kobject '%s' can not be renamed "
317 "to '%s' as '%s' is already in existance.\n",
318 kobject_name(kobj), new_name, new_name);
319 kobject_put(temp_kobj);
320 return -EINVAL;
321 }
322 }
323
311 devpath = kobject_get_path(kobj, GFP_KERNEL); 324 devpath = kobject_get_path(kobj, GFP_KERNEL);
312 if (!devpath) { 325 if (!devpath) {
313 error = -ENOMEM; 326 error = -ENOMEM;
diff --git a/mm/filemap.c b/mm/filemap.c
index 5209e47b7fe3..188cf5fd3e8d 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -28,6 +28,7 @@
28#include <linux/backing-dev.h> 28#include <linux/backing-dev.h>
29#include <linux/pagevec.h> 29#include <linux/pagevec.h>
30#include <linux/blkdev.h> 30#include <linux/blkdev.h>
31#include <linux/backing-dev.h>
31#include <linux/security.h> 32#include <linux/security.h>
32#include <linux/syscalls.h> 33#include <linux/syscalls.h>
33#include <linux/cpuset.h> 34#include <linux/cpuset.h>
@@ -1299,7 +1300,7 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1299 1300
1300 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 1301 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
1301 if (vmf->pgoff >= size) 1302 if (vmf->pgoff >= size)
1302 goto outside_data_content; 1303 return VM_FAULT_SIGBUS;
1303 1304
1304 /* If we don't want any read-ahead, don't bother */ 1305 /* If we don't want any read-ahead, don't bother */
1305 if (VM_RandomReadHint(vma)) 1306 if (VM_RandomReadHint(vma))
@@ -1376,7 +1377,7 @@ retry_find:
1376 if (unlikely(vmf->pgoff >= size)) { 1377 if (unlikely(vmf->pgoff >= size)) {
1377 unlock_page(page); 1378 unlock_page(page);
1378 page_cache_release(page); 1379 page_cache_release(page);
1379 goto outside_data_content; 1380 return VM_FAULT_SIGBUS;
1380 } 1381 }
1381 1382
1382 /* 1383 /*
@@ -1387,15 +1388,6 @@ retry_find:
1387 vmf->page = page; 1388 vmf->page = page;
1388 return ret | VM_FAULT_LOCKED; 1389 return ret | VM_FAULT_LOCKED;
1389 1390
1390outside_data_content:
1391 /*
1392 * An external ptracer can access pages that normally aren't
1393 * accessible..
1394 */
1395 if (vma->vm_mm == current->mm)
1396 return VM_FAULT_SIGBUS;
1397
1398 /* Fall through to the non-read-ahead case */
1399no_cached_page: 1391no_cached_page:
1400 /* 1392 /*
1401 * We're only likely to ever get here if MADV_RANDOM is in 1393 * We're only likely to ever get here if MADV_RANDOM is in
@@ -2510,21 +2502,17 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
2510 } 2502 }
2511 2503
2512 retval = mapping->a_ops->direct_IO(rw, iocb, iov, offset, nr_segs); 2504 retval = mapping->a_ops->direct_IO(rw, iocb, iov, offset, nr_segs);
2513 if (retval)
2514 goto out;
2515 2505
2516 /* 2506 /*
2517 * Finally, try again to invalidate clean pages which might have been 2507 * Finally, try again to invalidate clean pages which might have been
2518 * faulted in by get_user_pages() if the source of the write was an 2508 * cached by non-direct readahead, or faulted in by get_user_pages()
2519 * mmap()ed region of the file we're writing. That's a pretty crazy 2509 * if the source of the write was an mmap'ed region of the file
2520 * thing to do, so we don't support it 100%. If this invalidation 2510 * we're writing. Either one is a pretty crazy thing to do,
2521 * fails and we have -EIOCBQUEUED we ignore the failure. 2511 * so we don't support it 100%. If this invalidation
2512 * fails, tough, the write still worked...
2522 */ 2513 */
2523 if (rw == WRITE && mapping->nrpages) { 2514 if (rw == WRITE && mapping->nrpages) {
2524 int err = invalidate_inode_pages2_range(mapping, 2515 invalidate_inode_pages2_range(mapping, offset >> PAGE_CACHE_SHIFT, end);
2525 offset >> PAGE_CACHE_SHIFT, end);
2526 if (err && retval >= 0)
2527 retval = err;
2528 } 2516 }
2529out: 2517out:
2530 return retval; 2518 return retval;
diff --git a/mm/nommu.c b/mm/nommu.c
index 8f09333f78e1..35622c590925 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -12,6 +12,7 @@
12 * Copyright (c) 2002 Greg Ungerer <gerg@snapgear.com> 12 * Copyright (c) 2002 Greg Ungerer <gerg@snapgear.com>
13 */ 13 */
14 14
15#include <linux/module.h>
15#include <linux/mm.h> 16#include <linux/mm.h>
16#include <linux/mman.h> 17#include <linux/mman.h>
17#include <linux/swap.h> 18#include <linux/swap.h>
diff --git a/mm/shmem.c b/mm/shmem.c
index 404e53bb2127..253d205914ba 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -915,6 +915,21 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
915 struct inode *inode; 915 struct inode *inode;
916 916
917 BUG_ON(!PageLocked(page)); 917 BUG_ON(!PageLocked(page));
918 /*
919 * shmem_backing_dev_info's capabilities prevent regular writeback or
920 * sync from ever calling shmem_writepage; but a stacking filesystem
921 * may use the ->writepage of its underlying filesystem, in which case
922 * we want to do nothing when that underlying filesystem is tmpfs
923 * (writing out to swap is useful as a response to memory pressure, but
924 * of no use to stabilize the data) - just redirty the page, unlock it
925 * and claim success in this case. AOP_WRITEPAGE_ACTIVATE, and the
926 * page_mapped check below, must be avoided unless we're in reclaim.
927 */
928 if (!wbc->for_reclaim) {
929 set_page_dirty(page);
930 unlock_page(page);
931 return 0;
932 }
918 BUG_ON(page_mapped(page)); 933 BUG_ON(page_mapped(page));
919 934
920 mapping = page->mapping; 935 mapping = page->mapping;
diff --git a/mm/slub.c b/mm/slub.c
index aac1dd3c657d..bcdb2c8941a5 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2734,7 +2734,7 @@ static void slab_mem_offline_callback(void *arg)
2734 * and offline_pages() function shoudn't call this 2734 * and offline_pages() function shoudn't call this
2735 * callback. So, we must fail. 2735 * callback. So, we must fail.
2736 */ 2736 */
2737 BUG_ON(atomic_read(&n->nr_slabs)); 2737 BUG_ON(atomic_long_read(&n->nr_slabs));
2738 2738
2739 s->node[offline_node] = NULL; 2739 s->node[offline_node] = NULL;
2740 kmem_cache_free(kmalloc_caches, n); 2740 kmem_cache_free(kmalloc_caches, n);
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index d3b718b0c20a..22620f6a976b 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -24,6 +24,7 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/sched.h>
27#include <asm/dma.h> 28#include <asm/dma.h>
28#include <asm/pgalloc.h> 29#include <asm/pgalloc.h>
29#include <asm/pgtable.h> 30#include <asm/pgtable.h>
diff --git a/mm/sparse.c b/mm/sparse.c
index 08fb14f5eea3..e06f514fe04f 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -220,12 +220,6 @@ static int __meminit sparse_init_one_section(struct mem_section *ms,
220 return 1; 220 return 1;
221} 221}
222 222
223__attribute__((weak)) __init
224void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
225{
226 return NULL;
227}
228
229static unsigned long usemap_size(void) 223static unsigned long usemap_size(void)
230{ 224{
231 unsigned long size_bytes; 225 unsigned long size_bytes;
@@ -267,11 +261,6 @@ struct page __init *sparse_mem_map_populate(unsigned long pnum, int nid)
267 if (map) 261 if (map)
268 return map; 262 return map;
269 263
270 map = alloc_bootmem_high_node(NODE_DATA(nid),
271 sizeof(struct page) * PAGES_PER_SECTION);
272 if (map)
273 return map;
274
275 map = alloc_bootmem_node(NODE_DATA(nid), 264 map = alloc_bootmem_node(NODE_DATA(nid),
276 sizeof(struct page) * PAGES_PER_SECTION); 265 sizeof(struct page) * PAGES_PER_SECTION);
277 return map; 266 return map;
diff --git a/net/9p/mux.c b/net/9p/mux.c
index f14014793bed..c9f0805048e4 100644
--- a/net/9p/mux.c
+++ b/net/9p/mux.c
@@ -222,8 +222,10 @@ static int p9_mux_poll_start(struct p9_conn *m)
222 } 222 }
223 223
224 if (i >= ARRAY_SIZE(p9_mux_poll_tasks)) { 224 if (i >= ARRAY_SIZE(p9_mux_poll_tasks)) {
225 if (vptlast == NULL) 225 if (vptlast == NULL) {
226 mutex_unlock(&p9_mux_task_lock);
226 return -ENOMEM; 227 return -ENOMEM;
228 }
227 229
228 P9_DPRINTK(P9_DEBUG_MUX, "put in proc %d\n", i); 230 P9_DPRINTK(P9_DEBUG_MUX, "put in proc %d\n", i);
229 list_add(&m->mux_list, &vptlast->mux_list); 231 list_add(&m->mux_list, &vptlast->mux_list);
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 7c0b5151d526..e0d37d6dc1f8 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1044,7 +1044,7 @@ static int atalk_create(struct net *net, struct socket *sock, int protocol)
1044 if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) 1044 if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
1045 goto out; 1045 goto out;
1046 rc = -ENOMEM; 1046 rc = -ENOMEM;
1047 sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto, 1); 1047 sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto);
1048 if (!sk) 1048 if (!sk)
1049 goto out; 1049 goto out;
1050 rc = 0; 1050 rc = 0;
diff --git a/net/atm/common.c b/net/atm/common.c
index e166d9e0ffd9..eba09a04f6bf 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -133,7 +133,7 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family)
133 sock->sk = NULL; 133 sock->sk = NULL;
134 if (sock->type == SOCK_STREAM) 134 if (sock->type == SOCK_STREAM)
135 return -EINVAL; 135 return -EINVAL;
136 sk = sk_alloc(net, family, GFP_KERNEL, &vcc_proto, 1); 136 sk = sk_alloc(net, family, GFP_KERNEL, &vcc_proto);
137 if (!sk) 137 if (!sk)
138 return -ENOMEM; 138 return -ENOMEM;
139 sock_init_data(sock, sk); 139 sock_init_data(sock, sk);
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 993e5c75e909..8378afd54b30 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -836,7 +836,8 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol)
836 return -ESOCKTNOSUPPORT; 836 return -ESOCKTNOSUPPORT;
837 } 837 }
838 838
839 if ((sk = sk_alloc(net, PF_AX25, GFP_ATOMIC, &ax25_proto, 1)) == NULL) 839 sk = sk_alloc(net, PF_AX25, GFP_ATOMIC, &ax25_proto);
840 if (sk == NULL)
840 return -ENOMEM; 841 return -ENOMEM;
841 842
842 ax25 = sk->sk_protinfo = ax25_create_cb(); 843 ax25 = sk->sk_protinfo = ax25_create_cb();
@@ -861,7 +862,8 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
861 struct sock *sk; 862 struct sock *sk;
862 ax25_cb *ax25, *oax25; 863 ax25_cb *ax25, *oax25;
863 864
864 if ((sk = sk_alloc(osk->sk_net, PF_AX25, GFP_ATOMIC, osk->sk_prot, 1)) == NULL) 865 sk = sk_alloc(osk->sk_net, PF_AX25, GFP_ATOMIC, osk->sk_prot);
866 if (sk == NULL)
865 return NULL; 867 return NULL;
866 868
867 if ((ax25 = ax25_create_cb()) == NULL) { 869 if ((ax25 = ax25_create_cb()) == NULL) {
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c
index f718965f296c..9ebd3c64474d 100644
--- a/net/bluetooth/bnep/sock.c
+++ b/net/bluetooth/bnep/sock.c
@@ -213,7 +213,7 @@ static int bnep_sock_create(struct net *net, struct socket *sock, int protocol)
213 if (sock->type != SOCK_RAW) 213 if (sock->type != SOCK_RAW)
214 return -ESOCKTNOSUPPORT; 214 return -ESOCKTNOSUPPORT;
215 215
216 sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto, 1); 216 sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto);
217 if (!sk) 217 if (!sk)
218 return -ENOMEM; 218 return -ENOMEM;
219 219
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
index cf700c20d11e..783edab12ce8 100644
--- a/net/bluetooth/cmtp/sock.c
+++ b/net/bluetooth/cmtp/sock.c
@@ -204,7 +204,7 @@ static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol)
204 if (sock->type != SOCK_RAW) 204 if (sock->type != SOCK_RAW)
205 return -ESOCKTNOSUPPORT; 205 return -ESOCKTNOSUPPORT;
206 206
207 sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto, 1); 207 sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto);
208 if (!sk) 208 if (!sk)
209 return -ENOMEM; 209 return -ENOMEM;
210 210
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 8825102c517c..14991323c273 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -645,7 +645,7 @@ static int hci_sock_create(struct net *net, struct socket *sock, int protocol)
645 645
646 sock->ops = &hci_sock_ops; 646 sock->ops = &hci_sock_ops;
647 647
648 sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto, 1); 648 sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto);
649 if (!sk) 649 if (!sk)
650 return -ENOMEM; 650 return -ENOMEM;
651 651
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c
index 1de2b6fbcac0..3292b956a7c4 100644
--- a/net/bluetooth/hidp/sock.c
+++ b/net/bluetooth/hidp/sock.c
@@ -255,7 +255,7 @@ static int hidp_sock_create(struct net *net, struct socket *sock, int protocol)
255 if (sock->type != SOCK_RAW) 255 if (sock->type != SOCK_RAW)
256 return -ESOCKTNOSUPPORT; 256 return -ESOCKTNOSUPPORT;
257 257
258 sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto, 1); 258 sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto);
259 if (!sk) 259 if (!sk)
260 return -ENOMEM; 260 return -ENOMEM;
261 261
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 6fbbae78b304..477e052b17b5 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -607,7 +607,7 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int p
607{ 607{
608 struct sock *sk; 608 struct sock *sk;
609 609
610 sk = sk_alloc(net, PF_BLUETOOTH, prio, &l2cap_proto, 1); 610 sk = sk_alloc(net, PF_BLUETOOTH, prio, &l2cap_proto);
611 if (!sk) 611 if (!sk)
612 return NULL; 612 return NULL;
613 613
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index 266b6972667d..c46d51035e77 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -287,7 +287,7 @@ static struct sock *rfcomm_sock_alloc(struct net *net, struct socket *sock, int
287 struct rfcomm_dlc *d; 287 struct rfcomm_dlc *d;
288 struct sock *sk; 288 struct sock *sk;
289 289
290 sk = sk_alloc(net, PF_BLUETOOTH, prio, &rfcomm_proto, 1); 290 sk = sk_alloc(net, PF_BLUETOOTH, prio, &rfcomm_proto);
291 if (!sk) 291 if (!sk)
292 return NULL; 292 return NULL;
293 293
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 82d0dfdfa7e2..93ad1aae3f38 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -421,7 +421,7 @@ static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, int pro
421{ 421{
422 struct sock *sk; 422 struct sock *sk;
423 423
424 sk = sk_alloc(net, PF_BLUETOOTH, prio, &sco_proto, 1); 424 sk = sk_alloc(net, PF_BLUETOOTH, prio, &sco_proto);
425 if (!sk) 425 if (!sk)
426 return NULL; 426 return NULL;
427 427
diff --git a/net/core/dev.c b/net/core/dev.c
index 872658927e47..be6cedab5aa8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -120,6 +120,8 @@
120#include <linux/ctype.h> 120#include <linux/ctype.h>
121#include <linux/if_arp.h> 121#include <linux/if_arp.h>
122 122
123#include "net-sysfs.h"
124
123/* 125/*
124 * The list of packet types we will receive (as opposed to discard) 126 * The list of packet types we will receive (as opposed to discard)
125 * and the routines to invoke. 127 * and the routines to invoke.
@@ -249,10 +251,6 @@ static RAW_NOTIFIER_HEAD(netdev_chain);
249 251
250DEFINE_PER_CPU(struct softnet_data, softnet_data); 252DEFINE_PER_CPU(struct softnet_data, softnet_data);
251 253
252extern int netdev_kobject_init(void);
253extern int netdev_register_kobject(struct net_device *);
254extern void netdev_unregister_kobject(struct net_device *);
255
256#ifdef CONFIG_DEBUG_LOCK_ALLOC 254#ifdef CONFIG_DEBUG_LOCK_ALLOC
257/* 255/*
258 * register_netdevice() inits dev->_xmit_lock and sets lockdep class 256 * register_netdevice() inits dev->_xmit_lock and sets lockdep class
@@ -885,6 +883,9 @@ int dev_change_name(struct net_device *dev, char *newname)
885 if (!dev_valid_name(newname)) 883 if (!dev_valid_name(newname))
886 return -EINVAL; 884 return -EINVAL;
887 885
886 if (strncmp(newname, dev->name, IFNAMSIZ) == 0)
887 return 0;
888
888 memcpy(oldname, dev->name, IFNAMSIZ); 889 memcpy(oldname, dev->name, IFNAMSIZ);
889 890
890 if (strchr(newname, '%')) { 891 if (strchr(newname, '%')) {
@@ -1007,17 +1008,20 @@ int dev_open(struct net_device *dev)
1007 * Call device private open method 1008 * Call device private open method
1008 */ 1009 */
1009 set_bit(__LINK_STATE_START, &dev->state); 1010 set_bit(__LINK_STATE_START, &dev->state);
1010 if (dev->open) { 1011
1012 if (dev->validate_addr)
1013 ret = dev->validate_addr(dev);
1014
1015 if (!ret && dev->open)
1011 ret = dev->open(dev); 1016 ret = dev->open(dev);
1012 if (ret)
1013 clear_bit(__LINK_STATE_START, &dev->state);
1014 }
1015 1017
1016 /* 1018 /*
1017 * If it went open OK then: 1019 * If it went open OK then:
1018 */ 1020 */
1019 1021
1020 if (!ret) { 1022 if (ret)
1023 clear_bit(__LINK_STATE_START, &dev->state);
1024 else {
1021 /* 1025 /*
1022 * Set the flags. 1026 * Set the flags.
1023 */ 1027 */
@@ -1038,6 +1042,7 @@ int dev_open(struct net_device *dev)
1038 */ 1042 */
1039 call_netdevice_notifiers(NETDEV_UP, dev); 1043 call_netdevice_notifiers(NETDEV_UP, dev);
1040 } 1044 }
1045
1041 return ret; 1046 return ret;
1042} 1047}
1043 1048
@@ -1746,9 +1751,6 @@ DEFINE_PER_CPU(struct netif_rx_stats, netdev_rx_stat) = { 0, };
1746 * 1751 *
1747 * return values: 1752 * return values:
1748 * NET_RX_SUCCESS (no congestion) 1753 * NET_RX_SUCCESS (no congestion)
1749 * NET_RX_CN_LOW (low congestion)
1750 * NET_RX_CN_MOD (moderate congestion)
1751 * NET_RX_CN_HIGH (high congestion)
1752 * NET_RX_DROP (packet was dropped) 1754 * NET_RX_DROP (packet was dropped)
1753 * 1755 *
1754 */ 1756 */
@@ -1996,6 +1998,21 @@ out:
1996} 1998}
1997#endif 1999#endif
1998 2000
2001/**
2002 * netif_receive_skb - process receive buffer from network
2003 * @skb: buffer to process
2004 *
2005 * netif_receive_skb() is the main receive data processing function.
2006 * It always succeeds. The buffer may be dropped during processing
2007 * for congestion control or by the protocol layers.
2008 *
2009 * This function may only be called from softirq context and interrupts
2010 * should be enabled.
2011 *
2012 * Return values (usually ignored):
2013 * NET_RX_SUCCESS: no congestion
2014 * NET_RX_DROP: packet was dropped
2015 */
1999int netif_receive_skb(struct sk_buff *skb) 2016int netif_receive_skb(struct sk_buff *skb)
2000{ 2017{
2001 struct packet_type *ptype, *pt_prev; 2018 struct packet_type *ptype, *pt_prev;
@@ -2167,7 +2184,15 @@ static void net_rx_action(struct softirq_action *h)
2167 2184
2168 weight = n->weight; 2185 weight = n->weight;
2169 2186
2170 work = n->poll(n, weight); 2187 /* This NAPI_STATE_SCHED test is for avoiding a race
2188 * with netpoll's poll_napi(). Only the entity which
2189 * obtains the lock and sees NAPI_STATE_SCHED set will
2190 * actually make the ->poll() call. Therefore we avoid
2191 * accidently calling ->poll() when NAPI is not scheduled.
2192 */
2193 work = 0;
2194 if (test_bit(NAPI_STATE_SCHED, &n->state))
2195 work = n->poll(n, weight);
2171 2196
2172 WARN_ON_ONCE(work > weight); 2197 WARN_ON_ONCE(work > weight);
2173 2198
@@ -2663,7 +2688,7 @@ static void __net_exit dev_proc_net_exit(struct net *net)
2663 proc_net_remove(net, "dev"); 2688 proc_net_remove(net, "dev");
2664} 2689}
2665 2690
2666static struct pernet_operations __net_initdata dev_proc_ops = { 2691static struct pernet_operations dev_proc_ops = {
2667 .init = dev_proc_net_init, 2692 .init = dev_proc_net_init,
2668 .exit = dev_proc_net_exit, 2693 .exit = dev_proc_net_exit,
2669}; 2694};
@@ -3483,6 +3508,60 @@ static void net_set_todo(struct net_device *dev)
3483 spin_unlock(&net_todo_list_lock); 3508 spin_unlock(&net_todo_list_lock);
3484} 3509}
3485 3510
3511static void rollback_registered(struct net_device *dev)
3512{
3513 BUG_ON(dev_boot_phase);
3514 ASSERT_RTNL();
3515
3516 /* Some devices call without registering for initialization unwind. */
3517 if (dev->reg_state == NETREG_UNINITIALIZED) {
3518 printk(KERN_DEBUG "unregister_netdevice: device %s/%p never "
3519 "was registered\n", dev->name, dev);
3520
3521 WARN_ON(1);
3522 return;
3523 }
3524
3525 BUG_ON(dev->reg_state != NETREG_REGISTERED);
3526
3527 /* If device is running, close it first. */
3528 dev_close(dev);
3529
3530 /* And unlink it from device chain. */
3531 unlist_netdevice(dev);
3532
3533 dev->reg_state = NETREG_UNREGISTERING;
3534
3535 synchronize_net();
3536
3537 /* Shutdown queueing discipline. */
3538 dev_shutdown(dev);
3539
3540
3541 /* Notify protocols, that we are about to destroy
3542 this device. They should clean all the things.
3543 */
3544 call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
3545
3546 /*
3547 * Flush the unicast and multicast chains
3548 */
3549 dev_addr_discard(dev);
3550
3551 if (dev->uninit)
3552 dev->uninit(dev);
3553
3554 /* Notifier chain MUST detach us from master device. */
3555 BUG_TRAP(!dev->master);
3556
3557 /* Remove entries from kobject tree */
3558 netdev_unregister_kobject(dev);
3559
3560 synchronize_net();
3561
3562 dev_put(dev);
3563}
3564
3486/** 3565/**
3487 * register_netdevice - register a network device 3566 * register_netdevice - register a network device
3488 * @dev: device to register 3567 * @dev: device to register
@@ -3620,8 +3699,10 @@ int register_netdevice(struct net_device *dev)
3620 /* Notify protocols, that a new device appeared. */ 3699 /* Notify protocols, that a new device appeared. */
3621 ret = call_netdevice_notifiers(NETDEV_REGISTER, dev); 3700 ret = call_netdevice_notifiers(NETDEV_REGISTER, dev);
3622 ret = notifier_to_errno(ret); 3701 ret = notifier_to_errno(ret);
3623 if (ret) 3702 if (ret) {
3624 unregister_netdevice(dev); 3703 rollback_registered(dev);
3704 dev->reg_state = NETREG_UNREGISTERED;
3705 }
3625 3706
3626out: 3707out:
3627 return ret; 3708 return ret;
@@ -3898,59 +3979,9 @@ void synchronize_net(void)
3898 3979
3899void unregister_netdevice(struct net_device *dev) 3980void unregister_netdevice(struct net_device *dev)
3900{ 3981{
3901 BUG_ON(dev_boot_phase); 3982 rollback_registered(dev);
3902 ASSERT_RTNL();
3903
3904 /* Some devices call without registering for initialization unwind. */
3905 if (dev->reg_state == NETREG_UNINITIALIZED) {
3906 printk(KERN_DEBUG "unregister_netdevice: device %s/%p never "
3907 "was registered\n", dev->name, dev);
3908
3909 WARN_ON(1);
3910 return;
3911 }
3912
3913 BUG_ON(dev->reg_state != NETREG_REGISTERED);
3914
3915 /* If device is running, close it first. */
3916 dev_close(dev);
3917
3918 /* And unlink it from device chain. */
3919 unlist_netdevice(dev);
3920
3921 dev->reg_state = NETREG_UNREGISTERING;
3922
3923 synchronize_net();
3924
3925 /* Shutdown queueing discipline. */
3926 dev_shutdown(dev);
3927
3928
3929 /* Notify protocols, that we are about to destroy
3930 this device. They should clean all the things.
3931 */
3932 call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
3933
3934 /*
3935 * Flush the unicast and multicast chains
3936 */
3937 dev_addr_discard(dev);
3938
3939 if (dev->uninit)
3940 dev->uninit(dev);
3941
3942 /* Notifier chain MUST detach us from master device. */
3943 BUG_TRAP(!dev->master);
3944
3945 /* Remove entries from kobject tree */
3946 netdev_unregister_kobject(dev);
3947
3948 /* Finish processing unregister after unlock */ 3983 /* Finish processing unregister after unlock */
3949 net_set_todo(dev); 3984 net_set_todo(dev);
3950
3951 synchronize_net();
3952
3953 dev_put(dev);
3954} 3985}
3955 3986
3956/** 3987/**
@@ -4323,7 +4354,7 @@ static void __net_exit netdev_exit(struct net *net)
4323 kfree(net->dev_index_head); 4354 kfree(net->dev_index_head);
4324} 4355}
4325 4356
4326static struct pernet_operations __net_initdata netdev_net_ops = { 4357static struct pernet_operations netdev_net_ops = {
4327 .init = netdev_init, 4358 .init = netdev_init,
4328 .exit = netdev_exit, 4359 .exit = netdev_exit,
4329}; 4360};
@@ -4354,7 +4385,7 @@ static void __net_exit default_device_exit(struct net *net)
4354 rtnl_unlock(); 4385 rtnl_unlock();
4355} 4386}
4356 4387
4357static struct pernet_operations __net_initdata default_device_ops = { 4388static struct pernet_operations default_device_ops = {
4358 .exit = default_device_exit, 4389 .exit = default_device_exit,
4359}; 4390};
4360 4391
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index 15241cf48af8..ae354057d84c 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -285,7 +285,7 @@ static void __net_exit dev_mc_net_exit(struct net *net)
285 proc_net_remove(net, "dev_mcast"); 285 proc_net_remove(net, "dev_mcast");
286} 286}
287 287
288static struct pernet_operations __net_initdata dev_mc_net_ops = { 288static struct pernet_operations dev_mc_net_ops = {
289 .init = dev_mc_net_init, 289 .init = dev_mc_net_init,
290 .exit = dev_mc_net_exit, 290 .exit = dev_mc_net_exit,
291}; 291};
diff --git a/net/core/flow.c b/net/core/flow.c
index 0ab5234b17d8..3ed2b4b1d6d4 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -142,8 +142,6 @@ typedef u64 flow_compare_t;
142typedef u32 flow_compare_t; 142typedef u32 flow_compare_t;
143#endif 143#endif
144 144
145extern void flowi_is_missized(void);
146
147/* I hear what you're saying, use memcmp. But memcmp cannot make 145/* I hear what you're saying, use memcmp. But memcmp cannot make
148 * important assumptions that we can here, such as alignment and 146 * important assumptions that we can here, such as alignment and
149 * constant size. 147 * constant size.
@@ -153,8 +151,7 @@ static int flow_key_compare(struct flowi *key1, struct flowi *key2)
153 flow_compare_t *k1, *k1_lim, *k2; 151 flow_compare_t *k1, *k1_lim, *k2;
154 const int n_elem = sizeof(struct flowi) / sizeof(flow_compare_t); 152 const int n_elem = sizeof(struct flowi) / sizeof(flow_compare_t);
155 153
156 if (sizeof(struct flowi) % sizeof(flow_compare_t)) 154 BUILD_BUG_ON(sizeof(struct flowi) % sizeof(flow_compare_t));
157 flowi_is_missized();
158 155
159 k1 = (flow_compare_t *) key1; 156 k1 = (flow_compare_t *) key1;
160 k1_lim = k1 + n_elem; 157 k1_lim = k1 + n_elem;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 6628e457ddc0..61ead1d11132 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -18,6 +18,8 @@
18#include <linux/wireless.h> 18#include <linux/wireless.h>
19#include <net/iw_handler.h> 19#include <net/iw_handler.h>
20 20
21#include "net-sysfs.h"
22
21#ifdef CONFIG_SYSFS 23#ifdef CONFIG_SYSFS
22static const char fmt_hex[] = "%#x\n"; 24static const char fmt_hex[] = "%#x\n";
23static const char fmt_long_hex[] = "%#lx\n"; 25static const char fmt_long_hex[] = "%#lx\n";
diff --git a/net/core/net-sysfs.h b/net/core/net-sysfs.h
new file mode 100644
index 000000000000..f5f108db3924
--- /dev/null
+++ b/net/core/net-sysfs.h
@@ -0,0 +1,8 @@
1#ifndef __NET_SYSFS_H__
2#define __NET_SYSFS_H__
3
4int netdev_kobject_init(void);
5int netdev_register_kobject(struct net_device *);
6void netdev_unregister_kobject(struct net_device *);
7
8#endif
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 6f71db8c4428..e9f0964ce70b 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -17,74 +17,13 @@ static DEFINE_MUTEX(net_mutex);
17 17
18LIST_HEAD(net_namespace_list); 18LIST_HEAD(net_namespace_list);
19 19
20static struct kmem_cache *net_cachep;
21
22struct net init_net; 20struct net init_net;
23EXPORT_SYMBOL_GPL(init_net); 21EXPORT_SYMBOL_GPL(init_net);
24 22
25static struct net *net_alloc(void)
26{
27 return kmem_cache_zalloc(net_cachep, GFP_KERNEL);
28}
29
30static void net_free(struct net *net)
31{
32 if (!net)
33 return;
34
35 if (unlikely(atomic_read(&net->use_count) != 0)) {
36 printk(KERN_EMERG "network namespace not free! Usage: %d\n",
37 atomic_read(&net->use_count));
38 return;
39 }
40
41 kmem_cache_free(net_cachep, net);
42}
43
44static void cleanup_net(struct work_struct *work)
45{
46 struct pernet_operations *ops;
47 struct net *net;
48
49 net = container_of(work, struct net, work);
50
51 mutex_lock(&net_mutex);
52
53 /* Don't let anyone else find us. */
54 rtnl_lock();
55 list_del(&net->list);
56 rtnl_unlock();
57
58 /* Run all of the network namespace exit methods */
59 list_for_each_entry_reverse(ops, &pernet_list, list) {
60 if (ops->exit)
61 ops->exit(net);
62 }
63
64 mutex_unlock(&net_mutex);
65
66 /* Ensure there are no outstanding rcu callbacks using this
67 * network namespace.
68 */
69 rcu_barrier();
70
71 /* Finally it is safe to free my network namespace structure */
72 net_free(net);
73}
74
75
76void __put_net(struct net *net)
77{
78 /* Cleanup the network namespace in process context */
79 INIT_WORK(&net->work, cleanup_net);
80 schedule_work(&net->work);
81}
82EXPORT_SYMBOL_GPL(__put_net);
83
84/* 23/*
85 * setup_net runs the initializers for the network namespace object. 24 * setup_net runs the initializers for the network namespace object.
86 */ 25 */
87static int setup_net(struct net *net) 26static __net_init int setup_net(struct net *net)
88{ 27{
89 /* Must be called with net_mutex held */ 28 /* Must be called with net_mutex held */
90 struct pernet_operations *ops; 29 struct pernet_operations *ops;
@@ -112,9 +51,19 @@ out_undo:
112 if (ops->exit) 51 if (ops->exit)
113 ops->exit(net); 52 ops->exit(net);
114 } 53 }
54
55 rcu_barrier();
115 goto out; 56 goto out;
116} 57}
117 58
59#ifdef CONFIG_NET_NS
60static struct kmem_cache *net_cachep;
61
62static struct net *net_alloc(void)
63{
64 return kmem_cache_zalloc(net_cachep, GFP_KERNEL);
65}
66
118struct net *copy_net_ns(unsigned long flags, struct net *old_net) 67struct net *copy_net_ns(unsigned long flags, struct net *old_net)
119{ 68{
120 struct net *new_net = NULL; 69 struct net *new_net = NULL;
@@ -125,10 +74,6 @@ struct net *copy_net_ns(unsigned long flags, struct net *old_net)
125 if (!(flags & CLONE_NEWNET)) 74 if (!(flags & CLONE_NEWNET))
126 return old_net; 75 return old_net;
127 76
128#ifndef CONFIG_NET_NS
129 return ERR_PTR(-EINVAL);
130#endif
131
132 err = -ENOMEM; 77 err = -ENOMEM;
133 new_net = net_alloc(); 78 new_net = net_alloc();
134 if (!new_net) 79 if (!new_net)
@@ -155,14 +100,78 @@ out:
155 return new_net; 100 return new_net;
156} 101}
157 102
103static void net_free(struct net *net)
104{
105 if (!net)
106 return;
107
108 if (unlikely(atomic_read(&net->use_count) != 0)) {
109 printk(KERN_EMERG "network namespace not free! Usage: %d\n",
110 atomic_read(&net->use_count));
111 return;
112 }
113
114 kmem_cache_free(net_cachep, net);
115}
116
117static void cleanup_net(struct work_struct *work)
118{
119 struct pernet_operations *ops;
120 struct net *net;
121
122 net = container_of(work, struct net, work);
123
124 mutex_lock(&net_mutex);
125
126 /* Don't let anyone else find us. */
127 rtnl_lock();
128 list_del(&net->list);
129 rtnl_unlock();
130
131 /* Run all of the network namespace exit methods */
132 list_for_each_entry_reverse(ops, &pernet_list, list) {
133 if (ops->exit)
134 ops->exit(net);
135 }
136
137 mutex_unlock(&net_mutex);
138
139 /* Ensure there are no outstanding rcu callbacks using this
140 * network namespace.
141 */
142 rcu_barrier();
143
144 /* Finally it is safe to free my network namespace structure */
145 net_free(net);
146}
147
148void __put_net(struct net *net)
149{
150 /* Cleanup the network namespace in process context */
151 INIT_WORK(&net->work, cleanup_net);
152 schedule_work(&net->work);
153}
154EXPORT_SYMBOL_GPL(__put_net);
155
156#else
157struct net *copy_net_ns(unsigned long flags, struct net *old_net)
158{
159 if (flags & CLONE_NEWNET)
160 return ERR_PTR(-EINVAL);
161 return old_net;
162}
163#endif
164
158static int __init net_ns_init(void) 165static int __init net_ns_init(void)
159{ 166{
160 int err; 167 int err;
161 168
162 printk(KERN_INFO "net_namespace: %zd bytes\n", sizeof(struct net)); 169 printk(KERN_INFO "net_namespace: %zd bytes\n", sizeof(struct net));
170#ifdef CONFIG_NET_NS
163 net_cachep = kmem_cache_create("net_namespace", sizeof(struct net), 171 net_cachep = kmem_cache_create("net_namespace", sizeof(struct net),
164 SMP_CACHE_BYTES, 172 SMP_CACHE_BYTES,
165 SLAB_PANIC, NULL); 173 SLAB_PANIC, NULL);
174#endif
166 mutex_lock(&net_mutex); 175 mutex_lock(&net_mutex);
167 err = setup_net(&init_net); 176 err = setup_net(&init_net);
168 177
@@ -185,29 +194,28 @@ static int register_pernet_operations(struct list_head *list,
185 struct net *net, *undo_net; 194 struct net *net, *undo_net;
186 int error; 195 int error;
187 196
188 error = 0;
189 list_add_tail(&ops->list, list); 197 list_add_tail(&ops->list, list);
190 for_each_net(net) { 198 if (ops->init) {
191 if (ops->init) { 199 for_each_net(net) {
192 error = ops->init(net); 200 error = ops->init(net);
193 if (error) 201 if (error)
194 goto out_undo; 202 goto out_undo;
195 } 203 }
196 } 204 }
197out: 205 return 0;
198 return error;
199 206
200out_undo: 207out_undo:
201 /* If I have an error cleanup all namespaces I initialized */ 208 /* If I have an error cleanup all namespaces I initialized */
202 list_del(&ops->list); 209 list_del(&ops->list);
203 for_each_net(undo_net) { 210 if (ops->exit) {
204 if (undo_net == net) 211 for_each_net(undo_net) {
205 goto undone; 212 if (undo_net == net)
206 if (ops->exit) 213 goto undone;
207 ops->exit(undo_net); 214 ops->exit(undo_net);
215 }
208 } 216 }
209undone: 217undone:
210 goto out; 218 return error;
211} 219}
212 220
213static void unregister_pernet_operations(struct pernet_operations *ops) 221static void unregister_pernet_operations(struct pernet_operations *ops)
@@ -215,8 +223,8 @@ static void unregister_pernet_operations(struct pernet_operations *ops)
215 struct net *net; 223 struct net *net;
216 224
217 list_del(&ops->list); 225 list_del(&ops->list);
218 for_each_net(net) 226 if (ops->exit)
219 if (ops->exit) 227 for_each_net(net)
220 ops->exit(net); 228 ops->exit(net);
221} 229}
222 230
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index bf8d18f1b013..c499b5c69bed 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -116,6 +116,29 @@ static __sum16 checksum_udp(struct sk_buff *skb, struct udphdr *uh,
116 * network adapter, forcing superfluous retries and possibly timeouts. 116 * network adapter, forcing superfluous retries and possibly timeouts.
117 * Thus, we set our budget to greater than 1. 117 * Thus, we set our budget to greater than 1.
118 */ 118 */
119static int poll_one_napi(struct netpoll_info *npinfo,
120 struct napi_struct *napi, int budget)
121{
122 int work;
123
124 /* net_rx_action's ->poll() invocations and our's are
125 * synchronized by this test which is only made while
126 * holding the napi->poll_lock.
127 */
128 if (!test_bit(NAPI_STATE_SCHED, &napi->state))
129 return budget;
130
131 npinfo->rx_flags |= NETPOLL_RX_DROP;
132 atomic_inc(&trapped);
133
134 work = napi->poll(napi, budget);
135
136 atomic_dec(&trapped);
137 npinfo->rx_flags &= ~NETPOLL_RX_DROP;
138
139 return budget - work;
140}
141
119static void poll_napi(struct netpoll *np) 142static void poll_napi(struct netpoll *np)
120{ 143{
121 struct netpoll_info *npinfo = np->dev->npinfo; 144 struct netpoll_info *npinfo = np->dev->npinfo;
@@ -123,17 +146,13 @@ static void poll_napi(struct netpoll *np)
123 int budget = 16; 146 int budget = 16;
124 147
125 list_for_each_entry(napi, &np->dev->napi_list, dev_list) { 148 list_for_each_entry(napi, &np->dev->napi_list, dev_list) {
126 if (test_bit(NAPI_STATE_SCHED, &napi->state) && 149 if (napi->poll_owner != smp_processor_id() &&
127 napi->poll_owner != smp_processor_id() &&
128 spin_trylock(&napi->poll_lock)) { 150 spin_trylock(&napi->poll_lock)) {
129 npinfo->rx_flags |= NETPOLL_RX_DROP; 151 budget = poll_one_napi(npinfo, napi, budget);
130 atomic_inc(&trapped);
131
132 napi->poll(napi, budget);
133
134 atomic_dec(&trapped);
135 npinfo->rx_flags &= ~NETPOLL_RX_DROP;
136 spin_unlock(&napi->poll_lock); 152 spin_unlock(&napi->poll_lock);
153
154 if (!budget)
155 break;
137 } 156 }
138 } 157 }
139} 158}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 4a2640d38261..e1ba26fb4bf2 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -742,7 +742,7 @@ static struct net *get_net_ns_by_pid(pid_t pid)
742 /* Lookup the network namespace */ 742 /* Lookup the network namespace */
743 net = ERR_PTR(-ESRCH); 743 net = ERR_PTR(-ESRCH);
744 rcu_read_lock(); 744 rcu_read_lock();
745 tsk = find_task_by_pid(pid); 745 tsk = find_task_by_vpid(pid);
746 if (tsk) { 746 if (tsk) {
747 struct nsproxy *nsproxy; 747 struct nsproxy *nsproxy;
748 nsproxy = task_nsproxy(tsk); 748 nsproxy = task_nsproxy(tsk);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4e2c84fcf276..64b50ff7a413 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -415,13 +415,6 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
415 n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len; 415 n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len;
416 n->nohdr = 0; 416 n->nohdr = 0;
417 n->destructor = NULL; 417 n->destructor = NULL;
418#ifdef CONFIG_NET_CLS_ACT
419 /* FIXME What is this and why don't we do it in copy_skb_header? */
420 n->tc_verd = SET_TC_VERD(n->tc_verd,0);
421 n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd);
422 n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
423 C(iif);
424#endif
425 C(truesize); 418 C(truesize);
426 atomic_set(&n->users, 1); 419 atomic_set(&n->users, 1);
427 C(head); 420 C(head);
@@ -2035,8 +2028,8 @@ void __init skb_init(void)
2035 * Fill the specified scatter-gather list with mappings/pointers into a 2028 * Fill the specified scatter-gather list with mappings/pointers into a
2036 * region of the buffer space attached to a socket buffer. 2029 * region of the buffer space attached to a socket buffer.
2037 */ 2030 */
2038int 2031static int
2039skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len) 2032__skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
2040{ 2033{
2041 int start = skb_headlen(skb); 2034 int start = skb_headlen(skb);
2042 int i, copy = start - offset; 2035 int i, copy = start - offset;
@@ -2045,9 +2038,7 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
2045 if (copy > 0) { 2038 if (copy > 0) {
2046 if (copy > len) 2039 if (copy > len)
2047 copy = len; 2040 copy = len;
2048 sg_set_page(&sg[elt], virt_to_page(skb->data + offset)); 2041 sg_set_buf(sg, skb->data + offset, copy);
2049 sg[elt].offset = (unsigned long)(skb->data + offset) % PAGE_SIZE;
2050 sg[elt].length = copy;
2051 elt++; 2042 elt++;
2052 if ((len -= copy) == 0) 2043 if ((len -= copy) == 0)
2053 return elt; 2044 return elt;
@@ -2065,9 +2056,8 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
2065 2056
2066 if (copy > len) 2057 if (copy > len)
2067 copy = len; 2058 copy = len;
2068 sg_set_page(&sg[elt], frag->page); 2059 sg_set_page(&sg[elt], frag->page, copy,
2069 sg[elt].offset = frag->page_offset+offset-start; 2060 frag->page_offset+offset-start);
2070 sg[elt].length = copy;
2071 elt++; 2061 elt++;
2072 if (!(len -= copy)) 2062 if (!(len -= copy))
2073 return elt; 2063 return elt;
@@ -2088,7 +2078,8 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
2088 if ((copy = end - offset) > 0) { 2078 if ((copy = end - offset) > 0) {
2089 if (copy > len) 2079 if (copy > len)
2090 copy = len; 2080 copy = len;
2091 elt += skb_to_sgvec(list, sg+elt, offset - start, copy); 2081 elt += __skb_to_sgvec(list, sg+elt, offset - start,
2082 copy);
2092 if ((len -= copy) == 0) 2083 if ((len -= copy) == 0)
2093 return elt; 2084 return elt;
2094 offset += copy; 2085 offset += copy;
@@ -2100,6 +2091,15 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
2100 return elt; 2091 return elt;
2101} 2092}
2102 2093
2094int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
2095{
2096 int nsg = __skb_to_sgvec(skb, sg, offset, len);
2097
2098 __sg_mark_end(&sg[nsg - 1]);
2099
2100 return nsg;
2101}
2102
2103/** 2103/**
2104 * skb_cow_data - Check that a socket buffer's data buffers are writable 2104 * skb_cow_data - Check that a socket buffer's data buffers are writable
2105 * @skb: The socket buffer to check. 2105 * @skb: The socket buffer to check.
diff --git a/net/core/sock.c b/net/core/sock.c
index febbcbcf8022..12ad2067a988 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -857,46 +857,43 @@ static inline void sock_lock_init(struct sock *sk)
857 af_family_keys + sk->sk_family); 857 af_family_keys + sk->sk_family);
858} 858}
859 859
860/** 860static void sock_copy(struct sock *nsk, const struct sock *osk)
861 * sk_alloc - All socket objects are allocated here 861{
862 * @net: the applicable net namespace 862#ifdef CONFIG_SECURITY_NETWORK
863 * @family: protocol family 863 void *sptr = nsk->sk_security;
864 * @priority: for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc) 864#endif
865 * @prot: struct proto associated with this new sock instance 865
866 * @zero_it: if we should zero the newly allocated sock 866 memcpy(nsk, osk, osk->sk_prot->obj_size);
867 */ 867#ifdef CONFIG_SECURITY_NETWORK
868struct sock *sk_alloc(struct net *net, int family, gfp_t priority, 868 nsk->sk_security = sptr;
869 struct proto *prot, int zero_it) 869 security_sk_clone(osk, nsk);
870#endif
871}
872
873static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority,
874 int family)
870{ 875{
871 struct sock *sk = NULL; 876 struct sock *sk;
872 struct kmem_cache *slab = prot->slab; 877 struct kmem_cache *slab;
873 878
879 slab = prot->slab;
874 if (slab != NULL) 880 if (slab != NULL)
875 sk = kmem_cache_alloc(slab, priority); 881 sk = kmem_cache_alloc(slab, priority);
876 else 882 else
877 sk = kmalloc(prot->obj_size, priority); 883 sk = kmalloc(prot->obj_size, priority);
878 884
879 if (sk) { 885 if (sk != NULL) {
880 if (zero_it) {
881 memset(sk, 0, prot->obj_size);
882 sk->sk_family = family;
883 /*
884 * See comment in struct sock definition to understand
885 * why we need sk_prot_creator -acme
886 */
887 sk->sk_prot = sk->sk_prot_creator = prot;
888 sock_lock_init(sk);
889 sk->sk_net = get_net(net);
890 }
891
892 if (security_sk_alloc(sk, family, priority)) 886 if (security_sk_alloc(sk, family, priority))
893 goto out_free; 887 goto out_free;
894 888
895 if (!try_module_get(prot->owner)) 889 if (!try_module_get(prot->owner))
896 goto out_free; 890 goto out_free_sec;
897 } 891 }
892
898 return sk; 893 return sk;
899 894
895out_free_sec:
896 security_sk_free(sk);
900out_free: 897out_free:
901 if (slab != NULL) 898 if (slab != NULL)
902 kmem_cache_free(slab, sk); 899 kmem_cache_free(slab, sk);
@@ -905,10 +902,53 @@ out_free:
905 return NULL; 902 return NULL;
906} 903}
907 904
905static void sk_prot_free(struct proto *prot, struct sock *sk)
906{
907 struct kmem_cache *slab;
908 struct module *owner;
909
910 owner = prot->owner;
911 slab = prot->slab;
912
913 security_sk_free(sk);
914 if (slab != NULL)
915 kmem_cache_free(slab, sk);
916 else
917 kfree(sk);
918 module_put(owner);
919}
920
921/**
922 * sk_alloc - All socket objects are allocated here
923 * @net: the applicable net namespace
924 * @family: protocol family
925 * @priority: for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc)
926 * @prot: struct proto associated with this new sock instance
927 * @zero_it: if we should zero the newly allocated sock
928 */
929struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
930 struct proto *prot)
931{
932 struct sock *sk;
933
934 sk = sk_prot_alloc(prot, priority | __GFP_ZERO, family);
935 if (sk) {
936 sk->sk_family = family;
937 /*
938 * See comment in struct sock definition to understand
939 * why we need sk_prot_creator -acme
940 */
941 sk->sk_prot = sk->sk_prot_creator = prot;
942 sock_lock_init(sk);
943 sk->sk_net = get_net(net);
944 }
945
946 return sk;
947}
948
908void sk_free(struct sock *sk) 949void sk_free(struct sock *sk)
909{ 950{
910 struct sk_filter *filter; 951 struct sk_filter *filter;
911 struct module *owner = sk->sk_prot_creator->owner;
912 952
913 if (sk->sk_destruct) 953 if (sk->sk_destruct)
914 sk->sk_destruct(sk); 954 sk->sk_destruct(sk);
@@ -925,25 +965,22 @@ void sk_free(struct sock *sk)
925 printk(KERN_DEBUG "%s: optmem leakage (%d bytes) detected.\n", 965 printk(KERN_DEBUG "%s: optmem leakage (%d bytes) detected.\n",
926 __FUNCTION__, atomic_read(&sk->sk_omem_alloc)); 966 __FUNCTION__, atomic_read(&sk->sk_omem_alloc));
927 967
928 security_sk_free(sk);
929 put_net(sk->sk_net); 968 put_net(sk->sk_net);
930 if (sk->sk_prot_creator->slab != NULL) 969 sk_prot_free(sk->sk_prot_creator, sk);
931 kmem_cache_free(sk->sk_prot_creator->slab, sk);
932 else
933 kfree(sk);
934 module_put(owner);
935} 970}
936 971
937struct sock *sk_clone(const struct sock *sk, const gfp_t priority) 972struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
938{ 973{
939 struct sock *newsk = sk_alloc(sk->sk_net, sk->sk_family, priority, sk->sk_prot, 0); 974 struct sock *newsk;
940 975
976 newsk = sk_prot_alloc(sk->sk_prot, priority, sk->sk_family);
941 if (newsk != NULL) { 977 if (newsk != NULL) {
942 struct sk_filter *filter; 978 struct sk_filter *filter;
943 979
944 sock_copy(newsk, sk); 980 sock_copy(newsk, sk);
945 981
946 /* SANITY */ 982 /* SANITY */
983 get_net(newsk->sk_net);
947 sk_node_init(&newsk->sk_node); 984 sk_node_init(&newsk->sk_node);
948 sock_lock_init(newsk); 985 sock_lock_init(newsk);
949 bh_lock_sock(newsk); 986 bh_lock_sock(newsk);
@@ -1649,7 +1686,6 @@ void sock_enable_timestamp(struct sock *sk)
1649 net_enable_timestamp(); 1686 net_enable_timestamp();
1650 } 1687 }
1651} 1688}
1652EXPORT_SYMBOL(sock_enable_timestamp);
1653 1689
1654/* 1690/*
1655 * Get a socket option on an socket. 1691 * Get a socket option on an socket.
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 6d5ea9762040..113cc728dc31 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -9,25 +9,12 @@
9#include <linux/sysctl.h> 9#include <linux/sysctl.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/socket.h> 11#include <linux/socket.h>
12#include <linux/netdevice.h>
12#include <net/sock.h> 13#include <net/sock.h>
14#include <net/xfrm.h>
13 15
14#ifdef CONFIG_SYSCTL 16#ifdef CONFIG_SYSCTL
15 17
16extern int netdev_max_backlog;
17extern int weight_p;
18
19extern __u32 sysctl_wmem_max;
20extern __u32 sysctl_rmem_max;
21
22extern int sysctl_core_destroy_delay;
23
24#ifdef CONFIG_XFRM
25extern u32 sysctl_xfrm_aevent_etime;
26extern u32 sysctl_xfrm_aevent_rseqth;
27extern int sysctl_xfrm_larval_drop;
28extern u32 sysctl_xfrm_acq_expires;
29#endif
30
31ctl_table core_table[] = { 18ctl_table core_table[] = {
32#ifdef CONFIG_NET 19#ifdef CONFIG_NET
33 { 20 {
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index 426008e3b7e3..d694656b8800 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -750,20 +750,16 @@ static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk)
750 */ 750 */
751 hctx->ccid2hctx_ssthresh = ~0; 751 hctx->ccid2hctx_ssthresh = ~0;
752 hctx->ccid2hctx_numdupack = 3; 752 hctx->ccid2hctx_numdupack = 3;
753 hctx->ccid2hctx_seqbufc = 0;
754 753
755 /* XXX init ~ to window size... */ 754 /* XXX init ~ to window size... */
756 if (ccid2_hc_tx_alloc_seq(hctx)) 755 if (ccid2_hc_tx_alloc_seq(hctx))
757 return -ENOMEM; 756 return -ENOMEM;
758 757
759 hctx->ccid2hctx_sent = 0;
760 hctx->ccid2hctx_rto = 3 * HZ; 758 hctx->ccid2hctx_rto = 3 * HZ;
761 ccid2_change_srtt(hctx, -1); 759 ccid2_change_srtt(hctx, -1);
762 hctx->ccid2hctx_rttvar = -1; 760 hctx->ccid2hctx_rttvar = -1;
763 hctx->ccid2hctx_lastrtt = 0;
764 hctx->ccid2hctx_rpdupack = -1; 761 hctx->ccid2hctx_rpdupack = -1;
765 hctx->ccid2hctx_last_cong = jiffies; 762 hctx->ccid2hctx_last_cong = jiffies;
766 hctx->ccid2hctx_high_ack = 0;
767 763
768 hctx->ccid2hctx_rtotimer.function = &ccid2_hc_tx_rto_expire; 764 hctx->ccid2hctx_rtotimer.function = &ccid2_hc_tx_rto_expire;
769 hctx->ccid2hctx_rtotimer.data = (unsigned long)sk; 765 hctx->ccid2hctx_rtotimer.data = (unsigned long)sk;
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 25772c326172..19b33586333d 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -40,6 +40,8 @@
40#include "lib/tfrc.h" 40#include "lib/tfrc.h"
41#include "ccid3.h" 41#include "ccid3.h"
42 42
43#include <asm/unaligned.h>
44
43#ifdef CONFIG_IP_DCCP_CCID3_DEBUG 45#ifdef CONFIG_IP_DCCP_CCID3_DEBUG
44static int ccid3_debug; 46static int ccid3_debug;
45#define ccid3_pr_debug(format, a...) DCCP_PR_DEBUG(ccid3_debug, format, ##a) 47#define ccid3_pr_debug(format, a...) DCCP_PR_DEBUG(ccid3_debug, format, ##a)
@@ -544,6 +546,7 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option,
544 const struct dccp_sock *dp = dccp_sk(sk); 546 const struct dccp_sock *dp = dccp_sk(sk);
545 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 547 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
546 struct ccid3_options_received *opt_recv; 548 struct ccid3_options_received *opt_recv;
549 __be32 opt_val;
547 550
548 opt_recv = &hctx->ccid3hctx_options_received; 551 opt_recv = &hctx->ccid3hctx_options_received;
549 552
@@ -563,8 +566,8 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option,
563 dccp_role(sk), sk, len); 566 dccp_role(sk), sk, len);
564 rc = -EINVAL; 567 rc = -EINVAL;
565 } else { 568 } else {
566 opt_recv->ccid3or_loss_event_rate = 569 opt_val = get_unaligned((__be32 *)value);
567 ntohl(*(__be32 *)value); 570 opt_recv->ccid3or_loss_event_rate = ntohl(opt_val);
568 ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n", 571 ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n",
569 dccp_role(sk), sk, 572 dccp_role(sk), sk,
570 opt_recv->ccid3or_loss_event_rate); 573 opt_recv->ccid3or_loss_event_rate);
@@ -585,8 +588,8 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option,
585 dccp_role(sk), sk, len); 588 dccp_role(sk), sk, len);
586 rc = -EINVAL; 589 rc = -EINVAL;
587 } else { 590 } else {
588 opt_recv->ccid3or_receive_rate = 591 opt_val = get_unaligned((__be32 *)value);
589 ntohl(*(__be32 *)value); 592 opt_recv->ccid3or_receive_rate = ntohl(opt_val);
590 ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n", 593 ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n",
591 dccp_role(sk), sk, 594 dccp_role(sk), sk,
592 opt_recv->ccid3or_receive_rate); 595 opt_recv->ccid3or_receive_rate);
@@ -601,8 +604,6 @@ static int ccid3_hc_tx_init(struct ccid *ccid, struct sock *sk)
601{ 604{
602 struct ccid3_hc_tx_sock *hctx = ccid_priv(ccid); 605 struct ccid3_hc_tx_sock *hctx = ccid_priv(ccid);
603 606
604 hctx->ccid3hctx_s = 0;
605 hctx->ccid3hctx_rtt = 0;
606 hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT; 607 hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT;
607 INIT_LIST_HEAD(&hctx->ccid3hctx_hist); 608 INIT_LIST_HEAD(&hctx->ccid3hctx_hist);
608 609
@@ -963,8 +964,6 @@ static int ccid3_hc_rx_init(struct ccid *ccid, struct sock *sk)
963 INIT_LIST_HEAD(&hcrx->ccid3hcrx_li_hist); 964 INIT_LIST_HEAD(&hcrx->ccid3hcrx_li_hist);
964 hcrx->ccid3hcrx_tstamp_last_feedback = 965 hcrx->ccid3hcrx_tstamp_last_feedback =
965 hcrx->ccid3hcrx_tstamp_last_ack = ktime_get_real(); 966 hcrx->ccid3hcrx_tstamp_last_ack = ktime_get_real();
966 hcrx->ccid3hcrx_s = 0;
967 hcrx->ccid3hcrx_rtt = 0;
968 return 0; 967 return 0;
969} 968}
970 969
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 3560a2a875a0..1ce101062824 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -58,6 +58,42 @@ static void dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb)
58 dccp_send_close(sk, 0); 58 dccp_send_close(sk, 0);
59} 59}
60 60
61static u8 dccp_reset_code_convert(const u8 code)
62{
63 const u8 error_code[] = {
64 [DCCP_RESET_CODE_CLOSED] = 0, /* normal termination */
65 [DCCP_RESET_CODE_UNSPECIFIED] = 0, /* nothing known */
66 [DCCP_RESET_CODE_ABORTED] = ECONNRESET,
67
68 [DCCP_RESET_CODE_NO_CONNECTION] = ECONNREFUSED,
69 [DCCP_RESET_CODE_CONNECTION_REFUSED] = ECONNREFUSED,
70 [DCCP_RESET_CODE_TOO_BUSY] = EUSERS,
71 [DCCP_RESET_CODE_AGGRESSION_PENALTY] = EDQUOT,
72
73 [DCCP_RESET_CODE_PACKET_ERROR] = ENOMSG,
74 [DCCP_RESET_CODE_BAD_INIT_COOKIE] = EBADR,
75 [DCCP_RESET_CODE_BAD_SERVICE_CODE] = EBADRQC,
76 [DCCP_RESET_CODE_OPTION_ERROR] = EILSEQ,
77 [DCCP_RESET_CODE_MANDATORY_ERROR] = EOPNOTSUPP,
78 };
79
80 return code >= DCCP_MAX_RESET_CODES ? 0 : error_code[code];
81}
82
83static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb)
84{
85 u8 err = dccp_reset_code_convert(dccp_hdr_reset(skb)->dccph_reset_code);
86
87 sk->sk_err = err;
88
89 /* Queue the equivalent of TCP fin so that dccp_recvmsg exits the loop */
90 dccp_fin(sk, skb);
91
92 if (err && !sock_flag(sk, SOCK_DEAD))
93 sk_wake_async(sk, 0, POLL_ERR);
94 dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
95}
96
61static void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb) 97static void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb)
62{ 98{
63 struct dccp_sock *dp = dccp_sk(sk); 99 struct dccp_sock *dp = dccp_sk(sk);
@@ -191,9 +227,8 @@ static int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
191 * S.state := TIMEWAIT 227 * S.state := TIMEWAIT
192 * Set TIMEWAIT timer 228 * Set TIMEWAIT timer
193 * Drop packet and return 229 * Drop packet and return
194 */ 230 */
195 dccp_fin(sk, skb); 231 dccp_rcv_reset(sk, skb);
196 dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
197 return 0; 232 return 0;
198 case DCCP_PKT_CLOSEREQ: 233 case DCCP_PKT_CLOSEREQ:
199 dccp_rcv_closereq(sk, skb); 234 dccp_rcv_closereq(sk, skb);
@@ -521,12 +556,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
521 * Drop packet and return 556 * Drop packet and return
522 */ 557 */
523 if (dh->dccph_type == DCCP_PKT_RESET) { 558 if (dh->dccph_type == DCCP_PKT_RESET) {
524 /* 559 dccp_rcv_reset(sk, skb);
525 * Queue the equivalent of TCP fin so that dccp_recvmsg
526 * exits the loop
527 */
528 dccp_fin(sk, skb);
529 dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
530 return 0; 560 return 0;
531 /* 561 /*
532 * Step 7: Check for unexpected packet types 562 * Step 7: Check for unexpected packet types
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 222549ab274a..01a6a808bdb7 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -241,8 +241,8 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
241 goto out; 241 goto out;
242 242
243 dp = dccp_sk(sk); 243 dp = dccp_sk(sk);
244 seq = dccp_hdr_seq(skb); 244 seq = dccp_hdr_seq(dh);
245 if (sk->sk_state != DCCP_LISTEN && 245 if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) &&
246 !between48(seq, dp->dccps_swl, dp->dccps_swh)) { 246 !between48(seq, dp->dccps_swl, dp->dccps_swh)) {
247 NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS); 247 NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS);
248 goto out; 248 goto out;
@@ -795,7 +795,7 @@ static int dccp_v4_rcv(struct sk_buff *skb)
795 795
796 dh = dccp_hdr(skb); 796 dh = dccp_hdr(skb);
797 797
798 DCCP_SKB_CB(skb)->dccpd_seq = dccp_hdr_seq(skb); 798 DCCP_SKB_CB(skb)->dccpd_seq = dccp_hdr_seq(dh);
799 DCCP_SKB_CB(skb)->dccpd_type = dh->dccph_type; 799 DCCP_SKB_CB(skb)->dccpd_type = dh->dccph_type;
800 800
801 dccp_pr_debug("%8.8s " 801 dccp_pr_debug("%8.8s "
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index bbadd6681b83..62428ff137dd 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -173,7 +173,7 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
173 173
174 icmpv6_err_convert(type, code, &err); 174 icmpv6_err_convert(type, code, &err);
175 175
176 seq = DCCP_SKB_CB(skb)->dccpd_seq; 176 seq = dccp_hdr_seq(dh);
177 /* Might be for an request_sock */ 177 /* Might be for an request_sock */
178 switch (sk->sk_state) { 178 switch (sk->sk_state) {
179 struct request_sock *req, **prev; 179 struct request_sock *req, **prev;
@@ -787,7 +787,7 @@ static int dccp_v6_rcv(struct sk_buff *skb)
787 787
788 dh = dccp_hdr(skb); 788 dh = dccp_hdr(skb);
789 789
790 DCCP_SKB_CB(skb)->dccpd_seq = dccp_hdr_seq(skb); 790 DCCP_SKB_CB(skb)->dccpd_seq = dccp_hdr_seq(dh);
791 DCCP_SKB_CB(skb)->dccpd_type = dh->dccph_type; 791 DCCP_SKB_CB(skb)->dccpd_type = dh->dccph_type;
792 792
793 if (dccp_packet_without_ack(skb)) 793 if (dccp_packet_without_ack(skb))
diff --git a/net/dccp/options.c b/net/dccp/options.c
index d361b5533309..d286cffe2c49 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -14,6 +14,7 @@
14#include <linux/dccp.h> 14#include <linux/dccp.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <asm/unaligned.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/skbuff.h> 19#include <linux/skbuff.h>
19 20
@@ -59,6 +60,7 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
59 unsigned char opt, len; 60 unsigned char opt, len;
60 unsigned char *value; 61 unsigned char *value;
61 u32 elapsed_time; 62 u32 elapsed_time;
63 __be32 opt_val;
62 int rc; 64 int rc;
63 int mandatory = 0; 65 int mandatory = 0;
64 66
@@ -145,7 +147,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
145 if (len != 4) 147 if (len != 4)
146 goto out_invalid_option; 148 goto out_invalid_option;
147 149
148 opt_recv->dccpor_timestamp = ntohl(*(__be32 *)value); 150 opt_val = get_unaligned((__be32 *)value);
151 opt_recv->dccpor_timestamp = ntohl(opt_val);
149 152
150 dp->dccps_timestamp_echo = opt_recv->dccpor_timestamp; 153 dp->dccps_timestamp_echo = opt_recv->dccpor_timestamp;
151 dp->dccps_timestamp_time = ktime_get_real(); 154 dp->dccps_timestamp_time = ktime_get_real();
@@ -159,7 +162,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
159 if (len != 4 && len != 6 && len != 8) 162 if (len != 4 && len != 6 && len != 8)
160 goto out_invalid_option; 163 goto out_invalid_option;
161 164
162 opt_recv->dccpor_timestamp_echo = ntohl(*(__be32 *)value); 165 opt_val = get_unaligned((__be32 *)value);
166 opt_recv->dccpor_timestamp_echo = ntohl(opt_val);
163 167
164 dccp_pr_debug("%s rx opt: TIMESTAMP_ECHO=%u, len=%d, " 168 dccp_pr_debug("%s rx opt: TIMESTAMP_ECHO=%u, len=%d, "
165 "ackno=%llu", dccp_role(sk), 169 "ackno=%llu", dccp_role(sk),
@@ -168,16 +172,20 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
168 (unsigned long long) 172 (unsigned long long)
169 DCCP_SKB_CB(skb)->dccpd_ack_seq); 173 DCCP_SKB_CB(skb)->dccpd_ack_seq);
170 174
175 value += 4;
171 176
172 if (len == 4) { 177 if (len == 4) { /* no elapsed time included */
173 dccp_pr_debug_cat("\n"); 178 dccp_pr_debug_cat("\n");
174 break; 179 break;
175 } 180 }
176 181
177 if (len == 6) 182 if (len == 6) { /* 2-byte elapsed time */
178 elapsed_time = ntohs(*(__be16 *)(value + 4)); 183 __be16 opt_val2 = get_unaligned((__be16 *)value);
179 else 184 elapsed_time = ntohs(opt_val2);
180 elapsed_time = ntohl(*(__be32 *)(value + 4)); 185 } else { /* 4-byte elapsed time */
186 opt_val = get_unaligned((__be32 *)value);
187 elapsed_time = ntohl(opt_val);
188 }
181 189
182 dccp_pr_debug_cat(", ELAPSED_TIME=%u\n", elapsed_time); 190 dccp_pr_debug_cat(", ELAPSED_TIME=%u\n", elapsed_time);
183 191
@@ -192,10 +200,13 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
192 if (pkt_type == DCCP_PKT_DATA) 200 if (pkt_type == DCCP_PKT_DATA)
193 continue; 201 continue;
194 202
195 if (len == 2) 203 if (len == 2) {
196 elapsed_time = ntohs(*(__be16 *)value); 204 __be16 opt_val2 = get_unaligned((__be16 *)value);
197 else 205 elapsed_time = ntohs(opt_val2);
198 elapsed_time = ntohl(*(__be32 *)value); 206 } else {
207 opt_val = get_unaligned((__be32 *)value);
208 elapsed_time = ntohl(opt_val);
209 }
199 210
200 if (elapsed_time > opt_recv->dccpor_elapsed_time) 211 if (elapsed_time > opt_recv->dccpor_elapsed_time)
201 opt_recv->dccpor_elapsed_time = elapsed_time; 212 opt_recv->dccpor_elapsed_time = elapsed_time;
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index cc9bf1cb2646..d84973928033 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -26,6 +26,7 @@
26#include <net/sock.h> 26#include <net/sock.h>
27#include <net/xfrm.h> 27#include <net/xfrm.h>
28 28
29#include <asm/ioctls.h>
29#include <asm/semaphore.h> 30#include <asm/semaphore.h>
30#include <linux/spinlock.h> 31#include <linux/spinlock.h>
31#include <linux/timer.h> 32#include <linux/timer.h>
@@ -378,8 +379,36 @@ EXPORT_SYMBOL_GPL(dccp_poll);
378 379
379int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg) 380int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg)
380{ 381{
381 dccp_pr_debug("entry\n"); 382 int rc = -ENOTCONN;
382 return -ENOIOCTLCMD; 383
384 lock_sock(sk);
385
386 if (sk->sk_state == DCCP_LISTEN)
387 goto out;
388
389 switch (cmd) {
390 case SIOCINQ: {
391 struct sk_buff *skb;
392 unsigned long amount = 0;
393
394 skb = skb_peek(&sk->sk_receive_queue);
395 if (skb != NULL) {
396 /*
397 * We will only return the amount of this packet since
398 * that is all that will be read.
399 */
400 amount = skb->len;
401 }
402 rc = put_user(amount, (int __user *)arg);
403 }
404 break;
405 default:
406 rc = -ENOIOCTLCMD;
407 break;
408 }
409out:
410 release_sock(sk);
411 return rc;
383} 412}
384 413
385EXPORT_SYMBOL_GPL(dccp_ioctl); 414EXPORT_SYMBOL_GPL(dccp_ioctl);
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index aabe98d9402f..57d574951838 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -474,7 +474,7 @@ static struct proto dn_proto = {
474static struct sock *dn_alloc_sock(struct net *net, struct socket *sock, gfp_t gfp) 474static struct sock *dn_alloc_sock(struct net *net, struct socket *sock, gfp_t gfp)
475{ 475{
476 struct dn_scp *scp; 476 struct dn_scp *scp;
477 struct sock *sk = sk_alloc(net, PF_DECnet, gfp, &dn_proto, 1); 477 struct sock *sk = sk_alloc(net, PF_DECnet, gfp, &dn_proto);
478 478
479 if (!sk) 479 if (!sk)
480 goto out; 480 goto out;
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 9cae16b4e0b7..f70df073c588 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -624,7 +624,7 @@ static int econet_create(struct net *net, struct socket *sock, int protocol)
624 sock->state = SS_UNCONNECTED; 624 sock->state = SS_UNCONNECTED;
625 625
626 err = -ENOBUFS; 626 err = -ENOBUFS;
627 sk = sk_alloc(net, PF_ECONET, GFP_KERNEL, &econet_proto, 1); 627 sk = sk_alloc(net, PF_ECONET, GFP_KERNEL, &econet_proto);
628 if (sk == NULL) 628 if (sk == NULL)
629 goto out; 629 goto out;
630 630
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index ed8a3d49487d..6b2e454ae313 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -298,6 +298,14 @@ static int eth_change_mtu(struct net_device *dev, int new_mtu)
298 return 0; 298 return 0;
299} 299}
300 300
301static int eth_validate_addr(struct net_device *dev)
302{
303 if (!is_valid_ether_addr(dev->dev_addr))
304 return -EINVAL;
305
306 return 0;
307}
308
301const struct header_ops eth_header_ops ____cacheline_aligned = { 309const struct header_ops eth_header_ops ____cacheline_aligned = {
302 .create = eth_header, 310 .create = eth_header,
303 .parse = eth_header_parse, 311 .parse = eth_header_parse,
@@ -317,6 +325,7 @@ void ether_setup(struct net_device *dev)
317 325
318 dev->change_mtu = eth_change_mtu; 326 dev->change_mtu = eth_change_mtu;
319 dev->set_mac_address = eth_mac_addr; 327 dev->set_mac_address = eth_mac_addr;
328 dev->validate_addr = eth_validate_addr;
320 329
321 dev->type = ARPHRD_ETHER; 330 dev->type = ARPHRD_ETHER;
322 dev->hard_header_len = ETH_HLEN; 331 dev->hard_header_len = ETH_HLEN;
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index 811777682e2b..4cce3534e408 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -25,7 +25,7 @@
25#include <net/ieee80211.h> 25#include <net/ieee80211.h>
26 26
27#include <linux/crypto.h> 27#include <linux/crypto.h>
28#include <asm/scatterlist.h> 28#include <linux/scatterlist.h>
29#include <linux/crc32.h> 29#include <linux/crc32.h>
30 30
31MODULE_AUTHOR("Jouni Malinen"); 31MODULE_AUTHOR("Jouni Malinen");
@@ -537,13 +537,8 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
537 return -1; 537 return -1;
538 } 538 }
539 sg_init_table(sg, 2); 539 sg_init_table(sg, 2);
540 sg_set_page(&sg[0], virt_to_page(hdr)); 540 sg_set_buf(&sg[0], hdr, 16);
541 sg[0].offset = offset_in_page(hdr); 541 sg_set_buf(&sg[1], data, data_len);
542 sg[0].length = 16;
543
544 sg_set_page(&sg[1], virt_to_page(data));
545 sg[1].offset = offset_in_page(data);
546 sg[1].length = data_len;
547 542
548 if (crypto_hash_setkey(tfm_michael, key, 8)) 543 if (crypto_hash_setkey(tfm_michael, key, 8))
549 return -1; 544 return -1;
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c
index 9693429489ed..866fc04c44f9 100644
--- a/net/ieee80211/ieee80211_crypt_wep.c
+++ b/net/ieee80211/ieee80211_crypt_wep.c
@@ -22,7 +22,7 @@
22#include <net/ieee80211.h> 22#include <net/ieee80211.h>
23 23
24#include <linux/crypto.h> 24#include <linux/crypto.h>
25#include <asm/scatterlist.h> 25#include <linux/scatterlist.h>
26#include <linux/crc32.h> 26#include <linux/crc32.h>
27 27
28MODULE_AUTHOR("Jouni Malinen"); 28MODULE_AUTHOR("Jouni Malinen");
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 621b128897d7..d2f22e74b267 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -323,7 +323,7 @@ lookup_protocol:
323 BUG_TRAP(answer_prot->slab != NULL); 323 BUG_TRAP(answer_prot->slab != NULL);
324 324
325 err = -ENOBUFS; 325 err = -ENOBUFS;
326 sk = sk_alloc(net, PF_INET, GFP_KERNEL, answer_prot, 1); 326 sk = sk_alloc(net, PF_INET, GFP_KERNEL, answer_prot);
327 if (sk == NULL) 327 if (sk == NULL)
328 goto out; 328 goto out;
329 329
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index 805a78e6ed55..f18e88bc86ec 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -504,22 +504,16 @@ int cipso_v4_doi_add(struct cipso_v4_doi *doi_def)
504 INIT_RCU_HEAD(&doi_def->rcu); 504 INIT_RCU_HEAD(&doi_def->rcu);
505 INIT_LIST_HEAD(&doi_def->dom_list); 505 INIT_LIST_HEAD(&doi_def->dom_list);
506 506
507 rcu_read_lock();
508 if (cipso_v4_doi_search(doi_def->doi) != NULL)
509 goto doi_add_failure_rlock;
510 spin_lock(&cipso_v4_doi_list_lock); 507 spin_lock(&cipso_v4_doi_list_lock);
511 if (cipso_v4_doi_search(doi_def->doi) != NULL) 508 if (cipso_v4_doi_search(doi_def->doi) != NULL)
512 goto doi_add_failure_slock; 509 goto doi_add_failure;
513 list_add_tail_rcu(&doi_def->list, &cipso_v4_doi_list); 510 list_add_tail_rcu(&doi_def->list, &cipso_v4_doi_list);
514 spin_unlock(&cipso_v4_doi_list_lock); 511 spin_unlock(&cipso_v4_doi_list_lock);
515 rcu_read_unlock();
516 512
517 return 0; 513 return 0;
518 514
519doi_add_failure_slock: 515doi_add_failure:
520 spin_unlock(&cipso_v4_doi_list_lock); 516 spin_unlock(&cipso_v4_doi_list_lock);
521doi_add_failure_rlock:
522 rcu_read_unlock();
523 return -EEXIST; 517 return -EEXIST;
524} 518}
525 519
@@ -543,29 +537,23 @@ int cipso_v4_doi_remove(u32 doi,
543 struct cipso_v4_doi *doi_def; 537 struct cipso_v4_doi *doi_def;
544 struct cipso_v4_domhsh_entry *dom_iter; 538 struct cipso_v4_domhsh_entry *dom_iter;
545 539
546 rcu_read_lock(); 540 spin_lock(&cipso_v4_doi_list_lock);
547 if (cipso_v4_doi_search(doi) != NULL) { 541 doi_def = cipso_v4_doi_search(doi);
548 spin_lock(&cipso_v4_doi_list_lock); 542 if (doi_def != NULL) {
549 doi_def = cipso_v4_doi_search(doi);
550 if (doi_def == NULL) {
551 spin_unlock(&cipso_v4_doi_list_lock);
552 rcu_read_unlock();
553 return -ENOENT;
554 }
555 doi_def->valid = 0; 543 doi_def->valid = 0;
556 list_del_rcu(&doi_def->list); 544 list_del_rcu(&doi_def->list);
557 spin_unlock(&cipso_v4_doi_list_lock); 545 spin_unlock(&cipso_v4_doi_list_lock);
546 rcu_read_lock();
558 list_for_each_entry_rcu(dom_iter, &doi_def->dom_list, list) 547 list_for_each_entry_rcu(dom_iter, &doi_def->dom_list, list)
559 if (dom_iter->valid) 548 if (dom_iter->valid)
560 netlbl_domhsh_remove(dom_iter->domain, 549 netlbl_domhsh_remove(dom_iter->domain,
561 audit_info); 550 audit_info);
562 cipso_v4_cache_invalidate();
563 rcu_read_unlock(); 551 rcu_read_unlock();
564 552 cipso_v4_cache_invalidate();
565 call_rcu(&doi_def->rcu, callback); 553 call_rcu(&doi_def->rcu, callback);
566 return 0; 554 return 0;
567 } 555 }
568 rcu_read_unlock(); 556 spin_unlock(&cipso_v4_doi_list_lock);
569 557
570 return -ENOENT; 558 return -ENOENT;
571} 559}
@@ -653,22 +641,19 @@ int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, const char *domain)
653 new_dom->valid = 1; 641 new_dom->valid = 1;
654 INIT_RCU_HEAD(&new_dom->rcu); 642 INIT_RCU_HEAD(&new_dom->rcu);
655 643
656 rcu_read_lock();
657 spin_lock(&cipso_v4_doi_list_lock); 644 spin_lock(&cipso_v4_doi_list_lock);
658 list_for_each_entry_rcu(iter, &doi_def->dom_list, list) 645 list_for_each_entry(iter, &doi_def->dom_list, list)
659 if (iter->valid && 646 if (iter->valid &&
660 ((domain != NULL && iter->domain != NULL && 647 ((domain != NULL && iter->domain != NULL &&
661 strcmp(iter->domain, domain) == 0) || 648 strcmp(iter->domain, domain) == 0) ||
662 (domain == NULL && iter->domain == NULL))) { 649 (domain == NULL && iter->domain == NULL))) {
663 spin_unlock(&cipso_v4_doi_list_lock); 650 spin_unlock(&cipso_v4_doi_list_lock);
664 rcu_read_unlock();
665 kfree(new_dom->domain); 651 kfree(new_dom->domain);
666 kfree(new_dom); 652 kfree(new_dom);
667 return -EEXIST; 653 return -EEXIST;
668 } 654 }
669 list_add_tail_rcu(&new_dom->list, &doi_def->dom_list); 655 list_add_tail_rcu(&new_dom->list, &doi_def->dom_list);
670 spin_unlock(&cipso_v4_doi_list_lock); 656 spin_unlock(&cipso_v4_doi_list_lock);
671 rcu_read_unlock();
672 657
673 return 0; 658 return 0;
674} 659}
@@ -689,9 +674,8 @@ int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def,
689{ 674{
690 struct cipso_v4_domhsh_entry *iter; 675 struct cipso_v4_domhsh_entry *iter;
691 676
692 rcu_read_lock();
693 spin_lock(&cipso_v4_doi_list_lock); 677 spin_lock(&cipso_v4_doi_list_lock);
694 list_for_each_entry_rcu(iter, &doi_def->dom_list, list) 678 list_for_each_entry(iter, &doi_def->dom_list, list)
695 if (iter->valid && 679 if (iter->valid &&
696 ((domain != NULL && iter->domain != NULL && 680 ((domain != NULL && iter->domain != NULL &&
697 strcmp(iter->domain, domain) == 0) || 681 strcmp(iter->domain, domain) == 0) ||
@@ -699,13 +683,10 @@ int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def,
699 iter->valid = 0; 683 iter->valid = 0;
700 list_del_rcu(&iter->list); 684 list_del_rcu(&iter->list);
701 spin_unlock(&cipso_v4_doi_list_lock); 685 spin_unlock(&cipso_v4_doi_list_lock);
702 rcu_read_unlock();
703 call_rcu(&iter->rcu, cipso_v4_doi_domhsh_free); 686 call_rcu(&iter->rcu, cipso_v4_doi_domhsh_free);
704
705 return 0; 687 return 0;
706 } 688 }
707 spin_unlock(&cipso_v4_doi_list_lock); 689 spin_unlock(&cipso_v4_doi_list_lock);
708 rcu_read_unlock();
709 690
710 return -ENOENT; 691 return -ENOENT;
711} 692}
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 6b1a31a74cf2..c31bccb9b526 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -3,7 +3,7 @@
3#include <net/ip.h> 3#include <net/ip.h>
4#include <net/xfrm.h> 4#include <net/xfrm.h>
5#include <net/esp.h> 5#include <net/esp.h>
6#include <asm/scatterlist.h> 6#include <linux/scatterlist.h>
7#include <linux/crypto.h> 7#include <linux/crypto.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/pfkeyv2.h> 9#include <linux/pfkeyv2.h>
@@ -110,7 +110,11 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
110 if (!sg) 110 if (!sg)
111 goto unlock; 111 goto unlock;
112 } 112 }
113 skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen); 113 sg_init_table(sg, nfrags);
114 skb_to_sgvec(skb, sg,
115 esph->enc_data +
116 esp->conf.ivlen -
117 skb->data, clen);
114 err = crypto_blkcipher_encrypt(&desc, sg, sg, clen); 118 err = crypto_blkcipher_encrypt(&desc, sg, sg, clen);
115 if (unlikely(sg != &esp->sgbuf[0])) 119 if (unlikely(sg != &esp->sgbuf[0]))
116 kfree(sg); 120 kfree(sg);
@@ -201,7 +205,10 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
201 if (!sg) 205 if (!sg)
202 goto out; 206 goto out;
203 } 207 }
204 skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen, elen); 208 sg_init_table(sg, nfrags);
209 skb_to_sgvec(skb, sg,
210 sizeof(*esph) + esp->conf.ivlen,
211 elen);
205 err = crypto_blkcipher_decrypt(&desc, sg, sg, elen); 212 err = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
206 if (unlikely(sg != &esp->sgbuf[0])) 213 if (unlikely(sg != &esp->sgbuf[0]))
207 kfree(sg); 214 kfree(sg);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 78b514ba1414..60123905dbbf 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -128,13 +128,14 @@ struct net_device * ip_dev_find(__be32 addr)
128 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; 128 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
129 struct fib_result res; 129 struct fib_result res;
130 struct net_device *dev = NULL; 130 struct net_device *dev = NULL;
131 struct fib_table *local_table;
131 132
132#ifdef CONFIG_IP_MULTIPLE_TABLES 133#ifdef CONFIG_IP_MULTIPLE_TABLES
133 res.r = NULL; 134 res.r = NULL;
134#endif 135#endif
135 136
136 if (!ip_fib_local_table || 137 local_table = fib_get_table(RT_TABLE_LOCAL);
137 ip_fib_local_table->tb_lookup(ip_fib_local_table, &fl, &res)) 138 if (!local_table || local_table->tb_lookup(local_table, &fl, &res))
138 return NULL; 139 return NULL;
139 if (res.type != RTN_LOCAL) 140 if (res.type != RTN_LOCAL)
140 goto out; 141 goto out;
@@ -152,6 +153,7 @@ unsigned inet_addr_type(__be32 addr)
152 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; 153 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
153 struct fib_result res; 154 struct fib_result res;
154 unsigned ret = RTN_BROADCAST; 155 unsigned ret = RTN_BROADCAST;
156 struct fib_table *local_table;
155 157
156 if (ZERONET(addr) || BADCLASS(addr)) 158 if (ZERONET(addr) || BADCLASS(addr))
157 return RTN_BROADCAST; 159 return RTN_BROADCAST;
@@ -162,10 +164,10 @@ unsigned inet_addr_type(__be32 addr)
162 res.r = NULL; 164 res.r = NULL;
163#endif 165#endif
164 166
165 if (ip_fib_local_table) { 167 local_table = fib_get_table(RT_TABLE_LOCAL);
168 if (local_table) {
166 ret = RTN_UNICAST; 169 ret = RTN_UNICAST;
167 if (!ip_fib_local_table->tb_lookup(ip_fib_local_table, 170 if (!local_table->tb_lookup(local_table, &fl, &res)) {
168 &fl, &res)) {
169 ret = res.type; 171 ret = res.type;
170 fib_res_put(&res); 172 fib_res_put(&res);
171 } 173 }
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 272c69e106e9..233de0634298 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -1104,5 +1104,4 @@ void __init icmp_init(struct net_proto_family *ops)
1104EXPORT_SYMBOL(icmp_err_convert); 1104EXPORT_SYMBOL(icmp_err_convert);
1105EXPORT_SYMBOL(icmp_send); 1105EXPORT_SYMBOL(icmp_send);
1106EXPORT_SYMBOL(icmp_statistics); 1106EXPORT_SYMBOL(icmp_statistics);
1107EXPORT_SYMBOL(icmpmsg_statistics);
1108EXPORT_SYMBOL(xrlim_allow); 1107EXPORT_SYMBOL(xrlim_allow);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index f151900efaf9..02b02a8d681c 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -674,7 +674,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
674 struct rtable *rt; /* Route to the other host */ 674 struct rtable *rt; /* Route to the other host */
675 struct net_device *tdev; /* Device to other host */ 675 struct net_device *tdev; /* Device to other host */
676 struct iphdr *iph; /* Our new IP header */ 676 struct iphdr *iph; /* Our new IP header */
677 int max_headroom; /* The extra header space needed */ 677 unsigned int max_headroom; /* The extra header space needed */
678 int gre_hlen; 678 int gre_hlen;
679 __be32 dst; 679 __be32 dst;
680 int mtu; 680 int mtu;
@@ -1033,7 +1033,6 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
1033 return 0; 1033 return 0;
1034} 1034}
1035 1035
1036#ifdef CONFIG_NET_IPGRE_BROADCAST
1037/* Nice toy. Unfortunately, useless in real life :-) 1036/* Nice toy. Unfortunately, useless in real life :-)
1038 It allows to construct virtual multiprotocol broadcast "LAN" 1037 It allows to construct virtual multiprotocol broadcast "LAN"
1039 over the Internet, provided multicast routing is tuned. 1038 over the Internet, provided multicast routing is tuned.
@@ -1092,10 +1091,19 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev,
1092 return -t->hlen; 1091 return -t->hlen;
1093} 1092}
1094 1093
1094static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr)
1095{
1096 struct iphdr *iph = (struct iphdr*) skb_mac_header(skb);
1097 memcpy(haddr, &iph->saddr, 4);
1098 return 4;
1099}
1100
1095static const struct header_ops ipgre_header_ops = { 1101static const struct header_ops ipgre_header_ops = {
1096 .create = ipgre_header, 1102 .create = ipgre_header,
1103 .parse = ipgre_header_parse,
1097}; 1104};
1098 1105
1106#ifdef CONFIG_NET_IPGRE_BROADCAST
1099static int ipgre_open(struct net_device *dev) 1107static int ipgre_open(struct net_device *dev)
1100{ 1108{
1101 struct ip_tunnel *t = netdev_priv(dev); 1109 struct ip_tunnel *t = netdev_priv(dev);
@@ -1197,6 +1205,8 @@ static int ipgre_tunnel_init(struct net_device *dev)
1197 dev->stop = ipgre_close; 1205 dev->stop = ipgre_close;
1198 } 1206 }
1199#endif 1207#endif
1208 } else {
1209 dev->header_ops = &ipgre_header_ops;
1200 } 1210 }
1201 1211
1202 if (!tdev && tunnel->parms.link) 1212 if (!tdev && tunnel->parms.link)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index f508835ba713..e5f7dc2de303 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -161,7 +161,7 @@ static inline int ip_finish_output2(struct sk_buff *skb)
161 struct dst_entry *dst = skb->dst; 161 struct dst_entry *dst = skb->dst;
162 struct rtable *rt = (struct rtable *)dst; 162 struct rtable *rt = (struct rtable *)dst;
163 struct net_device *dev = dst->dev; 163 struct net_device *dev = dst->dev;
164 int hh_len = LL_RESERVED_SPACE(dev); 164 unsigned int hh_len = LL_RESERVED_SPACE(dev);
165 165
166 if (rt->rt_type == RTN_MULTICAST) 166 if (rt->rt_type == RTN_MULTICAST)
167 IP_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS); 167 IP_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS);
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 5cd5bbe1379a..8c2b2b0741da 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -515,7 +515,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
515 struct net_device *tdev; /* Device to other host */ 515 struct net_device *tdev; /* Device to other host */
516 struct iphdr *old_iph = ip_hdr(skb); 516 struct iphdr *old_iph = ip_hdr(skb);
517 struct iphdr *iph; /* Our new IP header */ 517 struct iphdr *iph; /* Our new IP header */
518 int max_headroom; /* The extra header space needed */ 518 unsigned int max_headroom; /* The extra header space needed */
519 __be32 dst = tiph->daddr; 519 __be32 dst = tiph->daddr;
520 int mtu; 520 int mtu;
521 521
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c
index 6a1fec416eaf..427b593c1069 100644
--- a/net/ipv4/ipvs/ip_vs_lblcr.c
+++ b/net/ipv4/ipvs/ip_vs_lblcr.c
@@ -48,8 +48,6 @@
48/* for sysctl */ 48/* for sysctl */
49#include <linux/fs.h> 49#include <linux/fs.h>
50#include <linux/sysctl.h> 50#include <linux/sysctl.h>
51/* for proc_net_create/proc_net_remove */
52#include <linux/proc_fs.h>
53#include <net/net_namespace.h> 51#include <net/net_namespace.h>
54 52
55#include <net/ip_vs.h> 53#include <net/ip_vs.h>
@@ -547,71 +545,6 @@ static void ip_vs_lblcr_check_expire(unsigned long data)
547 mod_timer(&tbl->periodic_timer, jiffies+CHECK_EXPIRE_INTERVAL); 545 mod_timer(&tbl->periodic_timer, jiffies+CHECK_EXPIRE_INTERVAL);
548} 546}
549 547
550
551#ifdef CONFIG_IP_VS_LBLCR_DEBUG
552static struct ip_vs_lblcr_table *lblcr_table_list;
553
554/*
555 * /proc/net/ip_vs_lblcr to display the mappings of
556 * destination IP address <==> its serverSet
557 */
558static int
559ip_vs_lblcr_getinfo(char *buffer, char **start, off_t offset, int length)
560{
561 off_t pos=0, begin;
562 int len=0, size;
563 struct ip_vs_lblcr_table *tbl;
564 unsigned long now = jiffies;
565 int i;
566 struct ip_vs_lblcr_entry *en;
567
568 tbl = lblcr_table_list;
569
570 size = sprintf(buffer, "LastTime Dest IP address Server set\n");
571 pos += size;
572 len += size;
573
574 for (i=0; i<IP_VS_LBLCR_TAB_SIZE; i++) {
575 read_lock_bh(&tbl->lock);
576 list_for_each_entry(en, &tbl->bucket[i], list) {
577 char tbuf[16];
578 struct ip_vs_dest_list *d;
579
580 sprintf(tbuf, "%u.%u.%u.%u", NIPQUAD(en->addr));
581 size = sprintf(buffer+len, "%8lu %-16s ",
582 now-en->lastuse, tbuf);
583
584 read_lock(&en->set.lock);
585 for (d=en->set.list; d!=NULL; d=d->next) {
586 size += sprintf(buffer+len+size,
587 "%u.%u.%u.%u ",
588 NIPQUAD(d->dest->addr));
589 }
590 read_unlock(&en->set.lock);
591 size += sprintf(buffer+len+size, "\n");
592 len += size;
593 pos += size;
594 if (pos <= offset)
595 len=0;
596 if (pos >= offset+length) {
597 read_unlock_bh(&tbl->lock);
598 goto done;
599 }
600 }
601 read_unlock_bh(&tbl->lock);
602 }
603
604 done:
605 begin = len - (pos - offset);
606 *start = buffer + begin;
607 len -= begin;
608 if(len>length)
609 len = length;
610 return len;
611}
612#endif
613
614
615static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc) 548static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
616{ 549{
617 int i; 550 int i;
@@ -650,9 +583,6 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
650 tbl->periodic_timer.expires = jiffies+CHECK_EXPIRE_INTERVAL; 583 tbl->periodic_timer.expires = jiffies+CHECK_EXPIRE_INTERVAL;
651 add_timer(&tbl->periodic_timer); 584 add_timer(&tbl->periodic_timer);
652 585
653#ifdef CONFIG_IP_VS_LBLCR_DEBUG
654 lblcr_table_list = tbl;
655#endif
656 return 0; 586 return 0;
657} 587}
658 588
@@ -843,18 +773,12 @@ static int __init ip_vs_lblcr_init(void)
843{ 773{
844 INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); 774 INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list);
845 sysctl_header = register_sysctl_table(lblcr_root_table); 775 sysctl_header = register_sysctl_table(lblcr_root_table);
846#ifdef CONFIG_IP_VS_LBLCR_DEBUG
847 proc_net_create(&init_net, "ip_vs_lblcr", 0, ip_vs_lblcr_getinfo);
848#endif
849 return register_ip_vs_scheduler(&ip_vs_lblcr_scheduler); 776 return register_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
850} 777}
851 778
852 779
853static void __exit ip_vs_lblcr_cleanup(void) 780static void __exit ip_vs_lblcr_cleanup(void)
854{ 781{
855#ifdef CONFIG_IP_VS_LBLCR_DEBUG
856 proc_net_remove(&init_net, "ip_vs_lblcr");
857#endif
858 unregister_sysctl_table(sysctl_header); 782 unregister_sysctl_table(sysctl_header);
859 unregister_ip_vs_scheduler(&ip_vs_lblcr_scheduler); 783 unregister_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
860} 784}
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c
index c99f2a33fb9e..0d4d9721cbd4 100644
--- a/net/ipv4/ipvs/ip_vs_sync.c
+++ b/net/ipv4/ipvs/ip_vs_sync.c
@@ -72,7 +72,6 @@ struct ip_vs_sync_thread_data {
72 int state; 72 int state;
73}; 73};
74 74
75#define IP_VS_SYNC_CONN_TIMEOUT (3*60*HZ)
76#define SIMPLE_CONN_SIZE (sizeof(struct ip_vs_sync_conn)) 75#define SIMPLE_CONN_SIZE (sizeof(struct ip_vs_sync_conn))
77#define FULL_CONN_SIZE \ 76#define FULL_CONN_SIZE \
78(sizeof(struct ip_vs_sync_conn) + sizeof(struct ip_vs_sync_conn_options)) 77(sizeof(struct ip_vs_sync_conn) + sizeof(struct ip_vs_sync_conn_options))
@@ -284,6 +283,7 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen)
284 struct ip_vs_sync_conn *s; 283 struct ip_vs_sync_conn *s;
285 struct ip_vs_sync_conn_options *opt; 284 struct ip_vs_sync_conn_options *opt;
286 struct ip_vs_conn *cp; 285 struct ip_vs_conn *cp;
286 struct ip_vs_protocol *pp;
287 char *p; 287 char *p;
288 int i; 288 int i;
289 289
@@ -342,7 +342,8 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen)
342 p += SIMPLE_CONN_SIZE; 342 p += SIMPLE_CONN_SIZE;
343 343
344 atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]); 344 atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]);
345 cp->timeout = IP_VS_SYNC_CONN_TIMEOUT; 345 pp = ip_vs_proto_get(s->protocol);
346 cp->timeout = pp->timeout_table[cp->state];
346 ip_vs_conn_put(cp); 347 ip_vs_conn_put(cp);
347 348
348 if (p > buffer+buflen) { 349 if (p > buffer+buflen) {
diff --git a/net/ipv4/ipvs/ip_vs_xmit.c b/net/ipv4/ipvs/ip_vs_xmit.c
index d0a92dec1050..7c074e386c17 100644
--- a/net/ipv4/ipvs/ip_vs_xmit.c
+++ b/net/ipv4/ipvs/ip_vs_xmit.c
@@ -325,7 +325,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
325 __be16 df = old_iph->frag_off; 325 __be16 df = old_iph->frag_off;
326 sk_buff_data_t old_transport_header = skb->transport_header; 326 sk_buff_data_t old_transport_header = skb->transport_header;
327 struct iphdr *iph; /* Our new IP header */ 327 struct iphdr *iph; /* Our new IP header */
328 int max_headroom; /* The extra header space needed */ 328 unsigned int max_headroom; /* The extra header space needed */
329 int mtu; 329 int mtu;
330 330
331 EnterFunction(10); 331 EnterFunction(10);
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index fa97947c6ae1..9aca9c55687c 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -128,7 +128,7 @@ config IP_NF_MATCH_ADDRTYPE
128 eg. UNICAST, LOCAL, BROADCAST, ... 128 eg. UNICAST, LOCAL, BROADCAST, ...
129 129
130 If you want to compile it as a module, say M here and read 130 If you want to compile it as a module, say M here and read
131 <file:Documentation/modules.txt>. If unsure, say `N'. 131 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
132 132
133# `filter', generic and specific targets 133# `filter', generic and specific targets
134config IP_NF_FILTER 134config IP_NF_FILTER
@@ -371,7 +371,7 @@ config IP_NF_RAW
371 and OUTPUT chains. 371 and OUTPUT chains.
372 372
373 If you want to compile it as a module, say M here and read 373 If you want to compile it as a module, say M here and read
374 <file:Documentation/modules.txt>. If unsure, say `N'. 374 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
375 375
376# ARP tables 376# ARP tables
377config IP_NF_ARPTABLES 377config IP_NF_ARPTABLES
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index fd16cb8f8abe..ffdccc0972e0 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -121,14 +121,6 @@ static const struct snmp_mib snmp4_ipextstats_list[] = {
121 SNMP_MIB_SENTINEL 121 SNMP_MIB_SENTINEL
122}; 122};
123 123
124static const struct snmp_mib snmp4_icmp_list[] = {
125 SNMP_MIB_ITEM("InMsgs", ICMP_MIB_INMSGS),
126 SNMP_MIB_ITEM("InErrors", ICMP_MIB_INERRORS),
127 SNMP_MIB_ITEM("OutMsgs", ICMP_MIB_OUTMSGS),
128 SNMP_MIB_ITEM("OutErrors", ICMP_MIB_OUTERRORS),
129 SNMP_MIB_SENTINEL
130};
131
132static struct { 124static struct {
133 char *name; 125 char *name;
134 int index; 126 int index;
@@ -312,7 +304,7 @@ static void icmp_put(struct seq_file *seq)
312 for (i=0; icmpmibmap[i].name != NULL; i++) 304 for (i=0; icmpmibmap[i].name != NULL; i++)
313 seq_printf(seq, " %lu", 305 seq_printf(seq, " %lu",
314 snmp_fold_field((void **) icmpmsg_statistics, 306 snmp_fold_field((void **) icmpmsg_statistics,
315 icmpmibmap[i].index)); 307 icmpmibmap[i].index | 0x100));
316} 308}
317 309
318/* 310/*
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2e6ad6dbba6c..c64072bb504b 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2453,7 +2453,7 @@ void __init tcp_init(void)
2453 0, 2453 0,
2454 &tcp_hashinfo.ehash_size, 2454 &tcp_hashinfo.ehash_size,
2455 NULL, 2455 NULL,
2456 0); 2456 thash_entries ? 0 : 512 * 1024);
2457 tcp_hashinfo.ehash_size = 1 << tcp_hashinfo.ehash_size; 2457 tcp_hashinfo.ehash_size = 1 << tcp_hashinfo.ehash_size;
2458 for (i = 0; i < tcp_hashinfo.ehash_size; i++) { 2458 for (i = 0; i < tcp_hashinfo.ehash_size; i++) {
2459 rwlock_init(&tcp_hashinfo.ehash[i].lock); 2459 rwlock_init(&tcp_hashinfo.ehash[i].lock);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 9288220b73a8..ca9590f4f520 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -103,7 +103,7 @@ int sysctl_tcp_abc __read_mostly;
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) */ 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 */ 106#define FLAG_DSACKING_ACK 0x800 /* SACK blocks contained D-SACK info */
107#define FLAG_NONHEAD_RETRANS_ACKED 0x1000 /* Non-head rexmitted data was ACKed */ 107#define FLAG_NONHEAD_RETRANS_ACKED 0x1000 /* Non-head rexmitted data was ACKed */
108 108
109#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) 109#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
@@ -866,7 +866,7 @@ static void tcp_disable_fack(struct tcp_sock *tp)
866 tp->rx_opt.sack_ok &= ~2; 866 tp->rx_opt.sack_ok &= ~2;
867} 867}
868 868
869/* Take a notice that peer is sending DSACKs */ 869/* Take a notice that peer is sending D-SACKs */
870static void tcp_dsack_seen(struct tcp_sock *tp) 870static void tcp_dsack_seen(struct tcp_sock *tp)
871{ 871{
872 tp->rx_opt.sack_ok |= 4; 872 tp->rx_opt.sack_ok |= 4;
@@ -1058,7 +1058,7 @@ static void tcp_update_reordering(struct sock *sk, const int metric,
1058 * 1058 *
1059 * With D-SACK the lower bound is extended to cover sequence space below 1059 * With D-SACK the lower bound is extended to cover sequence space below
1060 * SND.UNA down to undo_marker, which is the last point of interest. Yet 1060 * SND.UNA down to undo_marker, which is the last point of interest. Yet
1061 * again, DSACK block must not to go across snd_una (for the same reason as 1061 * again, D-SACK block must not to go across snd_una (for the same reason as
1062 * for the normal SACK blocks, explained above). But there all simplicity 1062 * for the normal SACK blocks, explained above). But there all simplicity
1063 * ends, TCP might receive valid D-SACKs below that. As long as they reside 1063 * ends, TCP might receive valid D-SACKs below that. As long as they reside
1064 * fully below undo_marker they do not affect behavior in anyway and can 1064 * fully below undo_marker they do not affect behavior in anyway and can
@@ -1080,7 +1080,7 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack,
1080 if (!before(start_seq, tp->snd_nxt)) 1080 if (!before(start_seq, tp->snd_nxt))
1081 return 0; 1081 return 0;
1082 1082
1083 /* In outstanding window? ...This is valid exit for DSACKs too. 1083 /* In outstanding window? ...This is valid exit for D-SACKs too.
1084 * start_seq == snd_una is non-sensical (see comments above) 1084 * start_seq == snd_una is non-sensical (see comments above)
1085 */ 1085 */
1086 if (after(start_seq, tp->snd_una)) 1086 if (after(start_seq, tp->snd_una))
@@ -1204,8 +1204,8 @@ static int tcp_check_dsack(struct tcp_sock *tp, struct sk_buff *ack_skb,
1204 * which may fail and creates some hassle (caller must handle error case 1204 * which may fail and creates some hassle (caller must handle error case
1205 * returns). 1205 * returns).
1206 */ 1206 */
1207int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb, 1207static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb,
1208 u32 start_seq, u32 end_seq) 1208 u32 start_seq, u32 end_seq)
1209{ 1209{
1210 int in_sack, err; 1210 int in_sack, err;
1211 unsigned int pkt_len; 1211 unsigned int pkt_len;
@@ -1248,6 +1248,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1248 int cached_fack_count; 1248 int cached_fack_count;
1249 int i; 1249 int i;
1250 int first_sack_index; 1250 int first_sack_index;
1251 int force_one_sack;
1251 1252
1252 if (!tp->sacked_out) { 1253 if (!tp->sacked_out) {
1253 if (WARN_ON(tp->fackets_out)) 1254 if (WARN_ON(tp->fackets_out))
@@ -1272,18 +1273,18 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1272 * if the only SACK change is the increase of the end_seq of 1273 * if the only SACK change is the increase of the end_seq of
1273 * the first block then only apply that SACK block 1274 * the first block then only apply that SACK block
1274 * and use retrans queue hinting otherwise slowpath */ 1275 * and use retrans queue hinting otherwise slowpath */
1275 flag = 1; 1276 force_one_sack = 1;
1276 for (i = 0; i < num_sacks; i++) { 1277 for (i = 0; i < num_sacks; i++) {
1277 __be32 start_seq = sp[i].start_seq; 1278 __be32 start_seq = sp[i].start_seq;
1278 __be32 end_seq = sp[i].end_seq; 1279 __be32 end_seq = sp[i].end_seq;
1279 1280
1280 if (i == 0) { 1281 if (i == 0) {
1281 if (tp->recv_sack_cache[i].start_seq != start_seq) 1282 if (tp->recv_sack_cache[i].start_seq != start_seq)
1282 flag = 0; 1283 force_one_sack = 0;
1283 } else { 1284 } else {
1284 if ((tp->recv_sack_cache[i].start_seq != start_seq) || 1285 if ((tp->recv_sack_cache[i].start_seq != start_seq) ||
1285 (tp->recv_sack_cache[i].end_seq != end_seq)) 1286 (tp->recv_sack_cache[i].end_seq != end_seq))
1286 flag = 0; 1287 force_one_sack = 0;
1287 } 1288 }
1288 tp->recv_sack_cache[i].start_seq = start_seq; 1289 tp->recv_sack_cache[i].start_seq = start_seq;
1289 tp->recv_sack_cache[i].end_seq = end_seq; 1290 tp->recv_sack_cache[i].end_seq = end_seq;
@@ -1295,7 +1296,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1295 } 1296 }
1296 1297
1297 first_sack_index = 0; 1298 first_sack_index = 0;
1298 if (flag) 1299 if (force_one_sack)
1299 num_sacks = 1; 1300 num_sacks = 1;
1300 else { 1301 else {
1301 int j; 1302 int j;
@@ -1321,9 +1322,6 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1321 } 1322 }
1322 } 1323 }
1323 1324
1324 /* clear flag as used for different purpose in following code */
1325 flag = 0;
1326
1327 /* Use SACK fastpath hint if valid */ 1325 /* Use SACK fastpath hint if valid */
1328 cached_skb = tp->fastpath_skb_hint; 1326 cached_skb = tp->fastpath_skb_hint;
1329 cached_fack_count = tp->fastpath_cnt_hint; 1327 cached_fack_count = tp->fastpath_cnt_hint;
@@ -1332,12 +1330,15 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1332 cached_fack_count = 0; 1330 cached_fack_count = 0;
1333 } 1331 }
1334 1332
1335 for (i=0; i<num_sacks; i++, sp++) { 1333 for (i = 0; i < num_sacks; i++) {
1336 struct sk_buff *skb; 1334 struct sk_buff *skb;
1337 __u32 start_seq = ntohl(sp->start_seq); 1335 __u32 start_seq = ntohl(sp->start_seq);
1338 __u32 end_seq = ntohl(sp->end_seq); 1336 __u32 end_seq = ntohl(sp->end_seq);
1339 int fack_count; 1337 int fack_count;
1340 int dup_sack = (found_dup_sack && (i == first_sack_index)); 1338 int dup_sack = (found_dup_sack && (i == first_sack_index));
1339 int next_dup = (found_dup_sack && (i+1 == first_sack_index));
1340
1341 sp++;
1341 1342
1342 if (!tcp_is_sackblock_valid(tp, dup_sack, start_seq, end_seq)) { 1343 if (!tcp_is_sackblock_valid(tp, dup_sack, start_seq, end_seq)) {
1343 if (dup_sack) { 1344 if (dup_sack) {
@@ -1363,7 +1364,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1363 flag |= FLAG_DATA_LOST; 1364 flag |= FLAG_DATA_LOST;
1364 1365
1365 tcp_for_write_queue_from(skb, sk) { 1366 tcp_for_write_queue_from(skb, sk) {
1366 int in_sack; 1367 int in_sack = 0;
1367 u8 sacked; 1368 u8 sacked;
1368 1369
1369 if (skb == tcp_send_head(sk)) 1370 if (skb == tcp_send_head(sk))
@@ -1382,7 +1383,23 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1382 if (!before(TCP_SKB_CB(skb)->seq, end_seq)) 1383 if (!before(TCP_SKB_CB(skb)->seq, end_seq))
1383 break; 1384 break;
1384 1385
1385 in_sack = tcp_match_skb_to_sack(sk, skb, start_seq, end_seq); 1386 dup_sack = (found_dup_sack && (i == first_sack_index));
1387
1388 /* Due to sorting DSACK may reside within this SACK block! */
1389 if (next_dup) {
1390 u32 dup_start = ntohl(sp->start_seq);
1391 u32 dup_end = ntohl(sp->end_seq);
1392
1393 if (before(TCP_SKB_CB(skb)->seq, dup_end)) {
1394 in_sack = tcp_match_skb_to_sack(sk, skb, dup_start, dup_end);
1395 if (in_sack > 0)
1396 dup_sack = 1;
1397 }
1398 }
1399
1400 /* DSACK info lost if out-of-mem, try SACK still */
1401 if (in_sack <= 0)
1402 in_sack = tcp_match_skb_to_sack(sk, skb, start_seq, end_seq);
1386 if (in_sack < 0) 1403 if (in_sack < 0)
1387 break; 1404 break;
1388 1405
@@ -1615,7 +1632,7 @@ void tcp_enter_frto(struct sock *sk)
1615 !icsk->icsk_retransmits)) { 1632 !icsk->icsk_retransmits)) {
1616 tp->prior_ssthresh = tcp_current_ssthresh(sk); 1633 tp->prior_ssthresh = tcp_current_ssthresh(sk);
1617 /* Our state is too optimistic in ssthresh() call because cwnd 1634 /* Our state is too optimistic in ssthresh() call because cwnd
1618 * is not reduced until tcp_enter_frto_loss() when previous FRTO 1635 * is not reduced until tcp_enter_frto_loss() when previous F-RTO
1619 * recovery has not yet completed. Pattern would be this: RTO, 1636 * recovery has not yet completed. Pattern would be this: RTO,
1620 * Cumulative ACK, RTO (2xRTO for the same segment does not end 1637 * Cumulative ACK, RTO (2xRTO for the same segment does not end
1621 * up here twice). 1638 * up here twice).
@@ -1801,7 +1818,7 @@ void tcp_enter_loss(struct sock *sk, int how)
1801 tcp_set_ca_state(sk, TCP_CA_Loss); 1818 tcp_set_ca_state(sk, TCP_CA_Loss);
1802 tp->high_seq = tp->snd_nxt; 1819 tp->high_seq = tp->snd_nxt;
1803 TCP_ECN_queue_cwr(tp); 1820 TCP_ECN_queue_cwr(tp);
1804 /* Abort FRTO algorithm if one is in progress */ 1821 /* Abort F-RTO algorithm if one is in progress */
1805 tp->frto_counter = 0; 1822 tp->frto_counter = 0;
1806} 1823}
1807 1824
@@ -1946,7 +1963,7 @@ static int tcp_time_to_recover(struct sock *sk)
1946 struct tcp_sock *tp = tcp_sk(sk); 1963 struct tcp_sock *tp = tcp_sk(sk);
1947 __u32 packets_out; 1964 __u32 packets_out;
1948 1965
1949 /* Do not perform any recovery during FRTO algorithm */ 1966 /* Do not perform any recovery during F-RTO algorithm */
1950 if (tp->frto_counter) 1967 if (tp->frto_counter)
1951 return 0; 1968 return 0;
1952 1969
@@ -2061,7 +2078,7 @@ static void tcp_update_scoreboard(struct sock *sk)
2061 if (!tcp_skb_timedout(sk, skb)) 2078 if (!tcp_skb_timedout(sk, skb))
2062 break; 2079 break;
2063 2080
2064 if (!(TCP_SKB_CB(skb)->sacked&TCPCB_TAGBITS)) { 2081 if (!(TCP_SKB_CB(skb)->sacked & (TCPCB_SACKED_ACKED|TCPCB_LOST))) {
2065 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; 2082 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
2066 tp->lost_out += tcp_skb_pcount(skb); 2083 tp->lost_out += tcp_skb_pcount(skb);
2067 tcp_verify_retransmit_hint(tp, skb); 2084 tcp_verify_retransmit_hint(tp, skb);
@@ -2962,7 +2979,7 @@ static int tcp_process_frto(struct sock *sk, int flag)
2962 } 2979 }
2963 2980
2964 if (tp->frto_counter == 1) { 2981 if (tp->frto_counter == 1) {
2965 /* Sending of the next skb must be allowed or no FRTO */ 2982 /* Sending of the next skb must be allowed or no F-RTO */
2966 if (!tcp_send_head(sk) || 2983 if (!tcp_send_head(sk) ||
2967 after(TCP_SKB_CB(tcp_send_head(sk))->end_seq, 2984 after(TCP_SKB_CB(tcp_send_head(sk))->end_seq,
2968 tp->snd_una + tp->snd_wnd)) { 2985 tp->snd_una + tp->snd_wnd)) {
@@ -3909,7 +3926,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list,
3909 3926
3910 while (before(start, end)) { 3927 while (before(start, end)) {
3911 struct sk_buff *nskb; 3928 struct sk_buff *nskb;
3912 int header = skb_headroom(skb); 3929 unsigned int header = skb_headroom(skb);
3913 int copy = SKB_MAX_ORDER(header, 0); 3930 int copy = SKB_MAX_ORDER(header, 0);
3914 3931
3915 /* Too big header? This can happen with IPv6. */ 3932 /* Too big header? This can happen with IPv6. */
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 38cf73a56731..eec02b29ffcf 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -858,16 +858,16 @@ int tcp_v4_md5_do_add(struct sock *sk, __be32 addr,
858 u8 *newkey, u8 newkeylen) 858 u8 *newkey, u8 newkeylen)
859{ 859{
860 /* Add Key to the list */ 860 /* Add Key to the list */
861 struct tcp4_md5sig_key *key; 861 struct tcp_md5sig_key *key;
862 struct tcp_sock *tp = tcp_sk(sk); 862 struct tcp_sock *tp = tcp_sk(sk);
863 struct tcp4_md5sig_key *keys; 863 struct tcp4_md5sig_key *keys;
864 864
865 key = (struct tcp4_md5sig_key *)tcp_v4_md5_do_lookup(sk, addr); 865 key = tcp_v4_md5_do_lookup(sk, addr);
866 if (key) { 866 if (key) {
867 /* Pre-existing entry - just update that one. */ 867 /* Pre-existing entry - just update that one. */
868 kfree(key->base.key); 868 kfree(key->key);
869 key->base.key = newkey; 869 key->key = newkey;
870 key->base.keylen = newkeylen; 870 key->keylen = newkeylen;
871 } else { 871 } else {
872 struct tcp_md5sig_info *md5sig; 872 struct tcp_md5sig_info *md5sig;
873 873
@@ -1055,6 +1055,9 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
1055 bp->pad = 0; 1055 bp->pad = 0;
1056 bp->protocol = protocol; 1056 bp->protocol = protocol;
1057 bp->len = htons(tcplen); 1057 bp->len = htons(tcplen);
1058
1059 sg_init_table(sg, 4);
1060
1058 sg_set_buf(&sg[block++], bp, sizeof(*bp)); 1061 sg_set_buf(&sg[block++], bp, sizeof(*bp));
1059 nbytes += sizeof(*bp); 1062 nbytes += sizeof(*bp);
1060 1063
@@ -1080,6 +1083,8 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
1080 sg_set_buf(&sg[block++], key->key, key->keylen); 1083 sg_set_buf(&sg[block++], key->key, key->keylen);
1081 nbytes += key->keylen; 1084 nbytes += key->keylen;
1082 1085
1086 __sg_mark_end(&sg[block - 1]);
1087
1083 /* Now store the Hash into the packet */ 1088 /* Now store the Hash into the packet */
1084 err = crypto_hash_init(desc); 1089 err = crypto_hash_init(desc);
1085 if (err) 1090 if (err)
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
index b49dedcda52d..007304e99842 100644
--- a/net/ipv4/tcp_vegas.c
+++ b/net/ipv4/tcp_vegas.c
@@ -266,26 +266,25 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack,
266 */ 266 */
267 diff = (old_wnd << V_PARAM_SHIFT) - target_cwnd; 267 diff = (old_wnd << V_PARAM_SHIFT) - target_cwnd;
268 268
269 if (tp->snd_cwnd <= tp->snd_ssthresh) { 269 if (diff > gamma && tp->snd_ssthresh > 2 ) {
270 /* Slow start. */ 270 /* Going too fast. Time to slow down
271 if (diff > gamma) { 271 * and switch to congestion avoidance.
272 /* Going too fast. Time to slow down 272 */
273 * and switch to congestion avoidance. 273 tp->snd_ssthresh = 2;
274 */ 274
275 tp->snd_ssthresh = 2; 275 /* Set cwnd to match the actual rate
276 276 * exactly:
277 /* Set cwnd to match the actual rate 277 * cwnd = (actual rate) * baseRTT
278 * exactly: 278 * Then we add 1 because the integer
279 * cwnd = (actual rate) * baseRTT 279 * truncation robs us of full link
280 * Then we add 1 because the integer 280 * utilization.
281 * truncation robs us of full link 281 */
282 * utilization. 282 tp->snd_cwnd = min(tp->snd_cwnd,
283 */ 283 (target_cwnd >>
284 tp->snd_cwnd = min(tp->snd_cwnd, 284 V_PARAM_SHIFT)+1);
285 (target_cwnd >>
286 V_PARAM_SHIFT)+1);
287 285
288 } 286 } else if (tp->snd_cwnd <= tp->snd_ssthresh) {
287 /* Slow start. */
289 tcp_slow_start(tp); 288 tcp_slow_start(tp);
290 } else { 289 } else {
291 /* Congestion avoidance. */ 290 /* Congestion avoidance. */
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 35d2b0e9e10b..4bc25b46f33f 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1152,7 +1152,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1152 return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); 1152 return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable);
1153 1153
1154 sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest, 1154 sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest,
1155 skb->dev->ifindex, udptable ); 1155 inet_iif(skb), udptable);
1156 1156
1157 if (sk != NULL) { 1157 if (sk != NULL) {
1158 int ret = udp_queue_rcv_skb(sk, skb); 1158 int ret = udp_queue_rcv_skb(sk, skb);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 348bd8d06112..1bd8d818f8e9 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4288,8 +4288,4 @@ void __exit addrconf_cleanup(void)
4288 del_timer(&addr_chk_timer); 4288 del_timer(&addr_chk_timer);
4289 4289
4290 rtnl_unlock(); 4290 rtnl_unlock();
4291
4292#ifdef CONFIG_PROC_FS
4293 proc_net_remove(&init_net, "if_inet6");
4294#endif
4295} 4291}
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 1b1caf3aa1c1..ecbd38894fdd 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -162,7 +162,7 @@ lookup_protocol:
162 BUG_TRAP(answer_prot->slab != NULL); 162 BUG_TRAP(answer_prot->slab != NULL);
163 163
164 err = -ENOBUFS; 164 err = -ENOBUFS;
165 sk = sk_alloc(net, PF_INET6, GFP_KERNEL, answer_prot, 1); 165 sk = sk_alloc(net, PF_INET6, GFP_KERNEL, answer_prot);
166 if (sk == NULL) 166 if (sk == NULL)
167 goto out; 167 goto out;
168 168
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 72a659806cad..7db66f10e00d 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -29,7 +29,7 @@
29#include <net/ip.h> 29#include <net/ip.h>
30#include <net/xfrm.h> 30#include <net/xfrm.h>
31#include <net/esp.h> 31#include <net/esp.h>
32#include <asm/scatterlist.h> 32#include <linux/scatterlist.h>
33#include <linux/crypto.h> 33#include <linux/crypto.h>
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/pfkeyv2.h> 35#include <linux/pfkeyv2.h>
@@ -109,7 +109,11 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
109 if (!sg) 109 if (!sg)
110 goto unlock; 110 goto unlock;
111 } 111 }
112 skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen); 112 sg_init_table(sg, nfrags);
113 skb_to_sgvec(skb, sg,
114 esph->enc_data +
115 esp->conf.ivlen -
116 skb->data, clen);
113 err = crypto_blkcipher_encrypt(&desc, sg, sg, clen); 117 err = crypto_blkcipher_encrypt(&desc, sg, sg, clen);
114 if (unlikely(sg != &esp->sgbuf[0])) 118 if (unlikely(sg != &esp->sgbuf[0]))
115 kfree(sg); 119 kfree(sg);
@@ -205,7 +209,10 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
205 goto out; 209 goto out;
206 } 210 }
207 } 211 }
208 skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen, elen); 212 sg_init_table(sg, nfrags);
213 skb_to_sgvec(skb, sg,
214 sizeof(*esph) + esp->conf.ivlen,
215 elen);
209 ret = crypto_blkcipher_decrypt(&desc, sg, sg, elen); 216 ret = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
210 if (unlikely(sg != &esp->sgbuf[0])) 217 if (unlikely(sg != &esp->sgbuf[0]))
211 kfree(sg); 218 kfree(sg);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 13565dfb1b45..653fc0a8235b 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -171,7 +171,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
171 u32 mtu; 171 u32 mtu;
172 172
173 if (opt) { 173 if (opt) {
174 int head_room; 174 unsigned int head_room;
175 175
176 /* First: exthdrs may take lots of space (~8K for now) 176 /* First: exthdrs may take lots of space (~8K for now)
177 MAX_HEADER is not enough. 177 MAX_HEADER is not enough.
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 2320cc27ff9e..5383b33db8ca 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -838,7 +838,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
838 struct dst_entry *dst; 838 struct dst_entry *dst;
839 struct net_device *tdev; 839 struct net_device *tdev;
840 int mtu; 840 int mtu;
841 int max_headroom = sizeof(struct ipv6hdr); 841 unsigned int max_headroom = sizeof(struct ipv6hdr);
842 u8 proto; 842 u8 proto;
843 int err = -1; 843 int err = -1;
844 int pkt_len; 844 int pkt_len;
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 20cfc90d5597..36f7dbfb6dbb 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1670,7 +1670,7 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f
1670 filp, buffer, lenp, ppos); 1670 filp, buffer, lenp, ppos);
1671 1671
1672 else if ((strcmp(ctl->procname, "retrans_time_ms") == 0) || 1672 else if ((strcmp(ctl->procname, "retrans_time_ms") == 0) ||
1673 (strcmp(ctl->procname, "base_reacable_time_ms") == 0)) 1673 (strcmp(ctl->procname, "base_reachable_time_ms") == 0))
1674 ret = proc_dointvec_ms_jiffies(ctl, write, 1674 ret = proc_dointvec_ms_jiffies(ctl, write,
1675 filp, buffer, lenp, ppos); 1675 filp, buffer, lenp, ppos);
1676 else 1676 else
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 466657a9a8bd..71433d29d884 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -430,7 +430,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
430 struct rtable *rt; /* Route to the other host */ 430 struct rtable *rt; /* Route to the other host */
431 struct net_device *tdev; /* Device to other host */ 431 struct net_device *tdev; /* Device to other host */
432 struct iphdr *iph; /* Our new IP header */ 432 struct iphdr *iph; /* Our new IP header */
433 int max_headroom; /* The extra header space needed */ 433 unsigned int max_headroom; /* The extra header space needed */
434 __be32 dst = tiph->daddr; 434 __be32 dst = tiph->daddr;
435 int mtu; 435 int mtu;
436 struct in6_addr *addr6; 436 struct in6_addr *addr6;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 737b755342bd..4b9032880959 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -59,6 +59,7 @@
59#include <net/snmp.h> 59#include <net/snmp.h>
60#include <net/dsfield.h> 60#include <net/dsfield.h>
61#include <net/timewait_sock.h> 61#include <net/timewait_sock.h>
62#include <net/netdma.h>
62 63
63#include <asm/uaccess.h> 64#include <asm/uaccess.h>
64 65
@@ -560,16 +561,16 @@ static int tcp_v6_md5_do_add(struct sock *sk, struct in6_addr *peer,
560 char *newkey, u8 newkeylen) 561 char *newkey, u8 newkeylen)
561{ 562{
562 /* Add key to the list */ 563 /* Add key to the list */
563 struct tcp6_md5sig_key *key; 564 struct tcp_md5sig_key *key;
564 struct tcp_sock *tp = tcp_sk(sk); 565 struct tcp_sock *tp = tcp_sk(sk);
565 struct tcp6_md5sig_key *keys; 566 struct tcp6_md5sig_key *keys;
566 567
567 key = (struct tcp6_md5sig_key*) tcp_v6_md5_do_lookup(sk, peer); 568 key = tcp_v6_md5_do_lookup(sk, peer);
568 if (key) { 569 if (key) {
569 /* modify existing entry - just update that one */ 570 /* modify existing entry - just update that one */
570 kfree(key->base.key); 571 kfree(key->key);
571 key->base.key = newkey; 572 key->key = newkey;
572 key->base.keylen = newkeylen; 573 key->keylen = newkeylen;
573 } else { 574 } else {
574 /* reallocate new list if current one is full. */ 575 /* reallocate new list if current one is full. */
575 if (!tp->md5sig_info) { 576 if (!tp->md5sig_info) {
@@ -757,6 +758,8 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
757 bp->len = htonl(tcplen); 758 bp->len = htonl(tcplen);
758 bp->protocol = htonl(protocol); 759 bp->protocol = htonl(protocol);
759 760
761 sg_init_table(sg, 4);
762
760 sg_set_buf(&sg[block++], bp, sizeof(*bp)); 763 sg_set_buf(&sg[block++], bp, sizeof(*bp));
761 nbytes += sizeof(*bp); 764 nbytes += sizeof(*bp);
762 765
@@ -778,6 +781,8 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
778 sg_set_buf(&sg[block++], key->key, key->keylen); 781 sg_set_buf(&sg[block++], key->key, key->keylen);
779 nbytes += key->keylen; 782 nbytes += key->keylen;
780 783
784 __sg_mark_end(&sg[block - 1]);
785
781 /* Now store the hash into the packet */ 786 /* Now store the hash into the packet */
782 err = crypto_hash_init(desc); 787 err = crypto_hash_init(desc);
783 if (err) { 788 if (err) {
@@ -1728,6 +1733,8 @@ process:
1728 if (!sock_owned_by_user(sk)) { 1733 if (!sock_owned_by_user(sk)) {
1729#ifdef CONFIG_NET_DMA 1734#ifdef CONFIG_NET_DMA
1730 struct tcp_sock *tp = tcp_sk(sk); 1735 struct tcp_sock *tp = tcp_sk(sk);
1736 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
1737 tp->ucopy.dma_chan = get_softnet_dma();
1731 if (tp->ucopy.dma_chan) 1738 if (tp->ucopy.dma_chan)
1732 ret = tcp_v6_do_rcv(sk, skb); 1739 ret = tcp_v6_do_rcv(sk, skb);
1733 else 1740 else
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 29b063d43120..a195a66e0cc7 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -1381,7 +1381,7 @@ static int ipx_create(struct net *net, struct socket *sock, int protocol)
1381 goto out; 1381 goto out;
1382 1382
1383 rc = -ENOMEM; 1383 rc = -ENOMEM;
1384 sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto, 1); 1384 sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto);
1385 if (!sk) 1385 if (!sk)
1386 goto out; 1386 goto out;
1387#ifdef IPX_REFCNT_DEBUG 1387#ifdef IPX_REFCNT_DEBUG
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 0328ae2654f4..48ce59a6e026 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -1078,7 +1078,7 @@ static int irda_create(struct net *net, struct socket *sock, int protocol)
1078 } 1078 }
1079 1079
1080 /* Allocate networking socket */ 1080 /* Allocate networking socket */
1081 sk = sk_alloc(net, PF_IRDA, GFP_ATOMIC, &irda_proto, 1); 1081 sk = sk_alloc(net, PF_IRDA, GFP_ATOMIC, &irda_proto);
1082 if (sk == NULL) 1082 if (sk == NULL)
1083 return -ENOMEM; 1083 return -ENOMEM;
1084 1084
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 3d241e415a2a..1120b150e211 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -77,7 +77,7 @@ static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
77#endif /* CONFIG_PROC_FS */ 77#endif /* CONFIG_PROC_FS */
78static struct tty_driver *driver; 78static struct tty_driver *driver;
79 79
80hashbin_t *ircomm_tty = NULL; 80static hashbin_t *ircomm_tty = NULL;
81 81
82static const struct tty_operations ops = { 82static const struct tty_operations ops = {
83 .open = ircomm_tty_open, 83 .open = ircomm_tty_open,
diff --git a/net/irda/irnet/irnet_ppp.c b/net/irda/irnet/irnet_ppp.c
index 2f9f8dce5a69..e0eab5927c4f 100644
--- a/net/irda/irnet/irnet_ppp.c
+++ b/net/irda/irnet/irnet_ppp.c
@@ -731,15 +731,25 @@ dev_irnet_ioctl(struct inode * inode,
731 /* Get termios */ 731 /* Get termios */
732 case TCGETS: 732 case TCGETS:
733 DEBUG(FS_INFO, "Get termios.\n"); 733 DEBUG(FS_INFO, "Get termios.\n");
734#ifndef TCGETS2
734 if(kernel_termios_to_user_termios((struct termios __user *)argp, &ap->termios)) 735 if(kernel_termios_to_user_termios((struct termios __user *)argp, &ap->termios))
735 break; 736 break;
737#else
738 if(kernel_termios_to_user_termios_1((struct termios __user *)argp, &ap->termios))
739 break;
740#endif
736 err = 0; 741 err = 0;
737 break; 742 break;
738 /* Set termios */ 743 /* Set termios */
739 case TCSETSF: 744 case TCSETSF:
740 DEBUG(FS_INFO, "Set termios.\n"); 745 DEBUG(FS_INFO, "Set termios.\n");
746#ifndef TCGETS2
741 if(user_termios_to_kernel_termios(&ap->termios, (struct termios __user *)argp)) 747 if(user_termios_to_kernel_termios(&ap->termios, (struct termios __user *)argp))
742 break; 748 break;
749#else
750 if(user_termios_to_kernel_termios_1(&ap->termios, (struct termios __user *)argp))
751 break;
752#endif
743 err = 0; 753 err = 0;
744 break; 754 break;
745 755
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 43e01c8d382b..aef664580355 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -216,7 +216,7 @@ static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio)
216{ 216{
217 struct sock *sk; 217 struct sock *sk;
218 218
219 sk = sk_alloc(&init_net, PF_IUCV, prio, &iucv_proto, 1); 219 sk = sk_alloc(&init_net, PF_IUCV, prio, &iucv_proto);
220 if (!sk) 220 if (!sk)
221 return NULL; 221 return NULL;
222 222
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 7969f8a716df..10c89d47f685 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -152,7 +152,7 @@ static int pfkey_create(struct net *net, struct socket *sock, int protocol)
152 return -EPROTONOSUPPORT; 152 return -EPROTONOSUPPORT;
153 153
154 err = -ENOMEM; 154 err = -ENOMEM;
155 sk = sk_alloc(net, PF_KEY, GFP_KERNEL, &key_proto, 1); 155 sk = sk_alloc(net, PF_KEY, GFP_KERNEL, &key_proto);
156 if (sk == NULL) 156 if (sk == NULL)
157 goto out; 157 goto out;
158 158
@@ -395,9 +395,9 @@ static inline int pfkey_sec_ctx_len(struct sadb_x_sec_ctx *sec_ctx)
395static inline int verify_sec_ctx_len(void *p) 395static inline int verify_sec_ctx_len(void *p)
396{ 396{
397 struct sadb_x_sec_ctx *sec_ctx = (struct sadb_x_sec_ctx *)p; 397 struct sadb_x_sec_ctx *sec_ctx = (struct sadb_x_sec_ctx *)p;
398 int len; 398 int len = sec_ctx->sadb_x_ctx_len;
399 399
400 if (sec_ctx->sadb_x_ctx_len > PAGE_SIZE) 400 if (len > PAGE_SIZE)
401 return -EINVAL; 401 return -EINVAL;
402 402
403 len = pfkey_sec_ctx_len(sec_ctx); 403 len = pfkey_sec_ctx_len(sec_ctx);
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 8ebc2769dfda..5c0b484237c8 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -869,7 +869,7 @@ static void llc_sk_init(struct sock* sk)
869 */ 869 */
870struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, struct proto *prot) 870struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, struct proto *prot)
871{ 871{
872 struct sock *sk = sk_alloc(net, family, priority, prot, 1); 872 struct sock *sk = sk_alloc(net, family, priority, prot);
873 873
874 if (!sk) 874 if (!sk)
875 goto out; 875 goto out;
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index f7ffeec3913f..fda0e06453e8 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -1184,7 +1184,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
1184 printk(KERN_DEBUG "%s: RX %sssocResp from %s (capab=0x%x " 1184 printk(KERN_DEBUG "%s: RX %sssocResp from %s (capab=0x%x "
1185 "status=%d aid=%d)\n", 1185 "status=%d aid=%d)\n",
1186 dev->name, reassoc ? "Rea" : "A", print_mac(mac, mgmt->sa), 1186 dev->name, reassoc ? "Rea" : "A", print_mac(mac, mgmt->sa),
1187 capab_info, status_code, aid & ~(BIT(15) | BIT(14))); 1187 capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14))));
1188 1188
1189 if (status_code != WLAN_STATUS_SUCCESS) { 1189 if (status_code != WLAN_STATUS_SUCCESS) {
1190 printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", 1190 printk(KERN_DEBUG "%s: AP denied association (code=%d)\n",
@@ -2096,7 +2096,8 @@ static int ieee80211_sta_match_ssid(struct ieee80211_if_sta *ifsta,
2096{ 2096{
2097 int tmp, hidden_ssid; 2097 int tmp, hidden_ssid;
2098 2098
2099 if (!memcmp(ifsta->ssid, ssid, ssid_len)) 2099 if (ssid_len == ifsta->ssid_len &&
2100 !memcmp(ifsta->ssid, ssid, ssid_len))
2100 return 1; 2101 return 1;
2101 2102
2102 if (ifsta->flags & IEEE80211_STA_AUTO_BSSID_SEL) 2103 if (ifsta->flags & IEEE80211_STA_AUTO_BSSID_SEL)
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index d7a600a5720a..21a9fcc03796 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -363,7 +363,7 @@ config NETFILTER_XT_TARGET_TRACE
363 the tables, chains, rules. 363 the tables, chains, rules.
364 364
365 If you want to compile it as a module, say M here and read 365 If you want to compile it as a module, say M here and read
366 <file:Documentation/modules.txt>. If unsure, say `N'. 366 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
367 367
368config NETFILTER_XT_TARGET_SECMARK 368config NETFILTER_XT_TARGET_SECMARK
369 tristate '"SECMARK" target support' 369 tristate '"SECMARK" target support'
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 4d6171bc0829..000c2fb462d0 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -999,7 +999,7 @@ struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced)
999 *vmalloced = 0; 999 *vmalloced = 0;
1000 1000
1001 size = *sizep = roundup(*sizep, PAGE_SIZE / sizeof(struct hlist_head)); 1001 size = *sizep = roundup(*sizep, PAGE_SIZE / sizeof(struct hlist_head));
1002 hash = (void*)__get_free_pages(GFP_KERNEL, 1002 hash = (void*)__get_free_pages(GFP_KERNEL|__GFP_NOWARN,
1003 get_order(sizeof(struct hlist_head) 1003 get_order(sizeof(struct hlist_head)
1004 * size)); 1004 * size));
1005 if (!hash) { 1005 if (!hash) {
diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
index b6c844b7e1c1..b3675bd7db33 100644
--- a/net/netlabel/netlabel_domainhash.c
+++ b/net/netlabel/netlabel_domainhash.c
@@ -178,11 +178,9 @@ int netlbl_domhsh_init(u32 size)
178 for (iter = 0; iter < hsh_tbl->size; iter++) 178 for (iter = 0; iter < hsh_tbl->size; iter++)
179 INIT_LIST_HEAD(&hsh_tbl->tbl[iter]); 179 INIT_LIST_HEAD(&hsh_tbl->tbl[iter]);
180 180
181 rcu_read_lock();
182 spin_lock(&netlbl_domhsh_lock); 181 spin_lock(&netlbl_domhsh_lock);
183 rcu_assign_pointer(netlbl_domhsh, hsh_tbl); 182 rcu_assign_pointer(netlbl_domhsh, hsh_tbl);
184 spin_unlock(&netlbl_domhsh_lock); 183 spin_unlock(&netlbl_domhsh_lock);
185 rcu_read_unlock();
186 184
187 return 0; 185 return 0;
188} 186}
@@ -222,7 +220,6 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry,
222 entry->valid = 1; 220 entry->valid = 1;
223 INIT_RCU_HEAD(&entry->rcu); 221 INIT_RCU_HEAD(&entry->rcu);
224 222
225 ret_val = 0;
226 rcu_read_lock(); 223 rcu_read_lock();
227 if (entry->domain != NULL) { 224 if (entry->domain != NULL) {
228 bkt = netlbl_domhsh_hash(entry->domain); 225 bkt = netlbl_domhsh_hash(entry->domain);
@@ -233,7 +230,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry,
233 else 230 else
234 ret_val = -EEXIST; 231 ret_val = -EEXIST;
235 spin_unlock(&netlbl_domhsh_lock); 232 spin_unlock(&netlbl_domhsh_lock);
236 } else if (entry->domain == NULL) { 233 } else {
237 INIT_LIST_HEAD(&entry->list); 234 INIT_LIST_HEAD(&entry->list);
238 spin_lock(&netlbl_domhsh_def_lock); 235 spin_lock(&netlbl_domhsh_def_lock);
239 if (rcu_dereference(netlbl_domhsh_def) == NULL) 236 if (rcu_dereference(netlbl_domhsh_def) == NULL)
@@ -241,9 +238,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry,
241 else 238 else
242 ret_val = -EEXIST; 239 ret_val = -EEXIST;
243 spin_unlock(&netlbl_domhsh_def_lock); 240 spin_unlock(&netlbl_domhsh_def_lock);
244 } else 241 }
245 ret_val = -EINVAL;
246
247 audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_ADD, audit_info); 242 audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_ADD, audit_info);
248 if (audit_buf != NULL) { 243 if (audit_buf != NULL) {
249 audit_log_format(audit_buf, 244 audit_log_format(audit_buf,
@@ -262,7 +257,6 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry,
262 audit_log_format(audit_buf, " res=%u", ret_val == 0 ? 1 : 0); 257 audit_log_format(audit_buf, " res=%u", ret_val == 0 ? 1 : 0);
263 audit_log_end(audit_buf); 258 audit_log_end(audit_buf);
264 } 259 }
265
266 rcu_read_unlock(); 260 rcu_read_unlock();
267 261
268 if (ret_val != 0) { 262 if (ret_val != 0) {
@@ -313,38 +307,30 @@ int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info)
313 struct audit_buffer *audit_buf; 307 struct audit_buffer *audit_buf;
314 308
315 rcu_read_lock(); 309 rcu_read_lock();
316 if (domain != NULL) 310 entry = netlbl_domhsh_search(domain, (domain != NULL ? 0 : 1));
317 entry = netlbl_domhsh_search(domain, 0);
318 else
319 entry = netlbl_domhsh_search(domain, 1);
320 if (entry == NULL) 311 if (entry == NULL)
321 goto remove_return; 312 goto remove_return;
322 switch (entry->type) { 313 switch (entry->type) {
323 case NETLBL_NLTYPE_UNLABELED:
324 break;
325 case NETLBL_NLTYPE_CIPSOV4: 314 case NETLBL_NLTYPE_CIPSOV4:
326 ret_val = cipso_v4_doi_domhsh_remove(entry->type_def.cipsov4, 315 cipso_v4_doi_domhsh_remove(entry->type_def.cipsov4,
327 entry->domain); 316 entry->domain);
328 if (ret_val != 0)
329 goto remove_return;
330 break; 317 break;
331 } 318 }
332 ret_val = 0;
333 if (entry != rcu_dereference(netlbl_domhsh_def)) { 319 if (entry != rcu_dereference(netlbl_domhsh_def)) {
334 spin_lock(&netlbl_domhsh_lock); 320 spin_lock(&netlbl_domhsh_lock);
335 if (entry->valid) { 321 if (entry->valid) {
336 entry->valid = 0; 322 entry->valid = 0;
337 list_del_rcu(&entry->list); 323 list_del_rcu(&entry->list);
338 } else 324 ret_val = 0;
339 ret_val = -ENOENT; 325 }
340 spin_unlock(&netlbl_domhsh_lock); 326 spin_unlock(&netlbl_domhsh_lock);
341 } else { 327 } else {
342 spin_lock(&netlbl_domhsh_def_lock); 328 spin_lock(&netlbl_domhsh_def_lock);
343 if (entry->valid) { 329 if (entry->valid) {
344 entry->valid = 0; 330 entry->valid = 0;
345 rcu_assign_pointer(netlbl_domhsh_def, NULL); 331 rcu_assign_pointer(netlbl_domhsh_def, NULL);
346 } else 332 ret_val = 0;
347 ret_val = -ENOENT; 333 }
348 spin_unlock(&netlbl_domhsh_def_lock); 334 spin_unlock(&netlbl_domhsh_def_lock);
349 } 335 }
350 336
@@ -357,11 +343,10 @@ int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info)
357 audit_log_end(audit_buf); 343 audit_log_end(audit_buf);
358 } 344 }
359 345
360 if (ret_val == 0)
361 call_rcu(&entry->rcu, netlbl_domhsh_free_entry);
362
363remove_return: 346remove_return:
364 rcu_read_unlock(); 347 rcu_read_unlock();
348 if (ret_val == 0)
349 call_rcu(&entry->rcu, netlbl_domhsh_free_entry);
365 return ret_val; 350 return ret_val;
366} 351}
367 352
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
index 5315dacc5222..56483377997a 100644
--- a/net/netlabel/netlabel_mgmt.c
+++ b/net/netlabel/netlabel_mgmt.c
@@ -85,11 +85,9 @@ static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {
85 */ 85 */
86void netlbl_mgmt_protocount_inc(void) 86void netlbl_mgmt_protocount_inc(void)
87{ 87{
88 rcu_read_lock();
89 spin_lock(&netlabel_mgmt_protocount_lock); 88 spin_lock(&netlabel_mgmt_protocount_lock);
90 netlabel_mgmt_protocount++; 89 netlabel_mgmt_protocount++;
91 spin_unlock(&netlabel_mgmt_protocount_lock); 90 spin_unlock(&netlabel_mgmt_protocount_lock);
92 rcu_read_unlock();
93} 91}
94 92
95/** 93/**
@@ -103,12 +101,10 @@ void netlbl_mgmt_protocount_inc(void)
103 */ 101 */
104void netlbl_mgmt_protocount_dec(void) 102void netlbl_mgmt_protocount_dec(void)
105{ 103{
106 rcu_read_lock();
107 spin_lock(&netlabel_mgmt_protocount_lock); 104 spin_lock(&netlabel_mgmt_protocount_lock);
108 if (netlabel_mgmt_protocount > 0) 105 if (netlabel_mgmt_protocount > 0)
109 netlabel_mgmt_protocount--; 106 netlabel_mgmt_protocount--;
110 spin_unlock(&netlabel_mgmt_protocount_lock); 107 spin_unlock(&netlabel_mgmt_protocount_lock);
111 rcu_read_unlock();
112} 108}
113 109
114/** 110/**
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 5c303c68af1d..348292450deb 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -84,12 +84,10 @@ static void netlbl_unlabel_acceptflg_set(u8 value,
84 struct audit_buffer *audit_buf; 84 struct audit_buffer *audit_buf;
85 u8 old_val; 85 u8 old_val;
86 86
87 rcu_read_lock();
88 old_val = netlabel_unlabel_acceptflg;
89 spin_lock(&netlabel_unlabel_acceptflg_lock); 87 spin_lock(&netlabel_unlabel_acceptflg_lock);
88 old_val = netlabel_unlabel_acceptflg;
90 netlabel_unlabel_acceptflg = value; 89 netlabel_unlabel_acceptflg = value;
91 spin_unlock(&netlabel_unlabel_acceptflg_lock); 90 spin_unlock(&netlabel_unlabel_acceptflg_lock);
92 rcu_read_unlock();
93 91
94 audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_ALLOW, 92 audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_ALLOW,
95 audit_info); 93 audit_info);
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 98e313e5e594..260171255576 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -396,7 +396,7 @@ static int __netlink_create(struct net *net, struct socket *sock,
396 396
397 sock->ops = &netlink_ops; 397 sock->ops = &netlink_ops;
398 398
399 sk = sk_alloc(net, PF_NETLINK, GFP_KERNEL, &netlink_proto, 1); 399 sk = sk_alloc(net, PF_NETLINK, GFP_KERNEL, &netlink_proto);
400 if (!sk) 400 if (!sk)
401 return -ENOMEM; 401 return -ENOMEM;
402 402
@@ -1565,7 +1565,11 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
1565 1565
1566 netlink_dump(sk); 1566 netlink_dump(sk);
1567 sock_put(sk); 1567 sock_put(sk);
1568 return 0; 1568
1569 /* We successfully started a dump, by returning -EINTR we
1570 * signal not to send ACK even if it was requested.
1571 */
1572 return -EINTR;
1569} 1573}
1570 1574
1571void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) 1575void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
@@ -1619,17 +1623,21 @@ int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
1619 1623
1620 /* Only requests are handled by the kernel */ 1624 /* Only requests are handled by the kernel */
1621 if (!(nlh->nlmsg_flags & NLM_F_REQUEST)) 1625 if (!(nlh->nlmsg_flags & NLM_F_REQUEST))
1622 goto skip; 1626 goto ack;
1623 1627
1624 /* Skip control messages */ 1628 /* Skip control messages */
1625 if (nlh->nlmsg_type < NLMSG_MIN_TYPE) 1629 if (nlh->nlmsg_type < NLMSG_MIN_TYPE)
1626 goto skip; 1630 goto ack;
1627 1631
1628 err = cb(skb, nlh); 1632 err = cb(skb, nlh);
1629skip: 1633 if (err == -EINTR)
1634 goto skip;
1635
1636ack:
1630 if (nlh->nlmsg_flags & NLM_F_ACK || err) 1637 if (nlh->nlmsg_flags & NLM_F_ACK || err)
1631 netlink_ack(skb, nlh, err); 1638 netlink_ack(skb, nlh, err);
1632 1639
1640skip:
1633 msglen = NLMSG_ALIGN(nlh->nlmsg_len); 1641 msglen = NLMSG_ALIGN(nlh->nlmsg_len);
1634 if (msglen > skb->len) 1642 if (msglen > skb->len)
1635 msglen = skb->len; 1643 msglen = skb->len;
@@ -1880,7 +1888,7 @@ static void __net_exit netlink_net_exit(struct net *net)
1880#endif 1888#endif
1881} 1889}
1882 1890
1883static struct pernet_operations __net_initdata netlink_net_ops = { 1891static struct pernet_operations netlink_net_ops = {
1884 .init = netlink_net_init, 1892 .init = netlink_net_init,
1885 .exit = netlink_net_exit, 1893 .exit = netlink_net_exit,
1886}; 1894};
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 3a4d479ea64e..972250c974f1 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -423,7 +423,8 @@ static int nr_create(struct net *net, struct socket *sock, int protocol)
423 if (sock->type != SOCK_SEQPACKET || protocol != 0) 423 if (sock->type != SOCK_SEQPACKET || protocol != 0)
424 return -ESOCKTNOSUPPORT; 424 return -ESOCKTNOSUPPORT;
425 425
426 if ((sk = sk_alloc(net, PF_NETROM, GFP_ATOMIC, &nr_proto, 1)) == NULL) 426 sk = sk_alloc(net, PF_NETROM, GFP_ATOMIC, &nr_proto);
427 if (sk == NULL)
427 return -ENOMEM; 428 return -ENOMEM;
428 429
429 nr = nr_sk(sk); 430 nr = nr_sk(sk);
@@ -465,7 +466,8 @@ static struct sock *nr_make_new(struct sock *osk)
465 if (osk->sk_type != SOCK_SEQPACKET) 466 if (osk->sk_type != SOCK_SEQPACKET)
466 return NULL; 467 return NULL;
467 468
468 if ((sk = sk_alloc(osk->sk_net, PF_NETROM, GFP_ATOMIC, osk->sk_prot, 1)) == NULL) 469 sk = sk_alloc(osk->sk_net, PF_NETROM, GFP_ATOMIC, osk->sk_prot);
470 if (sk == NULL)
469 return NULL; 471 return NULL;
470 472
471 nr = nr_sk(sk); 473 nr = nr_sk(sk);
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index d0936506b731..4cb2dfba0993 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -995,7 +995,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
995 sock->state = SS_UNCONNECTED; 995 sock->state = SS_UNCONNECTED;
996 996
997 err = -ENOBUFS; 997 err = -ENOBUFS;
998 sk = sk_alloc(net, PF_PACKET, GFP_KERNEL, &packet_proto, 1); 998 sk = sk_alloc(net, PF_PACKET, GFP_KERNEL, &packet_proto);
999 if (sk == NULL) 999 if (sk == NULL)
1000 goto out; 1000 goto out;
1001 1001
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 509defe53ee5..ed2d65cd8010 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -513,7 +513,8 @@ static int rose_create(struct net *net, struct socket *sock, int protocol)
513 if (sock->type != SOCK_SEQPACKET || protocol != 0) 513 if (sock->type != SOCK_SEQPACKET || protocol != 0)
514 return -ESOCKTNOSUPPORT; 514 return -ESOCKTNOSUPPORT;
515 515
516 if ((sk = sk_alloc(net, PF_ROSE, GFP_ATOMIC, &rose_proto, 1)) == NULL) 516 sk = sk_alloc(net, PF_ROSE, GFP_ATOMIC, &rose_proto);
517 if (sk == NULL)
517 return -ENOMEM; 518 return -ENOMEM;
518 519
519 rose = rose_sk(sk); 520 rose = rose_sk(sk);
@@ -551,7 +552,8 @@ static struct sock *rose_make_new(struct sock *osk)
551 if (osk->sk_type != SOCK_SEQPACKET) 552 if (osk->sk_type != SOCK_SEQPACKET)
552 return NULL; 553 return NULL;
553 554
554 if ((sk = sk_alloc(osk->sk_net, PF_ROSE, GFP_ATOMIC, &rose_proto, 1)) == NULL) 555 sk = sk_alloc(osk->sk_net, PF_ROSE, GFP_ATOMIC, &rose_proto);
556 if (sk == NULL)
555 return NULL; 557 return NULL;
556 558
557 rose = rose_sk(sk); 559 rose = rose_sk(sk);
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index c680017f5c8e..d6389450c4bf 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -627,7 +627,7 @@ static int rxrpc_create(struct net *net, struct socket *sock, int protocol)
627 sock->ops = &rxrpc_rpc_ops; 627 sock->ops = &rxrpc_rpc_ops;
628 sock->state = SS_UNCONNECTED; 628 sock->state = SS_UNCONNECTED;
629 629
630 sk = sk_alloc(net, PF_RXRPC, GFP_KERNEL, &rxrpc_proto, 1); 630 sk = sk_alloc(net, PF_RXRPC, GFP_KERNEL, &rxrpc_proto);
631 if (!sk) 631 if (!sk)
632 return -ENOMEM; 632 return -ENOMEM;
633 633
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
index ac3cabdca78c..c387cf68a08c 100644
--- a/net/rxrpc/rxkad.c
+++ b/net/rxrpc/rxkad.c
@@ -135,9 +135,8 @@ static void rxkad_prime_packet_security(struct rxrpc_connection *conn)
135 tmpbuf.x[2] = 0; 135 tmpbuf.x[2] = 0;
136 tmpbuf.x[3] = htonl(conn->security_ix); 136 tmpbuf.x[3] = htonl(conn->security_ix);
137 137
138 memset(sg, 0, sizeof(sg)); 138 sg_init_one(&sg[0], &tmpbuf, sizeof(tmpbuf));
139 sg_set_buf(&sg[0], &tmpbuf, sizeof(tmpbuf)); 139 sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf));
140 sg_set_buf(&sg[1], &tmpbuf, sizeof(tmpbuf));
141 crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); 140 crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf));
142 141
143 memcpy(&conn->csum_iv, &tmpbuf.x[2], sizeof(conn->csum_iv)); 142 memcpy(&conn->csum_iv, &tmpbuf.x[2], sizeof(conn->csum_iv));
@@ -180,9 +179,8 @@ static int rxkad_secure_packet_auth(const struct rxrpc_call *call,
180 desc.info = iv.x; 179 desc.info = iv.x;
181 desc.flags = 0; 180 desc.flags = 0;
182 181
183 memset(sg, 0, sizeof(sg)); 182 sg_init_one(&sg[0], &tmpbuf, sizeof(tmpbuf));
184 sg_set_buf(&sg[0], &tmpbuf, sizeof(tmpbuf)); 183 sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf));
185 sg_set_buf(&sg[1], &tmpbuf, sizeof(tmpbuf));
186 crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); 184 crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf));
187 185
188 memcpy(sechdr, &tmpbuf, sizeof(tmpbuf)); 186 memcpy(sechdr, &tmpbuf, sizeof(tmpbuf));
@@ -227,9 +225,8 @@ static int rxkad_secure_packet_encrypt(const struct rxrpc_call *call,
227 desc.info = iv.x; 225 desc.info = iv.x;
228 desc.flags = 0; 226 desc.flags = 0;
229 227
230 memset(sg, 0, sizeof(sg[0]) * 2); 228 sg_init_one(&sg[0], sechdr, sizeof(rxkhdr));
231 sg_set_buf(&sg[0], sechdr, sizeof(rxkhdr)); 229 sg_init_one(&sg[1], &rxkhdr, sizeof(rxkhdr));
232 sg_set_buf(&sg[1], &rxkhdr, sizeof(rxkhdr));
233 crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(rxkhdr)); 230 crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(rxkhdr));
234 231
235 /* we want to encrypt the skbuff in-place */ 232 /* we want to encrypt the skbuff in-place */
@@ -240,6 +237,7 @@ static int rxkad_secure_packet_encrypt(const struct rxrpc_call *call,
240 len = data_size + call->conn->size_align - 1; 237 len = data_size + call->conn->size_align - 1;
241 len &= ~(call->conn->size_align - 1); 238 len &= ~(call->conn->size_align - 1);
242 239
240 sg_init_table(sg, nsg);
243 skb_to_sgvec(skb, sg, 0, len); 241 skb_to_sgvec(skb, sg, 0, len);
244 crypto_blkcipher_encrypt_iv(&desc, sg, sg, len); 242 crypto_blkcipher_encrypt_iv(&desc, sg, sg, len);
245 243
@@ -290,9 +288,8 @@ static int rxkad_secure_packet(const struct rxrpc_call *call,
290 tmpbuf.x[0] = sp->hdr.callNumber; 288 tmpbuf.x[0] = sp->hdr.callNumber;
291 tmpbuf.x[1] = x; 289 tmpbuf.x[1] = x;
292 290
293 memset(&sg, 0, sizeof(sg)); 291 sg_init_one(&sg[0], &tmpbuf, sizeof(tmpbuf));
294 sg_set_buf(&sg[0], &tmpbuf, sizeof(tmpbuf)); 292 sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf));
295 sg_set_buf(&sg[1], &tmpbuf, sizeof(tmpbuf));
296 crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); 293 crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf));
297 294
298 x = ntohl(tmpbuf.x[1]); 295 x = ntohl(tmpbuf.x[1]);
@@ -332,19 +329,22 @@ static int rxkad_verify_packet_auth(const struct rxrpc_call *call,
332 struct rxrpc_skb_priv *sp; 329 struct rxrpc_skb_priv *sp;
333 struct blkcipher_desc desc; 330 struct blkcipher_desc desc;
334 struct rxrpc_crypt iv; 331 struct rxrpc_crypt iv;
335 struct scatterlist sg[2]; 332 struct scatterlist sg[16];
336 struct sk_buff *trailer; 333 struct sk_buff *trailer;
337 u32 data_size, buf; 334 u32 data_size, buf;
338 u16 check; 335 u16 check;
336 int nsg;
339 337
340 _enter(""); 338 _enter("");
341 339
342 sp = rxrpc_skb(skb); 340 sp = rxrpc_skb(skb);
343 341
344 /* we want to decrypt the skbuff in-place */ 342 /* we want to decrypt the skbuff in-place */
345 if (skb_cow_data(skb, 0, &trailer) < 0) 343 nsg = skb_cow_data(skb, 0, &trailer);
344 if (nsg < 0 || nsg > 16)
346 goto nomem; 345 goto nomem;
347 346
347 sg_init_table(sg, nsg);
348 skb_to_sgvec(skb, sg, 0, 8); 348 skb_to_sgvec(skb, sg, 0, 8);
349 349
350 /* start the decryption afresh */ 350 /* start the decryption afresh */
@@ -426,6 +426,7 @@ static int rxkad_verify_packet_encrypt(const struct rxrpc_call *call,
426 goto nomem; 426 goto nomem;
427 } 427 }
428 428
429 sg_init_table(sg, nsg);
429 skb_to_sgvec(skb, sg, 0, skb->len); 430 skb_to_sgvec(skb, sg, 0, skb->len);
430 431
431 /* decrypt from the session key */ 432 /* decrypt from the session key */
@@ -521,9 +522,8 @@ static int rxkad_verify_packet(const struct rxrpc_call *call,
521 tmpbuf.x[0] = call->call_id; 522 tmpbuf.x[0] = call->call_id;
522 tmpbuf.x[1] = x; 523 tmpbuf.x[1] = x;
523 524
524 memset(&sg, 0, sizeof(sg)); 525 sg_init_one(&sg[0], &tmpbuf, sizeof(tmpbuf));
525 sg_set_buf(&sg[0], &tmpbuf, sizeof(tmpbuf)); 526 sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf));
526 sg_set_buf(&sg[1], &tmpbuf, sizeof(tmpbuf));
527 crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); 527 crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf));
528 528
529 x = ntohl(tmpbuf.x[1]); 529 x = ntohl(tmpbuf.x[1]);
@@ -690,16 +690,20 @@ static void rxkad_calc_response_checksum(struct rxkad_response *response)
690static void rxkad_sg_set_buf2(struct scatterlist sg[2], 690static void rxkad_sg_set_buf2(struct scatterlist sg[2],
691 void *buf, size_t buflen) 691 void *buf, size_t buflen)
692{ 692{
693 int nsg = 1;
693 694
694 memset(sg, 0, sizeof(sg)); 695 sg_init_table(sg, 2);
695 696
696 sg_set_buf(&sg[0], buf, buflen); 697 sg_set_buf(&sg[0], buf, buflen);
697 if (sg[0].offset + buflen > PAGE_SIZE) { 698 if (sg[0].offset + buflen > PAGE_SIZE) {
698 /* the buffer was split over two pages */ 699 /* the buffer was split over two pages */
699 sg[0].length = PAGE_SIZE - sg[0].offset; 700 sg[0].length = PAGE_SIZE - sg[0].offset;
700 sg_set_buf(&sg[1], buf + sg[0].length, buflen - sg[0].length); 701 sg_set_buf(&sg[1], buf + sg[0].length, buflen - sg[0].length);
702 nsg++;
701 } 703 }
702 704
705 __sg_mark_end(&sg[nsg - 1]);
706
703 ASSERTCMP(sg[0].length + sg[1].length, ==, buflen); 707 ASSERTCMP(sg[0].length + sg[1].length, ==, buflen);
704} 708}
705 709
@@ -712,7 +716,7 @@ static void rxkad_encrypt_response(struct rxrpc_connection *conn,
712{ 716{
713 struct blkcipher_desc desc; 717 struct blkcipher_desc desc;
714 struct rxrpc_crypt iv; 718 struct rxrpc_crypt iv;
715 struct scatterlist ssg[2], dsg[2]; 719 struct scatterlist sg[2];
716 720
717 /* continue encrypting from where we left off */ 721 /* continue encrypting from where we left off */
718 memcpy(&iv, s2->session_key, sizeof(iv)); 722 memcpy(&iv, s2->session_key, sizeof(iv));
@@ -720,9 +724,8 @@ static void rxkad_encrypt_response(struct rxrpc_connection *conn,
720 desc.info = iv.x; 724 desc.info = iv.x;
721 desc.flags = 0; 725 desc.flags = 0;
722 726
723 rxkad_sg_set_buf2(ssg, &resp->encrypted, sizeof(resp->encrypted)); 727 rxkad_sg_set_buf2(sg, &resp->encrypted, sizeof(resp->encrypted));
724 memcpy(dsg, ssg, sizeof(dsg)); 728 crypto_blkcipher_encrypt_iv(&desc, sg, sg, sizeof(resp->encrypted));
725 crypto_blkcipher_encrypt_iv(&desc, dsg, ssg, sizeof(resp->encrypted));
726} 729}
727 730
728/* 731/*
@@ -817,7 +820,7 @@ static int rxkad_decrypt_ticket(struct rxrpc_connection *conn,
817{ 820{
818 struct blkcipher_desc desc; 821 struct blkcipher_desc desc;
819 struct rxrpc_crypt iv, key; 822 struct rxrpc_crypt iv, key;
820 struct scatterlist ssg[1], dsg[1]; 823 struct scatterlist sg[1];
821 struct in_addr addr; 824 struct in_addr addr;
822 unsigned life; 825 unsigned life;
823 time_t issue, now; 826 time_t issue, now;
@@ -850,9 +853,8 @@ static int rxkad_decrypt_ticket(struct rxrpc_connection *conn,
850 desc.info = iv.x; 853 desc.info = iv.x;
851 desc.flags = 0; 854 desc.flags = 0;
852 855
853 sg_init_one(&ssg[0], ticket, ticket_len); 856 sg_init_one(&sg[0], ticket, ticket_len);
854 memcpy(dsg, ssg, sizeof(dsg)); 857 crypto_blkcipher_decrypt_iv(&desc, sg, sg, ticket_len);
855 crypto_blkcipher_decrypt_iv(&desc, dsg, ssg, ticket_len);
856 858
857 p = ticket; 859 p = ticket;
858 end = p + ticket_len; 860 end = p + ticket_len;
@@ -961,7 +963,7 @@ static void rxkad_decrypt_response(struct rxrpc_connection *conn,
961 const struct rxrpc_crypt *session_key) 963 const struct rxrpc_crypt *session_key)
962{ 964{
963 struct blkcipher_desc desc; 965 struct blkcipher_desc desc;
964 struct scatterlist ssg[2], dsg[2]; 966 struct scatterlist sg[2];
965 struct rxrpc_crypt iv; 967 struct rxrpc_crypt iv;
966 968
967 _enter(",,%08x%08x", 969 _enter(",,%08x%08x",
@@ -979,9 +981,8 @@ static void rxkad_decrypt_response(struct rxrpc_connection *conn,
979 desc.info = iv.x; 981 desc.info = iv.x;
980 desc.flags = 0; 982 desc.flags = 0;
981 983
982 rxkad_sg_set_buf2(ssg, &resp->encrypted, sizeof(resp->encrypted)); 984 rxkad_sg_set_buf2(sg, &resp->encrypted, sizeof(resp->encrypted));
983 memcpy(dsg, ssg, sizeof(dsg)); 985 crypto_blkcipher_decrypt_iv(&desc, sg, sg, sizeof(resp->encrypted));
984 crypto_blkcipher_decrypt_iv(&desc, dsg, ssg, sizeof(resp->encrypted));
985 mutex_unlock(&rxkad_ci_mutex); 986 mutex_unlock(&rxkad_ci_mutex);
986 987
987 _leave(""); 988 _leave("");
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index fd7bca4d5c20..c3fde9180f9d 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -166,7 +166,7 @@ bad_mirred:
166 return TC_ACT_SHOT; 166 return TC_ACT_SHOT;
167 } 167 }
168 168
169 skb2 = skb_clone(skb, GFP_ATOMIC); 169 skb2 = skb_act_clone(skb, GFP_ATOMIC);
170 if (skb2 == NULL) 170 if (skb2 == NULL)
171 goto bad_mirred; 171 goto bad_mirred;
172 if (m->tcfm_eaction != TCA_EGRESS_MIRROR && 172 if (m->tcfm_eaction != TCA_EGRESS_MIRROR &&
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index abd82fc3ec60..de894096e442 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -136,7 +136,7 @@ prio_dequeue(struct Qdisc* sch)
136 * pulling an skb. This way we avoid excessive requeues 136 * pulling an skb. This way we avoid excessive requeues
137 * for slower queues. 137 * for slower queues.
138 */ 138 */
139 if (!netif_subqueue_stopped(sch->dev, (q->mq ? prio : 0))) { 139 if (!__netif_subqueue_stopped(sch->dev, (q->mq ? prio : 0))) {
140 qdisc = q->queues[prio]; 140 qdisc = q->queues[prio];
141 skb = qdisc->dequeue(qdisc); 141 skb = qdisc->dequeue(qdisc);
142 if (skb) { 142 if (skb) {
@@ -165,7 +165,7 @@ static struct sk_buff *rr_dequeue(struct Qdisc* sch)
165 * for slower queues. If the queue is stopped, try the 165 * for slower queues. If the queue is stopped, try the
166 * next queue. 166 * next queue.
167 */ 167 */
168 if (!netif_subqueue_stopped(sch->dev, 168 if (!__netif_subqueue_stopped(sch->dev,
169 (q->mq ? q->curband : 0))) { 169 (q->mq ? q->curband : 0))) {
170 qdisc = q->queues[q->curband]; 170 qdisc = q->queues[q->curband];
171 skb = qdisc->dequeue(qdisc); 171 skb = qdisc->dequeue(qdisc);
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index cbd64b216cce..6d5fa6bb371b 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -107,7 +107,7 @@ struct sctp_shared_key *sctp_auth_shkey_create(__u16 key_id, gfp_t gfp)
107} 107}
108 108
109/* Free the shared key stucture */ 109/* Free the shared key stucture */
110void sctp_auth_shkey_free(struct sctp_shared_key *sh_key) 110static void sctp_auth_shkey_free(struct sctp_shared_key *sh_key)
111{ 111{
112 BUG_ON(!list_empty(&sh_key->key_list)); 112 BUG_ON(!list_empty(&sh_key->key_list));
113 sctp_auth_key_put(sh_key->key); 113 sctp_auth_key_put(sh_key->key);
@@ -220,7 +220,7 @@ static struct sctp_auth_bytes *sctp_auth_make_key_vector(
220 220
221 221
222/* Make a key vector based on our local parameters */ 222/* Make a key vector based on our local parameters */
223struct sctp_auth_bytes *sctp_auth_make_local_vector( 223static struct sctp_auth_bytes *sctp_auth_make_local_vector(
224 const struct sctp_association *asoc, 224 const struct sctp_association *asoc,
225 gfp_t gfp) 225 gfp_t gfp)
226{ 226{
@@ -232,7 +232,7 @@ struct sctp_auth_bytes *sctp_auth_make_local_vector(
232} 232}
233 233
234/* Make a key vector based on peer's parameters */ 234/* Make a key vector based on peer's parameters */
235struct sctp_auth_bytes *sctp_auth_make_peer_vector( 235static struct sctp_auth_bytes *sctp_auth_make_peer_vector(
236 const struct sctp_association *asoc, 236 const struct sctp_association *asoc,
237 gfp_t gfp) 237 gfp_t gfp)
238{ 238{
@@ -556,7 +556,7 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc)
556 return &sctp_hmac_list[id]; 556 return &sctp_hmac_list[id];
557} 557}
558 558
559static int __sctp_auth_find_hmacid(__u16 *hmacs, int n_elts, __u16 hmac_id) 559static int __sctp_auth_find_hmacid(__be16 *hmacs, int n_elts, __be16 hmac_id)
560{ 560{
561 int found = 0; 561 int found = 0;
562 int i; 562 int i;
@@ -573,7 +573,7 @@ static int __sctp_auth_find_hmacid(__u16 *hmacs, int n_elts, __u16 hmac_id)
573 573
574/* See if the HMAC_ID is one that we claim as supported */ 574/* See if the HMAC_ID is one that we claim as supported */
575int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc, 575int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc,
576 __u16 hmac_id) 576 __be16 hmac_id)
577{ 577{
578 struct sctp_hmac_algo_param *hmacs; 578 struct sctp_hmac_algo_param *hmacs;
579 __u16 n_elt; 579 __u16 n_elt;
@@ -726,10 +726,7 @@ void sctp_auth_calculate_hmac(const struct sctp_association *asoc,
726 726
727 /* set up scatter list */ 727 /* set up scatter list */
728 end = skb_tail_pointer(skb); 728 end = skb_tail_pointer(skb);
729 sg_init_table(&sg, 1); 729 sg_init_one(&sg, auth, end - (unsigned char *)auth);
730 sg_set_page(&sg, virt_to_page(auth));
731 sg.offset = (unsigned long)(auth) % PAGE_SIZE;
732 sg.length = end - (unsigned char *)auth;
733 730
734 desc.tfm = asoc->ep->auth_hmacs[hmac_id]; 731 desc.tfm = asoc->ep->auth_hmacs[hmac_id];
735 desc.flags = 0; 732 desc.flags = 0;
diff --git a/net/sctp/crc32c.c b/net/sctp/crc32c.c
index 59cf7b06d216..181edabdb8ca 100644
--- a/net/sctp/crc32c.c
+++ b/net/sctp/crc32c.c
@@ -170,6 +170,7 @@ __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
170 return crc32; 170 return crc32;
171} 171}
172 172
173#if 0
173__u32 sctp_update_copy_cksum(__u8 *to, __u8 *from, __u16 length, __u32 crc32) 174__u32 sctp_update_copy_cksum(__u8 *to, __u8 *from, __u16 length, __u32 crc32)
174{ 175{
175 __u32 i; 176 __u32 i;
@@ -186,6 +187,7 @@ __u32 sctp_update_copy_cksum(__u8 *to, __u8 *from, __u16 length, __u32 crc32)
186 187
187 return crc32; 188 return crc32;
188} 189}
190#endif /* 0 */
189 191
190__u32 sctp_end_cksum(__u32 crc32) 192__u32 sctp_end_cksum(__u32 crc32)
191{ 193{
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index eb4deaf58914..7f31ff638bc6 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -631,7 +631,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
631 struct ipv6_pinfo *newnp, *np = inet6_sk(sk); 631 struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
632 struct sctp6_sock *newsctp6sk; 632 struct sctp6_sock *newsctp6sk;
633 633
634 newsk = sk_alloc(sk->sk_net, PF_INET6, GFP_KERNEL, sk->sk_prot, 1); 634 newsk = sk_alloc(sk->sk_net, PF_INET6, GFP_KERNEL, sk->sk_prot);
635 if (!newsk) 635 if (!newsk)
636 goto out; 636 goto out;
637 637
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index f5cd96f5fe74..40c1a47d1b8d 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -552,7 +552,8 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk,
552{ 552{
553 struct inet_sock *inet = inet_sk(sk); 553 struct inet_sock *inet = inet_sk(sk);
554 struct inet_sock *newinet; 554 struct inet_sock *newinet;
555 struct sock *newsk = sk_alloc(sk->sk_net, PF_INET, GFP_KERNEL, sk->sk_prot, 1); 555 struct sock *newsk = sk_alloc(sk->sk_net, PF_INET, GFP_KERNEL,
556 sk->sk_prot);
556 557
557 if (!newsk) 558 if (!newsk)
558 goto out; 559 goto out;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 658476c4d587..c377e4e8f653 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1513,10 +1513,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
1513 struct hash_desc desc; 1513 struct hash_desc desc;
1514 1514
1515 /* Sign the message. */ 1515 /* Sign the message. */
1516 sg_init_table(&sg, 1); 1516 sg_init_one(&sg, &cookie->c, bodysize);
1517 sg_set_page(&sg, virt_to_page(&cookie->c));
1518 sg.offset = (unsigned long)(&cookie->c) % PAGE_SIZE;
1519 sg.length = bodysize;
1520 keylen = SCTP_SECRET_SIZE; 1517 keylen = SCTP_SECRET_SIZE;
1521 key = (char *)ep->secret_key[ep->current_key]; 1518 key = (char *)ep->secret_key[ep->current_key];
1522 desc.tfm = sctp_sk(ep->base.sk)->hmac; 1519 desc.tfm = sctp_sk(ep->base.sk)->hmac;
@@ -1586,10 +1583,7 @@ struct sctp_association *sctp_unpack_cookie(
1586 1583
1587 /* Check the signature. */ 1584 /* Check the signature. */
1588 keylen = SCTP_SECRET_SIZE; 1585 keylen = SCTP_SECRET_SIZE;
1589 sg_init_table(&sg, 1); 1586 sg_init_one(&sg, bear_cookie, bodysize);
1590 sg_set_page(&sg, virt_to_page(bear_cookie));
1591 sg.offset = (unsigned long)(bear_cookie) % PAGE_SIZE;
1592 sg.length = bodysize;
1593 key = (char *)ep->secret_key[ep->current_key]; 1587 key = (char *)ep->secret_key[ep->current_key];
1594 desc.tfm = sctp_sk(ep->base.sk)->hmac; 1588 desc.tfm = sctp_sk(ep->base.sk)->hmac;
1595 desc.flags = 0; 1589 desc.flags = 0;
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index b9370956b187..4be92d0a2cab 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -908,8 +908,8 @@ void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn)
908 return; 908 return;
909} 909}
910 910
911/* Renege 'needed' bytes from the ordering queue. */ 911static __u16 sctp_ulpq_renege_list(struct sctp_ulpq *ulpq,
912static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed) 912 struct sk_buff_head *list, __u16 needed)
913{ 913{
914 __u16 freed = 0; 914 __u16 freed = 0;
915 __u32 tsn; 915 __u32 tsn;
@@ -919,7 +919,7 @@ static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed)
919 919
920 tsnmap = &ulpq->asoc->peer.tsn_map; 920 tsnmap = &ulpq->asoc->peer.tsn_map;
921 921
922 while ((skb = __skb_dequeue_tail(&ulpq->lobby)) != NULL) { 922 while ((skb = __skb_dequeue_tail(list)) != NULL) {
923 freed += skb_headlen(skb); 923 freed += skb_headlen(skb);
924 event = sctp_skb2event(skb); 924 event = sctp_skb2event(skb);
925 tsn = event->tsn; 925 tsn = event->tsn;
@@ -933,30 +933,16 @@ static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed)
933 return freed; 933 return freed;
934} 934}
935 935
936/* Renege 'needed' bytes from the ordering queue. */
937static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed)
938{
939 return sctp_ulpq_renege_list(ulpq, &ulpq->lobby, needed);
940}
941
936/* Renege 'needed' bytes from the reassembly queue. */ 942/* Renege 'needed' bytes from the reassembly queue. */
937static __u16 sctp_ulpq_renege_frags(struct sctp_ulpq *ulpq, __u16 needed) 943static __u16 sctp_ulpq_renege_frags(struct sctp_ulpq *ulpq, __u16 needed)
938{ 944{
939 __u16 freed = 0; 945 return sctp_ulpq_renege_list(ulpq, &ulpq->reasm, needed);
940 __u32 tsn;
941 struct sk_buff *skb;
942 struct sctp_ulpevent *event;
943 struct sctp_tsnmap *tsnmap;
944
945 tsnmap = &ulpq->asoc->peer.tsn_map;
946
947 /* Walk backwards through the list, reneges the newest tsns. */
948 while ((skb = __skb_dequeue_tail(&ulpq->reasm)) != NULL) {
949 freed += skb_headlen(skb);
950 event = sctp_skb2event(skb);
951 tsn = event->tsn;
952
953 sctp_ulpevent_free(event);
954 sctp_tsnmap_renege(tsnmap, tsn);
955 if (freed >= needed)
956 return freed;
957 }
958
959 return freed;
960} 946}
961 947
962/* Partial deliver the first message as there is pressure on rwnd. */ 948/* Partial deliver the first message as there is pressure on rwnd. */
diff --git a/net/socket.c b/net/socket.c
index 540013ea8620..5d879fd3d01d 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1250,11 +1250,14 @@ asmlinkage long sys_socketpair(int family, int type, int protocol,
1250 goto out_release_both; 1250 goto out_release_both;
1251 1251
1252 fd1 = sock_alloc_fd(&newfile1); 1252 fd1 = sock_alloc_fd(&newfile1);
1253 if (unlikely(fd1 < 0)) 1253 if (unlikely(fd1 < 0)) {
1254 err = fd1;
1254 goto out_release_both; 1255 goto out_release_both;
1256 }
1255 1257
1256 fd2 = sock_alloc_fd(&newfile2); 1258 fd2 = sock_alloc_fd(&newfile2);
1257 if (unlikely(fd2 < 0)) { 1259 if (unlikely(fd2 < 0)) {
1260 err = fd2;
1258 put_filp(newfile1); 1261 put_filp(newfile1);
1259 put_unused_fd(fd1); 1262 put_unused_fd(fd1);
1260 goto out_release_both; 1263 goto out_release_both;
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index 32be431affcf..ab7cbd6575c4 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -75,7 +75,7 @@ krb5_encrypt(
75 memcpy(local_iv, iv, crypto_blkcipher_ivsize(tfm)); 75 memcpy(local_iv, iv, crypto_blkcipher_ivsize(tfm));
76 76
77 memcpy(out, in, length); 77 memcpy(out, in, length);
78 sg_set_buf(sg, out, length); 78 sg_init_one(sg, out, length);
79 79
80 ret = crypto_blkcipher_encrypt_iv(&desc, sg, sg, length); 80 ret = crypto_blkcipher_encrypt_iv(&desc, sg, sg, length);
81out: 81out:
@@ -110,7 +110,7 @@ krb5_decrypt(
110 memcpy(local_iv,iv, crypto_blkcipher_ivsize(tfm)); 110 memcpy(local_iv,iv, crypto_blkcipher_ivsize(tfm));
111 111
112 memcpy(out, in, length); 112 memcpy(out, in, length);
113 sg_set_buf(sg, out, length); 113 sg_init_one(sg, out, length);
114 114
115 ret = crypto_blkcipher_decrypt_iv(&desc, sg, sg, length); 115 ret = crypto_blkcipher_decrypt_iv(&desc, sg, sg, length);
116out: 116out:
@@ -146,7 +146,7 @@ make_checksum(char *cksumname, char *header, int hdrlen, struct xdr_buf *body,
146 err = crypto_hash_init(&desc); 146 err = crypto_hash_init(&desc);
147 if (err) 147 if (err)
148 goto out; 148 goto out;
149 sg_set_buf(sg, header, hdrlen); 149 sg_init_one(sg, header, hdrlen);
150 err = crypto_hash_update(&desc, sg, hdrlen); 150 err = crypto_hash_update(&desc, sg, hdrlen);
151 if (err) 151 if (err)
152 goto out; 152 goto out;
@@ -188,8 +188,6 @@ encryptor(struct scatterlist *sg, void *data)
188 /* Worst case is 4 fragments: head, end of page 1, start 188 /* Worst case is 4 fragments: head, end of page 1, start
189 * of page 2, tail. Anything more is a bug. */ 189 * of page 2, tail. Anything more is a bug. */
190 BUG_ON(desc->fragno > 3); 190 BUG_ON(desc->fragno > 3);
191 desc->infrags[desc->fragno] = *sg;
192 desc->outfrags[desc->fragno] = *sg;
193 191
194 page_pos = desc->pos - outbuf->head[0].iov_len; 192 page_pos = desc->pos - outbuf->head[0].iov_len;
195 if (page_pos >= 0 && page_pos < outbuf->page_len) { 193 if (page_pos >= 0 && page_pos < outbuf->page_len) {
@@ -199,7 +197,10 @@ encryptor(struct scatterlist *sg, void *data)
199 } else { 197 } else {
200 in_page = sg_page(sg); 198 in_page = sg_page(sg);
201 } 199 }
202 sg_set_page(&desc->infrags[desc->fragno], in_page); 200 sg_set_page(&desc->infrags[desc->fragno], in_page, sg->length,
201 sg->offset);
202 sg_set_page(&desc->outfrags[desc->fragno], sg_page(sg), sg->length,
203 sg->offset);
203 desc->fragno++; 204 desc->fragno++;
204 desc->fraglen += sg->length; 205 desc->fraglen += sg->length;
205 desc->pos += sg->length; 206 desc->pos += sg->length;
@@ -210,16 +211,22 @@ encryptor(struct scatterlist *sg, void *data)
210 if (thislen == 0) 211 if (thislen == 0)
211 return 0; 212 return 0;
212 213
214 __sg_mark_end(&desc->infrags[desc->fragno - 1]);
215 __sg_mark_end(&desc->outfrags[desc->fragno - 1]);
216
213 ret = crypto_blkcipher_encrypt_iv(&desc->desc, desc->outfrags, 217 ret = crypto_blkcipher_encrypt_iv(&desc->desc, desc->outfrags,
214 desc->infrags, thislen); 218 desc->infrags, thislen);
215 if (ret) 219 if (ret)
216 return ret; 220 return ret;
221
222 sg_init_table(desc->infrags, 4);
223 sg_init_table(desc->outfrags, 4);
224
217 if (fraglen) { 225 if (fraglen) {
218 sg_set_page(&desc->outfrags[0], sg_page(sg)); 226 sg_set_page(&desc->outfrags[0], sg_page(sg), fraglen,
219 desc->outfrags[0].offset = sg->offset + sg->length - fraglen; 227 sg->offset + sg->length - fraglen);
220 desc->outfrags[0].length = fraglen;
221 desc->infrags[0] = desc->outfrags[0]; 228 desc->infrags[0] = desc->outfrags[0];
222 sg_set_page(&desc->infrags[0], in_page); 229 sg_assign_page(&desc->infrags[0], in_page);
223 desc->fragno = 1; 230 desc->fragno = 1;
224 desc->fraglen = fraglen; 231 desc->fraglen = fraglen;
225 } else { 232 } else {
@@ -248,6 +255,9 @@ gss_encrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *buf,
248 desc.fragno = 0; 255 desc.fragno = 0;
249 desc.fraglen = 0; 256 desc.fraglen = 0;
250 257
258 sg_init_table(desc.infrags, 4);
259 sg_init_table(desc.outfrags, 4);
260
251 ret = xdr_process_buf(buf, offset, buf->len - offset, encryptor, &desc); 261 ret = xdr_process_buf(buf, offset, buf->len - offset, encryptor, &desc);
252 return ret; 262 return ret;
253} 263}
@@ -272,7 +282,8 @@ decryptor(struct scatterlist *sg, void *data)
272 /* Worst case is 4 fragments: head, end of page 1, start 282 /* Worst case is 4 fragments: head, end of page 1, start
273 * of page 2, tail. Anything more is a bug. */ 283 * of page 2, tail. Anything more is a bug. */
274 BUG_ON(desc->fragno > 3); 284 BUG_ON(desc->fragno > 3);
275 desc->frags[desc->fragno] = *sg; 285 sg_set_page(&desc->frags[desc->fragno], sg_page(sg), sg->length,
286 sg->offset);
276 desc->fragno++; 287 desc->fragno++;
277 desc->fraglen += sg->length; 288 desc->fraglen += sg->length;
278 289
@@ -282,14 +293,18 @@ decryptor(struct scatterlist *sg, void *data)
282 if (thislen == 0) 293 if (thislen == 0)
283 return 0; 294 return 0;
284 295
296 __sg_mark_end(&desc->frags[desc->fragno - 1]);
297
285 ret = crypto_blkcipher_decrypt_iv(&desc->desc, desc->frags, 298 ret = crypto_blkcipher_decrypt_iv(&desc->desc, desc->frags,
286 desc->frags, thislen); 299 desc->frags, thislen);
287 if (ret) 300 if (ret)
288 return ret; 301 return ret;
302
303 sg_init_table(desc->frags, 4);
304
289 if (fraglen) { 305 if (fraglen) {
290 sg_set_page(&desc->frags[0], sg_page(sg)); 306 sg_set_page(&desc->frags[0], sg_page(sg), fraglen,
291 desc->frags[0].offset = sg->offset + sg->length - fraglen; 307 sg->offset + sg->length - fraglen);
292 desc->frags[0].length = fraglen;
293 desc->fragno = 1; 308 desc->fragno = 1;
294 desc->fraglen = fraglen; 309 desc->fraglen = fraglen;
295 } else { 310 } else {
@@ -314,6 +329,9 @@ gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *buf,
314 desc.desc.flags = 0; 329 desc.desc.flags = 0;
315 desc.fragno = 0; 330 desc.fragno = 0;
316 desc.fraglen = 0; 331 desc.fraglen = 0;
332
333 sg_init_table(desc.frags, 4);
334
317 return xdr_process_buf(buf, offset, buf->len - offset, decryptor, &desc); 335 return xdr_process_buf(buf, offset, buf->len - offset, decryptor, &desc);
318} 336}
319 337
diff --git a/net/sunrpc/auth_gss/gss_spkm3_seal.c b/net/sunrpc/auth_gss/gss_spkm3_seal.c
index d158635de6c0..abf17ce2e3b1 100644
--- a/net/sunrpc/auth_gss/gss_spkm3_seal.c
+++ b/net/sunrpc/auth_gss/gss_spkm3_seal.c
@@ -173,7 +173,7 @@ make_spkm3_checksum(s32 cksumtype, struct xdr_netobj *key, char *header,
173 if (err) 173 if (err)
174 goto out; 174 goto out;
175 175
176 sg_set_buf(sg, header, hdrlen); 176 sg_init_one(sg, header, hdrlen);
177 crypto_hash_update(&desc, sg, sg->length); 177 crypto_hash_update(&desc, sg, sg->length);
178 178
179 xdr_process_buf(body, body_offset, body->len - body_offset, 179 xdr_process_buf(body, body_offset, body->len - body_offset,
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
index 864b541bbf51..2be714e9b382 100644
--- a/net/sunrpc/sysctl.c
+++ b/net/sunrpc/sysctl.c
@@ -87,9 +87,8 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
87 left--, s++; 87 left--, s++;
88 *(unsigned int *) table->data = value; 88 *(unsigned int *) table->data = value;
89 /* Display the RPC tasks on writing to rpc_debug */ 89 /* Display the RPC tasks on writing to rpc_debug */
90 if (table->ctl_name == CTL_RPCDEBUG) { 90 if (strcmp(table->procname, "rpc_debug") == 0)
91 rpc_show_tasks(); 91 rpc_show_tasks();
92 }
93 } else { 92 } else {
94 if (!access_ok(VERIFY_WRITE, buffer, left)) 93 if (!access_ok(VERIFY_WRITE, buffer, left))
95 return -EFAULT; 94 return -EFAULT;
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 3d1f7cdf9dd0..fdc5e6d7562b 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -1030,6 +1030,8 @@ xdr_process_buf(struct xdr_buf *buf, unsigned int offset, unsigned int len,
1030 unsigned page_len, thislen, page_offset; 1030 unsigned page_len, thislen, page_offset;
1031 struct scatterlist sg[1]; 1031 struct scatterlist sg[1];
1032 1032
1033 sg_init_table(sg, 1);
1034
1033 if (offset >= buf->head[0].iov_len) { 1035 if (offset >= buf->head[0].iov_len) {
1034 offset -= buf->head[0].iov_len; 1036 offset -= buf->head[0].iov_len;
1035 } else { 1037 } else {
@@ -1059,9 +1061,7 @@ xdr_process_buf(struct xdr_buf *buf, unsigned int offset, unsigned int len,
1059 do { 1061 do {
1060 if (thislen > page_len) 1062 if (thislen > page_len)
1061 thislen = page_len; 1063 thislen = page_len;
1062 sg_set_page(sg, buf->pages[i]); 1064 sg_set_page(sg, buf->pages[i], thislen, page_offset);
1063 sg->offset = page_offset;
1064 sg->length = thislen;
1065 ret = actor(sg, data); 1065 ret = actor(sg, data);
1066 if (ret) 1066 if (ret)
1067 goto out; 1067 goto out;
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index 12db63580427..9e11ce715958 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -181,7 +181,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
181 struct rpcrdma_read_chunk *cur_rchunk = NULL; 181 struct rpcrdma_read_chunk *cur_rchunk = NULL;
182 struct rpcrdma_write_array *warray = NULL; 182 struct rpcrdma_write_array *warray = NULL;
183 struct rpcrdma_write_chunk *cur_wchunk = NULL; 183 struct rpcrdma_write_chunk *cur_wchunk = NULL;
184 u32 *iptr = headerp->rm_body.rm_chunks; 184 __be32 *iptr = headerp->rm_body.rm_chunks;
185 185
186 if (type == rpcrdma_readch || type == rpcrdma_areadch) { 186 if (type == rpcrdma_readch || type == rpcrdma_areadch) {
187 /* a read chunk - server will RDMA Read our memory */ 187 /* a read chunk - server will RDMA Read our memory */
@@ -217,25 +217,25 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
217 cur_rchunk->rc_target.rs_handle = htonl(seg->mr_rkey); 217 cur_rchunk->rc_target.rs_handle = htonl(seg->mr_rkey);
218 cur_rchunk->rc_target.rs_length = htonl(seg->mr_len); 218 cur_rchunk->rc_target.rs_length = htonl(seg->mr_len);
219 xdr_encode_hyper( 219 xdr_encode_hyper(
220 (u32 *)&cur_rchunk->rc_target.rs_offset, 220 (__be32 *)&cur_rchunk->rc_target.rs_offset,
221 seg->mr_base); 221 seg->mr_base);
222 dprintk("RPC: %s: read chunk " 222 dprintk("RPC: %s: read chunk "
223 "elem %d@0x%llx:0x%x pos %d (%s)\n", __func__, 223 "elem %d@0x%llx:0x%x pos %d (%s)\n", __func__,
224 seg->mr_len, seg->mr_base, seg->mr_rkey, pos, 224 seg->mr_len, (unsigned long long)seg->mr_base,
225 n < nsegs ? "more" : "last"); 225 seg->mr_rkey, pos, n < nsegs ? "more" : "last");
226 cur_rchunk++; 226 cur_rchunk++;
227 r_xprt->rx_stats.read_chunk_count++; 227 r_xprt->rx_stats.read_chunk_count++;
228 } else { /* write/reply */ 228 } else { /* write/reply */
229 cur_wchunk->wc_target.rs_handle = htonl(seg->mr_rkey); 229 cur_wchunk->wc_target.rs_handle = htonl(seg->mr_rkey);
230 cur_wchunk->wc_target.rs_length = htonl(seg->mr_len); 230 cur_wchunk->wc_target.rs_length = htonl(seg->mr_len);
231 xdr_encode_hyper( 231 xdr_encode_hyper(
232 (u32 *)&cur_wchunk->wc_target.rs_offset, 232 (__be32 *)&cur_wchunk->wc_target.rs_offset,
233 seg->mr_base); 233 seg->mr_base);
234 dprintk("RPC: %s: %s chunk " 234 dprintk("RPC: %s: %s chunk "
235 "elem %d@0x%llx:0x%x (%s)\n", __func__, 235 "elem %d@0x%llx:0x%x (%s)\n", __func__,
236 (type == rpcrdma_replych) ? "reply" : "write", 236 (type == rpcrdma_replych) ? "reply" : "write",
237 seg->mr_len, seg->mr_base, seg->mr_rkey, 237 seg->mr_len, (unsigned long long)seg->mr_base,
238 n < nsegs ? "more" : "last"); 238 seg->mr_rkey, n < nsegs ? "more" : "last");
239 cur_wchunk++; 239 cur_wchunk++;
240 if (type == rpcrdma_replych) 240 if (type == rpcrdma_replych)
241 r_xprt->rx_stats.reply_chunk_count++; 241 r_xprt->rx_stats.reply_chunk_count++;
@@ -257,14 +257,14 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
257 * finish off header. If write, marshal discrim and nchunks. 257 * finish off header. If write, marshal discrim and nchunks.
258 */ 258 */
259 if (cur_rchunk) { 259 if (cur_rchunk) {
260 iptr = (u32 *) cur_rchunk; 260 iptr = (__be32 *) cur_rchunk;
261 *iptr++ = xdr_zero; /* finish the read chunk list */ 261 *iptr++ = xdr_zero; /* finish the read chunk list */
262 *iptr++ = xdr_zero; /* encode a NULL write chunk list */ 262 *iptr++ = xdr_zero; /* encode a NULL write chunk list */
263 *iptr++ = xdr_zero; /* encode a NULL reply chunk */ 263 *iptr++ = xdr_zero; /* encode a NULL reply chunk */
264 } else { 264 } else {
265 warray->wc_discrim = xdr_one; 265 warray->wc_discrim = xdr_one;
266 warray->wc_nchunks = htonl(nchunks); 266 warray->wc_nchunks = htonl(nchunks);
267 iptr = (u32 *) cur_wchunk; 267 iptr = (__be32 *) cur_wchunk;
268 if (type == rpcrdma_writech) { 268 if (type == rpcrdma_writech) {
269 *iptr++ = xdr_zero; /* finish the write chunk list */ 269 *iptr++ = xdr_zero; /* finish the write chunk list */
270 *iptr++ = xdr_zero; /* encode a NULL reply chunk */ 270 *iptr++ = xdr_zero; /* encode a NULL reply chunk */
@@ -559,7 +559,7 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst)
559 * RDMA'd by server. See map at rpcrdma_create_chunks()! :-) 559 * RDMA'd by server. See map at rpcrdma_create_chunks()! :-)
560 */ 560 */
561static int 561static int
562rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp) 562rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, __be32 **iptrp)
563{ 563{
564 unsigned int i, total_len; 564 unsigned int i, total_len;
565 struct rpcrdma_write_chunk *cur_wchunk; 565 struct rpcrdma_write_chunk *cur_wchunk;
@@ -573,11 +573,11 @@ rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp)
573 struct rpcrdma_segment *seg = &cur_wchunk->wc_target; 573 struct rpcrdma_segment *seg = &cur_wchunk->wc_target;
574 ifdebug(FACILITY) { 574 ifdebug(FACILITY) {
575 u64 off; 575 u64 off;
576 xdr_decode_hyper((u32 *)&seg->rs_offset, &off); 576 xdr_decode_hyper((__be32 *)&seg->rs_offset, &off);
577 dprintk("RPC: %s: chunk %d@0x%llx:0x%x\n", 577 dprintk("RPC: %s: chunk %d@0x%llx:0x%x\n",
578 __func__, 578 __func__,
579 ntohl(seg->rs_length), 579 ntohl(seg->rs_length),
580 off, 580 (unsigned long long)off,
581 ntohl(seg->rs_handle)); 581 ntohl(seg->rs_handle));
582 } 582 }
583 total_len += ntohl(seg->rs_length); 583 total_len += ntohl(seg->rs_length);
@@ -585,7 +585,7 @@ rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp)
585 } 585 }
586 /* check and adjust for properly terminated write chunk */ 586 /* check and adjust for properly terminated write chunk */
587 if (wrchunk) { 587 if (wrchunk) {
588 u32 *w = (u32 *) cur_wchunk; 588 __be32 *w = (__be32 *) cur_wchunk;
589 if (*w++ != xdr_zero) 589 if (*w++ != xdr_zero)
590 return -1; 590 return -1;
591 cur_wchunk = (struct rpcrdma_write_chunk *) w; 591 cur_wchunk = (struct rpcrdma_write_chunk *) w;
@@ -593,7 +593,7 @@ rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp)
593 if ((char *) cur_wchunk > rep->rr_base + rep->rr_len) 593 if ((char *) cur_wchunk > rep->rr_base + rep->rr_len)
594 return -1; 594 return -1;
595 595
596 *iptrp = (u32 *) cur_wchunk; 596 *iptrp = (__be32 *) cur_wchunk;
597 return total_len; 597 return total_len;
598} 598}
599 599
@@ -721,7 +721,7 @@ rpcrdma_reply_handler(struct rpcrdma_rep *rep)
721 struct rpc_rqst *rqst; 721 struct rpc_rqst *rqst;
722 struct rpc_xprt *xprt = rep->rr_xprt; 722 struct rpc_xprt *xprt = rep->rr_xprt;
723 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); 723 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
724 u32 *iptr; 724 __be32 *iptr;
725 int i, rdmalen, status; 725 int i, rdmalen, status;
726 726
727 /* Check status. If bad, signal disconnect and return rep to pool */ 727 /* Check status. If bad, signal disconnect and return rep to pool */
@@ -801,7 +801,7 @@ repost:
801 r_xprt->rx_stats.total_rdma_reply += rdmalen; 801 r_xprt->rx_stats.total_rdma_reply += rdmalen;
802 } else { 802 } else {
803 /* else ordinary inline */ 803 /* else ordinary inline */
804 iptr = (u32 *)((unsigned char *)headerp + 28); 804 iptr = (__be32 *)((unsigned char *)headerp + 28);
805 rep->rr_len -= 28; /*sizeof *headerp;*/ 805 rep->rr_len -= 28; /*sizeof *headerp;*/
806 status = rep->rr_len; 806 status = rep->rr_len;
807 } 807 }
@@ -816,7 +816,7 @@ repost:
816 headerp->rm_body.rm_chunks[2] != xdr_one || 816 headerp->rm_body.rm_chunks[2] != xdr_one ||
817 req->rl_nchunks == 0) 817 req->rl_nchunks == 0)
818 goto badheader; 818 goto badheader;
819 iptr = (u32 *)((unsigned char *)headerp + 28); 819 iptr = (__be32 *)((unsigned char *)headerp + 28);
820 rdmalen = rpcrdma_count_chunks(rep, req->rl_nchunks, 0, &iptr); 820 rdmalen = rpcrdma_count_chunks(rep, req->rl_nchunks, 0, &iptr);
821 if (rdmalen < 0) 821 if (rdmalen < 0)
822 goto badheader; 822 goto badheader;
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index e36b4b5a5222..6b792265dc06 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -201,7 +201,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol)
201 return -EPROTOTYPE; 201 return -EPROTOTYPE;
202 } 202 }
203 203
204 sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto, 1); 204 sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto);
205 if (!sk) { 205 if (!sk) {
206 tipc_deleteport(ref); 206 tipc_deleteport(ref);
207 return -ENOMEM; 207 return -ENOMEM;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 9163ec526c2a..515e7a692f9b 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -602,7 +602,7 @@ static struct sock * unix_create1(struct net *net, struct socket *sock)
602 if (atomic_read(&unix_nr_socks) >= 2*get_max_files()) 602 if (atomic_read(&unix_nr_socks) >= 2*get_max_files())
603 goto out; 603 goto out;
604 604
605 sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto, 1); 605 sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto);
606 if (!sk) 606 if (!sk)
607 goto out; 607 goto out;
608 608
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index fc416f9606a9..92cfe8e3e0b8 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -472,7 +472,7 @@ static struct proto x25_proto = {
472static struct sock *x25_alloc_socket(struct net *net) 472static struct sock *x25_alloc_socket(struct net *net)
473{ 473{
474 struct x25_sock *x25; 474 struct x25_sock *x25;
475 struct sock *sk = sk_alloc(net, AF_X25, GFP_ATOMIC, &x25_proto, 1); 475 struct sock *sk = sk_alloc(net, AF_X25, GFP_ATOMIC, &x25_proto);
476 476
477 if (!sk) 477 if (!sk)
478 goto out; 478 goto out;
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index 313d4bed3aa9..0426388d351d 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -553,9 +553,7 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc,
553 if (copy > len) 553 if (copy > len)
554 copy = len; 554 copy = len;
555 555
556 sg_set_page(&sg, virt_to_page(skb->data + offset)); 556 sg_init_one(&sg, skb->data + offset, copy);
557 sg.offset = (unsigned long)(skb->data + offset) % PAGE_SIZE;
558 sg.length = copy;
559 557
560 err = icv_update(desc, &sg, copy); 558 err = icv_update(desc, &sg, copy);
561 if (unlikely(err)) 559 if (unlikely(err))
@@ -578,9 +576,9 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc,
578 if (copy > len) 576 if (copy > len)
579 copy = len; 577 copy = len;
580 578
581 sg_set_page(&sg, frag->page); 579 sg_init_table(&sg, 1);
582 sg.offset = frag->page_offset + offset-start; 580 sg_set_page(&sg, frag->page, copy,
583 sg.length = copy; 581 frag->page_offset + offset-start);
584 582
585 err = icv_update(desc, &sg, copy); 583 err = icv_update(desc, &sg, copy);
586 if (unlikely(err)) 584 if (unlikely(err))
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 83c5e76414ce..59594126e8b6 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -4,23 +4,30 @@
4 4
5PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config 5PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
6 6
7# If a arch/$(SRCARCH)/Kconfig.$(ARCH) file exist use it
8ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/Kconfig.$(ARCH)),)
9 Kconfig := arch/$(SRCARCH)/Kconfig.$(ARCH)
10else
11 Kconfig := arch/$(SRCARCH)/Kconfig
12endif
13
7xconfig: $(obj)/qconf 14xconfig: $(obj)/qconf
8 $< arch/$(ARCH)/Kconfig 15 $< $(Kconfig)
9 16
10gconfig: $(obj)/gconf 17gconfig: $(obj)/gconf
11 $< arch/$(ARCH)/Kconfig 18 $< $(Kconfig)
12 19
13menuconfig: $(obj)/mconf 20menuconfig: $(obj)/mconf
14 $< arch/$(ARCH)/Kconfig 21 $< $(Kconfig)
15 22
16config: $(obj)/conf 23config: $(obj)/conf
17 $< arch/$(ARCH)/Kconfig 24 $< $(Kconfig)
18 25
19oldconfig: $(obj)/conf 26oldconfig: $(obj)/conf
20 $< -o arch/$(ARCH)/Kconfig 27 $< -o $(Kconfig)
21 28
22silentoldconfig: $(obj)/conf 29silentoldconfig: $(obj)/conf
23 $< -s arch/$(ARCH)/Kconfig 30 $< -s $(Kconfig)
24 31
25# Create new linux.po file 32# Create new linux.po file
26# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files 33# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
@@ -45,27 +52,27 @@ update-po-config: $(obj)/kxgettext
45PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig 52PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
46 53
47randconfig: $(obj)/conf 54randconfig: $(obj)/conf
48 $< -r arch/$(ARCH)/Kconfig 55 $< -r $(Kconfig)
49 56
50allyesconfig: $(obj)/conf 57allyesconfig: $(obj)/conf
51 $< -y arch/$(ARCH)/Kconfig 58 $< -y $(Kconfig)
52 59
53allnoconfig: $(obj)/conf 60allnoconfig: $(obj)/conf
54 $< -n arch/$(ARCH)/Kconfig 61 $< -n $(Kconfig)
55 62
56allmodconfig: $(obj)/conf 63allmodconfig: $(obj)/conf
57 $< -m arch/$(ARCH)/Kconfig 64 $< -m $(Kconfig)
58 65
59defconfig: $(obj)/conf 66defconfig: $(obj)/conf
60ifeq ($(KBUILD_DEFCONFIG),) 67ifeq ($(KBUILD_DEFCONFIG),)
61 $< -d arch/$(ARCH)/Kconfig 68 $< -d $(Kconfig)
62else 69else
63 @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)' 70 @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
64 $(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig 71 $(Q)$< -D arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
65endif 72endif
66 73
67%_defconfig: $(obj)/conf 74%_defconfig: $(obj)/conf
68 $(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig 75 $(Q)$< -D arch/$(SRCARCH)/configs/$@ $(Kconfig)
69 76
70# Help text used by make help 77# Help text used by make help
71help: 78help:
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index d9f78c809ee9..1c502789cc1e 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -9299,7 +9299,6 @@ static struct alc_config_preset alc268_presets[] = {
9299 .num_channel_mode = ARRAY_SIZE(alc268_modes), 9299 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9300 .channel_mode = alc268_modes, 9300 .channel_mode = alc268_modes,
9301 .input_mux = &alc268_capture_source, 9301 .input_mux = &alc268_capture_source,
9302 .input_mux = &alc268_capture_source,
9303 .unsol_event = alc268_toshiba_unsol_event, 9302 .unsol_event = alc268_toshiba_unsol_event,
9304 .init_hook = alc268_toshiba_automute, 9303 .init_hook = alc268_toshiba_automute,
9305 }, 9304 },